diff --git a/src/main/webapp/resources/js/pages/UserGroupsPage/components/CreateNewUserGroupButton.jsx b/src/main/webapp/resources/js/pages/UserGroupsPage/components/CreateNewUserGroupButton.jsx index a9e1201aa03..8922731ebfe 100644 --- a/src/main/webapp/resources/js/pages/UserGroupsPage/components/CreateNewUserGroupButton.jsx +++ b/src/main/webapp/resources/js/pages/UserGroupsPage/components/CreateNewUserGroupButton.jsx @@ -78,7 +78,7 @@ export function CreateNewUserGroupButton({ baseUrl }) { { - if (visible) { + if (open) { setTimeout(() => clientIdRef.current.focus(), 100); } - }, [visible]); + }, [open]); const [form] = Form.useForm(); @@ -85,7 +85,7 @@ export function AddClientModal({ children, onComplete, existing = null }) { if (!existing) { form.resetFields(); } - setVisible(false); + setOpen(false); } catch (errors) { // Re-enforce the error to the user errors.errorFields.forEach((error) => @@ -96,7 +96,7 @@ export function AddClientModal({ children, onComplete, existing = null }) { const closeModal = () => { form.resetFields(); - setVisible(false); + setOpen(false); }; const initialValues = { @@ -110,11 +110,11 @@ export function AddClientModal({ children, onComplete, existing = null }) { return ( <> {React.cloneElement(children, { - onClick: () => setVisible(true), + onClick: () => setOpen(true), })} { form.resetFields(); setCurrent(0); - setVisible(false); + setOpen(false); }; return ( <> {React.cloneElement(children, { - onClick: () => setVisible(true), + onClick: () => setOpen(true), })} - onAddFields(selectedFields).then(() => setVisible(false)); + onAddFields(selectedFields).then(() => setOpen(false)); return ( <> - setVisible(false)} + open={open} + onCancel={() => setOpen(false)} onOk={addFieldsToTemplate} okText={i18n("MetadataAddTemplateField.ok-text")} > diff --git a/src/main/webapp/resources/js/pages/projects/settings/components/metadata/MetadataTemplateCreate.jsx b/src/main/webapp/resources/js/pages/projects/settings/components/metadata/MetadataTemplateCreate.jsx index 4625b60d3aa..fd8d3df5834 100644 --- a/src/main/webapp/resources/js/pages/projects/settings/components/metadata/MetadataTemplateCreate.jsx +++ b/src/main/webapp/resources/js/pages/projects/settings/components/metadata/MetadataTemplateCreate.jsx @@ -25,7 +25,7 @@ export function MetadataTemplateCreate({ children, projectId, fields = [] }) { const navigate = useNavigate(); const [createMetadataTemplate] = useCreateMetadataTemplateMutation(); const [names, setNames] = React.useState(undefined); - const [visible, setVisible] = React.useState(false); + const [open, setOpen] = React.useState(false); const [fieldsState, setFieldsState] = React.useState([]); const [form] = Form.useForm(); const { data: templates, refetch: refetchTemplates } = @@ -61,7 +61,7 @@ export function MetadataTemplateCreate({ children, projectId, fields = [] }) { .unwrap() .then((template) => { form.resetFields(Object.keys(values)); - setVisible(false); + setOpen(false); refetchTemplates(); navigate( setBaseUrl( @@ -75,13 +75,13 @@ export function MetadataTemplateCreate({ children, projectId, fields = [] }) { return ( <> {React.cloneElement(children, { - onClick: () => setVisible(true), + onClick: () => setOpen(true), })} setVisible(false)} + open={open} + onCancel={() => setOpen(false)} okText={i18n("CreateMetadataTemplate.ok-text")} onOk={onOk} okButtonProps={{