RED-2420: Admin navigation patches
This commit is contained in:
parent
eef34df5ae
commit
f825d487d1
@ -50,7 +50,7 @@ const routes = [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: ':type',
|
||||
path: ':dictionary',
|
||||
component: DictionaryOverviewScreenComponent,
|
||||
canActivate: [CompositeRouteGuard],
|
||||
canDeactivate: [PendingChangesGuard],
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<iqser-side-nav [title]="translations[type] | translate">
|
||||
<ng-container *ngFor="let item of items[type]">
|
||||
<div
|
||||
<a
|
||||
*ngIf="!item.hideIf"
|
||||
[routerLinkActiveOptions]="{ exact: false }"
|
||||
[routerLink]="prefix + item.screen"
|
||||
@ -8,6 +8,6 @@
|
||||
routerLinkActive="active"
|
||||
>
|
||||
{{ item.label | translate }}
|
||||
</div>
|
||||
</a>
|
||||
</ng-container>
|
||||
</iqser-side-nav>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, HostBinding, Input } from '@angular/core';
|
||||
import { Component, HostBinding, Input, OnInit } from '@angular/core';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
@ -18,11 +18,11 @@ interface NavItem {
|
||||
templateUrl: './admin-side-nav.component.html',
|
||||
styleUrls: ['./admin-side-nav.component.scss'],
|
||||
})
|
||||
export class AdminSideNavComponent {
|
||||
export class AdminSideNavComponent implements OnInit {
|
||||
@Input() type: Type;
|
||||
readonly translations = adminSideNavTranslations;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
readonly prefix = this._appStateService.activeDictionaryType ? '../../' : '../';
|
||||
prefix: string;
|
||||
|
||||
readonly items: { readonly [key in Type]: NavItem[] } = {
|
||||
settings: [
|
||||
@ -74,4 +74,8 @@ export class AdminSideNavComponent {
|
||||
@HostBinding('class.dossier-templates') get isDossierTemplates(): boolean {
|
||||
return this.type === 'dossierTemplates';
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.prefix = this._appStateService.activeDictionaryType ? '../../' : '../';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
@ -16,7 +16,7 @@ import { DossierTemplatesService } from '@services/entity-services/dossier-templ
|
||||
templateUrl: './dictionary-overview-screen.component.html',
|
||||
styleUrls: ['./dictionary-overview-screen.component.scss'],
|
||||
})
|
||||
export class DictionaryOverviewScreenComponent extends ComponentHasChanges implements OnInit {
|
||||
export class DictionaryOverviewScreenComponent extends ComponentHasChanges implements OnInit, OnDestroy {
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
@ -46,7 +46,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
await this._appStateService.activateDictionary(this._activatedRoute.snapshot.params.type);
|
||||
this._appStateService.activateDictionary(this._activatedRoute.snapshot.params.dictionary);
|
||||
this.dictionary = this._appStateService.activeDictionary;
|
||||
await this._loadEntries();
|
||||
}
|
||||
@ -117,6 +117,10 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this._appStateService.reset();
|
||||
}
|
||||
|
||||
private async _loadEntries() {
|
||||
this._loadingService.start();
|
||||
await this._dictionaryService
|
||||
|
||||
@ -193,12 +193,12 @@ export class AppStateService {
|
||||
await this._updateLastActiveFileForDossier(dossierId, fileId);
|
||||
}
|
||||
|
||||
async activateDictionary(dictionaryType: string) {
|
||||
activateDictionary(dictionaryType: string) {
|
||||
if (this._dossierTemplatesService.activeDossierTemplate) {
|
||||
this._appState.activeDictionaryType = dictionaryType;
|
||||
if (!this.activeDictionary) {
|
||||
this._appState.activeDictionaryType = null;
|
||||
await this._router.navigate([this._dossierTemplatesService.activeDossierTemplate.routerLink]);
|
||||
this._router.navigate([this._dossierTemplatesService.activeDossierTemplate.routerLink]).then();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 260d7e44ff91967bea89b51c360e470ebc9b7300
|
||||
Subproject commit f466cf23eac3e4954eeab43cca0f3cc2c7746dee
|
||||
Loading…
x
Reference in New Issue
Block a user