Skip to content

Commit cb6c313

Browse files
committed
Merge remote-tracking branch 'origin/NAE-2116' into NAE-2116
2 parents c88d069 + ebce8bb commit cb6c313

31 files changed

+122
-118
lines changed

.github/workflows/pr-build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ on:
55
jobs:
66
matrix-test:
77
name: Matrix Test
8-
runs-on: ubuntu-latest
8+
runs-on: ubuntu-24.04
99
strategy:
1010
matrix:
11-
node-version: [ 18, 20 ]
11+
node-version: [ 20, 22, 24 ]
1212
steps:
1313
- uses: actions/checkout@v4
1414
with:
@@ -17,7 +17,8 @@ jobs:
1717
name: Full Test on Node.js version ${{ matrix.node-version }}
1818
with:
1919
node-version: ${{ matrix.node-version }}
20-
- run: npm i --legacy-peer-deps
20+
- name: Install dependencies
21+
run: npm install --legacy-peer-deps
2122
- name: Build & test components-core
2223
run: |
2324
npm run ncc:build

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netgrif/components-project",
3-
"version": "7.0.0-rc.2",
3+
"version": "7.0.0-rc.3",
44
"description": "Netgrif Application Engine Frontend project. Project includes angular libraries as base for NAE applications.",
55
"homepage": "https://components.netgrif.com",
66
"license": "SEE LICENSE IN LICENSE",
@@ -144,7 +144,7 @@
144144
"karma-webpack": "^5.0.1",
145145
"ncp": "~2.0.0",
146146
"ng-packagr": "~17.3.0",
147-
"puppeteer": "~22.0.0",
147+
"puppeteer": "~23.0.0",
148148
"requirejs": "^2.3.6",
149149
"schematics-utilities": "~2.0.1",
150150
"sonarqube-scanner": "~2.5.0",

projects/netgrif-components-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netgrif/components-core",
3-
"version": "7.0.0-rc.2",
3+
"version": "7.0.0-rc.3",
44
"description": "Netgrif Application engine frontend core Angular library",
55
"homepage": "https://components.netgrif.com",
66
"license": "SEE LICENSE IN LICENSE",

projects/netgrif-components-core/src/lib/authorization/permission/permission.service.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('PermissionService', () => {
4949
title: 'string',
5050
caseColor: 'string',
5151
caseTitle: 'string',
52-
user: undefined,
52+
userId: undefined,
5353
roles: {
5454
assignRole: {
5555
assign: true,
@@ -83,7 +83,7 @@ describe('PermissionService', () => {
8383
title: 'string',
8484
caseColor: 'string',
8585
caseTitle: 'string',
86-
user: undefined,
86+
userId: undefined,
8787
roles: {
8888
assignRole: {
8989
assign: false,
@@ -117,7 +117,7 @@ describe('PermissionService', () => {
117117
title: 'string',
118118
caseColor: 'string',
119119
caseTitle: 'string',
120-
user: undefined,
120+
userId: undefined,
121121
roles: {},
122122
startDate: undefined,
123123
finishDate: undefined,
@@ -155,7 +155,7 @@ describe('PermissionService', () => {
155155
title: 'string',
156156
caseColor: 'string',
157157
caseTitle: 'string',
158-
user: undefined,
158+
userId: undefined,
159159
roles: {},
160160
startDate: undefined,
161161
finishDate: undefined,

projects/netgrif-components-core/src/lib/authorization/permission/permission.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,30 @@ export class PermissionService {
6161
&& (
6262
(
6363
task.assignPolicy === AssignPolicy.manual
64-
&& !task.user
64+
&& !task.userId
6565
&& this.hasTaskPermission(task, PermissionType.ASSIGN)
6666
)
6767
);
6868
}
6969

7070
public canCancel(task: Task | undefined): boolean {
71-
return !!task && !!task.user
71+
return !!task && !!task.userId
7272
&& this.hasTaskPermission(task, PermissionType.CANCEL)
7373
&& ((task.assignedUserPolicy === undefined || task.assignedUserPolicy.cancel === undefined)
7474
|| task.assignedUserPolicy.cancel);
7575
}
7676

7777
public canReassign(task: Task | undefined): boolean {
78-
return !!task && !!task.user && this.userComparator.compareUsers(task.user)
78+
return !!task && !!task.userId && this.userComparator.compareUsers(task.userId)
7979
&& this.hasTaskPermission(task, PermissionType.DELEGATE)
8080
&& ((task.assignedUserPolicy === undefined || task.assignedUserPolicy.reassign === undefined)
8181
|| task.assignedUserPolicy.reassign);
8282
}
8383

8484
public canFinish(task: Task | undefined): boolean {
8585
return !!task
86-
&& !!task.user
87-
&& this.userComparator.compareUsers(task.user)
86+
&& !!task.userId
87+
&& this.userComparator.compareUsers(task.userId)
8888
&& this.hasTaskPermission(task, PermissionType.FINISH);
8989
}
9090

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export abstract class AbstractBreadcrumbsComponent implements OnDestroy, AfterVi
9797
this.nicePathSubscription = this.nicePath.subscribe(np => {
9898
if (!!np) {
9999
const path = np;
100-
if (path?.length > this.partsAfterDots + 1 && this._uriService.activeNode?.uriPath.length > this.lengthOfPath && !this._showPaths) {
100+
if (path?.length > this.partsAfterDots + 1 && this._uriService.activeNode?.path.length > this.lengthOfPath && !this._showPaths) {
101101
const newPath = [path[0], AbstractBreadcrumbsComponent.DOTS];
102102
for (let i = path.length - this.partsAfterDots; i < path.length; i++) {
103103
newPath.push(path[i]);
@@ -114,7 +114,7 @@ export abstract class AbstractBreadcrumbsComponent implements OnDestroy, AfterVi
114114
if (!this.redirectOnClick) {
115115
return;
116116
}
117-
this._router.navigate(this.redirectUrls.get(this._uriService.activeNode.uriPath)).then(r => {})
117+
this._router.navigate(this.redirectUrls.get(this._uriService.activeNode.path)).then(r => {})
118118
}
119119

120120
public reset(): void {
@@ -146,7 +146,7 @@ export abstract class AbstractBreadcrumbsComponent implements OnDestroy, AfterVi
146146
}
147147

148148
private resultCounter(count: number, tmp: string[]): number {
149-
if (tmp?.length > this.partsAfterDots + 1 && this._uriService.activeNode?.uriPath.length > this.lengthOfPath && !this._showPaths) {
149+
if (tmp?.length > this.partsAfterDots + 1 && this._uriService.activeNode?.path.length > this.lengthOfPath && !this._showPaths) {
150150
return tmp.length - this.partsAfterDots + (count - 2);
151151
}
152152
return count;

projects/netgrif-components-core/src/lib/navigation/model/uri-resource.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11

22
export interface UriNodeResource {
3-
id: string;
4-
uriPath: string;
3+
id?: string;
4+
uriPath?: string;
5+
path: string;
56
name: string;
67
parentId: string;
7-
parent: UriNodeResource;
8+
parent?: UriNodeResource;
89
childrenId: Set<string>;
9-
children: Set<UriNodeResource>;
10+
children?: Set<UriNodeResource>;
1011
level: number;
11-
contentTypes: Set<UriContentType>
12+
contentTypes?: Set<UriContentType>
1213
}
1314

1415
export enum UriContentType {

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
206206
this.leftItems = [];
207207
this.loadRightSide();
208208
} else {
209-
if (!this.leftItems.find(item => item.resource?.immediateData.find(f => f.stringId === GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH)?.value === node.uriPath)) {
209+
if (!this.leftItems.find(item => item.resource?.immediateData.find(f => f.stringId === GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH)?.value === node.path)) {
210210
this.loadLeftSide();
211211
}
212212
this.loadRightSide();
@@ -327,7 +327,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
327327
onItemClick(item: NavigationItem): void {
328328
if (item.resource === undefined) {
329329
// custom view represented only in nae.json
330-
if (item.processUri === this.currentNode.uriPath) {
330+
if (item.processUri === this.currentNode.path) {
331331
this._uriService.activeNode = this._currentNode;
332332
} else {
333333
this._uriService.activeNode = this._currentNode.parent;
@@ -340,7 +340,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
340340
}, error => {
341341
this._log.error(error);
342342
});
343-
} else if (!path.includes(this.currentNode.uriPath)){
343+
} else if (!path.includes(this.currentNode.path)){
344344
this._uriService.activeNode = this._currentNode.parent;
345345
} else {
346346
this._uriService.activeNode = this._currentNode;
@@ -353,7 +353,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
353353
}
354354

355355
isItemAndNodeEqual(item: NavigationItem, node: UriNodeResource): boolean {
356-
return item.resource?.immediateData.find(f => f.stringId === GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH)?.value === node.uriPath
356+
return item.resource?.immediateData.find(f => f.stringId === GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH)?.value === node.path
357357
}
358358

359359
protected loadLeftSide() {
@@ -485,14 +485,14 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
485485
}
486486

487487
protected resolveCustomViewsInRightSide() {
488-
if (!!this._childCustomViews[this._currentNode.uriPath]) {
489-
this.rightItems.push(...Object.values(this._childCustomViews[this._currentNode.uriPath]));
488+
if (!!this._childCustomViews[this._currentNode.path]) {
489+
this.rightItems.push(...Object.values(this._childCustomViews[this._currentNode.path]));
490490
}
491491
}
492492

493493
protected resolveCustomViewsInLeftSide() {
494-
if (!!this._childCustomViews[this._currentNode.parent.uriPath]) {
495-
this.leftItems.push(...Object.values(this._childCustomViews[this._currentNode.parent.uriPath]));
494+
if (!!this._childCustomViews[this._currentNode.parent.path]) {
495+
this.leftItems.push(...Object.values(this._childCustomViews[this._currentNode.parent.path]));
496496
}
497497
}
498498

@@ -526,7 +526,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
526526

527527
protected getTranslation(value: I18nFieldValue): string {
528528
const locale = this._translateService.currentLang.split('-')[0];
529-
return locale in value.translations ? value.translations[locale] : value.defaultValue;
529+
return value.translations?.[locale] ?? value.defaultValue;
530530
}
531531

532532
protected resolveAccessRoles(filter: Case, roleType: string): Array<RoleAccess> | undefined {
@@ -567,7 +567,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
567567
}
568568

569569
uriNodeTrackBy(index: number, node: UriNodeResource) {
570-
return node.id;
570+
return node.path;
571571
}
572572

573573
itemsTrackBy(index: number, item: NavigationItem) {

projects/netgrif-components-core/src/lib/navigation/service/uri-resource.service.ts

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,53 @@ export class UriResourceService extends AbstractResourceService {
2020

2121
public getRoot(): Observable<UriNodeResource> {
2222
return this._resourceProvider.get$('uri/root', this.SERVER_URL).pipe(
23-
map(r => this.changeType(r, 'uriNode')));
23+
map(r => this.changeType(r, 'uriNode')),
24+
map((r: UriNodeResource) => {
25+
if (r.path) {
26+
r.uriPath = r.path;
27+
r.id = r.path;
28+
}
29+
return r;
30+
}));
2431
}
2532

2633
public getByLevel(level: number): Observable<Array<UriNodeResource>> {
2734
return this._resourceProvider.get$('uri/level/' + level, this.SERVER_URL).pipe(
28-
map(r => this.changeType(r, 'uriNodes')));
35+
map(r => this.changeType(r, 'uriNodes')),
36+
map((ar: Array<UriNodeResource>) => {
37+
return ar.map(r => {
38+
if (r.path) {
39+
r.uriPath = r.path;
40+
r.id = r.path;
41+
}
42+
return r;
43+
})
44+
}));
2945
}
3046

3147
public getNodesByParent(parentId: string): Observable<Array<UriNodeResource>> {
3248
return this._resourceProvider.get$('uri/parent/' + parentId, this.SERVER_URL).pipe(
33-
map(r => this.changeType(r, 'uriNodes')));
49+
map(r => this.changeType(r, 'uriNodes')),
50+
map((ar: Array<UriNodeResource>) => {
51+
return ar.map(r => {
52+
if (r.path) {
53+
r.uriPath = r.path;
54+
r.id = r.path;
55+
}
56+
return r;
57+
})
58+
}));
3459
}
3560

3661
public getNodeByUri(uriPath: string): Observable<UriNodeResource> {
3762
return this._resourceProvider.get$('uri/' + btoa(uriPath), this.SERVER_URL).pipe(
38-
map(r => this.changeType(r, 'uriNode')));
63+
map(r => this.changeType(r, 'uriNode')),
64+
map((r: UriNodeResource) => {
65+
if (r.path) {
66+
r.uriPath = r.path;
67+
r.id = r.path;
68+
}
69+
return r;
70+
}));
3971
}
4072
}

projects/netgrif-components-core/src/lib/navigation/service/uri.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('UriService', () => {
5959

6060
it('should get node by path', done => {
6161
service.getNodeByPath(MockUriResourceService.TEST1_PATH).subscribe(res => {
62-
expect(res.uriPath).toEqual(MockUriResourceService.TEST1_PATH);
62+
expect(res.path).toEqual(MockUriResourceService.TEST1_PATH);
6363
expect(res.id).toEqual(MockUriResourceService.TEST1_ID);
6464
done();
6565
});

0 commit comments

Comments
 (0)