Skip to content

Commit 2f93804

Browse files
committed
Replace uriPath with path in navigation components.
Replaced all occurrences of the `uriPath` property with `path` across navigation-related components, services, and tests. This ensures consistency in property naming and simplifies path handling logic.
1 parent c61a9ab commit 2f93804

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

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/navigation-double-drawer/abstract-navigation-double-drawer.ts

Lines changed: 9 additions & 9 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

@@ -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.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
});

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class UriService implements OnDestroy {
6262
}
6363

6464
public isRoot(node: UriNodeResource): boolean {
65-
return node.id === this._rootNode.id && node.uriPath === this._rootNode.uriPath;
65+
return node.path === this._rootNode.path;
6666
}
6767

6868
public get activeNode(): UriNodeResource {
@@ -71,7 +71,7 @@ export class UriService implements OnDestroy {
7171

7272
public set activeNode(node: UriNodeResource) {
7373
if (node.parentId && !node.parent) {
74-
if (node.parentId === this._rootNode.id) {
74+
if (node.parentId === this._rootNode.path) {
7575
node.parent = this._rootNode;
7676
} else {
7777
this._parentLoading$.on();
@@ -182,7 +182,7 @@ export class UriService implements OnDestroy {
182182
}
183183
const searchBody: CaseSearchRequestBody = {
184184
data: {
185-
[GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH] : node.uriPath
185+
[GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH] : node.path
186186
},
187187
process: {identifier: "preference_item"}
188188
};
@@ -225,13 +225,13 @@ export class UriService implements OnDestroy {
225225

226226
public resolveParentPath(node?: UriNodeResource): string {
227227
if (!node) node = this.activeNode;
228-
const lastDelimiter = node.uriPath.lastIndexOf('/');
228+
const lastDelimiter = node.path.lastIndexOf('/');
229229
if (lastDelimiter === 0) return '/';
230-
return node.uriPath.substring(0, lastDelimiter);
230+
return node.path.substring(0, lastDelimiter);
231231
}
232232

233233
public splitNodePath(node: UriNodeResource): Array<string> {
234-
return node?.uriPath.split('/').filter(s => s !== UriService.ROOT);
234+
return node?.path.split('/').filter(s => s !== UriService.ROOT);
235235
}
236236

237237
private capitalizeNames(nodes: Array<UriNodeResource>) {

projects/netgrif-components-core/src/lib/utility/tests/mocks/mock-uri-resource.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class MockUriResourceService extends UriResourceService {
1515

1616
private _root: UriNodeResource = {
1717
id: 'root',
18-
uriPath: 'root',
18+
path: 'root',
1919
name: 'root',
2020
parentId: null,
2121
parent: undefined,
@@ -26,7 +26,7 @@ export class MockUriResourceService extends UriResourceService {
2626
} as UriNodeResource;
2727
private _test1Node: UriNodeResource = {
2828
id: MockUriResourceService.TEST1_ID,
29-
uriPath: MockUriResourceService.TEST1_PATH,
29+
path: MockUriResourceService.TEST1_PATH,
3030
name: MockUriResourceService.TEST1_ID,
3131
parentId: 'root',
3232
parent: this._root,
@@ -37,7 +37,7 @@ export class MockUriResourceService extends UriResourceService {
3737
} as UriNodeResource;
3838
private _test2Node: UriNodeResource = {
3939
id: MockUriResourceService.TEST2_ID,
40-
uriPath: MockUriResourceService.TEST2_PATH,
40+
path: MockUriResourceService.TEST2_PATH,
4141
name: MockUriResourceService.TEST2_ID,
4242
parentId: 'root',
4343
parent: this._root,

0 commit comments

Comments
 (0)