PR review fix

This commit is contained in:
Erik Jan de Wit 2021-06-14 09:34:37 +02:00
parent 8a73291bc2
commit 3e4a73ebfb
3 changed files with 18 additions and 11 deletions

View file

@ -155,7 +155,10 @@ export const AssociatedRolesTab = ({
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
titleKey: "roles:roleRemoveAssociatedRoleConfirm",
messageKey: t("roles:roleRemoveAssociatedText"),
messageKey: t("roles:roleRemoveAssociatedText", {
role: selectedRows.map((r) => r.name),
roleName: parentRole.name,
}),
continueButtonLabel: "common:remove",
continueButtonVariant: ButtonVariant.danger,
onConfirm: async () => {
@ -183,7 +186,7 @@ export const AssociatedRolesTab = ({
continueButtonVariant: ButtonVariant.danger,
onConfirm: async () => {
try {
if (selectedRows.length === allRoles.length) {
if (selectedRows.length >= allRoles.length) {
onRemove(selectedRows);
const loc = url.replace(/\/AssociatedRoles/g, "/details");
history.push(loc);

View file

@ -154,7 +154,9 @@ export const RealmRoleTabs = () => {
});
}
setRole(convert(createdRole));
history.push(`/${realm}/roles/${createdRole.id}`);
history.push(
url.substr(0, url.lastIndexOf("/") + 1) + createdRole.id + "/details"
);
}
addAlert(t(id ? "roleSaveSuccess" : "roleCreated"), AlertVariant.success);
} catch (error) {
@ -202,7 +204,7 @@ export const RealmRoleTabs = () => {
});
}
addAlert(t("roleDeletedSuccess"), AlertVariant.success);
history.replace(`/${realm}/roles`);
history.push(url.substr(0, url.indexOf("/roles") + "/roles".length));
} catch (error) {
addAlert(`${t("roleDeleteError")} ${error}`, AlertVariant.danger);
}
@ -316,12 +318,14 @@ export const RealmRoleTabs = () => {
title={<TabTitleText>{t("associatedRolesText")}</TabTitleText>}
>
<PageSection variant="light">
<AssociatedRolesTab
additionalRoles={additionalRoles}
addComposites={addComposites}
parentRole={role!}
onRemove={() => refresh()}
/>
{role && (
<AssociatedRolesTab
additionalRoles={additionalRoles}
addComposites={addComposites}
parentRole={role}
onRemove={() => refresh()}
/>
)}
</PageSection>
</Tab>
)}

View file

@ -44,7 +44,7 @@
"removeRoles": "Remove roles",
"removeAllAssociatedRolesConfirmDialog": "This action will remove the associated roles of {{name}}. Users who have permission to {{name}} will no longer have access to these roles.",
"roleRemoveAssociatedRoleConfirm": "Remove associated role?",
"roleRemoveAssociatedText": "This action will remove {{role}} from {{roleName}. All the associated roles of {{role}} will also be removed.",
"roleRemoveAssociatedText": "This action will remove {{role}} from {{roleName}}. All the associated roles of {{role}} will also be removed.",
"compositeRoleOff": "Composite role turned off",
"associatedRolesRemoved": "Associated roles have been removed",
"compositesRemovedAlertDescription": "All the associated roles have been removed",