Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Full Changelog: [https://github.com/netgrif/components/commits/v6.4.0](https://g
- [NAE-2019] Bugs after merge with 6.4.0

### Changed
- [NAE- 1940] Update to new Angular
- [NAE-1940] Update to new Angular
- [NAE-2023] Update URI attributes on frontend

## [6.4.0](https://github.com/netgrif/components/releases/tag/v6.4.0) (2024-11-07)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netgrif/components-project",
"version": "7.0.0-rc.1",
"version": "7.0.0-beta.2",
"description": "Netgrif Application Engine Frontend project. Project includes angular libraries as base for NAE applications.",
"homepage": "https://components.netgrif.com",
"license": "SEE LICENSE IN LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion projects/netgrif-components-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netgrif/components-core",
"version": "7.0.0-rc.1",
"version": "7.0.0-beta.2",
"description": "Netgrif Application engine frontend core Angular library",
"homepage": "https://components.netgrif.com",
"license": "SEE LICENSE IN LICENSE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export abstract class AbstractBreadcrumbsComponent implements OnDestroy, AfterVi
this.nicePathSubscription = this.nicePath.subscribe(np => {
if (!!np) {
const path = np;
if (path?.length > this.partsAfterDots + 1 && this._uriService.activeNode?.uriPath.length > this.lengthOfPath && !this._showPaths) {
if (path?.length > this.partsAfterDots + 1 && this._uriService.activeNode?.path.length > this.lengthOfPath && !this._showPaths) {
const newPath = [path[0], AbstractBreadcrumbsComponent.DOTS];
for (let i = path.length - this.partsAfterDots; i < path.length; i++) {
newPath.push(path[i]);
Expand All @@ -114,7 +114,7 @@ export abstract class AbstractBreadcrumbsComponent implements OnDestroy, AfterVi
if (!this.redirectOnClick) {
return;
}
this._router.navigate(this.redirectUrls.get(this._uriService.activeNode.uriPath)).then(r => {})
this._router.navigate(this.redirectUrls.get(this._uriService.activeNode.path)).then(r => {})
}

public reset(): void {
Expand Down Expand Up @@ -146,7 +146,7 @@ export abstract class AbstractBreadcrumbsComponent implements OnDestroy, AfterVi
}

private resultCounter(count: number, tmp: string[]): number {
if (tmp?.length > this.partsAfterDots + 1 && this._uriService.activeNode?.uriPath.length > this.lengthOfPath && !this._showPaths) {
if (tmp?.length > this.partsAfterDots + 1 && this._uriService.activeNode?.path.length > this.lengthOfPath && !this._showPaths) {
return tmp.length - this.partsAfterDots + (count - 2);
}
return count;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

export interface UriNodeResource {
id: string;
uriPath: string;
path: string;
name: string;
parentId: string;
parent: UriNodeResource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
return;
}
if (node.parentId && !node.parent) {
if (node.parentId === this._uriService.root.id) {
if (node.parentId === this._uriService.root.path) {
node.parent = this._uriService.root;
} else {
this.nodeLoading$.on();
Expand All @@ -206,7 +206,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
this.leftItems = [];
this.loadRightSide();
} else {
if (!this.leftItems.find(item => item.resource?.immediateData.find(f => f.stringId === GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH)?.value === node.uriPath)) {
if (!this.leftItems.find(item => item.resource?.immediateData.find(f => f.stringId === GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH)?.value === node.path)) {
this.loadLeftSide();
}
this.loadRightSide();
Expand Down Expand Up @@ -327,7 +327,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
onItemClick(item: NavigationItem): void {
if (item.resource === undefined) {
// custom view represented only in nae.json
if (item.processUri === this.currentNode.uriPath) {
if (item.processUri === this.currentNode.path) {
this._uriService.activeNode = this._currentNode;
} else {
this._uriService.activeNode = this._currentNode.parent;
Expand All @@ -340,7 +340,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
}, error => {
this._log.error(error);
});
} else if (!path.includes(this.currentNode.uriPath)){
} else if (!path.includes(this.currentNode.path)){
this._uriService.activeNode = this._currentNode.parent;
} else {
this._uriService.activeNode = this._currentNode;
Expand All @@ -353,7 +353,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
}

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

protected loadLeftSide() {
Expand Down Expand Up @@ -485,14 +485,14 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
}

protected resolveCustomViewsInRightSide() {
if (!!this._childCustomViews[this._currentNode.uriPath]) {
this.rightItems.push(...Object.values(this._childCustomViews[this._currentNode.uriPath]));
if (!!this._childCustomViews[this._currentNode.path]) {
this.rightItems.push(...Object.values(this._childCustomViews[this._currentNode.path]));
}
}

protected resolveCustomViewsInLeftSide() {
if (!!this._childCustomViews[this._currentNode.parent.uriPath]) {
this.leftItems.push(...Object.values(this._childCustomViews[this._currentNode.parent.uriPath]));
if (!!this._childCustomViews[this._currentNode.parent.path]) {
this.leftItems.push(...Object.values(this._childCustomViews[this._currentNode.parent.path]));
}
}

Expand Down Expand Up @@ -567,7 +567,7 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit,
}

uriNodeTrackBy(index: number, node: UriNodeResource) {
return node.id;
return node.path;
}

itemsTrackBy(index: number, item: NavigationItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('UriService', () => {

it('should get root node', () => {
const root = service.root;
expect(root.id).toEqual('root');
expect(root.path).toEqual('root');
expect(service.isRoot(root)).toBeTruthy();
expect(service.activeNode).toEqual(root);
});
Expand All @@ -59,8 +59,7 @@ describe('UriService', () => {

it('should get node by path', done => {
service.getNodeByPath(MockUriResourceService.TEST1_PATH).subscribe(res => {
expect(res.uriPath).toEqual(MockUriResourceService.TEST1_PATH);
expect(res.id).toEqual(MockUriResourceService.TEST1_ID);
expect(res.path).toEqual(MockUriResourceService.TEST1_PATH);
done();
});
});
Expand All @@ -69,7 +68,7 @@ describe('UriService', () => {
service.getChildNodes(service.root).subscribe(res => {
expect(res.length).toEqual(2);
res.forEach(r => {
expect(r.id).toContain('test');
expect(r.path).toContain('test');
expect(r.parentId).toEqual('root');
});
done();
Expand All @@ -85,9 +84,9 @@ describe('UriService', () => {

it('should get siblings of a node', done => {
service.getNodeByPath(MockUriResourceService.TEST1_PATH).subscribe(node => {
expect(node.id).toEqual(MockUriResourceService.TEST1_ID);
expect(node.path).toEqual(MockUriResourceService.TEST1_PATH);
service.getSiblingsOfNode(node).subscribe(siblings => {
expect(siblings.find(n => n.id === MockUriResourceService.TEST2_ID)).not.toBeUndefined();
expect(siblings.find(n => n.path === MockUriResourceService.TEST2_PATH)).not.toBeUndefined();
done();
});
});
Expand All @@ -110,9 +109,7 @@ describe('UriService', () => {

it('should get parts of path', done => {
service.getNodeByPath(MockUriResourceService.TEST1_PATH).subscribe(node => {
const path = service.splitNodePath(node);
expect(path.length).toEqual(1);
expect(path[0]).toEqual(MockUriResourceService.TEST1_ID);
expect(node.path).toEqual(MockUriResourceService.TEST1_PATH);
done();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class UriService implements OnDestroy {
}

public isRoot(node: UriNodeResource): boolean {
return node.id === this._rootNode.id && node.uriPath === this._rootNode.uriPath;
return node.path === this._rootNode.path;
}

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

public set activeNode(node: UriNodeResource) {
if (node.parentId && !node.parent) {
if (node.parentId === this._rootNode.id) {
if (node.parentId === this._rootNode.path) {
node.parent = this._rootNode;
} else {
this._parentLoading$.on();
Expand Down Expand Up @@ -137,7 +137,7 @@ export class UriService implements OnDestroy {
*/
public getChildNodes(node?: UriNodeResource): Observable<Array<UriNodeResource>> {
if (!node) node = this.activeNode;
return this._resourceService.getNodesByParent(node.id).pipe(
return this._resourceService.getNodesByParent(node.path).pipe(
map(nodes => {
this.capitalizeNames(nodes);
return nodes;
Expand All @@ -155,7 +155,7 @@ export class UriService implements OnDestroy {
public getCasesOfNode(node?: UriNodeResource, processIdentifiers?: Array<string>, pageNumber: number = 0, pageSize: string | number = this.pageSize): Observable<Page<Case>> {
if (!node) node = this.activeNode;
const searchBody: CaseSearchRequestBody = {
uriNodeId: node.id,
uriNodeId: node.path,
};
if (!!processIdentifiers) {
searchBody.process = processIdentifiers.map(id => ({identifier: id} as PetriNetSearchRequest));
Expand All @@ -182,7 +182,7 @@ export class UriService implements OnDestroy {
}
const searchBody: CaseSearchRequestBody = {
data: {
[GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH] : node.uriPath
[GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH] : node.path
},
process: {identifier: "preference_item"}
};
Expand Down Expand Up @@ -216,7 +216,7 @@ export class UriService implements OnDestroy {
if (level === 0) return of([this.root]);
return this._resourceService.getByLevel(level).pipe(
map(nodes => {
const ns = !!parent?.id ? nodes.filter(n => n.parentId === parent.id) : nodes;
const ns = !!parent?.path ? nodes.filter(n => n.parentId === parent.path) : nodes;
this.capitalizeNames(ns);
return ns;
}),
Expand All @@ -225,13 +225,13 @@ export class UriService implements OnDestroy {

public resolveParentPath(node?: UriNodeResource): string {
if (!node) node = this.activeNode;
const lastDelimiter = node.uriPath.lastIndexOf('/');
const lastDelimiter = node.path.lastIndexOf('/');
if (lastDelimiter === 0) return '/';
return node.uriPath.substring(0, lastDelimiter);
return node.path.substring(0, lastDelimiter);
}

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

private capitalizeNames(nodes: Array<UriNodeResource>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export abstract class AbstractImportNetComponent implements AfterViewInit {
protected uploadFile(file: FileUploadModel) {
const fileFormData = new FormData();
fileFormData.append('file', file.data as File);
fileFormData.append('uriNodeId', this._uriService.activeNode.id);
fileFormData.append('uriNodeId', this._uriService.activeNode.path);
fileFormData.append('meta', this.releaseTypeControl.value.toString().toUpperCase());

file.inProgress = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,22 @@ import {ResourceProvider} from '../../../resources/resource-provider.service';
@Injectable()
export class MockUriResourceService extends UriResourceService {

static TEST1_ID = 'test1';
static TEST1_PATH = 'root/test1';
static TEST2_ID = 'test2';
static TEST2_PATH = 'root/test2';

private _root: UriNodeResource = {
id: 'root',
uriPath: 'root',
path: 'root',
name: 'root',
parentId: null,
parent: undefined,
childrenId: new Set<string>([MockUriResourceService.TEST1_ID, MockUriResourceService.TEST2_ID]),
childrenId: new Set<string>([MockUriResourceService.TEST1_PATH, MockUriResourceService.TEST2_PATH]),
children: undefined,
level: 0,
contentTypes: undefined,
} as UriNodeResource;
private _test1Node: UriNodeResource = {
id: MockUriResourceService.TEST1_ID,
uriPath: MockUriResourceService.TEST1_PATH,
name: MockUriResourceService.TEST1_ID,
path: MockUriResourceService.TEST1_PATH,
name: MockUriResourceService.TEST1_PATH,
parentId: 'root',
parent: this._root,
childrenId: undefined,
Expand All @@ -36,9 +32,8 @@ export class MockUriResourceService extends UriResourceService {
contentTypes: new Set<UriContentType>([UriContentType.PROCESS]),
} as UriNodeResource;
private _test2Node: UriNodeResource = {
id: MockUriResourceService.TEST2_ID,
uriPath: MockUriResourceService.TEST2_PATH,
name: MockUriResourceService.TEST2_ID,
path: MockUriResourceService.TEST2_PATH,
name: MockUriResourceService.TEST2_PATH,
parentId: 'root',
parent: this._root,
childrenId: undefined,
Expand Down
4 changes: 2 additions & 2 deletions projects/netgrif-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netgrif/components",
"version": "7.0.0-rc.1",
"version": "7.0.0-beta.2",
"description": "Netgrif Application Engine frontend Angular components",
"homepage": "https://components.netgrif.com",
"license": "SEE LICENSE IN LICENSE",
Expand Down Expand Up @@ -29,7 +29,7 @@
"nae frontend"
],
"peerDependencies": {
"@netgrif/components-core": "7.0.0-rc.1",
"@netgrif/components-core": "7.0.0-beta.2",
"@angular-material-components/datetime-picker": "~16.0.0",
"@angular-material-components/moment-adapter": "~16.0.0",
"@angular/animations": "~17.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class ImportNetDialogComponent implements AfterViewInit {
protected uploadFile(file: FileUploadModel) {
const fileFormData = new FormData();
fileFormData.append('file', file.data as File);
fileFormData.append('uriNodeId', this._uriService.activeNode.id);
fileFormData.append('uriNodeId', this._uriService.activeNode.path);
fileFormData.append('meta', this.releaseTypeControl.value.toString().toUpperCase());

file.inProgress = true;
Expand Down
Loading