diff --git a/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts b/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts index eb95b94bf..b409cacbe 100644 --- a/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts +++ b/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts @@ -13,6 +13,7 @@ import {I18nFieldValue} from '../../data-fields/i18n-field/models/i18n-field-val import {LanguageService} from '../../translate/language.service'; import {LoadingEmitter} from '../../utility/loading-emitter'; import {PathService} from "../service/path.service"; +import {GroupNavigationConstants} from "../model/group-navigation-constants"; @Component({ @@ -257,9 +258,18 @@ export abstract class AbstractDashboardComponent { public navigate(itemCase: Case) { if (this.getItemInternal(itemCase)) { - const itemPath = this._doubleDrawerNavigationService.getItemRoutingPath(this.dashboardItemsMapping[itemCase.stringId]); - this._pathService.activePath = itemPath; - this._router.navigate([itemPath]); + const menuItemCase = this.dashboardItemsMapping[itemCase.stringId]; + if (!menuItemCase) { + this._log.warn(`No mapped menu item for dashboard item ${itemCase.stringId}`); + 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) { + this._pathService.activePath = nodePath; + } + this._router.navigate([itemRoute]); } else { window.open(this.getItemURL(itemCase), "_blank"); } diff --git a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.ts b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.ts index 36db96185..12887f250 100644 --- a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.ts +++ b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.ts @@ -126,7 +126,11 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit, this._userService.user$.pipe(filter(u => !!u && u.id !== ''), take(1)).subscribe(() => { this._currentPathSubscription = this._pathService.activePath$.subscribe(path => { - this.currentPath = path; + if (path !== this.currentPath) { + this.currentPath = path; + } else { + this.openAvailableView(); + } }); if (this.canApplyAutoSelect()) { diff --git a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts index b2d503177..f1039df07 100644 --- a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts +++ b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts @@ -94,7 +94,7 @@ export class DoubleDrawerNavigationService implements OnDestroy { protected _redirectService: RedirectService, protected _pathService: PathService, protected _userService: UserService, - ) { + ) { this._leftItems$ = new BehaviorSubject([]); this._rightItems$ = new BehaviorSubject([]); this._moreItems$ = new BehaviorSubject([]); @@ -439,6 +439,8 @@ export class DoubleDrawerNavigationService implements OnDestroy { this.resolveCustomViewsInRightSide(); this._rightLoading$.off(); this.itemLoaded.emit({menu: 'right', items: this.rightItems}); + + this.openAvailableView(); }, error => { this._log.error(error); this._rightItems$.next([]); @@ -492,7 +494,7 @@ export class DoubleDrawerNavigationService implements OnDestroy { const resolvedBannedRoles = DoubleDrawerUtils.resolveAccessRoles(itemCase, GroupNavigationConstants.ITEM_FIELD_ID_BANNED_ROLES); if (!!resolvedRoles) item.access['role'] = resolvedRoles; if (!!resolvedBannedRoles) item.access['bannedRole'] = resolvedBannedRoles; - if (!this._accessService.canAccessView(item, item.routingPath)) return; + if (!this._accessService.canAccessView(item, item.routing?.path)) return; return item; } @@ -545,7 +547,8 @@ export class DoubleDrawerNavigationService implements OnDestroy { public getItemRoutingPath(itemCase: Case) { const taskId = DoubleDrawerUtils.findTaskIdInCase(itemCase, SETTINGS_TRANSITION_ID); const url = this._dynamicRoutingService.route; - return `/${url}/${taskId}`; + const prefix = url.startsWith('/') ? '' : '/'; + return `${prefix}${url}/${taskId}`; } private processLeftItems(cases: Case[], orderedChildCaseIds: string[]): NavigationItem[] { diff --git a/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts b/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts index 8a3bfc1e2..d96077fbb 100644 --- a/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts +++ b/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts @@ -2,7 +2,7 @@ import {Component, Input, OnDestroy, OnInit, Optional} from '@angular/core'; import {MatExpansionPanel} from '@angular/material/expansion'; import {AbstractPanelWithHeaderBindingComponent} from '../abstract/panel-with-header-binding'; import {HeaderColumn} from '../../header/models/header-column'; -import {Observable, Subscription} from 'rxjs'; +import {Subscription} from 'rxjs'; import {LoggerService} from '../../logger/services/logger.service'; import {toMoment} from '../../resources/types/nae-date-type'; import {DATE_TIME_FORMAT_STRING} from '../../moment/time-formats'; @@ -18,7 +18,6 @@ import {PetriNetResourceService} from '../../resources/engine-endpoint/petri-net import {ProgressType, ProviderProgress} from '../../resources/resource-provider.service'; import {OverflowService} from '../../header/services/overflow.service'; - export interface WorkflowPanelContent { netIdentifier: TextField; title: TextField; @@ -160,7 +159,7 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe case WorkflowMetaField.INITIALS: return {value: this.workflow.initials, icon: '', type: 'meta'}; case WorkflowMetaField.TITLE: - return {value: this.workflow.title, icon: '', type: 'meta'}; + return {value: this.workflow.title || this.workflow.identifier, icon: '', type: 'meta'}; case WorkflowMetaField.NET_ID: return {value: this.workflow.stringId, icon: '', type: 'meta'}; case WorkflowMetaField.VERSION: @@ -168,7 +167,11 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe case WorkflowMetaField.AUTHOR: return {value: this.workflow.author.fullName, icon: 'account_circle', type: 'meta'}; case WorkflowMetaField.CREATION_DATE: - return {value: toMoment(this.workflow.createdDate).format(DATE_TIME_FORMAT_STRING), icon: 'event', type: 'meta'}; + return { + value: toMoment(this.workflow.createdDate).format(DATE_TIME_FORMAT_STRING), + icon: 'event', + type: 'meta' + }; } } diff --git a/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts b/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts index 2d77def9a..a5548cb33 100644 --- a/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts +++ b/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts @@ -42,6 +42,7 @@ export class CaseProcess extends NoConfigurationAutocompleteCategory { this._allowedNetsSub = this._optionalDependencies.allowedNetsService.allowedNets$.subscribe(allowedNets => { this._optionsMap.clear(); + this._uniqueOptionsMap.clear(); allowedNets.forEach(petriNet => { if (this.isUniqueOption(petriNet.title, petriNet.identifier)) { this.addToMap(petriNet.title, petriNet.identifier);