Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,16 @@ export abstract class AbstractDashboardComponent {
return;
}
const itemRoute = this._doubleDrawerNavigationService.getItemRoutingPath(menuItemCase);
this._pathService.activePath = this.getFieldValue(menuItemCase, GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH);
const nodePath = this.getFieldValue(menuItemCase, GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH);
if (nodePath) {
if (menuItemCase.immediateData.find(f => f.stringId === GroupNavigationConstants.ITEM_FIELD_ID_HAS_CHILDREN)?.value && nodePath) {
this._doubleDrawerNavigationService.currentNavigationItem = undefined;
this._pathService.activePath = nodePath;
} else if (nodePath) {
const menuItem = this._doubleDrawerNavigationService.resolveItemCaseToNavigationItem(menuItemCase);
if (menuItem) {
this._doubleDrawerNavigationService.currentNavigationItem = menuItem;
}
this._pathService.activePath = this._doubleDrawerNavigationService.extractParentPath(nodePath);
}
this._router.navigate([itemRoute]);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
/**
* Currently selected navigation item
*/
protected _currentNavigationItem: NavigationItem;
protected _currentNavigationItem: NavigationItem | undefined;
protected defaultViewIcon: string = 'filter_alt';
protected customItemsInitialized: boolean;
protected hiddenCustomItemsInitialized: boolean;
Expand All @@ -103,7 +103,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
this._leftLoading$ = new LoadingEmitter();
this._rightLoading$ = new LoadingEmitter();
this._nodeLoading$ = new LoadingEmitter();
this._currentNavigationItem = null;
this._currentNavigationItem = undefined;
this.itemsOrder = MenuOrder.Ascending;
this.customItemsInitialized = false;
this.hiddenCustomItemsInitialized = false;
Expand Down Expand Up @@ -145,6 +145,10 @@ export class DoubleDrawerNavigationService implements OnDestroy {
}
}

public set currentNavigationItem(item: NavigationItem | undefined) {
this._currentNavigationItem = item;
}

protected resolveMenuItems(path: string) {
if (path === PathService.SEPARATOR) {
this._leftItems$.next([])
Expand Down Expand Up @@ -242,7 +246,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
if (this.leftLoading$.isActive || this.rightLoading$.isActive || this.currentPath === PathService.SEPARATOR) {
return
}
this._pathService.activePath = this.extractParent(this.currentPath);
this._pathService.activePath = this.extractParentPath(this.currentPath);
this.itemClicked.emit({path: this._pathService.activePath, isHome: false});
}

Expand All @@ -253,12 +257,12 @@ export class DoubleDrawerNavigationService implements OnDestroy {
* */
public onItemClick(item: NavigationItem): void {
if (item.resource === undefined) {
this._currentNavigationItem = null;
this._currentNavigationItem = undefined;
// custom view represented only in nae.json
if (item.processUri === this.currentPath) {
this._pathService.activePath = this.currentPath;
} else {
this._pathService.activePath = this.extractParent(this.currentPath);
this._pathService.activePath = this.extractParentPath(this.currentPath);
}
this.itemClicked.emit({path: this._pathService.activePath, isHome: false});
} else {
Expand All @@ -275,7 +279,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
this.openAvailableView();
})
} else if (!path.includes(this.currentPath)) {
this._pathService.activePath = this.extractParent(this.currentPath);
this._pathService.activePath = this.extractParentPath(this.currentPath);
this.itemClicked.emit({path: this._pathService.activePath, isHome: false});

} else {
Expand Down Expand Up @@ -376,7 +380,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
}
this.leftLoading$.on();

this.getItemCaseByPath(this.extractParent(this.currentPath)).subscribe(page => {
this.getItemCaseByPath(this.extractParentPath(this.currentPath)).subscribe(page => {
let childCases$;
let targetItem;
let orderedChildCaseIds;
Expand Down Expand Up @@ -510,9 +514,9 @@ export class DoubleDrawerNavigationService implements OnDestroy {
}

protected resolveCustomViewsInLeftSide() {
if (!!this.extractParent(this.currentPath) && !!this._childCustomViews[this.extractParent(this.currentPath)]) {
if (!!this.extractParentPath(this.currentPath) && !!this._childCustomViews[this.extractParentPath(this.currentPath)]) {
let currentLeftItems = this._leftItems$.getValue();
currentLeftItems.push(...Object.values(this._childCustomViews[this.extractParent(this.currentPath)]));
currentLeftItems.push(...Object.values(this._childCustomViews[this.extractParentPath(this.currentPath)]));
this._leftItems$.next(currentLeftItems);
}
}
Expand Down Expand Up @@ -590,7 +594,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
return this._caseResourceService.searchCases(SimpleFilter.fromCaseQuery(searchBody), httpParams);
}

private extractParent(path: string): string {
public extractParentPath(path: string): string {
if (path === '/') {
return path;
}
Expand Down
Loading