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