From 79f07725c2cec1315db0671080f93403c3946485 Mon Sep 17 00:00:00 2001 From: renczesstefan Date: Sat, 6 Sep 2025 09:41:00 +0200 Subject: [PATCH 1/8] [NAE-2202] Post test fixes - Implemented the `resolveI18n` function and `I18nString` interface to support resolving i18n strings. - Updated multiple components, including `new-case-dialog.component.ts`, `abstract-new-case.component.ts`, and `abstract-header-service.ts`, to use `resolveI18n` for titles. - Adjusted the `ProcessList`, `case-process`, and `workflow-panel` components to handle i18n titles via `resolveI18n`. - Modified `PetriNetReference` and `Net` models to support `I18nString` for titles. - Updated `nae.json` to reflect a new API address (`http://localhost:8800/api/`). This change improves i18n support by enabling dynamic translations and prepares the codebase for better localization support. --- .../admin/role-assignment/services/ProcessList.ts | 3 ++- .../src/lib/header/abstract-header-service.ts | 5 +++-- .../abstract-workflow-panel.component.ts | 5 +++-- .../netgrif-components-core/src/lib/process/net.ts | 5 +++-- .../src/lib/resources/interface/i18n-string.ts | 13 +++++++++++++ .../lib/resources/interface/petri-net-reference.ts | 3 ++- .../src/lib/resources/public-api.ts | 1 + .../lib/search/models/category/case/case-process.ts | 3 ++- .../new-case/abstract-new-case.component.ts | 3 ++- .../new-case-dialog/new-case-dialog.component.ts | 5 +++-- 10 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 projects/netgrif-components-core/src/lib/resources/interface/i18n-string.ts diff --git a/projects/netgrif-components-core/src/lib/admin/role-assignment/services/ProcessList.ts b/projects/netgrif-components-core/src/lib/admin/role-assignment/services/ProcessList.ts index 6b14efa6fb..8651787f20 100644 --- a/projects/netgrif-components-core/src/lib/admin/role-assignment/services/ProcessList.ts +++ b/projects/netgrif-components-core/src/lib/admin/role-assignment/services/ProcessList.ts @@ -6,6 +6,7 @@ import {forkJoin, Observable, of, Subject, timer} from 'rxjs'; import {catchError, map, tap} from 'rxjs/operators'; import NetRole from '../../../process/netRole'; import RolesAndPermissions from '../../../process/rolesAndPermissions'; +import {resolveI18n} from "../../../resources/interface/i18n-string"; export interface ExtendedProcessRole extends NetRole { selected: boolean; @@ -82,7 +83,7 @@ export class ProcessList { } else { cache[net.identifier] = { identifier: net.identifier, - title: net.title, + title: resolveI18n(net.title), initials: net.initials, newestVersion: undefined, processes: [net], diff --git a/projects/netgrif-components-core/src/lib/header/abstract-header-service.ts b/projects/netgrif-components-core/src/lib/header/abstract-header-service.ts index 74a91d5627..b8b58991f1 100644 --- a/projects/netgrif-components-core/src/lib/header/abstract-header-service.ts +++ b/projects/netgrif-components-core/src/lib/header/abstract-header-service.ts @@ -17,6 +17,7 @@ import {HeaderChangeType} from './models/user-changes/header-change-type'; import {ViewIdService} from '../user/services/view-id.service'; import {Net} from '../process/net'; import {OverflowService} from './services/overflow.service'; +import {resolveI18n} from "../resources/interface/i18n-string"; @Injectable() export abstract class AbstractHeaderService implements OnDestroy { @@ -202,7 +203,7 @@ export abstract class AbstractHeaderService implements OnDestroy { const fieldsGroups: Array = []; allowedNets.forEach(allowedNet => { const fieldsGroup: FieldsGroup = { - groupTitle: allowedNet.title, + groupTitle: resolveI18n(allowedNet.title), fields: [] }; allowedNet.immediateData.forEach(immediate => { @@ -227,7 +228,7 @@ export abstract class AbstractHeaderService implements OnDestroy { const fieldsGroups: Array = []; allowedNets.forEach(allowedNet => { const fieldsGroup: FieldsGroup = { - groupTitle: allowedNet.title, + groupTitle: resolveI18n(allowedNet.title), fields: [] }; const existing = new Set(); diff --git a/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts b/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts index 8a3bfc1e2e..1dabd843bb 100644 --- a/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts +++ b/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts @@ -17,6 +17,7 @@ import {FeaturedValue} from '../abstract/featured-value'; import {PetriNetResourceService} from '../../resources/engine-endpoint/petri-net-resource.service'; import {ProgressType, ProviderProgress} from '../../resources/resource-provider.service'; import {OverflowService} from '../../header/services/overflow.service'; +import {resolveI18n} from "../../resources/interface/i18n-string"; export interface WorkflowPanelContent { @@ -134,7 +135,7 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe netIdentifier: new TextField('', this._translate.instant(this.TRANSLATION_NET), this.workflow.identifier, this.dataFieldsBehaviour), title: new TextField('', this._translate.instant(this.TRANSLATION_TITLE), - this.workflow.title, this.dataFieldsBehaviour), + resolveI18n(this.workflow.title), this.dataFieldsBehaviour), version: new TextField('', this._translate.instant(this.TRANSLATION_VERSION), this.workflow.version, this.dataFieldsBehaviour), author: new TextField('', this._translate.instant(this.TRANSLATION_AUTHOR), @@ -160,7 +161,7 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe case WorkflowMetaField.INITIALS: return {value: this.workflow.initials, icon: '', type: 'meta'}; case WorkflowMetaField.TITLE: - return {value: this.workflow.title, icon: '', type: 'meta'}; + return {value: resolveI18n(this.workflow.title), icon: '', type: 'meta'}; case WorkflowMetaField.NET_ID: return {value: this.workflow.stringId, icon: '', type: 'meta'}; case WorkflowMetaField.VERSION: diff --git a/projects/netgrif-components-core/src/lib/process/net.ts b/projects/netgrif-components-core/src/lib/process/net.ts index a87b8c0194..cd62b29797 100644 --- a/projects/netgrif-components-core/src/lib/process/net.ts +++ b/projects/netgrif-components-core/src/lib/process/net.ts @@ -6,6 +6,7 @@ import Transaction from './transaction'; import NetRole from './netRole'; import {Permissions} from './permissions'; import {PetriNetReferenceWithPermissions} from './petri-net-reference-with-permissions'; +import {I18nString} from "../resources/interface/i18n-string"; /** * @ignore @@ -18,7 +19,7 @@ export class Net implements PetriNetReferenceWithPermissions { /** * @ignore */ - private _title: string; + private _title: string | I18nString; /** * @ignore */ @@ -94,7 +95,7 @@ export class Net implements PetriNetReferenceWithPermissions { this._stringId = value; } - get title(): string { + get title(): string | I18nString { return this._title; } diff --git a/projects/netgrif-components-core/src/lib/resources/interface/i18n-string.ts b/projects/netgrif-components-core/src/lib/resources/interface/i18n-string.ts new file mode 100644 index 0000000000..7c9a6dc94e --- /dev/null +++ b/projects/netgrif-components-core/src/lib/resources/interface/i18n-string.ts @@ -0,0 +1,13 @@ +export function resolveI18n(value: string | I18nString): string { + return typeof value === 'string' ? value : value.defaultValue; +} + +export interface I18nString { + defaultValue: string; + key?: string; + translations?: I18nStringTranslations; +} + +export interface I18nStringTranslations { + [k: string]: string; +} diff --git a/projects/netgrif-components-core/src/lib/resources/interface/petri-net-reference.ts b/projects/netgrif-components-core/src/lib/resources/interface/petri-net-reference.ts index 9ecffbd45e..ae83e8e0bd 100644 --- a/projects/netgrif-components-core/src/lib/resources/interface/petri-net-reference.ts +++ b/projects/netgrif-components-core/src/lib/resources/interface/petri-net-reference.ts @@ -1,6 +1,7 @@ import {Author} from './author'; import {ImmediateData} from './immediate-data'; import {NaeDate} from '../types/nae-date-type'; +import {I18nString} from "./i18n-string"; /** * Information Petri Net @@ -13,7 +14,7 @@ export interface PetriNetReference { /** * Title */ - title: string; + title: string | I18nString; /** * Identifier */ diff --git a/projects/netgrif-components-core/src/lib/resources/public-api.ts b/projects/netgrif-components-core/src/lib/resources/public-api.ts index 6ee3de7108..3af23d32cf 100644 --- a/projects/netgrif-components-core/src/lib/resources/public-api.ts +++ b/projects/netgrif-components-core/src/lib/resources/public-api.ts @@ -45,6 +45,7 @@ export * from './interface/user-resource'; export * from './interface/create-case-request-body'; export * from './interface/ldapGroupResponseBody'; export * from './interface/task-pair'; +export * from './interface/i18n-string' export * from './types/nae-date-type'; diff --git a/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts b/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts index 2d77def9a3..98ba17d7df 100644 --- a/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts +++ b/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts @@ -9,6 +9,7 @@ import {NotEquals} from '../../operator/not-equals'; import {Categories} from '../categories'; import {Subscription} from 'rxjs'; import {CaseSearch} from './case-search.enum'; +import {resolveI18n} from "../../../../resources/interface/i18n-string"; export class CaseProcess extends NoConfigurationAutocompleteCategory { @@ -43,7 +44,7 @@ export class CaseProcess extends NoConfigurationAutocompleteCategory { this._allowedNetsSub = this._optionalDependencies.allowedNetsService.allowedNets$.subscribe(allowedNets => { this._optionsMap.clear(); allowedNets.forEach(petriNet => { - if (this.isUniqueOption(petriNet.title, petriNet.identifier)) { + if (this.isUniqueOption(resolveI18n(petriNet.title), petriNet.identifier)) { this.addToMap(petriNet.title, petriNet.identifier); } }); diff --git a/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/abstract-new-case.component.ts b/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/abstract-new-case.component.ts index f884f7aa63..0ef230fa52 100644 --- a/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/abstract-new-case.component.ts +++ b/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/abstract-new-case.component.ts @@ -16,6 +16,7 @@ import {CreateCaseEventOutcome} from '../../../event/model/event-outcomes/case-o import {EventOutcomeMessageResource} from '../../../resources/interface/message-resource'; import {MatOption} from '@angular/material/core'; import {LoadingEmitter} from '../../../utility/loading-emitter'; +import {I18nString, resolveI18n} from "../../../resources/interface/i18n-string"; interface Form { value: string; @@ -76,7 +77,7 @@ export abstract class AbstractNewCaseComponent implements OnDestroy { this._allowedNetsSubscription = this._injectedData.allowedNets$.pipe( map(nets => nets.map(petriNet => ({ value: petriNet.stringId, - viewValue: petriNet.title, + viewValue: resolveI18n(petriNet.title), version: petriNet.version }))), map(nets => { diff --git a/projects/netgrif-components/src/lib/dialog/new-case-dialog/new-case-dialog.component.ts b/projects/netgrif-components/src/lib/dialog/new-case-dialog/new-case-dialog.component.ts index 68efb1918a..69e2d5d481 100644 --- a/projects/netgrif-components/src/lib/dialog/new-case-dialog/new-case-dialog.component.ts +++ b/projects/netgrif-components/src/lib/dialog/new-case-dialog/new-case-dialog.component.ts @@ -7,7 +7,8 @@ import { EventOutcomeMessageResource, LoadingEmitter, NAE_NET_ALL_VERSIONS, NAE_NET_VERSION_VISIBLE, NewCaseInjectionData, SideMenuInjectionData, - SnackBarService + SnackBarService, + resolveI18n } from '@netgrif/components-core'; import {Hotkey, HotkeysService} from 'angular2-hotkeys'; import {TranslateService} from '@ngx-translate/core'; @@ -83,7 +84,7 @@ export class NewCaseDialogComponent implements OnDestroy { this._allowedNetsSubscription = this._injectedData.allowedNets$.pipe( map(nets => nets.map(petriNet => ({ value: petriNet.stringId, - viewValue: petriNet.title, + viewValue: resolveI18n(petriNet.title), version: petriNet.version }))), map(nets => { From f77f0557cd60b54b80002353c5631ed058447c29 Mon Sep 17 00:00:00 2001 From: Machac Date: Sat, 6 Sep 2025 23:29:52 +0200 Subject: [PATCH 2/8] fix --- .../dashboard/abstract-dashboard.component.ts | 8 +++++--- .../service/double-drawer-navigation.service.ts | 5 +++-- .../abstract-workflow-panel.component.ts | 12 ++++++++---- .../netgrif-components-core/src/lib/process/net.ts | 2 +- .../src/lib/resources/public-api.ts | 2 +- .../lib/search/models/category/case/case-process.ts | 3 ++- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts b/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts index eb95b94bf8..934211eebb 100644 --- a/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts +++ b/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts @@ -13,6 +13,7 @@ import {I18nFieldValue} from '../../data-fields/i18n-field/models/i18n-field-val import {LanguageService} from '../../translate/language.service'; import {LoadingEmitter} from '../../utility/loading-emitter'; import {PathService} from "../service/path.service"; +import {GroupNavigationConstants} from "../model/group-navigation-constants"; @Component({ @@ -257,9 +258,10 @@ export abstract class AbstractDashboardComponent { public navigate(itemCase: Case) { if (this.getItemInternal(itemCase)) { - const itemPath = this._doubleDrawerNavigationService.getItemRoutingPath(this.dashboardItemsMapping[itemCase.stringId]); - this._pathService.activePath = itemPath; - this._router.navigate([itemPath]); + const menuItemCase = this.dashboardItemsMapping[itemCase.stringId]; + const itemRoute = this._doubleDrawerNavigationService.getItemRoutingPath(menuItemCase); + this._pathService.activePath = this.getFieldValue(menuItemCase, GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH); + this._router.navigate([itemRoute]); } else { window.open(this.getItemURL(itemCase), "_blank"); } diff --git a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts index b2d5031778..36547d2b30 100644 --- a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts +++ b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts @@ -94,7 +94,7 @@ export class DoubleDrawerNavigationService implements OnDestroy { protected _redirectService: RedirectService, protected _pathService: PathService, protected _userService: UserService, - ) { + ) { this._leftItems$ = new BehaviorSubject([]); this._rightItems$ = new BehaviorSubject([]); this._moreItems$ = new BehaviorSubject([]); @@ -545,7 +545,8 @@ export class DoubleDrawerNavigationService implements OnDestroy { public getItemRoutingPath(itemCase: Case) { const taskId = DoubleDrawerUtils.findTaskIdInCase(itemCase, SETTINGS_TRANSITION_ID); const url = this._dynamicRoutingService.route; - return `/${url}/${taskId}`; + const prefix = url.startsWith('/') ? '' : '/'; + return `${prefix}${url}/${taskId}`; } private processLeftItems(cases: Case[], orderedChildCaseIds: string[]): NavigationItem[] { diff --git a/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts b/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts index 1dabd843bb..965ffa177b 100644 --- a/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts +++ b/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts @@ -2,7 +2,7 @@ import {Component, Input, OnDestroy, OnInit, Optional} from '@angular/core'; import {MatExpansionPanel} from '@angular/material/expansion'; import {AbstractPanelWithHeaderBindingComponent} from '../abstract/panel-with-header-binding'; import {HeaderColumn} from '../../header/models/header-column'; -import {Observable, Subscription} from 'rxjs'; +import {Subscription} from 'rxjs'; import {LoggerService} from '../../logger/services/logger.service'; import {toMoment} from '../../resources/types/nae-date-type'; import {DATE_TIME_FORMAT_STRING} from '../../moment/time-formats'; @@ -17,7 +17,7 @@ import {FeaturedValue} from '../abstract/featured-value'; import {PetriNetResourceService} from '../../resources/engine-endpoint/petri-net-resource.service'; import {ProgressType, ProviderProgress} from '../../resources/resource-provider.service'; import {OverflowService} from '../../header/services/overflow.service'; -import {resolveI18n} from "../../resources/interface/i18n-string"; +import {resolveI18n} from '../../resources/interface/i18n-string'; export interface WorkflowPanelContent { @@ -161,7 +161,7 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe case WorkflowMetaField.INITIALS: return {value: this.workflow.initials, icon: '', type: 'meta'}; case WorkflowMetaField.TITLE: - return {value: resolveI18n(this.workflow.title), icon: '', type: 'meta'}; + return {value: resolveI18n(this.workflow.title) || this.workflow.identifier, icon: '', type: 'meta'}; case WorkflowMetaField.NET_ID: return {value: this.workflow.stringId, icon: '', type: 'meta'}; case WorkflowMetaField.VERSION: @@ -169,7 +169,11 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe case WorkflowMetaField.AUTHOR: return {value: this.workflow.author.fullName, icon: 'account_circle', type: 'meta'}; case WorkflowMetaField.CREATION_DATE: - return {value: toMoment(this.workflow.createdDate).format(DATE_TIME_FORMAT_STRING), icon: 'event', type: 'meta'}; + return { + value: toMoment(this.workflow.createdDate).format(DATE_TIME_FORMAT_STRING), + icon: 'event', + type: 'meta' + }; } } diff --git a/projects/netgrif-components-core/src/lib/process/net.ts b/projects/netgrif-components-core/src/lib/process/net.ts index cd62b29797..06006ec5d1 100644 --- a/projects/netgrif-components-core/src/lib/process/net.ts +++ b/projects/netgrif-components-core/src/lib/process/net.ts @@ -6,7 +6,7 @@ import Transaction from './transaction'; import NetRole from './netRole'; import {Permissions} from './permissions'; import {PetriNetReferenceWithPermissions} from './petri-net-reference-with-permissions'; -import {I18nString} from "../resources/interface/i18n-string"; +import {I18nString} from '../resources/interface/i18n-string'; /** * @ignore diff --git a/projects/netgrif-components-core/src/lib/resources/public-api.ts b/projects/netgrif-components-core/src/lib/resources/public-api.ts index 3af23d32cf..256914e1a9 100644 --- a/projects/netgrif-components-core/src/lib/resources/public-api.ts +++ b/projects/netgrif-components-core/src/lib/resources/public-api.ts @@ -45,7 +45,7 @@ export * from './interface/user-resource'; export * from './interface/create-case-request-body'; export * from './interface/ldapGroupResponseBody'; export * from './interface/task-pair'; -export * from './interface/i18n-string' +export * from './interface/i18n-string'; export * from './types/nae-date-type'; diff --git a/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts b/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts index 98ba17d7df..4979ab5fc7 100644 --- a/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts +++ b/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts @@ -43,9 +43,10 @@ export class CaseProcess extends NoConfigurationAutocompleteCategory { this._allowedNetsSub = this._optionalDependencies.allowedNetsService.allowedNets$.subscribe(allowedNets => { this._optionsMap.clear(); + this._uniqueOptionsMap.clear(); allowedNets.forEach(petriNet => { if (this.isUniqueOption(resolveI18n(petriNet.title), petriNet.identifier)) { - this.addToMap(petriNet.title, petriNet.identifier); + this.addToMap(resolveI18n(petriNet.title), petriNet.identifier); } }); this.updateOptions(); From 924ab417258ce3d63a4973a0eb00a2fe992958d2 Mon Sep 17 00:00:00 2001 From: renczesstefan Date: Mon, 8 Sep 2025 12:52:14 +0200 Subject: [PATCH 3/8] Update authentication method to Basic in nae.json Changed the authentication type from BasicWithRealm to Basic in the auth provider configuration. This simplifies the authentication setup and ensures compatibility with the current API. --- nae.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nae.json b/nae.json index a4d4740e03..16dc91b4ba 100644 --- a/nae.json +++ b/nae.json @@ -4,7 +4,7 @@ "providers": { "auth": { "address": "http://localhost:8080/api/", - "authentication": "BasicWithRealm", + "authentication": "Basic", "endpoints": { "login": "auth/login", "logout": "auth/logout", From 94051f4803dbbeaaab4b14bf73f966ba1331b41b Mon Sep 17 00:00:00 2001 From: Machac Date: Mon, 8 Sep 2025 19:26:05 +0200 Subject: [PATCH 4/8] [NAE-2202] Post test fixes - Added a call to `openAvailableView` in `resolveCustomViewsInRightSide` to ensure the appropriate view is opened after resolving custom views. - Left a comment in `canAccessView` method to review the routing path logic for potential issues. --- .../service/double-drawer-navigation.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts index 36547d2b30..fedfb3786c 100644 --- a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts +++ b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts @@ -439,6 +439,8 @@ export class DoubleDrawerNavigationService implements OnDestroy { this.resolveCustomViewsInRightSide(); this._rightLoading$.off(); this.itemLoaded.emit({menu: 'right', items: this.rightItems}); + + this.openAvailableView(); }, error => { this._log.error(error); this._rightItems$.next([]); @@ -492,7 +494,7 @@ export class DoubleDrawerNavigationService implements OnDestroy { const resolvedBannedRoles = DoubleDrawerUtils.resolveAccessRoles(itemCase, GroupNavigationConstants.ITEM_FIELD_ID_BANNED_ROLES); if (!!resolvedRoles) item.access['role'] = resolvedRoles; if (!!resolvedBannedRoles) item.access['bannedRole'] = resolvedBannedRoles; - if (!this._accessService.canAccessView(item, item.routingPath)) return; + if (!this._accessService.canAccessView(item, item.routingPath)) return; //todo neni zle? routing?.path return item; } From 50d6477c48c76eea992d7eda22d4971e95c08dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kov=C3=A1=C4=8Dik?= Date: Tue, 9 Sep 2025 12:34:56 +0200 Subject: [PATCH 5/8] [NAE-2202] Post test fixes - fix the problem with opening view in double drawer when its clicked from dashboard --- .../abstract-navigation-double-drawer.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.ts b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.ts index 36db96185f..12887f2505 100644 --- a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.ts +++ b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.ts @@ -126,7 +126,11 @@ export abstract class AbstractNavigationDoubleDrawerComponent implements OnInit, this._userService.user$.pipe(filter(u => !!u && u.id !== ''), take(1)).subscribe(() => { this._currentPathSubscription = this._pathService.activePath$.subscribe(path => { - this.currentPath = path; + if (path !== this.currentPath) { + this.currentPath = path; + } else { + this.openAvailableView(); + } }); if (this.canApplyAutoSelect()) { From cb921433ca50113be4c62de995c47abf247986dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kov=C3=A1=C4=8Dik?= Date: Fri, 12 Sep 2025 17:05:18 +0200 Subject: [PATCH 6/8] [NAE-2202] Post test fixes - fix the problem with i18nfield from admin --- .../admin/role-assignment/services/ProcessList.ts | 3 +-- .../src/lib/header/abstract-header-service.ts | 5 ++--- .../abstract-workflow-panel.component.ts | 6 ++---- .../netgrif-components-core/src/lib/process/net.ts | 5 ++--- .../src/lib/resources/interface/i18n-string.ts | 13 ------------- .../lib/resources/interface/petri-net-reference.ts | 3 +-- .../src/lib/resources/public-api.ts | 1 - .../lib/search/models/category/case/case-process.ts | 5 ++--- .../new-case/abstract-new-case.component.ts | 3 +-- .../new-case-dialog/new-case-dialog.component.ts | 5 ++--- 10 files changed, 13 insertions(+), 36 deletions(-) delete mode 100644 projects/netgrif-components-core/src/lib/resources/interface/i18n-string.ts diff --git a/projects/netgrif-components-core/src/lib/admin/role-assignment/services/ProcessList.ts b/projects/netgrif-components-core/src/lib/admin/role-assignment/services/ProcessList.ts index 8651787f20..6b14efa6fb 100644 --- a/projects/netgrif-components-core/src/lib/admin/role-assignment/services/ProcessList.ts +++ b/projects/netgrif-components-core/src/lib/admin/role-assignment/services/ProcessList.ts @@ -6,7 +6,6 @@ import {forkJoin, Observable, of, Subject, timer} from 'rxjs'; import {catchError, map, tap} from 'rxjs/operators'; import NetRole from '../../../process/netRole'; import RolesAndPermissions from '../../../process/rolesAndPermissions'; -import {resolveI18n} from "../../../resources/interface/i18n-string"; export interface ExtendedProcessRole extends NetRole { selected: boolean; @@ -83,7 +82,7 @@ export class ProcessList { } else { cache[net.identifier] = { identifier: net.identifier, - title: resolveI18n(net.title), + title: net.title, initials: net.initials, newestVersion: undefined, processes: [net], diff --git a/projects/netgrif-components-core/src/lib/header/abstract-header-service.ts b/projects/netgrif-components-core/src/lib/header/abstract-header-service.ts index b8b58991f1..74a91d5627 100644 --- a/projects/netgrif-components-core/src/lib/header/abstract-header-service.ts +++ b/projects/netgrif-components-core/src/lib/header/abstract-header-service.ts @@ -17,7 +17,6 @@ import {HeaderChangeType} from './models/user-changes/header-change-type'; import {ViewIdService} from '../user/services/view-id.service'; import {Net} from '../process/net'; import {OverflowService} from './services/overflow.service'; -import {resolveI18n} from "../resources/interface/i18n-string"; @Injectable() export abstract class AbstractHeaderService implements OnDestroy { @@ -203,7 +202,7 @@ export abstract class AbstractHeaderService implements OnDestroy { const fieldsGroups: Array = []; allowedNets.forEach(allowedNet => { const fieldsGroup: FieldsGroup = { - groupTitle: resolveI18n(allowedNet.title), + groupTitle: allowedNet.title, fields: [] }; allowedNet.immediateData.forEach(immediate => { @@ -228,7 +227,7 @@ export abstract class AbstractHeaderService implements OnDestroy { const fieldsGroups: Array = []; allowedNets.forEach(allowedNet => { const fieldsGroup: FieldsGroup = { - groupTitle: resolveI18n(allowedNet.title), + groupTitle: allowedNet.title, fields: [] }; const existing = new Set(); diff --git a/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts b/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts index 965ffa177b..d96077fbba 100644 --- a/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts +++ b/projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts @@ -17,8 +17,6 @@ import {FeaturedValue} from '../abstract/featured-value'; import {PetriNetResourceService} from '../../resources/engine-endpoint/petri-net-resource.service'; import {ProgressType, ProviderProgress} from '../../resources/resource-provider.service'; import {OverflowService} from '../../header/services/overflow.service'; -import {resolveI18n} from '../../resources/interface/i18n-string'; - export interface WorkflowPanelContent { netIdentifier: TextField; @@ -135,7 +133,7 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe netIdentifier: new TextField('', this._translate.instant(this.TRANSLATION_NET), this.workflow.identifier, this.dataFieldsBehaviour), title: new TextField('', this._translate.instant(this.TRANSLATION_TITLE), - resolveI18n(this.workflow.title), this.dataFieldsBehaviour), + this.workflow.title, this.dataFieldsBehaviour), version: new TextField('', this._translate.instant(this.TRANSLATION_VERSION), this.workflow.version, this.dataFieldsBehaviour), author: new TextField('', this._translate.instant(this.TRANSLATION_AUTHOR), @@ -161,7 +159,7 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe case WorkflowMetaField.INITIALS: return {value: this.workflow.initials, icon: '', type: 'meta'}; case WorkflowMetaField.TITLE: - return {value: resolveI18n(this.workflow.title) || this.workflow.identifier, icon: '', type: 'meta'}; + return {value: this.workflow.title || this.workflow.identifier, icon: '', type: 'meta'}; case WorkflowMetaField.NET_ID: return {value: this.workflow.stringId, icon: '', type: 'meta'}; case WorkflowMetaField.VERSION: diff --git a/projects/netgrif-components-core/src/lib/process/net.ts b/projects/netgrif-components-core/src/lib/process/net.ts index 06006ec5d1..a87b8c0194 100644 --- a/projects/netgrif-components-core/src/lib/process/net.ts +++ b/projects/netgrif-components-core/src/lib/process/net.ts @@ -6,7 +6,6 @@ import Transaction from './transaction'; import NetRole from './netRole'; import {Permissions} from './permissions'; import {PetriNetReferenceWithPermissions} from './petri-net-reference-with-permissions'; -import {I18nString} from '../resources/interface/i18n-string'; /** * @ignore @@ -19,7 +18,7 @@ export class Net implements PetriNetReferenceWithPermissions { /** * @ignore */ - private _title: string | I18nString; + private _title: string; /** * @ignore */ @@ -95,7 +94,7 @@ export class Net implements PetriNetReferenceWithPermissions { this._stringId = value; } - get title(): string | I18nString { + get title(): string { return this._title; } diff --git a/projects/netgrif-components-core/src/lib/resources/interface/i18n-string.ts b/projects/netgrif-components-core/src/lib/resources/interface/i18n-string.ts deleted file mode 100644 index 7c9a6dc94e..0000000000 --- a/projects/netgrif-components-core/src/lib/resources/interface/i18n-string.ts +++ /dev/null @@ -1,13 +0,0 @@ -export function resolveI18n(value: string | I18nString): string { - return typeof value === 'string' ? value : value.defaultValue; -} - -export interface I18nString { - defaultValue: string; - key?: string; - translations?: I18nStringTranslations; -} - -export interface I18nStringTranslations { - [k: string]: string; -} diff --git a/projects/netgrif-components-core/src/lib/resources/interface/petri-net-reference.ts b/projects/netgrif-components-core/src/lib/resources/interface/petri-net-reference.ts index ae83e8e0bd..9ecffbd45e 100644 --- a/projects/netgrif-components-core/src/lib/resources/interface/petri-net-reference.ts +++ b/projects/netgrif-components-core/src/lib/resources/interface/petri-net-reference.ts @@ -1,7 +1,6 @@ import {Author} from './author'; import {ImmediateData} from './immediate-data'; import {NaeDate} from '../types/nae-date-type'; -import {I18nString} from "./i18n-string"; /** * Information Petri Net @@ -14,7 +13,7 @@ export interface PetriNetReference { /** * Title */ - title: string | I18nString; + title: string; /** * Identifier */ diff --git a/projects/netgrif-components-core/src/lib/resources/public-api.ts b/projects/netgrif-components-core/src/lib/resources/public-api.ts index 256914e1a9..6ee3de7108 100644 --- a/projects/netgrif-components-core/src/lib/resources/public-api.ts +++ b/projects/netgrif-components-core/src/lib/resources/public-api.ts @@ -45,7 +45,6 @@ export * from './interface/user-resource'; export * from './interface/create-case-request-body'; export * from './interface/ldapGroupResponseBody'; export * from './interface/task-pair'; -export * from './interface/i18n-string'; export * from './types/nae-date-type'; diff --git a/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts b/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts index 4979ab5fc7..a5548cb337 100644 --- a/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts +++ b/projects/netgrif-components-core/src/lib/search/models/category/case/case-process.ts @@ -9,7 +9,6 @@ import {NotEquals} from '../../operator/not-equals'; import {Categories} from '../categories'; import {Subscription} from 'rxjs'; import {CaseSearch} from './case-search.enum'; -import {resolveI18n} from "../../../../resources/interface/i18n-string"; export class CaseProcess extends NoConfigurationAutocompleteCategory { @@ -45,8 +44,8 @@ export class CaseProcess extends NoConfigurationAutocompleteCategory { this._optionsMap.clear(); this._uniqueOptionsMap.clear(); allowedNets.forEach(petriNet => { - if (this.isUniqueOption(resolveI18n(petriNet.title), petriNet.identifier)) { - this.addToMap(resolveI18n(petriNet.title), petriNet.identifier); + if (this.isUniqueOption(petriNet.title, petriNet.identifier)) { + this.addToMap(petriNet.title, petriNet.identifier); } }); this.updateOptions(); diff --git a/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/abstract-new-case.component.ts b/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/abstract-new-case.component.ts index 0ef230fa52..f884f7aa63 100644 --- a/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/abstract-new-case.component.ts +++ b/projects/netgrif-components-core/src/lib/side-menu/content-components/new-case/abstract-new-case.component.ts @@ -16,7 +16,6 @@ import {CreateCaseEventOutcome} from '../../../event/model/event-outcomes/case-o import {EventOutcomeMessageResource} from '../../../resources/interface/message-resource'; import {MatOption} from '@angular/material/core'; import {LoadingEmitter} from '../../../utility/loading-emitter'; -import {I18nString, resolveI18n} from "../../../resources/interface/i18n-string"; interface Form { value: string; @@ -77,7 +76,7 @@ export abstract class AbstractNewCaseComponent implements OnDestroy { this._allowedNetsSubscription = this._injectedData.allowedNets$.pipe( map(nets => nets.map(petriNet => ({ value: petriNet.stringId, - viewValue: resolveI18n(petriNet.title), + viewValue: petriNet.title, version: petriNet.version }))), map(nets => { diff --git a/projects/netgrif-components/src/lib/dialog/new-case-dialog/new-case-dialog.component.ts b/projects/netgrif-components/src/lib/dialog/new-case-dialog/new-case-dialog.component.ts index 69e2d5d481..68efb1918a 100644 --- a/projects/netgrif-components/src/lib/dialog/new-case-dialog/new-case-dialog.component.ts +++ b/projects/netgrif-components/src/lib/dialog/new-case-dialog/new-case-dialog.component.ts @@ -7,8 +7,7 @@ import { EventOutcomeMessageResource, LoadingEmitter, NAE_NET_ALL_VERSIONS, NAE_NET_VERSION_VISIBLE, NewCaseInjectionData, SideMenuInjectionData, - SnackBarService, - resolveI18n + SnackBarService } from '@netgrif/components-core'; import {Hotkey, HotkeysService} from 'angular2-hotkeys'; import {TranslateService} from '@ngx-translate/core'; @@ -84,7 +83,7 @@ export class NewCaseDialogComponent implements OnDestroy { this._allowedNetsSubscription = this._injectedData.allowedNets$.pipe( map(nets => nets.map(petriNet => ({ value: petriNet.stringId, - viewValue: resolveI18n(petriNet.title), + viewValue: petriNet.title, version: petriNet.version }))), map(nets => { From eec0fa05722333b2a7a9c475e02a9f7536161416 Mon Sep 17 00:00:00 2001 From: Machac Date: Tue, 30 Sep 2025 21:05:30 +0200 Subject: [PATCH 7/8] [NAE-2202] Post test fixes - Added a warning log when no mapped menu item is found for a dashboard item to improve debugging clarity. - Introduced null checks for `nodePath` in `navigate` method to prevent potential runtime errors. - Ensured `activePath` is only updated when a valid `nodePath` is retrieved. --- .../navigation/dashboard/abstract-dashboard.component.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts b/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts index 934211eebb..b409cacbeb 100644 --- a/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts +++ b/projects/netgrif-components-core/src/lib/navigation/dashboard/abstract-dashboard.component.ts @@ -259,8 +259,16 @@ export abstract class AbstractDashboardComponent { public navigate(itemCase: Case) { if (this.getItemInternal(itemCase)) { const menuItemCase = this.dashboardItemsMapping[itemCase.stringId]; + if (!menuItemCase) { + this._log.warn(`No mapped menu item for dashboard item ${itemCase.stringId}`); + return; + } const itemRoute = this._doubleDrawerNavigationService.getItemRoutingPath(menuItemCase); this._pathService.activePath = this.getFieldValue(menuItemCase, GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH); + const nodePath = this.getFieldValue(menuItemCase, GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH); + if (nodePath) { + this._pathService.activePath = nodePath; + } this._router.navigate([itemRoute]); } else { window.open(this.getItemURL(itemCase), "_blank"); From 354bee633beea39011a8cde623ebba0400769c2a Mon Sep 17 00:00:00 2001 From: Machac Date: Tue, 30 Sep 2025 21:11:44 +0200 Subject: [PATCH 8/8] [NAE-2202] Post test fixes - Fixed the routing path logic in the `canAccessView` method by replacing `item.routingPath` with `item.routing?.path` to handle optional chaining properly and prevent potential runtime errors. --- .../service/double-drawer-navigation.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts index fedfb3786c..f1039df07a 100644 --- a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts +++ b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts @@ -494,7 +494,7 @@ export class DoubleDrawerNavigationService implements OnDestroy { const resolvedBannedRoles = DoubleDrawerUtils.resolveAccessRoles(itemCase, GroupNavigationConstants.ITEM_FIELD_ID_BANNED_ROLES); if (!!resolvedRoles) item.access['role'] = resolvedRoles; if (!!resolvedBannedRoles) item.access['bannedRole'] = resolvedBannedRoles; - if (!this._accessService.canAccessView(item, item.routingPath)) return; //todo neni zle? routing?.path + if (!this._accessService.canAccessView(item, item.routing?.path)) return; return item; }