Added delete action (#2600)
This commit is contained in:
parent
783396acb9
commit
ccdd762d6d
1 changed files with 36 additions and 0 deletions
|
@ -6,6 +6,8 @@ import {
|
||||||
ActionGroup,
|
ActionGroup,
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
Button,
|
Button,
|
||||||
|
ButtonVariant,
|
||||||
|
DropdownItem,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
PageSection,
|
PageSection,
|
||||||
ValidatedOptions,
|
ValidatedOptions,
|
||||||
|
@ -32,6 +34,7 @@ import { DynamicComponents } from "../../components/dynamic/DynamicComponents";
|
||||||
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
|
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
|
||||||
import type { AttributeForm } from "../../components/key-value-form/AttributeForm";
|
import type { AttributeForm } from "../../components/key-value-form/AttributeForm";
|
||||||
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
|
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
|
||||||
|
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
|
||||||
|
|
||||||
export type IdPMapperRepresentationWithAttributes =
|
export type IdPMapperRepresentationWithAttributes =
|
||||||
IdentityProviderMapperRepresentation & AttributeForm;
|
IdentityProviderMapperRepresentation & AttributeForm;
|
||||||
|
@ -115,6 +118,29 @@ export default function AddMapper() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [toggleDeleteMapperDialog, DeleteMapperConfirm] = useConfirmDialog({
|
||||||
|
titleKey: "identity-providers:deleteProviderMapper",
|
||||||
|
messageKey: t("identity-providers:deleteMapperConfirm", {
|
||||||
|
mapper: currentMapper?.name,
|
||||||
|
}),
|
||||||
|
continueButtonLabel: "common:delete",
|
||||||
|
continueButtonVariant: ButtonVariant.danger,
|
||||||
|
onConfirm: async () => {
|
||||||
|
try {
|
||||||
|
await adminClient.identityProviders.delMapper({
|
||||||
|
alias: alias,
|
||||||
|
id: id!,
|
||||||
|
});
|
||||||
|
addAlert(t("deleteMapperSuccess"), AlertVariant.success);
|
||||||
|
history.push(
|
||||||
|
toIdentityProvider({ providerId, alias, tab: "mappers", realm })
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
addError("identity-providers:deleteErrorError", error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
useFetch(
|
useFetch(
|
||||||
() =>
|
() =>
|
||||||
Promise.all([
|
Promise.all([
|
||||||
|
@ -147,6 +173,7 @@ export default function AddMapper() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageSection variant="light">
|
<PageSection variant="light">
|
||||||
|
<DeleteMapperConfirm />
|
||||||
<ViewHeader
|
<ViewHeader
|
||||||
className="kc-add-mapper-title"
|
className="kc-add-mapper-title"
|
||||||
titleKey={
|
titleKey={
|
||||||
|
@ -160,6 +187,15 @@ export default function AddMapper() {
|
||||||
providerId[0].toUpperCase() + providerId.substring(1),
|
providerId[0].toUpperCase() + providerId.substring(1),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
dropdownItems={
|
||||||
|
id
|
||||||
|
? [
|
||||||
|
<DropdownItem key="delete" onClick={toggleDeleteMapperDialog}>
|
||||||
|
{t("common:delete")}
|
||||||
|
</DropdownItem>,
|
||||||
|
]
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
divider
|
divider
|
||||||
/>
|
/>
|
||||||
<FormAccess
|
<FormAccess
|
||||||
|
|
Loading…
Reference in a new issue