From b77691ac92e4f499909b563cecb4932e27fe5c30 Mon Sep 17 00:00:00 2001 From: ClementBouvierN Date: Fri, 28 Feb 2025 09:57:39 +0100 Subject: [PATCH] Dashboard : permit to redirect to a custom screen (#8021) Signed-off-by: ClementBouvierN --- config/docker/ui-config/web-ui.json | 5 ++++ .../configuration/web-ui_configuration.adoc | 27 ++++++++++++++++--- .../dashboard/dashboard.component.ts | 7 +++-- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/config/docker/ui-config/web-ui.json b/config/docker/ui-config/web-ui.json index 947d8b35a9..f350915e37 100644 --- a/config/docker/ui-config/web-ui.json +++ b/config/docker/ui-config/web-ui.json @@ -163,6 +163,11 @@ "stateId": "chartLineState", "menuId": "uid_test_0", "urlExtension": "?search=chart&fulltext=1" + }, + { + "processId": "defaultProcess", + "stateId": "questionState", + "screenId": "testId" } ] } diff --git a/src/docs/asciidoc/deployment/configuration/web-ui_configuration.adoc b/src/docs/asciidoc/deployment/configuration/web-ui_configuration.adoc index ff03468e0f..2e5f43f672 100644 --- a/src/docs/asciidoc/deployment/configuration/web-ui_configuration.adoc +++ b/src/docs/asciidoc/deployment/configuration/web-ui_configuration.adoc @@ -70,6 +70,30 @@ For example adding `Keycloak` application, with `'Keycloak'` as `name`, `1` as ` |checkIfUrlIsLocked|true|no| if set to false, an OperatorFabric url can be used by several tabs in the same browser. Note that there can only be one token per browser for a given OperatorFabric url, so the first session will be replaced by the second one +|customCssToLoad||no|List of URLs of css files to be loaded at startup + +|customJsToLoad||no|List of URLs of javascript files to be loaded at startup + +|dashboard.processStateRedirects||no| Declares if a state when clicked in the dashboard should redirect to a custom menu or custom screen. If nothing is specified the redirection is pointing to the card feed. Here is a declaration with one redirection to a custom menu and one to a custom screen. The ids declared should match the ones in the ui-menu config. +[source, json] +---- +"dashboard": { + "processStateRedirects": [ + { + "processId": "defaultProcess", + "stateId": "chartLineState", + "menuId": "uid_test_0", + "urlExtension": "?search=chart&fulltext=1" + }, + { + "processId": "defaultProcess", + "stateId": "questionState", + "screenId": "testId" + } + ] + } +---- + |defaultEntryPage|feed|no|This configuration determines the default page that will be displayed after a user logs in. The possible values include all core menus, with the exception of 'usercard' and 'about'. Additionally, you can set a custom application as the entry page by using 'businessconfigparty/menuId' as the value. |environmentColor|blue|no| Color of the background of the environment name. The format of color is css, for example : `red` , `#4052FF` |environmentName||no| Name of the environment to display in the top-right corner (examples: PROD , TEST .. ), if the value not set the environment name is not shown . @@ -191,9 +215,6 @@ a|authentication mode, available options: |usercard.useDescriptionFieldForEntityList|false|no|If true, show entity `description` field instead of `name` in user card page -|customJsToLoad||no|List of URLs of javascript files to be loaded at startup - -|customCssToLoad||no|List of URLs of css files to be loaded at startup |=== diff --git a/ui/main/src/app/components/dashboard/dashboard.component.ts b/ui/main/src/app/components/dashboard/dashboard.component.ts index 0b4d5360e8..544c199330 100644 --- a/ui/main/src/app/components/dashboard/dashboard.component.ts +++ b/ui/main/src/app/components/dashboard/dashboard.component.ts @@ -109,9 +109,12 @@ export class DashboardComponent implements OnInit, OnDestroy { const redirect = this.processStateRedirects.filter( (redirect) => redirect.processId === processId && redirect.stateId === stateId ); - if (redirect?.length > 0) { - opfab.navigate.redirectToBusinessMenu(redirect[0].menuId, redirect[0].urlExtension); + if (redirect[0]?.screenId) { + NavigationService.navigateTo('customscreen/' + redirect[0].screenId); + } else if (redirect[0]?.menuId) { + opfab.navigate.redirectToBusinessMenu(redirect[0].menuId, redirect[0].urlExtension); + } } else if (!this.hideProcessFilter && !this.hideStateFilter) { NavigationService.navigateToFeedWithProcessStateFilter(processId, stateId); }