mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
fix(tabs): correct singleton tabs interaction with new tab areas
- Fix tab name persistence when switching from Sortiment/Wareneingang to Retoure/Remission - Prevent duplicate tab creation when clicking on new areas - Ensure correct tab naming for Retoure and Remission areas - Update side menu navigation to use consistent tab ID generation - Add processResolverFn for backwards compatibility - Simplify process bar navigation logic Refs: #5345
This commit is contained in:
@@ -35,6 +35,7 @@ import {
|
||||
tabResolverFn,
|
||||
TabService,
|
||||
TabNavigationService,
|
||||
processResolverFn,
|
||||
} from '@isa/core/tabs';
|
||||
import { provideScrollPositionRestoration } from '@isa/utils/scroll-position';
|
||||
|
||||
@@ -187,7 +188,7 @@ const routes: Routes = [
|
||||
{
|
||||
path: ':tabId',
|
||||
component: MainComponent,
|
||||
resolve: { process: tabResolverFn, tab: tabResolverFn },
|
||||
resolve: { process: processResolverFn, tab: tabResolverFn },
|
||||
canActivate: [IsAuthenticatedGuard],
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -156,26 +156,7 @@ export class ShellProcessBarComponent implements OnInit {
|
||||
|
||||
processes = await this.processes$.pipe(delay(1), first()).toPromise();
|
||||
|
||||
if (processes.length === 0) {
|
||||
this._router.navigate(['/kunde', 'dashboard']);
|
||||
} else {
|
||||
const lastest = processes.reduce(
|
||||
(prev, current) =>
|
||||
prev.activated > current.activated ? prev : current,
|
||||
processes[0],
|
||||
);
|
||||
const crumb = await this._breadcrumb
|
||||
.getLastActivatedBreadcrumbByKey$(lastest.id)
|
||||
.pipe(first())
|
||||
.toPromise();
|
||||
if (crumb) {
|
||||
this._router.navigate(coerceArray(crumb.path), {
|
||||
queryParams: crumb.params,
|
||||
});
|
||||
} else {
|
||||
this._router.navigate(['/kunde', lastest.id, 'product']);
|
||||
}
|
||||
}
|
||||
this._router.navigate(['/kunde', 'dashboard']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
*ifRole="'Store'"
|
||||
class="side-menu-group-item"
|
||||
(click)="closeSideMenu(); focusSearchBox()"
|
||||
[routerLink]="['/', tabService.activatedTab()?.id || nextId(), 'return']"
|
||||
[routerLink]="['/', tabId(), 'return']"
|
||||
(isActiveChange)="focusSearchBox()"
|
||||
>
|
||||
<span class="side-menu-group-item-icon w-[2.375rem] h-12">
|
||||
@@ -303,7 +303,7 @@
|
||||
(click)="closeSideMenu(); focusSearchBox()"
|
||||
[routerLink]="[
|
||||
'/',
|
||||
tabService.activatedTab()?.id || nextId(),
|
||||
tabId(),
|
||||
'remission',
|
||||
]"
|
||||
(isActiveChange)="focusSearchBox(); remissionExpanded.set($event)"
|
||||
|
||||
@@ -26,3 +26,12 @@ export const tabResolverFn: ResolveFn<Tab> = (route) => {
|
||||
|
||||
return tab;
|
||||
};
|
||||
|
||||
/// @deprecated use tabResolverFn instead
|
||||
export const processResolverFn: ResolveFn<Tab> = async (route) => {
|
||||
const tabService = inject(TabService);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
const id = parseInt(route.params['tabId']);
|
||||
|
||||
return tabService.entityMap()[id];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user