Skip to content

Commit c79cdc6

Browse files
authored
Merge branch 'release/7.0.0-rev8' into NAE-2217
2 parents 8309d60 + 91c9a59 commit c79cdc6

File tree

10 files changed

+66
-22
lines changed

10 files changed

+66
-22
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,16 @@ export abstract class AbstractDashboardComponent {
264264
return;
265265
}
266266
const itemRoute = this._doubleDrawerNavigationService.getItemRoutingPath(menuItemCase);
267-
this._pathService.activePath = this.getFieldValue(menuItemCase, GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH);
268267
const nodePath = this.getFieldValue(menuItemCase, GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH);
269-
if (nodePath) {
268+
if (menuItemCase.immediateData.find(f => f.stringId === GroupNavigationConstants.ITEM_FIELD_ID_HAS_CHILDREN)?.value && nodePath) {
269+
this._doubleDrawerNavigationService.currentNavigationItem = undefined;
270270
this._pathService.activePath = nodePath;
271+
} else if (nodePath) {
272+
const menuItem = this._doubleDrawerNavigationService.resolveItemCaseToNavigationItem(menuItemCase);
273+
if (menuItem) {
274+
this._doubleDrawerNavigationService.currentNavigationItem = menuItem;
275+
}
276+
this._pathService.activePath = this._doubleDrawerNavigationService.extractParentPath(nodePath);
271277
}
272278
this._router.navigate([itemRoute]);
273279
} else {

projects/netgrif-components-core/src/lib/navigation/model/group-navigation-constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export enum GroupNavigationConstants {
123123
/**
124124
* Boolean field, that is true to use default headers configuration for case view
125125
* */
126-
ITEM_FIELD_ID_USE_CASE_DEFAULT_HEADERS = 'use_default_headers',
126+
ITEM_FIELD_ID_USE_CASE_DEFAULT_HEADERS = 'use_case_default_headers',
127127

128128
/**
129129
* Text field, that contains default header metadata separated by comma for case view as a value

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
7676
/**
7777
* Currently selected navigation item
7878
*/
79-
protected _currentNavigationItem: NavigationItem;
79+
protected _currentNavigationItem: NavigationItem | undefined;
8080
protected defaultViewIcon: string = 'filter_alt';
8181
protected customItemsInitialized: boolean;
8282
protected hiddenCustomItemsInitialized: boolean;
@@ -103,7 +103,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
103103
this._leftLoading$ = new LoadingEmitter();
104104
this._rightLoading$ = new LoadingEmitter();
105105
this._nodeLoading$ = new LoadingEmitter();
106-
this._currentNavigationItem = null;
106+
this._currentNavigationItem = undefined;
107107
this.itemsOrder = MenuOrder.Ascending;
108108
this.customItemsInitialized = false;
109109
this.hiddenCustomItemsInitialized = false;
@@ -145,6 +145,10 @@ export class DoubleDrawerNavigationService implements OnDestroy {
145145
}
146146
}
147147

148+
public set currentNavigationItem(item: NavigationItem | undefined) {
149+
this._currentNavigationItem = item;
150+
}
151+
148152
protected resolveMenuItems(path: string) {
149153
if (path === PathService.SEPARATOR) {
150154
this._leftItems$.next([])
@@ -242,7 +246,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
242246
if (this.leftLoading$.isActive || this.rightLoading$.isActive || this.currentPath === PathService.SEPARATOR) {
243247
return
244248
}
245-
this._pathService.activePath = this.extractParent(this.currentPath);
249+
this._pathService.activePath = this.extractParentPath(this.currentPath);
246250
this.itemClicked.emit({path: this._pathService.activePath, isHome: false});
247251
}
248252

@@ -253,12 +257,12 @@ export class DoubleDrawerNavigationService implements OnDestroy {
253257
* */
254258
public onItemClick(item: NavigationItem): void {
255259
if (item.resource === undefined) {
256-
this._currentNavigationItem = null;
260+
this._currentNavigationItem = undefined;
257261
// custom view represented only in nae.json
258262
if (item.processUri === this.currentPath) {
259263
this._pathService.activePath = this.currentPath;
260264
} else {
261-
this._pathService.activePath = this.extractParent(this.currentPath);
265+
this._pathService.activePath = this.extractParentPath(this.currentPath);
262266
}
263267
this.itemClicked.emit({path: this._pathService.activePath, isHome: false});
264268
} else {
@@ -275,7 +279,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
275279
this.openAvailableView();
276280
})
277281
} else if (!path.includes(this.currentPath)) {
278-
this._pathService.activePath = this.extractParent(this.currentPath);
282+
this._pathService.activePath = this.extractParentPath(this.currentPath);
279283
this.itemClicked.emit({path: this._pathService.activePath, isHome: false});
280284

281285
} else {
@@ -376,7 +380,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
376380
}
377381
this.leftLoading$.on();
378382

379-
this.getItemCaseByPath(this.extractParent(this.currentPath)).subscribe(page => {
383+
this.getItemCaseByPath(this.extractParentPath(this.currentPath)).subscribe(page => {
380384
let childCases$;
381385
let targetItem;
382386
let orderedChildCaseIds;
@@ -510,9 +514,9 @@ export class DoubleDrawerNavigationService implements OnDestroy {
510514
}
511515

512516
protected resolveCustomViewsInLeftSide() {
513-
if (!!this.extractParent(this.currentPath) && !!this._childCustomViews[this.extractParent(this.currentPath)]) {
517+
if (!!this.extractParentPath(this.currentPath) && !!this._childCustomViews[this.extractParentPath(this.currentPath)]) {
514518
let currentLeftItems = this._leftItems$.getValue();
515-
currentLeftItems.push(...Object.values(this._childCustomViews[this.extractParent(this.currentPath)]));
519+
currentLeftItems.push(...Object.values(this._childCustomViews[this.extractParentPath(this.currentPath)]));
516520
this._leftItems$.next(currentLeftItems);
517521
}
518522
}
@@ -590,7 +594,7 @@ export class DoubleDrawerNavigationService implements OnDestroy {
590594
return this._caseResourceService.searchCases(SimpleFilter.fromCaseQuery(searchBody), httpParams);
591595
}
592596

593-
private extractParent(path: string): string {
597+
public extractParentPath(path: string): string {
594598
if (path === '/') {
595599
return path;
596600
}

projects/netgrif-components-core/src/lib/task/services/assign-task.service.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import {ChangedFieldsService} from '../../changed-fields/services/changed-fields
2424
import {EventService} from '../../event/services/event.service';
2525
import {ChangedFieldsMap} from '../../event/services/interfaces/changed-fields-map';
2626
import {TaskEventOutcome} from '../../event/model/event-outcomes/task-outcomes/task-event-outcome';
27+
import {FrontActionService} from '../../actions/services/front-action.service';
28+
import {FrontAction} from '../../data-fields/models/changed-fields';
2729

2830

2931
/**
@@ -42,6 +44,7 @@ export class AssignTaskService extends TaskHandlingService {
4244
protected _eventQueue: EventQueueService,
4345
protected _eventService: EventService,
4446
protected _changedFieldsService: ChangedFieldsService,
47+
protected _frontActionService: FrontActionService,
4548
@Inject(NAE_TASK_OPERATIONS) protected _taskOperations: TaskOperations,
4649
@Optional() _selectedCaseService: SelectedCaseService,
4750
@Optional() protected _taskViewService: TaskViewService,
@@ -121,9 +124,15 @@ export class AssignTaskService extends TaskHandlingService {
121124
this._taskContentService.updateStateData(outcomeResource.outcome as AssignTaskEventOutcome);
122125
const changedFieldsMap: ChangedFieldsMap = this._eventService
123126
.parseChangedFieldsFromOutcomeTree(outcomeResource.outcome);
127+
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
128+
124129
if (!!changedFieldsMap) {
125130
this._changedFieldsService.emitChangedFields(changedFieldsMap);
126131
}
132+
if (frontActions?.length > 0) {
133+
this._frontActionService.runAll(frontActions);
134+
}
135+
127136
forceReload ? this._taskOperations.forceReload() : this._taskOperations.reload();
128137
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as AssignTaskEventOutcome);
129138
this._snackBar.openSuccessSnackBar(!!outcomeResource.outcome.message

projects/netgrif-components-core/src/lib/task/services/cancel-task.service.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ import {QueuedEvent} from '../../event-queue/model/queued-event';
2323
import {AfterAction} from '../../utility/call-chain/after-action';
2424
import {PermissionService} from '../../authorization/permission/permission.service';
2525
import {ChangedFieldsService} from '../../changed-fields/services/changed-fields.service';
26-
import { EventService} from '../../event/services/event.service';
26+
import {EventService} from '../../event/services/event.service';
2727
import {ChangedFieldsMap} from '../../event/services/interfaces/changed-fields-map';
2828
import {TaskEventOutcome} from '../../event/model/event-outcomes/task-outcomes/task-event-outcome';
29-
29+
import {FrontActionService} from '../../actions/services/front-action.service';
30+
import {FrontAction} from '../../data-fields/models/changed-fields';
3031
/**
3132
* Service that handles the logic of canceling a task.
3233
*/
@@ -49,7 +50,9 @@ export class CancelTaskService extends TaskHandlingService {
4950
@Optional() _selectedCaseService: SelectedCaseService,
5051
@Optional() protected _taskViewService: TaskViewService,
5152
_taskContentService: TaskContentService,
52-
protected permissionService: PermissionService) {
53+
protected permissionService: PermissionService,
54+
protected _frontActionService: FrontActionService
55+
) {
5356
super(_taskContentService, _selectedCaseService);
5457
}
5558

@@ -123,9 +126,15 @@ export class CancelTaskService extends TaskHandlingService {
123126
this._taskContentService.updateStateData(outcomeResource.outcome as CancelTaskEventOutcome);
124127
const changedFieldsMap: ChangedFieldsMap = this._eventService
125128
.parseChangedFieldsFromOutcomeTree(outcomeResource.outcome);
129+
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
130+
126131
if (!!changedFieldsMap) {
127132
this._changedFieldsService.emitChangedFields(changedFieldsMap);
128133
}
134+
if (frontActions?.length > 0) {
135+
this._frontActionService.runAll(frontActions);
136+
}
137+
129138
forceReload ? this._taskOperations.forceReload() : this._taskOperations.reload();
130139
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as CancelTaskEventOutcome);
131140
} else if (outcomeResource.error !== undefined) {

projects/netgrif-components-core/src/lib/task/services/finish-task.service.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import {ChangedFieldsService} from '../../changed-fields/services/changed-fields
2424
import {EventService} from '../../event/services/event.service';
2525
import {ChangedFieldsMap} from '../../event/services/interfaces/changed-fields-map';
2626
import {TaskEventOutcome} from '../../event/model/event-outcomes/task-outcomes/task-event-outcome';
27-
27+
import {FrontActionService} from '../../actions/services/front-action.service';
28+
import {FrontAction} from '../../data-fields/models/changed-fields';
2829

2930
/**
3031
* Service that handles the logic of finishing a task.
@@ -45,7 +46,8 @@ export class FinishTaskService extends TaskHandlingService {
4546
protected _changedFieldsService: ChangedFieldsService,
4647
@Inject(NAE_TASK_OPERATIONS) protected _taskOperations: TaskOperations,
4748
@Optional() _selectedCaseService: SelectedCaseService,
48-
_taskContentService: TaskContentService) {
49+
_taskContentService: TaskContentService,
50+
protected _frontActionService: FrontActionService) {
4951
super(_taskContentService, _selectedCaseService);
5052
}
5153

@@ -136,9 +138,15 @@ export class FinishTaskService extends TaskHandlingService {
136138
this._taskContentService.updateStateData(outcomeResource.outcome as FinishTaskEventOutcome);
137139
const changedFieldsMap: ChangedFieldsMap = this._eventService
138140
.parseChangedFieldsFromOutcomeTree(outcomeResource.outcome);
141+
const frontActions: Array<FrontAction> = this._eventService.parseFrontActionsFromOutcomeTree(outcomeResource.outcome);
142+
139143
if (!!changedFieldsMap) {
140144
this._changedFieldsService.emitChangedFields(changedFieldsMap);
141145
}
146+
if (frontActions?.length > 0) {
147+
this._frontActionService.runAll(frontActions);
148+
}
149+
142150
this._taskOperations.reload();
143151
this.completeActions(afterAction, nextEvent, true, outcomeResource.outcome as FinishTaskEventOutcome);
144152
this._taskOperations.close();

projects/netgrif-components-core/src/lib/task/services/task-data.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ export class TaskDataService extends TaskHandlingService implements OnDestroy {
489489
if (Object.keys(changedFieldsMap).length > 0) {
490490
this._changedFieldsService.emitChangedFields(changedFieldsMap);
491491
}
492-
if (!!frontActions && frontActions.length > 0) {
492+
if (frontActions?.length > 0) {
493493
this._frontActionService.runAll(frontActions);
494494
}
495495
this.clearWaitingForResponseFlag(context.body);

projects/netgrif-components-core/src/lib/utility/navigation-item-default-headers-factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function navigationItemDefaultHeadersFactory(navigationItemTaskData: DataGroup[]
2424
return undefined;
2525
}
2626
} catch (e) {
27+
console.log('Error during resolving default headers', e)
2728
return undefined;
2829
}
2930
}

projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/tabbed/default-tabbed-case-view/default-tabbed-case-view.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="full-height transform-div custom-scrollbar"
1717
[ngClass]="{'overflow-div': getOverflowStatus()}" fxLayout="column" fxLayoutAlign="start stretch">
1818
<div class="full-height transform-div max-width-fix" fxLayout="column" fxLayoutAlign="start stretch">
19-
<nc-header #header [type]="headerType" [maxHeaderColumns]="6" [responsiveHeaders]="true" [ngStyle]="{'width': getWidth()}" [hideHeaderMenu]="!headersChangeable" [showEditButton]="isMenuOptionEnabled('edit')"
19+
<nc-header #header [type]="headerType" [maxHeaderColumns]="headersCount" [responsiveHeaders]="true" [ngStyle]="{'width': getWidth()}" [hideHeaderMenu]="!headersChangeable" [showEditButton]="isMenuOptionEnabled('edit')"
2020
[showSortButton]="isMenuOptionEnabled('sort')" [showSearchButton]="isMenuOptionEnabled('search')"
2121
[showTableSection]="allowTableMode" class="case-header-padding"></nc-header>
2222

projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/tabbed/default-tabbed-case-view/default-tabbed-case-view.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {AfterViewInit, Component, Inject, ViewChild} from '@angular/core';
1+
import {AfterViewInit, Component, Inject, Optional, ViewChild} from '@angular/core';
22
import {
33
AbstractTabbedCaseViewComponent,
44
AllowedNetsService,
@@ -85,12 +85,14 @@ export class DefaultTabbedCaseViewComponent extends AbstractTabbedCaseViewCompon
8585
headersMode: string[];
8686
allowTableMode: boolean;
8787
defaultHeadersMode: HeaderMode;
88+
headersCount: number
8889

8990
constructor(caseViewService: CaseViewService,
9091
loggerService: LoggerService,
9192
viewIdService: ViewIdService,
9293
overflowService: OverflowService,
93-
@Inject(NAE_TAB_DATA) protected _injectedTabData: InjectedTabbedCaseViewDataWithNavigationItemTaskData) {
94+
@Inject(NAE_TAB_DATA) protected _injectedTabData: InjectedTabbedCaseViewDataWithNavigationItemTaskData,
95+
@Optional() @Inject(NAE_DEFAULT_HEADERS) protected _defaultHeaders: Array<string> | undefined) {
9496
super(caseViewService, loggerService, _injectedTabData, overflowService, undefined, undefined, _injectedTabData.newCaseButtonConfiguration);
9597

9698
this.initialSearchMode = _injectedTabData.caseViewSearchTypeConfiguration.initialSearchMode;
@@ -107,6 +109,11 @@ export class DefaultTabbedCaseViewComponent extends AbstractTabbedCaseViewCompon
107109
const viewId = viewIdService.viewId;
108110
localStorage.setItem(viewId + '-overflowMode', 'false');
109111
}
112+
if (this._defaultHeaders) {
113+
this.headersCount = this._defaultHeaders.length;
114+
} else {
115+
this.headersCount = 5; // 5 meta headers
116+
}
110117
}
111118

112119
ngAfterViewInit(): void {

0 commit comments

Comments
 (0)