Commit 936171b80bd285f0b3d069e8b82a3ffb74c0cd7c

Authored by Vladyslav_Prykhodko
Committed by Andrew Shvayka
1 parent 4a6e0c7a

UI: Improvement event statistics filter

@@ -29,6 +29,15 @@ @@ -29,6 +29,15 @@
29 </mat-select> 29 </mat-select>
30 </mat-form-field> 30 </mat-form-field>
31 </ng-template> 31 </ng-template>
  32 + <ng-template [ngSwitchCase]="isNumberFields(column.key)">
  33 + <mat-form-field>
  34 + <mat-label>{{ column.title | translate}}</mat-label>
  35 + <input matInput type="number" min="0" [name]="column.key" [formControlName]="column.key">
  36 + <mat-error *ngIf="eventFilterFormGroup.get(column.key).hasError('min')">
  37 + {{ 'event.min-value' | translate }}
  38 + </mat-error>
  39 + </mat-form-field>
  40 + </ng-template>
32 <ng-template [ngSwitchCase]="'isError'"> 41 <ng-template [ngSwitchCase]="'isError'">
33 <tb-checkbox formControlName="isError" [falseValue]="''"> 42 <tb-checkbox formControlName="isError" [falseValue]="''">
34 {{ 'event.has-error' | translate }} 43 {{ 'event.has-error' | translate }}
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 /// 15 ///
16 16
17 import { Component, Inject, InjectionToken } from '@angular/core'; 17 import { Component, Inject, InjectionToken } from '@angular/core';
18 -import { FormBuilder, FormGroup } from '@angular/forms'; 18 +import { FormBuilder, FormGroup, Validators } from '@angular/forms';
19 import { OverlayRef } from '@angular/cdk/overlay'; 19 import { OverlayRef } from '@angular/cdk/overlay';
20 import { EntityType } from '@shared/models/entity-type.models'; 20 import { EntityType } from '@shared/models/entity-type.models';
21 import { FilterEventBody } from '@shared/models/event.models'; 21 import { FilterEventBody } from '@shared/models/event.models';
@@ -59,7 +59,11 @@ export class EventFilterPanelComponent { @@ -59,7 +59,11 @@ export class EventFilterPanelComponent {
59 this.eventFilterFormGroup = this.fb.group({}); 59 this.eventFilterFormGroup = this.fb.group({});
60 this.data.columns.forEach((column) => { 60 this.data.columns.forEach((column) => {
61 this.showColumns.push(column); 61 this.showColumns.push(column);
62 - this.eventFilterFormGroup.addControl(column.key, this.fb.control(this.data.filterParams[column.key] || '')); 62 + const validators = [];
  63 + if (this.isNumberFields(column.key)) {
  64 + validators.push(Validators.min(0));
  65 + }
  66 + this.eventFilterFormGroup.addControl(column.key, this.fb.control(this.data.filterParams[column.key] || '', validators));
63 if (column.key === 'isError') { 67 if (column.key === 'isError') {
64 this.conditionError = true; 68 this.conditionError = true;
65 } 69 }
@@ -70,6 +74,10 @@ export class EventFilterPanelComponent { @@ -70,6 +74,10 @@ export class EventFilterPanelComponent {
70 return ['msgDirectionType', 'status', 'entityName'].includes(key) ? key : ''; 74 return ['msgDirectionType', 'status', 'entityName'].includes(key) ? key : '';
71 } 75 }
72 76
  77 + isNumberFields(key: string): string {
  78 + return ['messagesProcessed', 'errorsOccurred'].includes(key) ? key : '';
  79 + }
  80 +
73 selectorValues(key: string): string[] { 81 selectorValues(key: string): string[] {
74 switch (key) { 82 switch (key) {
75 case 'msgDirectionType': 83 case 'msgDirectionType':
@@ -295,8 +295,8 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> { @@ -295,8 +295,8 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> {
295 break; 295 break;
296 case EventType.STATS: 296 case EventType.STATS:
297 this.filterColumns.push( 297 this.filterColumns.push(
298 - {key: 'messagesProcessed', title: 'event.messages-processed'},  
299 - {key: 'errorsOccurred', title: 'event.errors-occurred'} 298 + {key: 'messagesProcessed', title: 'event.min-messages-processed'},
  299 + {key: 'errorsOccurred', title: 'event.min-errors-occurred'}
300 ); 300 );
301 break; 301 break;
302 case DebugEventType.DEBUG_RULE_NODE: 302 case DebugEventType.DEBUG_RULE_NODE:
@@ -1641,7 +1641,10 @@ @@ -1641,7 +1641,10 @@
1641 "success": "Success", 1641 "success": "Success",
1642 "failed": "Failed", 1642 "failed": "Failed",
1643 "messages-processed": "Messages processed", 1643 "messages-processed": "Messages processed",
  1644 + "min-messages-processed": "Minimum messages processed",
1644 "errors-occurred": "Errors occurred", 1645 "errors-occurred": "Errors occurred",
  1646 + "min-errors-occurred": "Minimum errors occurred",
  1647 + "min-value": "Minimum value is 0.",
1645 "all-events": "All", 1648 "all-events": "All",
1646 "has-error": "Has error", 1649 "has-error": "Has error",
1647 "entity-id": "Entity Id", 1650 "entity-id": "Entity Id",