Skip to content

Commit 48d7ce0

Browse files
committed
[NAE-2205] DefaultCaseRefListViewComponent - headers not displayed when processes exceed single view
- add all features for case/task ref from idsk components
1 parent 8d7aa65 commit 48d7ce0

File tree

19 files changed

+254
-107
lines changed

19 files changed

+254
-107
lines changed

nae.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"providers": {
55
"auth": {
66
"address": "http://localhost:8080/api/",
7-
"authentication": "BasicWithRealm",
7+
"authentication": "Basic",
88
"endpoints": {
99
"login": "auth/login",
1010
"logout": "auth/logout",

projects/netgrif-components-core/src/lib/allowed-nets/services/factory/allowed-nets-service-factory.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import {getFieldFromDataGroups} from '../../../utility/get-field';
1717
import {FilterField} from '../../../data-fields/filter-field/models/filter-field';
1818
import {BaseAllowedNetsService} from '../base-allowed-nets.service';
1919
import {MultichoiceField} from "../../../data-fields/multichoice-field/models/multichoice-field";
20+
import {HttpParams} from "@angular/common/http";
21+
import {PaginationParams} from "../../../utility/pagination/pagination-params";
2022

2123
function addAllowedNets(allowedNets, existingAllowedNets) {
2224
if (!!allowedNets && allowedNets.length > 0) {
@@ -86,8 +88,10 @@ export class AllowedNetsServiceFactory {
8688
* @returns an instance of {@link AllowedNetsService} with all nets set as the `allowedNets`
8789
*/
8890
public createWithAllNets(): AllowedNetsService {
91+
let httpParams = new HttpParams()
92+
.set(PaginationParams.PAGE_SIZE, 10000)
8993
return new AllowedNetsService(
90-
this._petriNetResource.getAll().pipe(
94+
this._petriNetResource.getAll(httpParams).pipe(
9195
switchMap(nets => {
9296
if (nets && Array.isArray(nets)) {
9397
return of(nets.map(n => n.identifier));

projects/netgrif-components-core/src/lib/data-fields/case-ref-field/model/abstract-case-ref-base-field-component.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import {ComponentPortal} from '@angular/cdk/portal';
55
import {DATA_FIELD_PORTAL_DATA, DataFieldPortalData} from '../../models/data-field-portal-data-injection-token';
66
import {CaseSearchRequestBody} from '../../../filter/models/case-search-request-body';
77
import {NAE_DEFAULT_HEADERS} from '../../../header/models/default-headers-token';
8-
import {NAE_CASE_REF_CREATE_CASE, NAE_CASE_REF_DATAFIELD, NAE_CASE_REF_SEARCH} from './case-ref-injection-tokens';
8+
import {
9+
NAE_CASE_REF_CREATE_CASE,
10+
NAE_CASE_REF_DATAFIELD,
11+
NAE_CASE_REF_SEARCH, NAE_CLICKABLE_CASES, NAE_DATAFIELD_ALLOWED_NETS, NAE_OPEN_SINGLE_TASK,
12+
NAE_SINGLE_TASK_QUERY
13+
} from './case-ref-injection-tokens';
914
import {NAE_BASE_FILTER} from '../../../search/models/base-filter-injection-token';
1015
import {SimpleFilter} from '../../../filter/models/simple-filter';
1116
import {BaseFilter} from '../../../search/models/base-filter';
@@ -32,14 +37,35 @@ export abstract class AbstractCaseRefBaseFieldComponent<T extends DataField<unkn
3237
}
3338
let providers = [
3439
{
35-
provide: NAE_DEFAULT_HEADERS, useValue: this.dataField.component?.properties?.headers.split(',')
40+
provide: NAE_DEFAULT_HEADERS, useValue: this.dataField.component?.properties?.headers?.split(',')
41+
},
42+
{
43+
provide: NAE_CLICKABLE_CASES,
44+
useValue: this.dataField.component?.properties?.clickable === undefined ?
45+
true : this.dataField.component?.properties?.clickable === "true"
3646
},
3747
{
3848
provide: NAE_CASE_REF_CREATE_CASE, useValue: this.dataField.component?.properties?.createCase === 'true'
3949
},
4050
{
4151
provide: NAE_CASE_REF_SEARCH, useValue: this.dataField.component?.properties?.search === 'true'
4252
},
53+
{
54+
provide: NAE_DATAFIELD_ALLOWED_NETS,
55+
useValue: this.dataField.component?.properties?.allowedNets === undefined ?
56+
[] : this.dataField.component?.properties?.allowedNets?.split(',')
57+
},
58+
{
59+
provide: NAE_OPEN_SINGLE_TASK,
60+
useValue: this.dataField.component?.properties?.singleTask === undefined ?
61+
false : this.dataField.component?.properties?.singleTask === "true"
62+
},
63+
{
64+
provide: NAE_SINGLE_TASK_QUERY,
65+
useValue: this.dataField.component?.properties?.singleTaskQuery !== undefined ?
66+
this.dataField?.component?.properties?.singleTaskQuery :
67+
undefined
68+
},
4369
{
4470
provide: NAE_BASE_FILTER,
4571
useValue: { filter: SimpleFilter.fromCaseQuery((filterProperty && query ? query : {id: filterValue})) } as BaseFilter

projects/netgrif-components-core/src/lib/data-fields/case-ref-field/model/case-ref-injection-tokens.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ import {CaseRefField} from './case-ref-field';
44
export const NAE_CASE_REF_CREATE_CASE = new InjectionToken<boolean>('NaeCaseRefCreateCase');
55
export const NAE_CASE_REF_SEARCH = new InjectionToken<boolean>('NaeCaseRefSearch');
66
export const NAE_CASE_REF_DATAFIELD = new InjectionToken<CaseRefField>('NaeCaseRefDatafield');
7+
export const NAE_CLICKABLE_CASES = new InjectionToken<boolean>('NaeClickableCases');
8+
export const NAE_OPEN_SINGLE_TASK = new InjectionToken<boolean>('NaeOpenSingleTask');
9+
export const NAE_SINGLE_TASK_QUERY = new InjectionToken<string>('NaeSingleTaskQuery');
10+
export const NAE_DATAFIELD_ALLOWED_NETS = new InjectionToken<boolean>('NaeDatafieldAllowedNets');
11+

projects/netgrif-components-core/src/lib/data-fields/public-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export * from './task-ref-field/abstract-task-ref-field.component';
6464
export * from './task-ref-field/task-ref-dashboard-field/task-ref-dashboard-tile/abstract-task-ref-dashboard-tile.component';
6565
export * from './task-ref-field/task-ref-dashboard-field/abstract-task-ref-dashboard-field.component';
6666
export * from './task-ref-field/task-ref-list-field/abstract-task-ref-list-field.component';
67+
export * from './task-ref-field/model/task-ref-injection-tokens';
6768
export * from './case-ref-field/case-ref-default/case-ref-default.component';
6869
export * from './case-ref-field/model/case-ref-injection-tokens';
6970
export * from './string-collection-field/string-collection-default-field/abstract-string-collection-default-field.component';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import {InjectionToken} from "@angular/core";
2+
3+
export const NAE_CLICKABLE_TASKS = new InjectionToken<boolean>('NaeClickableTasks');
Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {AfterViewInit, Component, Inject, Injector, Optional, Type} from "@angular/core";
1+
import {AfterViewInit, Component, Inject, Injector, OnDestroy, Optional, Type} from "@angular/core";
22
import {TaskRefField} from "../model/task-ref-field";
33
import {NAE_BASE_FILTER} from "../../../search/models/base-filter-injection-token";
44
import {SimpleFilter} from "../../../filter/models/simple-filter";
@@ -8,14 +8,21 @@ import {ViewIdService} from "../../../user/services/view-id.service";
88
import {AbstractBaseDataFieldComponent} from "../../base-component/abstract-base-data-field.component";
99
import {DATA_FIELD_PORTAL_DATA, DataFieldPortalData} from "../../models/data-field-portal-data-injection-token";
1010
import {ComponentPortal} from "@angular/cdk/portal";
11+
import {Subscription} from "rxjs";
12+
import {NAE_DEFAULT_HEADERS} from "../../../header/models/default-headers-token";
13+
import {NAE_CLICKABLE_TASKS} from "../model/task-ref-injection-tokens";
14+
import {NAE_DATAFIELD_ALLOWED_NETS} from "../../case-ref-field/model/case-ref-injection-tokens";
15+
import {TaskSearchRequestBody} from "../../../filter/models/task-search-request-body";
1116

1217
@Component({
1318
selector: 'ncc-abstract-task-ref-list-field',
1419
template: ''
1520
})
16-
export abstract class AbstractTaskRefListFieldComponent extends AbstractBaseDataFieldComponent<TaskRefField> implements AfterViewInit {
21+
export abstract class AbstractTaskRefListFieldComponent extends AbstractBaseDataFieldComponent<TaskRefField> implements AfterViewInit, OnDestroy {
1722

1823
public componentPortal: ComponentPortal<any>;
24+
protected _sub: Subscription;
25+
protected _subComp: Subscription;
1926

2027
protected constructor(protected injector: Injector,
2128
protected taskViewType: Type<any>,
@@ -25,26 +32,63 @@ export abstract class AbstractTaskRefListFieldComponent extends AbstractBaseData
2532

2633
ngAfterViewInit(): void {
2734
this.createFilter();
28-
this.dataField.valueChanges().subscribe(() => {
29-
this.createFilter();
35+
this._sub = this.dataField.valueChanges().subscribe(() => {
36+
this.callCreateFilter();
37+
});
38+
this._subComp = this.dataField.componentChange$().subscribe(() => {
39+
this.callCreateFilter();
3040
});
3141
}
3242

43+
protected callCreateFilter() {
44+
this.createFilter();
45+
}
46+
3347
createFilter() {
34-
const portalInjector = Injector.create({
35-
providers: [
36-
{
37-
provide: NAE_BASE_FILTER,
38-
useValue: { filter: SimpleFilter.fromTaskQuery({stringId: this.dataField.value}) } as BaseFilter
39-
},
40-
{
41-
provide: NAE_VIEW_ID_SEGMENT,
42-
useValue: this.dataField.parentCaseId + '_' + this.dataField.parentTaskId + '_' + this.dataField.stringId
43-
},
44-
{ provide: ViewIdService, useClass: ViewIdService }],
48+
let portalInjector;
49+
const filterProperty: boolean = this.dataField?.component?.properties?.filter === 'true';
50+
let query: TaskSearchRequestBody;
51+
if (filterProperty) {
52+
query = JSON.parse(this.dataField?.component?.properties?.filterQuery) as TaskSearchRequestBody;
53+
}
54+
let providers = [
55+
{
56+
provide: NAE_DEFAULT_HEADERS, useValue: this.dataField.component?.properties?.headers?.split(',')
57+
},
58+
{
59+
provide: NAE_CLICKABLE_TASKS,
60+
useValue: this.dataField.component?.properties?.clickable === undefined ?
61+
true : this.dataField.component?.properties?.clickable === "true"
62+
},
63+
{
64+
provide: NAE_DATAFIELD_ALLOWED_NETS,
65+
useValue: this.dataField.component?.properties?.allowedNets === undefined ?
66+
[] : this.dataField.component?.properties?.allowedNets.split(',')
67+
},
68+
{
69+
provide: NAE_BASE_FILTER,
70+
useValue: { filter: SimpleFilter.fromTaskQuery(
71+
(filterProperty && query ? query : {stringId: this.dataField.value.length > 0 ? this.dataField.value : ''})
72+
)} as BaseFilter
73+
},
74+
{
75+
provide: NAE_VIEW_ID_SEGMENT,
76+
useValue: this.dataField.parentCaseId + '_' + this.dataField.parentTaskId + '_' + this.dataField.stringId
77+
},
78+
{ provide: ViewIdService, useClass: ViewIdService }
79+
];
80+
portalInjector = Injector.create({
81+
providers,
4582
parent: this.injector
4683
});
4784
this.componentPortal = new ComponentPortal(this.taskViewType, null, portalInjector);
4885
}
4986

87+
ngOnDestroy() {
88+
super.ngOnDestroy();
89+
if (this._sub) {
90+
this._sub.unsubscribe();
91+
}
92+
this._subComp.unsubscribe()
93+
}
5094
}

projects/netgrif-components-core/src/lib/panel/task-panel-list/default-task-panel-list/abstract-default-task-list.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export abstract class AbstractDefaultTaskListComponent extends TabbedVirtualScro
3030
@Input() forceLoadDataOnOpen = false;
3131
@Input() textEllipsis = false;
3232
@Input() showMoreMenu: boolean = true;
33+
@Input() preventExpand = false;
3334

3435
@Input()
3536
set allowMultiOpen(bool: boolean) {

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export abstract class AbstractTaskPanelComponent extends AbstractPanelWithImmedi
7171
@Input() public first: boolean;
7272
@Input() public last: boolean;
7373
@Input() responsiveBody = true;
74+
@Input() preventExpand = false;
7475
@Input() preventCollapse = false;
7576
@Input() hidePanelHeader = false;
7677
@Input() hideActionRow = false;
@@ -166,7 +167,9 @@ export abstract class AbstractTaskPanelComponent extends AbstractPanelWithImmedi
166167
});
167168
});
168169
_taskOperations.open$.subscribe(() => {
169-
this.expand();
170+
if (!this.preventExpand) {
171+
this.expand();
172+
}
170173
});
171174
_taskOperations.close$.subscribe(() => {
172175
if (!(this._taskForceOpen || this.preventCollapse)) {
@@ -221,9 +224,11 @@ export abstract class AbstractTaskPanelComponent extends AbstractPanelWithImmedi
221224

222225
ngAfterViewInit() {
223226
this.panelRef.opened.subscribe(() => {
224-
this._taskContentService.expansionStarted();
225-
if (!this._taskState.isLoading()) {
226-
this._assignPolicyService.performAssignPolicy(true);
227+
if (!this.preventExpand) {
228+
this._taskContentService.expansionStarted();
229+
if (!this._taskState.isLoading()) {
230+
this._assignPolicyService.performAssignPolicy(true);
231+
}
227232
}
228233
});
229234
this.panelRef.closed.subscribe(() => {
@@ -242,7 +247,7 @@ export abstract class AbstractTaskPanelComponent extends AbstractPanelWithImmedi
242247
this._taskPanelData.initiallyExpanded = false;
243248
});
244249

245-
if (this._taskPanelData.initiallyExpanded || this._taskForceOpen) {
250+
if ((this._taskPanelData.initiallyExpanded || this._taskForceOpen) && !this.preventExpand) {
246251
this.panelRef.expanded = true;
247252
}
248253
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<div class="full-height transform-div custom-scrollbar" [ngClass]="{'overflow-div': getOverflowStatus()}" fxLayout="column" fxLayoutAlign="start stretch">
1515
<div class="full-height transform-div max-width-fix" fxLayout="column" fxLayoutAlign="start stretch">
16-
<nc-header #header [type]="headerType" [responsiveHeaders]="true" class="case-header-padding" [ngStyle]="{'width': getWidth()}" [approval]="isApproval()"></nc-header>
16+
<nc-header #header [type]="headerType" [responsiveHeaders]="true" class="case-header-padding" [ngStyle]="{'width': getWidth()}" [maxHeaderColumns]="caseHeadersCount" [approval]="isApproval()"></nc-header>
1717

1818
<nc-case-list-paginator [selectedHeaders$]="selectedHeaders$" [showDeleteMenu]="false" [width]="getWidth()" [approval]="isApproval()" [disabled]="disabled()"
1919
(caseClick)="handleCaseClick($event)" [responsiveBody]="true" fxFlex [textEllipsis]="true"></nc-case-list-paginator>

0 commit comments

Comments
 (0)