parent
4428a4e088
commit
9b3cd978c3
2 changed files with 19 additions and 3 deletions
|
@ -225,6 +225,10 @@ export const SamlKeys = ({ clientId, save }: SamlKeysProps) => {
|
||||||
save();
|
save();
|
||||||
setRefresh(refresh + 1);
|
setRefresh(refresh + 1);
|
||||||
}}
|
}}
|
||||||
|
onCancel={() => {
|
||||||
|
setValue(KEYS_MAPPING[selectedType!].name, "false");
|
||||||
|
setIsChanged(undefined);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<DisableConfirm />
|
<DisableConfirm />
|
||||||
|
|
|
@ -34,6 +34,7 @@ type SamlKeysDialogProps = {
|
||||||
id: string;
|
id: string;
|
||||||
attr: KeyTypes;
|
attr: KeyTypes;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
onCancel: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SamlKeysDialogForm = KeyStoreConfig & {
|
export type SamlKeysDialogForm = KeyStoreConfig & {
|
||||||
|
@ -65,11 +66,21 @@ export const submitForm = async (
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SamlKeysDialog = ({ id, attr, onClose }: SamlKeysDialogProps) => {
|
export const SamlKeysDialog = ({
|
||||||
|
id,
|
||||||
|
attr,
|
||||||
|
onClose,
|
||||||
|
onCancel,
|
||||||
|
}: SamlKeysDialogProps) => {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const [type, setType] = useState(false);
|
const [type, setType] = useState(false);
|
||||||
const [keys, setKeys] = useState<CertificateRepresentation>();
|
const [keys, setKeys] = useState<CertificateRepresentation>();
|
||||||
const { register, control, handleSubmit } = useForm<SamlKeysDialogForm>();
|
const {
|
||||||
|
register,
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { isDirty },
|
||||||
|
} = useForm<SamlKeysDialogForm>();
|
||||||
|
|
||||||
const adminClient = useAdminClient();
|
const adminClient = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
|
@ -122,6 +133,7 @@ export const SamlKeysDialog = ({ id, attr, onClose }: SamlKeysDialogProps) => {
|
||||||
key="confirm"
|
key="confirm"
|
||||||
data-testid="confirm"
|
data-testid="confirm"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
|
isDisabled={!isDirty && !keys}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (type) {
|
if (type) {
|
||||||
handleSubmit(submit)();
|
handleSubmit(submit)();
|
||||||
|
@ -136,7 +148,7 @@ export const SamlKeysDialog = ({ id, attr, onClose }: SamlKeysDialogProps) => {
|
||||||
key="cancel"
|
key="cancel"
|
||||||
data-testid="cancel"
|
data-testid="cancel"
|
||||||
variant={ButtonVariant.link}
|
variant={ButtonVariant.link}
|
||||||
onClick={onClose}
|
onClick={onCancel}
|
||||||
>
|
>
|
||||||
{t("common:cancel")}
|
{t("common:cancel")}
|
||||||
</Button>,
|
</Button>,
|
||||||
|
|
Loading…
Reference in a new issue