UNPKG

@keycloakify/keycloak-admin-ui

Version:
28 lines 1.81 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Alert, AlertVariant } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { useAdminClient } from "../../admin-client"; import { useAlerts } from "../../ui-shared"; import { ConfirmDialogModal } from "../../components/confirm-dialog/ConfirmDialog"; export const DeleteScopeDialog = ({ clientId, selectedScope, refresh, open, toggleDialog, }) => { const { adminClient } = useAdminClient(); const { t } = useTranslation(); const { addAlert, addError } = useAlerts(); return (_jsxs(ConfirmDialogModal, { open: open, toggleDialog: toggleDialog, titleKey: "deleteScope", continueButtonLabel: "confirm", onConfirm: async () => { try { await adminClient.clients.delAuthorizationScope({ id: clientId, scopeId: selectedScope === null || selectedScope === void 0 ? void 0 : selectedScope.id, }); addAlert(t("resourceScopeSuccess"), AlertVariant.success); refresh(); } catch (error) { addError("resourceScopeError", error); } }, children: [t("deleteScopeConfirm"), selectedScope && "permissions" in selectedScope && selectedScope.permissions && selectedScope.permissions.length > 0 && (_jsx(Alert, { variant: "warning", isInline: true, isPlain: true, title: t("deleteScopeWarning"), className: "pf-v5-u-pt-lg", children: _jsx("p", { className: "pf-v5-u-pt-xs", children: selectedScope.permissions.map((permission) => (_jsx("strong", { className: "pf-v5-u-pr-md", children: permission.name }, permission.id))) }) }))] })); }; //# sourceMappingURL=DeleteScopeDialog.js.map