Browse Source

Count events.

pull/575/head
Sebastian 5 years ago
parent
commit
b8f7cb0718
  1. 1
      backend/i18n/frontend_en.json
  2. 1
      backend/i18n/frontend_it.json
  3. 1
      backend/i18n/frontend_nl.json
  4. 1
      backend/i18n/source/frontend_en.json
  5. 2
      backend/src/Squidex.Infrastructure/EventSourcing/EventConsumerInfo.cs
  6. 12
      backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerState.cs
  7. 2
      backend/src/Squidex/Areas/Api/Controllers/EventConsumers/Models/EventConsumerDto.cs
  8. 3
      backend/src/Squidex/Config/Domain/StoreServices.cs
  9. 3
      frontend/app/features/administration/pages/event-consumers/event-consumer.component.html
  10. 3
      frontend/app/features/administration/pages/event-consumers/event-consumers-page.component.html
  11. 2
      frontend/app/features/administration/services/event-consumers.service.spec.ts
  12. 2
      frontend/app/features/administration/services/event-consumers.service.ts
  13. 7
      frontend/app/theme/_panels.scss

1
backend/i18n/frontend_en.json

@ -481,6 +481,7 @@
"dashboard.trafficSummaryCard": "API Traffic Summary",
"dashboard.welcomeText": "Welcome to **{app}** dashboard.",
"dashboard.welcomeTitle": "Hi {user}",
"eventConsumers.count": "Count",
"eventConsumers.loadFailed": "Failed to load event consumers. Please reload.",
"eventConsumers.pageTitle": "Event Consumers",
"eventConsumers.position": "Position",

1
backend/i18n/frontend_it.json

@ -481,6 +481,7 @@
"dashboard.trafficSummaryCard": "Riepilogo del traffico delle API",
"dashboard.welcomeText": "Benvenuto su **{app}** dashboard.",
"dashboard.welcomeTitle": "Ciao {user}",
"eventConsumers.count": "Count",
"eventConsumers.loadFailed": "Non è stato possibile caricare event consumers. Per favore ricarica.",
"eventConsumers.pageTitle": "Eventi degli utenti",
"eventConsumers.position": "Posizione",

1
backend/i18n/frontend_nl.json

@ -481,6 +481,7 @@
"dashboard.trafficSummaryCard": "API Verkeer Samenvatting",
"dashboard.welcomeText": "Welkom bij **{app}** dashboard.",
"dashboard.welcomeTitle": "Hallo {user}",
"eventConsumers.count": "Count",
"eventConsumers.loadFailed": "Kan gebeurtenisgebruikers niet laden. Laad opnieuw.",
"eventConsumers.pageTitle": "Evenementconsumenten",
"eventConsumers.position": "Positie",

1
backend/i18n/source/frontend_en.json

@ -481,6 +481,7 @@
"dashboard.trafficSummaryCard": "API Traffic Summary",
"dashboard.welcomeText": "Welcome to **{app}** dashboard.",
"dashboard.welcomeTitle": "Hi {user}",
"eventConsumers.count": "Count",
"eventConsumers.loadFailed": "Failed to load event consumers. Please reload.",
"eventConsumers.pageTitle": "Event Consumers",
"eventConsumers.position": "Position",

2
backend/src/Squidex.Infrastructure/EventSourcing/EventConsumerInfo.cs

@ -11,6 +11,8 @@ namespace Squidex.Infrastructure.EventSourcing
{
public bool IsStopped { get; set; }
public int Count { get; set; }
public string Name { get; set; }
public string Error { get; set; }

12
backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerState.cs

@ -14,6 +14,8 @@ namespace Squidex.Infrastructure.EventSourcing.Grains
{
public bool IsStopped { get; set; }
public int Count { get; set; }
public string? Error { get; set; }
public string? Position { get; set; }
@ -32,9 +34,11 @@ namespace Squidex.Infrastructure.EventSourcing.Grains
{
}
public EventConsumerState(string? position)
public EventConsumerState(string? position, int count)
{
Position = position;
Count = count;
}
public EventConsumerState Reset()
@ -44,17 +48,17 @@ namespace Squidex.Infrastructure.EventSourcing.Grains
public EventConsumerState Handled(string position)
{
return new EventConsumerState(position);
return new EventConsumerState(position, Count + 1);
}
public EventConsumerState Stopped(Exception? ex = null)
{
return new EventConsumerState(Position) { IsStopped = true, Error = ex?.ToString() };
return new EventConsumerState(Position, Count) { IsStopped = true, Error = ex?.ToString() };
}
public EventConsumerState Started()
{
return new EventConsumerState(Position) { IsStopped = false };
return new EventConsumerState(Position, Count) { IsStopped = false };
}
public EventConsumerInfo ToInfo(string name)

2
backend/src/Squidex/Areas/Api/Controllers/EventConsumers/Models/EventConsumerDto.cs

@ -17,6 +17,8 @@ namespace Squidex.Areas.Api.Controllers.EventConsumers.Models
public bool IsResetting { get; set; }
public int Count { get; set; }
public string Name { get; set; }
public string? Error { get; set; }

3
backend/src/Squidex/Config/Domain/StoreServices.cs

@ -119,9 +119,6 @@ namespace Squidex.Config.Domain
.As<IContentRepository>().As<ISnapshotStore<ContentState, Guid>>();
services.AddSingletonAs<MongoTextIndexerState>()
.AsSelf();
services.AddSingletonAs(c => new CachingTextIndexerState(c.GetRequiredService<MongoTextIndexerState>()))
.As<ITextIndexerState>();
var registration = services.FirstOrDefault(x => x.ServiceType == typeof(IPersistedGrantStore));

3
frontend/app/features/administration/pages/event-consumers/event-consumer.component.html

@ -6,6 +6,9 @@
{{eventConsumer.name}}
</span>
</td>
<td class="cell-auto-right">
<span>{{eventConsumer.count}}</span>
</td>
<td class="cell-auto-right">
<span>{{eventConsumer.position}}</span>
</td>

3
frontend/app/features/administration/pages/event-consumers/event-consumers-page.component.html

@ -22,6 +22,9 @@
<th class="cell-auto">
{{ 'common.name' | sqxTranslate }}
</th>
<th class="cell-auto-right">
{{ 'eventConsumers.count' | sqxTranslate }}
</th>
<th class="cell-auto-right">
{{ 'eventConsumers.position' | sqxTranslate }}
</th>

2
frontend/app/features/administration/services/event-consumers.service.spec.ts

@ -134,6 +134,7 @@ describe('EventConsumersService', () => {
return {
name: `event-consumer${id}`,
position: `position${id}`,
count: id,
isStopped: true,
isResetting: true,
error: `failure${id}`,
@ -151,6 +152,7 @@ export function createEventConsumer(id: number, suffix = '') {
return new EventConsumerDto(links,
`event-consumer${id}`,
id,
true,
true,
`failure${id}${suffix}`,

2
frontend/app/features/administration/services/event-consumers.service.ts

@ -30,6 +30,7 @@ export class EventConsumerDto {
constructor(links: ResourceLinks,
public readonly name: string,
public readonly count: number,
public readonly isStopped?: boolean,
public readonly isResetting?: boolean,
public readonly error?: string,
@ -104,6 +105,7 @@ function parseEventConsumer(response: any): EventConsumerDto {
return new EventConsumerDto(
response._links,
response.name,
response.count,
response.isStopped,
response.isResetting,
response.error,

7
frontend/app/theme/_panels.scss

@ -334,11 +334,14 @@
&-item {
& {
@include border-radius;
color: inherit;
display: block;
font-size: .9rem;
font-weight: normal;
margin-bottom: .25rem;
padding: .25rem 1rem;
text-align: left;
text-decoration: none;
}
&-remove {
@ -352,6 +355,9 @@
&.active,
&:hover {
background: $color-theme-secondary;
color: inherit;
text-align: left;
text-decoration: none;
}
&.inactive {
@ -359,6 +365,7 @@
}
&:hover {
.sidebar-item-remove {
visibility: visible;
}

Loading…
Cancel
Save