Issue 2580 (#2614)
This commit is contained in:
parent
67c23444e9
commit
1eb33007c4
2 changed files with 12 additions and 4 deletions
|
@ -58,5 +58,7 @@
|
||||||
"attributes": "Attributes",
|
"attributes": "Attributes",
|
||||||
"groupUpdated": "Group updated",
|
"groupUpdated": "Group updated",
|
||||||
"groupUpdateError": "Error updating group {error}",
|
"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."
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
|
@ -24,6 +24,8 @@ import { useAlerts } from "../alert/Alerts";
|
||||||
import { useConfirmDialog } from "../confirm-dialog/ConfirmDialog";
|
import { useConfirmDialog } from "../confirm-dialog/ConfirmDialog";
|
||||||
import { useAdminClient } from "../../context/auth/AdminClient";
|
import { useAdminClient } from "../../context/auth/AdminClient";
|
||||||
import { ListEmptyState } from "../list-empty-state/ListEmptyState";
|
import { ListEmptyState } from "../list-empty-state/ListEmptyState";
|
||||||
|
import useSetTimeout from "../../utils/useSetTimeout";
|
||||||
|
import useToggle from "../../utils/useToggle";
|
||||||
|
|
||||||
import "./role-mapping.css";
|
import "./role-mapping.css";
|
||||||
|
|
||||||
|
@ -172,12 +174,16 @@ export const RoleMapping = ({
|
||||||
const [hide, setHide] = useState(false);
|
const [hide, setHide] = useState(false);
|
||||||
const [showAssign, setShowAssign] = useState(false);
|
const [showAssign, setShowAssign] = useState(false);
|
||||||
const [selected, setSelected] = useState<Row[]>([]);
|
const [selected, setSelected] = useState<Row[]>([]);
|
||||||
|
const [wait, toggleWait] = useToggle();
|
||||||
|
const setTimeout = useSetTimeout();
|
||||||
|
|
||||||
const assignRoles = async (rows: Row[]) => {
|
const assignRoles = async (rows: Row[]) => {
|
||||||
await save(rows);
|
await save(rows);
|
||||||
refresh();
|
refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => setTimeout(refresh, 200), [wait]);
|
||||||
|
|
||||||
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
|
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
|
||||||
titleKey: "clients:removeMappingTitle",
|
titleKey: "clients:removeMappingTitle",
|
||||||
messageKey: t("clients:removeMappingConfirm", { count: selected.length }),
|
messageKey: t("clients:removeMappingConfirm", { count: selected.length }),
|
||||||
|
@ -202,8 +208,8 @@ export const RoleMapping = ({
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
addAlert(t("clientScopeRemoveSuccess"), AlertVariant.success);
|
addAlert(t("clients:clientScopeRemoveSuccess"), AlertVariant.success);
|
||||||
refresh();
|
toggleWait();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("clients:clientScopeRemoveError", error);
|
addError("clients:clientScopeRemoveError", error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue