Skip to content

Commit 94e3229

Browse files
authored
Merge pull request #298 from netgrif/NAE-2202
[NAE-2202] Post test fixes
2 parents e98393b + a022691 commit 94e3229

File tree

5 files changed

+32
-11
lines changed

5 files changed

+32
-11
lines changed

projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {I18nFieldValue} from '../../data-fields/i18n-field/models/i18n-field-val
1313
import {LanguageService} from '../../translate/language.service';
1414
import {LoadingEmitter} from '../../utility/loading-emitter';
1515
import {PathService} from "../service/path.service";
16+
import {GroupNavigationConstants} from "../model/group-navigation-constants";
1617

1718

1819
@Component({
@@ -257,9 +258,18 @@ export abstract class AbstractDashboardComponent {
257258

258259
public navigate(itemCase: Case) {
259260
if (this.getItemInternal(itemCase)) {
260-
const itemPath = this._doubleDrawerNavigationService.getItemRoutingPath(this.dashboardItemsMapping[itemCase.stringId]);
261-
this._pathService.activePath = itemPath;
262-
this._router.navigate([itemPath]);
261+
const menuItemCase = this.dashboardItemsMapping[itemCase.stringId];
262+
if (!menuItemCase) {
263+
this._log.warn(`No mapped menu item for dashboard item ${itemCase.stringId}`);
264+
return;
265+
}
266+
const itemRoute = this._doubleDrawerNavigationService.getItemRoutingPath(menuItemCase);
267+
this._pathService.activePath = this.getFieldValue(menuItemCase, GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH);
268+
const nodePath = this.getFieldValue(menuItemCase, GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH);
269+
if (nodePath) {
270+
this._pathService.activePath = nodePath;
271+
}
272+
this._router.navigate([itemRoute]);
263273
} else {
264274
window.open(this.getItemURL(itemCase), "_blank");
265275
}

projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
126126

127127
this._userService.user$.pipe(filter(u => !!u && u.id !== ''), take(1)).subscribe(() => {
128128
this._currentPathSubscription = this._pathService.activePath$.subscribe(path => {
129-
this.currentPath = path;
129+
if (path !== this.currentPath) {
130+
this.currentPath = path;
131+
} else {
132+
this.openAvailableView();
133+
}
130134
});
131135

132136
if (this.canApplyAutoSelect()) {

projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
9494
protected _redirectService: RedirectService,
9595
protected _pathService: PathService,
9696
protected _userService: UserService,
97-
) {
97+
) {
9898
this._leftItems$ = new BehaviorSubject([]);
9999
this._rightItems$ = new BehaviorSubject([]);
100100
this._moreItems$ = new BehaviorSubject([]);
@@ -439,6 +439,8 @@ export class DoubleDrawerNavigationService implements OnDestroy {
439439
this.resolveCustomViewsInRightSide();
440440
this._rightLoading$.off();
441441
this.itemLoaded.emit({menu: 'right', items: this.rightItems});
442+
443+
this.openAvailableView();
442444
}, error => {
443445
this._log.error(error);
444446
this._rightItems$.next([]);
@@ -492,7 +494,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
492494
const resolvedBannedRoles = DoubleDrawerUtils.resolveAccessRoles(itemCase, GroupNavigationConstants.ITEM_FIELD_ID_BANNED_ROLES);
493495
if (!!resolvedRoles) item.access['role'] = resolvedRoles;
494496
if (!!resolvedBannedRoles) item.access['bannedRole'] = resolvedBannedRoles;
495-
if (!this._accessService.canAccessView(item, item.routingPath)) return;
497+
if (!this._accessService.canAccessView(item, item.routing?.path)) return;
496498
return item;
497499
}
498500

@@ -545,7 +547,8 @@ export class DoubleDrawerNavigationService implements OnDestroy {
545547
public getItemRoutingPath(itemCase: Case) {
546548
const taskId = DoubleDrawerUtils.findTaskIdInCase(itemCase, SETTINGS_TRANSITION_ID);
547549
const url = this._dynamicRoutingService.route;
548-
return `/${url}/${taskId}`;
550+
const prefix = url.startsWith('/') ? '' : '/';
551+
return `${prefix}${url}/${taskId}`;
549552
}
550553

551554
private processLeftItems(cases: Case[], orderedChildCaseIds: string[]): NavigationItem[] {

projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Component, Input, OnDestroy, OnInit, Optional} from '@angular/core';
22
import {MatExpansionPanel} from '@angular/material/expansion';
33
import {AbstractPanelWithHeaderBindingComponent} from '../abstract/panel-with-header-binding';
44
import {HeaderColumn} from '../../header/models/header-column';
5-
import {Observable, Subscription} from 'rxjs';
5+
import {Subscription} from 'rxjs';
66
import {LoggerService} from '../../logger/services/logger.service';
77
import {toMoment} from '../../resources/types/nae-date-type';
88
import {DATE_TIME_FORMAT_STRING} from '../../moment/time-formats';
@@ -18,7 +18,6 @@ import {PetriNetResourceService} from '../../resources/engine-endpoint/petri-net
1818
import {ProgressType, ProviderProgress} from '../../resources/resource-provider.service';
1919
import {OverflowService} from '../../header/services/overflow.service';
2020

21-
2221
export interface WorkflowPanelContent {
2322
netIdentifier: TextField;
2423
title: TextField;
@@ -160,15 +159,19 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe
160159
case WorkflowMetaField.INITIALS:
161160
return {value: this.workflow.initials, icon: '', type: 'meta'};
162161
case WorkflowMetaField.TITLE:
163-
return {value: this.workflow.title, icon: '', type: 'meta'};
162+
return {value: this.workflow.title || this.workflow.identifier, icon: '', type: 'meta'};
164163
case WorkflowMetaField.NET_ID:
165164
return {value: this.workflow.stringId, icon: '', type: 'meta'};
166165
case WorkflowMetaField.VERSION:
167166
return {value: this.workflow.version, icon: '', type: 'meta'};
168167
case WorkflowMetaField.AUTHOR:
169168
return {value: this.workflow.author.fullName, icon: 'account_circle', type: 'meta'};
170169
case WorkflowMetaField.CREATION_DATE:
171-
return {value: toMoment(this.workflow.createdDate).format(DATE_TIME_FORMAT_STRING), icon: 'event', type: 'meta'};
170+
return {
171+
value: toMoment(this.workflow.createdDate).format(DATE_TIME_FORMAT_STRING),
172+
icon: 'event',
173+
type: 'meta'
174+
};
172175
}
173176
}
174177

projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class CaseProcess extends NoConfigurationAutocompleteCategory<string> {
4242

4343
this._allowedNetsSub = this._optionalDependencies.allowedNetsService.allowedNets$.subscribe(allowedNets => {
4444
this._optionsMap.clear();
45+
this._uniqueOptionsMap.clear();
4546
allowedNets.forEach(petriNet => {
4647
if (this.isUniqueOption(petriNet.title, petriNet.identifier)) {
4748
this.addToMap(petriNet.title, petriNet.identifier);

0 commit comments

Comments
 (0)