diff --git a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts index c9630a1fd..d3952653f 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts @@ -12,6 +12,13 @@ import { TypeValueWrapper } from '../../../../models/file/type-value.wrapper'; import { TranslateService } from '@ngx-translate/core'; import { LoadingService } from '../../../../services/loading.service'; +const toChartConfig = (dict: TypeValueWrapper): DoughnutChartConfig => ({ + value: dict.entries ? dict.entries.length : 0, + color: dict.hexColor, + label: dict.label, + key: dict.type +}); + @Component({ selector: 'redaction-dictionary-listing-screen', templateUrl: './dictionary-listing-screen.component.html', @@ -61,6 +68,7 @@ export class DictionaryListingScreenComponent this._loadingService.start(); await this._appStateService.loadDictionaryData(); this._loadDictionaryData(false); + this._calculateData(); this._loadingService.stop(); } ); @@ -76,6 +84,7 @@ export class DictionaryListingScreenComponent this._loadingService.start(); await this._appStateService.loadDictionaryData(); this._loadDictionaryData(false); + this._calculateData(); this._loadingService.stop(); } } @@ -117,17 +126,8 @@ export class DictionaryListingScreenComponent } private _calculateData(): void { - this.chartData = this.allEntities.map(dict => this._toChartConfig(dict)); + this.chartData = this.allEntities.map(dict => toChartConfig(dict)); this.chartData.sort((a, b) => (a.label < b.label ? -1 : 1)); this._loadingService.stop(); } - - private _toChartConfig(dict: TypeValueWrapper): DoughnutChartConfig { - return { - value: dict.entries ? dict.entries.length : 0, - color: dict.hexColor, - label: dict.label, - key: dict.type - }; - } } diff --git a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts index 9e68c723f..73a37074e 100644 --- a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts @@ -162,14 +162,13 @@ export class DictionaryManagerComponent implements OnChanges, OnInit { } private _applySearchDecorations() { - this._searchDecorations = this._codeEditor?.deltaDecorations(this._searchDecorations, []); + this._searchDecorations = + this._codeEditor?.deltaDecorations(this._searchDecorations, []) || []; const decorations = this.findMatches.map(match => this._getSearchDecoration(match)); - this._searchDecorations = this._codeEditor?.deltaDecorations( - this._searchDecorations, - decorations - ); + this._searchDecorations = + this._codeEditor?.deltaDecorations(this._searchDecorations, decorations) || []; } private _getMatches(text: string): FindMatch[] {