Fix Shell Navigation if ProcessId is undefined

This commit is contained in:
Nino Righi
2023-01-09 16:24:53 +01:00
parent 393172ec9f
commit bf18b83a75
3 changed files with 6 additions and 4 deletions

View File

@@ -39,15 +39,15 @@
<div class="shell-footer-wrapper">
<shell-footer *ngIf="section$ | async; let section">
<ng-container *ngIf="section === 'customer'">
<a [routerLink]="['/kunde', activatedProcessId$ | async, 'product']" routerLinkActive="active">
<a [routerLink]="[customerBasePath$ | async, 'product']" routerLinkActive="active">
<ui-icon icon="catalog" size="30px"></ui-icon>
Artikelsuche
</a>
<a [routerLink]="['/kunde', activatedProcessId$ | async, 'customer']" routerLinkActive="active">
<a [routerLink]="[customerBasePath$ | async, 'customer']" routerLinkActive="active">
<ui-icon icon="customer" size="24px"></ui-icon>
Kundensuche
</a>
<a [routerLink]="['/kunde', activatedProcessId$ | async, 'goods', 'out']" routerLinkActive="active">
<a [routerLink]="[customerBasePath$ | async, 'goods', 'out']" routerLinkActive="active">
<ui-icon icon="box_out" size="24px"></ui-icon>
Warenausgabe
</a>

View File

@@ -175,7 +175,7 @@ describe('ShellComponent', () => {
it('should display the menu items for section customer', () => {
applicationServiceMock.getSection$.and.returnValue(of('customer'));
applicationServiceMock.getActivatedProcessId$.and.returnValue(of(1));
spectator.component.customerBasePath$ = of('/kunde/1');
spectator.detectComponentChanges();
const anchors = spectator.queryAll('shell-footer a');

View File

@@ -34,6 +34,8 @@ export class ShellComponent {
);
}
customerBasePath$ = this.activatedProcessId$.pipe(map((processId) => (processId ? `/kunde/${processId}` : '/kunde')));
get section$() {
return this._appService.getSection$().pipe(shareReplay());
}