From d9555e4c9fc1b5ae6cb7db0664fa46ef22b98edd Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Tue, 23 Jul 2024 13:38:08 +0200 Subject: [PATCH] made buttons disabled when all fields are readonly (#31436) also renamed `isActive` to `isDisabled` to be more inline with PF fixes: #31304 Signed-off-by: Erik Jan de Wit --- js/apps/admin-ui/src/clients/add/AccessSettings.tsx | 2 +- js/apps/admin-ui/src/clients/add/LogoutPanel.tsx | 2 +- .../admin-ui/src/clients/authorization/Settings.tsx | 1 - .../admin-ui/src/components/form/FixedButtonGroup.tsx | 11 +++++------ .../src/components/key-value-form/AttributeForm.tsx | 2 +- js/apps/admin-ui/src/realm-settings/GeneralTab.tsx | 1 - .../src/user-federation/UserFederationLdapForm.tsx | 2 +- js/apps/admin-ui/src/user/UserForm.tsx | 8 +++++++- 8 files changed, 16 insertions(+), 13 deletions(-) diff --git a/js/apps/admin-ui/src/clients/add/AccessSettings.tsx b/js/apps/admin-ui/src/clients/add/AccessSettings.tsx index 624b1f677c..04d3c81a02 100644 --- a/js/apps/admin-ui/src/clients/add/AccessSettings.tsx +++ b/js/apps/admin-ui/src/clients/add/AccessSettings.tsx @@ -42,7 +42,7 @@ export const AccessSettings = ({ name="settings" save={save} reset={reset} - isActive={!isManager} + isDisabled={isManager} /> )} diff --git a/js/apps/admin-ui/src/clients/add/LogoutPanel.tsx b/js/apps/admin-ui/src/clients/add/LogoutPanel.tsx index c21c3c3db5..c95d47a62d 100644 --- a/js/apps/admin-ui/src/clients/add/LogoutPanel.tsx +++ b/js/apps/admin-ui/src/clients/add/LogoutPanel.tsx @@ -157,7 +157,7 @@ export const LogoutPanel = ({ name="settings" save={save} reset={reset} - isActive={isManager} + isDisabled={!isManager} /> ); diff --git a/js/apps/admin-ui/src/clients/authorization/Settings.tsx b/js/apps/admin-ui/src/clients/authorization/Settings.tsx index ebf7b00364..8908eb4af1 100644 --- a/js/apps/admin-ui/src/clients/authorization/Settings.tsx +++ b/js/apps/admin-ui/src/clients/authorization/Settings.tsx @@ -155,7 +155,6 @@ export const AuthorizationSettings = ({ clientId }: { clientId: string }) => { reset(resource)} - isActive isSubmit /> diff --git a/js/apps/admin-ui/src/components/form/FixedButtonGroup.tsx b/js/apps/admin-ui/src/components/form/FixedButtonGroup.tsx index 0c8159357d..1fad64e0df 100644 --- a/js/apps/admin-ui/src/components/form/FixedButtonGroup.tsx +++ b/js/apps/admin-ui/src/components/form/FixedButtonGroup.tsx @@ -1,6 +1,5 @@ import { useTranslation } from "react-i18next"; import { ActionGroup, ActionGroupProps, Button } from "@patternfly/react-core"; -import { PropsWithChildren } from "react"; import style from "./fixed-buttons.module.css"; @@ -11,7 +10,7 @@ type FixedButtonGroupProps = ActionGroupProps & { reset?: () => void; resetText?: string; isSubmit?: boolean; - isActive?: boolean; + isDisabled?: boolean; }; export const FixedButtonsGroup = ({ @@ -21,16 +20,16 @@ export const FixedButtonsGroup = ({ reset, resetText, isSubmit = false, - isActive = true, + isDisabled = false, children, ...rest -}: PropsWithChildren) => { +}: FixedButtonGroupProps) => { const { t } = useTranslation(); return ( {(save || isSubmit) && (