From 62d894084302d28d94e8ae469715c3fea1e6ae62 Mon Sep 17 00:00:00 2001 From: Carla Martinez Date: Tue, 14 Jan 2025 16:12:26 +0100 Subject: [PATCH] Add contextual help panel in Services > Settings The Context Help Links Panel needs to be implemented in Services > 'Settings' page to provide help links according to the shown page. Signed-off-by: Carla Martinez --- .../documentation/documentation-links.json | 14 ++ src/pages/Services/ServicesSettings.tsx | 12 +- src/pages/Services/ServicesTabs.tsx | 145 +++++++++++------- tests/features/contextual_help_panel.feature | 10 ++ 4 files changed, 125 insertions(+), 56 deletions(-) diff --git a/src/assets/documentation/documentation-links.json b/src/assets/documentation/documentation-links.json index bd4d52cd..a31303df 100644 --- a/src/assets/documentation/documentation-links.json +++ b/src/assets/documentation/documentation-links.json @@ -132,5 +132,19 @@ "name": "The IdM services", "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/accessing_identity_management_services/viewing-starting-and-stopping-the-ipa-server_accessing-idm-services#the-idm-services_start-stop-ipa" } + ], + "services-settings": [ + { + "name": "Kerberos authentication indicators", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_idm_users_groups_hosts_and_access_control_rules/managing-kerberos-ticket-policies_managing-users-groups-hosts#kerberos-authentication-indicators_managing-kerberos-ticket-policies" + }, + { + "name": "Enforcing authentication indicators for an IdM service", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_idm_users_groups_hosts_and_access_control_rules/managing-kerberos-ticket-policies_managing-users-groups-hosts#enforcing-authentication-indicators-for-an-idm-service_managing-kerberos-ticket-policies" + }, + { + "name": "Associating authentication indicators with an IdM service using IdM Web UI", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_idm_users_groups_hosts_and_access_control_rules/managing-kerberos-ticket-policies_managing-users-groups-hosts#associating-authentication-indicators-with-an-idm-service-using-idm-web-ui_enforcing-authentication-indicators-for-an-idm-service" + } ] } diff --git a/src/pages/Services/ServicesSettings.tsx b/src/pages/Services/ServicesSettings.tsx index f7d7883a..a0dfe037 100644 --- a/src/pages/Services/ServicesSettings.tsx +++ b/src/pages/Services/ServicesSettings.tsx @@ -55,6 +55,8 @@ interface PropsToServicesSettings { modifiedValues: () => Partial; onResetValues: () => void; certData: Record; + changeFromPage: (from: string) => void; + onOpenContextualPanel: () => void; } const ServicesSettings = (props: PropsToServicesSettings) => { @@ -65,6 +67,11 @@ const ServicesSettings = (props: PropsToServicesSettings) => { const [saveService] = useSaveServiceMutation(); const [executeUnprovision] = useUnprovisionServiceMutation(); + // Update page to show correct links info in Contextual panel + React.useEffect(() => { + props.changeFromPage("service-settings"); + }, [props.changeFromPage]); + // Kebab const [isKebabOpen, setIsKebabOpen] = useState(false); const [isSaving, setSaving] = useState(false); @@ -263,7 +270,10 @@ const ServicesSettings = (props: PropsToServicesSettings) => { - + { BreadCrumbItem[] >([]); + // Contextual links panel + const [fromPageSelected, setFromPageSelected] = + React.useState("services-settings"); + const [isContextualPanelExpanded, setIsContextualPanelExpanded] = + React.useState(false); + + const changeFromPage = (fromPage: string) => { + setFromPageSelected(fromPage); + }; + + const onOpenContextualPanel = () => { + setIsContextualPanelExpanded(!isContextualPanelExpanded); + }; + + const onCloseContextualPanel = () => { + setIsContextualPanelExpanded(false); + }; + + // - Close links panel when tab section is changed + React.useEffect(() => { + setIsContextualPanelExpanded(false); + }, [section]); + // Data loaded from DB const serviceSettingsData = useServiceSettings(decodedId as string); @@ -114,63 +138,74 @@ const ServicesTabs = ({ section }) => { return ( <> - - - - - - - + + - Settings} - > - - - Is a member of} - > - - - Is managed by} + + + + + - - - - + Settings} + > + + + Is a member of} + > + + + Is managed by} + > + + + + + ); }; diff --git a/tests/features/contextual_help_panel.feature b/tests/features/contextual_help_panel.feature index a5d3ca61..19cc5134 100644 --- a/tests/features/contextual_help_panel.feature +++ b/tests/features/contextual_help_panel.feature @@ -83,3 +83,13 @@ Feature: Contextual help links panel Given I should see contextual help panel When I click on close button in the panel Then I should not see contextual help panel + + # - Services > Settings page + Scenario: Open and close the contextual help links panel on 'services-settings' main page + Given I am on "services-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