show number of dictionaries per ruleset
This commit is contained in:
parent
21c6e17f09
commit
69d6589faf
@ -106,12 +106,12 @@
|
||||
<div class="small-label stats-subtitle">
|
||||
<div>
|
||||
<mat-icon svgIcon="red:dictionary"></mat-icon>
|
||||
{{ 'project-templates-listing.dictionaries' | translate: { length: 3 } }}
|
||||
</div>
|
||||
<div>
|
||||
<mat-icon svgIcon="red:entries"></mat-icon>
|
||||
{{ 'project-templates-listing.entries' | translate: { length: 300 } }}
|
||||
{{ 'project-templates-listing.dictionaries' | translate: { length: ruleSet.dictionariesCount } }}
|
||||
</div>
|
||||
<!-- <div>-->
|
||||
<!-- <mat-icon svgIcon="red:entries"></mat-icon>-->
|
||||
<!-- {{ 'project-templates-listing.entries' | translate: { length: ruleSet.totalDictionaryEntries } }}-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -47,4 +47,8 @@ export interface RuleSetModel {
|
||||
* Validity of end this ruleSet.
|
||||
*/
|
||||
validTo?: string;
|
||||
|
||||
// UI only virtual
|
||||
dictionariesCount?: number;
|
||||
totalDictionaryEntries?: number;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user