WIP modal

This commit is contained in:
jenny-s51 2021-01-08 13:04:58 -05:00
parent f669be1d78
commit 50db2c73d7
4 changed files with 29 additions and 5 deletions

View file

@ -79,7 +79,7 @@ export const ConfirmDialogModal = ({
<Button <Button
id="modal-cancel" id="modal-cancel"
key="cancel" key="cancel"
variant={ButtonVariant.secondary} variant={ButtonVariant.link}
onClick={() => { onClick={() => {
if (onCancel) onCancel(); if (onCancel) onCancel();
toggleDialog(); toggleDialog();

View file

@ -71,6 +71,26 @@ export const RealmRolesSection = () => {
}, },
}); });
// const [toggleAssociatedRoleDialog, associatedRolesList] = useConfirmDialog({
// titleKey: "roles:associatedRolesModalTitle",
// messageKey: t("roles:roleDeleteConfirmDialog", {
// selectedRoleName: selectedRole ? selectedRole!.name : "",
// }),
// continueButtonLabel: t("Add"),
// continueButtonVariant: ButtonVariant.danger,
// onConfirm: async () => {
// try {
// await adminClient.roles.delById({
// id: selectedRole!.id!,
// });
// setSelectedRole(undefined);
// addAlert(t("roleDeletedSuccess"), AlertVariant.success);
// } catch (error) {
// addAlert(`${t("roleDeleteError")} ${error}`, AlertVariant.danger);
// }
// },
// });
const goToCreate = () => history.push(`${url}/add-role`); const goToCreate = () => history.push(`${url}/add-role`);
return ( return (
<> <>
@ -90,12 +110,12 @@ export const RealmRolesSection = () => {
} }
actions={[ actions={[
{ {
title: t("common:Delete"), title: t("addAssociatedRolesText"),
onRowClick: (role) => { onRowClick: (role) => {
setSelectedRole(role); setSelectedRole(role);
toggleDeleteDialog(); toggleDeleteDialog();
}, },
}, }
]} ]}
columns={[ columns={[
{ {

View file

@ -1,8 +1,12 @@
{ {
"roles": { "roles": {
"attributes": "Attributes", "attributes": "Attributes",
"add": "Add",
"addAttributeText": "Add an attribute", "addAttributeText": "Add an attribute",
"deleteAttributeText": "Delete an attribute", "deleteAttributeText": "Delete an attribute",
"addAssociatedRolesText": "Add associated roles",
"addAssociatedRolesSuccess": "Associated roles have been added",
"associatedRolesModalTitle": "Add roles to {{name}}",
"title": "Realm roles", "title": "Realm roles",
"createRole": "Create role", "createRole": "Create role",
"importRole": "Import role", "importRole": "Import role",
@ -24,7 +28,7 @@
"roleCreateError": "Could not create role: {{error}}", "roleCreateError": "Could not create role: {{error}}",
"roleImportSuccess": "Role import successful", "roleImportSuccess": "Role import successful",
"roleDeleteConfirm": "Delete role?", "roleDeleteConfirm": "Delete role?",
"roleDeleteConfirmDialog": "This action will permanently delete the role {{selectedRoleName}} and cannot be undone.", "roleDeleteConfirmDialog": "This action will permanently delete the role {{name}} and cannot be undone.",
"roleDeletedSuccess": "The role has been deleted", "roleDeletedSuccess": "The role has been deleted",
"roleDeleteError": "Could not delete role:", "roleDeleteError": "Could not delete role:",
"roleSaveSuccess": "The role has been saved", "roleSaveSuccess": "The role has been saved",