From 5b5ecc0f098cea5b0441dbb60f1c324bd7450592 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Tue, 28 Sep 2021 17:33:21 +0300 Subject: [PATCH] remove router links --- .../src/app/models/file/dossier-template.ts | 4 ++++ apps/red-ui/src/app/models/file/file.ts | 4 ++++ apps/red-ui/src/app/models/file/type-value.ts | 4 ++++ .../dictionary-listing-screen.component.ts | 2 -- ...ssier-templates-listing-screen.component.ts | 2 -- .../dossier-listing-screen.component.ts | 2 -- .../dossier-overview-screen.component.ts | 7 ++----- .../search-screen/search-screen.component.ts | 2 -- .../dictionary-manager.component.ts | 18 +++++++----------- 9 files changed, 21 insertions(+), 24 deletions(-) diff --git a/apps/red-ui/src/app/models/file/dossier-template.ts b/apps/red-ui/src/app/models/file/dossier-template.ts index ed27de79f..265d29d5f 100644 --- a/apps/red-ui/src/app/models/file/dossier-template.ts +++ b/apps/red-ui/src/app/models/file/dossier-template.ts @@ -37,4 +37,8 @@ export class DossierTemplate implements IDossierTemplate, IListable { get searchKey(): string { return this.name; } + + get routerLink(): string { + return `/main/admin/dossier-templates/${this.dossierTemplateId}/dictionaries`; + } } diff --git a/apps/red-ui/src/app/models/file/file.ts b/apps/red-ui/src/app/models/file/file.ts index d2085b208..830e19487 100644 --- a/apps/red-ui/src/app/models/file/file.ts +++ b/apps/red-ui/src/app/models/file/file.ts @@ -135,4 +135,8 @@ export class File implements IFile, IListable { get searchKey(): string { return this.filename; } + + get routerLink(): string | undefined { + return this.canBeOpened ? `/main/dossiers/${this.dossierId}/file/${this.fileId}` : undefined; + } } diff --git a/apps/red-ui/src/app/models/file/type-value.ts b/apps/red-ui/src/app/models/file/type-value.ts index 208805f64..d9c3a5b04 100644 --- a/apps/red-ui/src/app/models/file/type-value.ts +++ b/apps/red-ui/src/app/models/file/type-value.ts @@ -34,4 +34,8 @@ export class TypeValue implements ITypeValue, IListable { get searchKey(): string { return this.type; } + + get routerLink(): string { + return `/main/admin/dossier-templates/${this.dossierTemplateId}/dictionaries/${this.type}`; + } } 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 05d3dcb9b..6d9ed2807 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 @@ -57,8 +57,6 @@ export class DictionaryListingScreenComponent extends ListingComponent [entity.type]; - ngOnInit(): void { this._configureTableColumns(); this._loadDictionaryData(); diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.ts index 0497b00c2..f7a9989ca 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.ts @@ -51,8 +51,6 @@ export class DossierTemplatesListingScreenComponent extends ListingComponent [dossierTemplate.dossierTemplateId, 'dictionaries']; - ngOnInit(): void { this._configureTableColumns(); this.loadDossierTemplatesData(); diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts index 815f96c27..8b4b7661f 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts @@ -82,8 +82,6 @@ export class DossierListingScreenComponent return this.entitiesService.all.length - this._activeDossiersCount; } - routerLinkFn = (dossier: Dossier) => ['/main/dossiers/' + dossier.id]; - getDossierTemplateNameFor(dossierTemplateId: string): string { return this._appStateService.getDossierTemplateById(dossierTemplateId).name; } diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts index 8cc3fd391..14e31d540 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts @@ -198,17 +198,14 @@ export class DossierOverviewScreenComponent extends ListingComponent imple this._loadingService.stop(); }; - actionPerformed(action?: string, fileStatus?: File) { + actionPerformed(action?: string, file?: File) { this.calculateData(); if (action === 'navigate') { - this._router.navigate(this.routerLinkFn(fileStatus)); + this._router.navigate([file.routerLink]); } } - routerLinkFn = (fileStatus: File) => - fileStatus.canBeOpened ? [`/main/dossiers/${this.currentDossier.id}/file/${fileStatus.fileId}`] : []; - disabledFn = (fileStatus: File) => fileStatus.excluded; lastOpenedFn = (fileStatus: File) => fileStatus.lastOpened; diff --git a/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.ts index 699b9cc2f..7ffcb6273 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.ts @@ -102,8 +102,6 @@ export class SearchScreenComponent extends ListingComponent implements }); } - routerLinkFn = (entity: ListItem) => [entity.routerLink]; - updateNavigation(query: string, mustContain?: string): void { const newQuery = query?.replace(mustContain, `"${mustContain}"`); const queryParams = newQuery && newQuery !== '' ? { query: newQuery } : {}; 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 6af800fca..33bfc20ed 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 @@ -23,14 +23,10 @@ const SMOOTH_SCROLL = 0; export class DictionaryManagerComponent implements OnChanges, OnInit { readonly iconButtonTypes = IconButtonTypes; - @Input() - withFloatingActions = true; - @Input() - initialEntries: List; - @Input() - canEdit = false; - @Output() - readonly saveDictionary = new EventEmitter(); + @Input() withFloatingActions = true; + @Input() initialEntries: List; + @Input() canEdit = false; + @Output() readonly saveDictionary = new EventEmitter(); currentMatch = 0; findMatches: FindMatch[] = []; @@ -48,9 +44,7 @@ export class DictionaryManagerComponent implements OnChanges, OnInit { private _decorations: string[] = []; private _searchDecorations: string[] = []; - constructor(private readonly _dictionaryService: DictionaryService, private readonly _appStateService: AppStateService) { - this.currentEntries = [...this.initialEntries]; - } + constructor(private readonly _dictionaryService: DictionaryService, private readonly _appStateService: AppStateService) {} private _dossier: Dossier = this.selectDossier as Dossier; @@ -96,6 +90,8 @@ export class DictionaryManagerComponent implements OnChanges, OnInit { } ngOnInit(): void { + this.currentEntries = [...this.initialEntries]; + this.editorOptions = { theme: 'vs', language: 'text/plain',