From 6783c04c97650d24255edde2699dd62de00a1d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Mon, 19 Apr 2021 22:18:12 +0300 Subject: [PATCH] Refactored default colors screen --- .../default-colors-screen.component.ts | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts index e4f1f461e..b645e21d1 100644 --- a/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts @@ -1,17 +1,19 @@ -import { Component } from '@angular/core'; +import { Component, Injector } from '@angular/core'; import { AppStateService } from '../../../../state/app-state.service'; import { Colors, DictionaryControllerService } from '@redaction/red-ui-http'; import { ActivatedRoute } from '@angular/router'; -import { SortingOption, SortingService } from '../../../../services/sorting.service'; import { PermissionsService } from '../../../../services/permissions.service'; import { AdminDialogService } from '../../services/admin-dialog.service'; +import { BaseListingComponent } from '../../../shared/base/base-listing.component'; @Component({ selector: 'redaction-default-colors-screen', templateUrl: './default-colors-screen.component.html', styleUrls: ['./default-colors-screen.component.scss'] }) -export class DefaultColorsScreenComponent { +export class DefaultColorsScreenComponent extends BaseListingComponent { + protected readonly _sortKey = 'default-colors'; + public viewReady = false; private _colorsObj: Colors; public colors: { key: string; value: string }[] = []; @@ -20,22 +22,15 @@ export class DefaultColorsScreenComponent { private readonly _appStateService: AppStateService, private readonly _activatedRoute: ActivatedRoute, private readonly _dictionaryControllerService: DictionaryControllerService, - private readonly _sortingService: SortingService, private readonly _dialogService: AdminDialogService, - public readonly permissionsService: PermissionsService + public readonly permissionsService: PermissionsService, + protected readonly _injector: Injector ) { + super(_injector); this._appStateService.activateRuleSet(_activatedRoute.snapshot.params.ruleSetId); this._loadColors(); } - public get sortingOption(): SortingOption { - return this._sortingService.getSortingOption('default-colors'); - } - - public toggleSort($event) { - this._sortingService.toggleSort('default-colors', $event); - } - public async loadRuleSetsData(): Promise { await this._appStateService.loadAllRuleSets(); }