From 68584acd4536423ab46d403ed1e6a20737d2a5cc Mon Sep 17 00:00:00 2001 From: Carla Martinez Date: Mon, 13 Jan 2025 16:42:03 +0100 Subject: [PATCH] Add contextual help panel in Preserved users > Settings The Contextual help links panel should be implemented in Preserved users > 'Settings' page to provide documentation links related to the page that is currently being shown. Signed-off-by: Carla Martinez --- .../documentation/documentation-links.json | 30 +++++ src/components/UsersSections/UserSettings.tsx | 2 + .../PreservedUsers/PreservedUsersTabs.tsx | 121 +++++++++++------- tests/features/contextual_help_panel.feature | 10 ++ 4 files changed, 118 insertions(+), 45 deletions(-) diff --git a/src/assets/documentation/documentation-links.json b/src/assets/documentation/documentation-links.json index d7eb7bcd..5c94a546 100644 --- a/src/assets/documentation/documentation-links.json +++ b/src/assets/documentation/documentation-links.json @@ -109,6 +109,36 @@ "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_idm_users_groups_hosts_and_access_control_rules/managing-user-accounts-using-the-idm-web-ui_managing-users-groups-hosts#restoring-users-in-the-idm-web-ui_managing-user-accounts-using-the-idm-web-ui" } ], + "preserved-users-settings": [ + { + "name": "Managing user accounts", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_idm_users_groups_hosts_and_access_control_rules/managing-user-accounts-using-the-idm-web-ui_managing-users-groups-hosts" + }, + { + "name": "Adding a certificate mapping rule", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_certificates_in_idm/conf-certmap-idm_managing-certificates-in-idm#proc-add-maprule-webui_conf-certmap-for-users-in-idm" + }, + { + "name": "Adding certificate mapping data to a user entry", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_certificates_in_idm/conf-certmap-idm_managing-certificates-in-idm#proc-add-certmapdata-to-user-webui_conf-certmap-for-users-in-idm" + }, + { + "name": "Adding a certificate issued by an external CA to an IdM user, host, or service", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_certificates_in_idm/managing-externally-signed-certificates-for-idm-users-hosts-and-services_managing-certificates-in-idm#adding-a-certificate-issued-by-an-external-ca-to-an-idm-user-host-or-service-by-using-the-idm-web-ui_managing-externally-signed-certificates-for-idm-users-hosts-and-services" + }, + { + "name": "Removing a certificate issued by an external CA from an IdM user, host, or service account", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_certificates_in_idm/managing-externally-signed-certificates-for-idm-users-hosts-and-services_managing-certificates-in-idm#removing-a-certificate-issued-by-an-external-ca-from-an-idm-user-host-or-service-account-by-using-the-idm-web-ui_managing-externally-signed-certificates-for-idm-users-hosts-and-services" + }, + { + "name": "Converting an external certificate for loading into an IdM user account", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_certificates_in_idm/convert-cert-formats-idm_managing-certificates-in-idm#proc_converting-an-external-certificate-in-the-idm-web-ui-for-loading-into-an-idm-user-account_assembly_converting-an-external-certificate-to-load-into-an-idm-user-account" + }, + { + "name": "Viewing the expiry date of a certificate", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_certificates_in_idm/managing-the-validity-of-certificates-in-idm_managing-certificates-in-idm#viewing-the-expiry-date-of-a-certificate-in-IdM-WebUI_managing-the-validity-of-certificates-in-idm" + } + ], "hosts": [ { "name": "Adding host entries from IdM Web UI", diff --git a/src/components/UsersSections/UserSettings.tsx b/src/components/UsersSections/UserSettings.tsx index ad956022..93315305 100644 --- a/src/components/UsersSections/UserSettings.tsx +++ b/src/components/UsersSections/UserSettings.tsx @@ -104,6 +104,8 @@ const UserSettings = (props: PropsToUserSettings) => { props.changeFromPage("active-users-settings"); } else if (props.from === "stage-users") { props.changeFromPage("stage-users-settings"); + } else if (props.from === "preserved-users") { + props.changeFromPage("preserved-users-settings"); } } }, [props.changeFromPage]); diff --git a/src/pages/PreservedUsers/PreservedUsersTabs.tsx b/src/pages/PreservedUsers/PreservedUsersTabs.tsx index 2bf3e419..d410d253 100644 --- a/src/pages/PreservedUsers/PreservedUsersTabs.tsx +++ b/src/pages/PreservedUsers/PreservedUsersTabs.tsx @@ -14,6 +14,7 @@ import UserSettings from "src/components/UsersSections/UserSettings"; import DataSpinner from "src/components/layouts/DataSpinner"; import BreadCrumb, { BreadCrumbItem } from "src/components/layouts/BreadCrumb"; import TitleLayout from "src/components/layouts/TitleLayout"; +import ContextualHelpPanel from "src/components/ContextualHelpPanel/ContextualHelpPanel"; // Hooks import { useUserSettings } from "src/hooks/useUserSettingsData"; // Redux @@ -56,6 +57,25 @@ const PreservedUsersTabs = () => { } }, [uid]); + // Contextual links panel + const [fromPageSelected, setFromPageSelected] = React.useState( + "preserved-users-settings" + ); + const [isContextualPanelExpanded, setIsContextualPanelExpanded] = + React.useState(false); + + const changeFromPage = (fromPage: string) => { + setFromPageSelected(fromPage); + }; + + const onOpenContextualPanel = () => { + setIsContextualPanelExpanded(!isContextualPanelExpanded); + }; + + const onCloseContextualPanel = () => { + setIsContextualPanelExpanded(false); + }; + // Data loaded from DB const userSettingsData = useUserSettings(uid as string); @@ -83,53 +103,64 @@ const PreservedUsersTabs = () => { return ( <> - - - - - - + - Settings} + + + + + - - - - + Settings} + > + + + + + ); }; diff --git a/tests/features/contextual_help_panel.feature b/tests/features/contextual_help_panel.feature index a5d3ca61..f33d3fee 100644 --- a/tests/features/contextual_help_panel.feature +++ b/tests/features/contextual_help_panel.feature @@ -56,6 +56,16 @@ Feature: Contextual help links panel When I click on close button in the panel Then I should not see contextual help panel + # - Preserved users > Settings page + Scenario: Open and close the contextual help links panel on 'preserved-users-settings' main page + Given I am on "preserved-users-settings" page + When I click on "Help" button + Then I should see contextual help panel + And I should see a title "Links" in the panel + * I should see a list of links + When I click on close button in the panel + Then I should not see contextual help panel + # Hosts page Scenario: Open the contextual help links panel on 'hosts' main page Given I am on "hosts" page