diff --git a/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/rule-sets-listing-screen.component.html b/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/rule-sets-listing-screen.component.html index 2d14e4b2b..2db5280cc 100644 --- a/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/rule-sets-listing-screen.component.html +++ b/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/rule-sets-listing-screen.component.html @@ -106,12 +106,12 @@
- {{ 'project-templates-listing.dictionaries' | translate: { length: 3 } }} -
-
- - {{ 'project-templates-listing.entries' | translate: { length: 300 } }} + {{ 'project-templates-listing.dictionaries' | translate: { length: ruleSet.dictionariesCount } }}
+ + + +
diff --git a/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/rule-sets-listing-screen.component.ts b/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/rule-sets-listing-screen.component.ts index b1da6a106..07005bcac 100644 --- a/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/rule-sets-listing-screen.component.ts +++ b/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/rule-sets-listing-screen.component.ts @@ -6,6 +6,8 @@ import { PermissionsService } from '../../../common/service/permissions.service' import { FormBuilder, FormGroup } from '@angular/forms'; import { debounce } from '../../../utils/debounce'; import { RuleSetModel } from '@redaction/red-ui-http'; +import { tap } from 'rxjs/operators'; +import { forkJoin } from 'rxjs'; @Component({ selector: 'redaction-rule-sets-listing-screen', @@ -45,6 +47,21 @@ export class RuleSetsListingScreenComponent implements OnInit { this._appStateService.reset(); this.ruleSets = this._appStateService.ruleSets; this.displayedRuleSets = [...this.ruleSets]; + this._loadRuleSetStats(); + } + + private _loadRuleSetStats() { + this.ruleSets.forEach((rs) => { + const dictionaries = this._appStateService.dictionaryData[rs.ruleSetId]; + if (dictionaries) { + rs.dictionariesCount = Object.keys(dictionaries) + .map((key) => dictionaries[key]) + .filter((d) => !d.virtual || d.type === 'false_positive').length; + } else { + rs.dictionariesCount = 0; + rs.totalDictionaryEntries = 0; + } + }); } public get sortingOption(): SortingOption { diff --git a/libs/red-ui-http/src/lib/model/ruleSetModel.ts b/libs/red-ui-http/src/lib/model/ruleSetModel.ts index 7f87a9f66..69f8b7633 100644 --- a/libs/red-ui-http/src/lib/model/ruleSetModel.ts +++ b/libs/red-ui-http/src/lib/model/ruleSetModel.ts @@ -47,4 +47,8 @@ export interface RuleSetModel { * Validity of end this ruleSet. */ validTo?: string; + + // UI only virtual + dictionariesCount?: number; + totalDictionaryEntries?: number; }