Issue 2580 (#2614)

This commit is contained in:
Erik Jan de Wit 2022-05-11 11:43:07 +02:00 committed by GitHub
parent 67c23444e9
commit 1eb33007c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -58,5 +58,7 @@
"attributes": "Attributes",
"groupUpdated": "Group updated",
"groupUpdateError": "Error updating group {error}",
"roleMapping": "Role mapping"
"roleMapping": "Role mapping",
"noRoles": "No roles for this group",
"noRolesInstructions": "You haven't created any roles for this group. Create a role to get started."
}

View file

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import {
AlertVariant,
@ -24,6 +24,8 @@ import { useAlerts } from "../alert/Alerts";
import { useConfirmDialog } from "../confirm-dialog/ConfirmDialog";
import { useAdminClient } from "../../context/auth/AdminClient";
import { ListEmptyState } from "../list-empty-state/ListEmptyState";
import useSetTimeout from "../../utils/useSetTimeout";
import useToggle from "../../utils/useToggle";
import "./role-mapping.css";
@ -172,12 +174,16 @@ export const RoleMapping = ({
const [hide, setHide] = useState(false);
const [showAssign, setShowAssign] = useState(false);
const [selected, setSelected] = useState<Row[]>([]);
const [wait, toggleWait] = useToggle();
const setTimeout = useSetTimeout();
const assignRoles = async (rows: Row[]) => {
await save(rows);
refresh();
};
useEffect(() => setTimeout(refresh, 200), [wait]);
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
titleKey: "clients:removeMappingTitle",
messageKey: t("clients:removeMappingConfirm", { count: selected.length }),
@ -202,8 +208,8 @@ export const RoleMapping = ({
);
})
);
addAlert(t("clientScopeRemoveSuccess"), AlertVariant.success);
refresh();
addAlert(t("clients:clientScopeRemoveSuccess"), AlertVariant.success);
toggleWait();
} catch (error) {
addError("clients:clientScopeRemoveError", error);
}