format
This commit is contained in:
parent
82fb002e76
commit
d7b154b656
3 changed files with 49 additions and 40 deletions
|
@ -29,7 +29,7 @@ export const GroupsCreateModal = ({
|
||||||
setIsCreateModalOpen,
|
setIsCreateModalOpen,
|
||||||
createGroupName,
|
createGroupName,
|
||||||
setCreateGroupName,
|
setCreateGroupName,
|
||||||
refresh
|
refresh,
|
||||||
}: GroupsCreateModalProps) => {
|
}: GroupsCreateModalProps) => {
|
||||||
const { t } = useTranslation("groups");
|
const { t } = useTranslation("groups");
|
||||||
const httpClient = useContext(HttpClientContext)!;
|
const httpClient = useContext(HttpClientContext)!;
|
||||||
|
@ -53,7 +53,10 @@ export const GroupsCreateModal = ({
|
||||||
refresh();
|
refresh();
|
||||||
addAlert(t("groupCreated"), AlertVariant.success);
|
addAlert(t("groupCreated"), AlertVariant.success);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addAlert(`${t("couldNotCreateGroup")} ': '${error}'`, AlertVariant.danger);
|
addAlert(
|
||||||
|
`${t("couldNotCreateGroup")} ': '${error}'`,
|
||||||
|
AlertVariant.danger
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,7 +80,10 @@ export const GroupsList = ({ list, refresh }: GroupsListProps) => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("common:Delete"),
|
title: t("common:Delete"),
|
||||||
onClick: async (_: React.MouseEvent<Element, MouseEvent>, rowId: number) => {
|
onClick: async (
|
||||||
|
_: React.MouseEvent<Element, MouseEvent>,
|
||||||
|
rowId: number
|
||||||
|
) => {
|
||||||
try {
|
try {
|
||||||
await httpClient.doDelete(
|
await httpClient.doDelete(
|
||||||
`/admin/realms/${realm}/groups/${list![rowId].id}`
|
`/admin/realms/${realm}/groups/${list![rowId].id}`
|
||||||
|
|
|
@ -96,43 +96,46 @@ export const GroupsSection = () => {
|
||||||
{rawData ? (
|
{rawData ? (
|
||||||
<>
|
<>
|
||||||
<TableToolbar
|
<TableToolbar
|
||||||
inputGroupName="groupsToolbarTextInput"
|
inputGroupName="groupsToolbarTextInput"
|
||||||
inputGroupPlaceholder={t("searchGroups")}
|
inputGroupPlaceholder={t("searchGroups")}
|
||||||
inputGroupOnChange={filterGroups}
|
inputGroupOnChange={filterGroups}
|
||||||
toolbarItem={
|
toolbarItem={
|
||||||
<>
|
<>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Button variant="primary" onClick={() => handleModalToggle()}>
|
<Button
|
||||||
{t("createGroup")}
|
variant="primary"
|
||||||
</Button>
|
onClick={() => handleModalToggle()}
|
||||||
</ToolbarItem>
|
>
|
||||||
<ToolbarItem>
|
{t("createGroup")}
|
||||||
<Dropdown
|
</Button>
|
||||||
onSelect={onKebabSelect}
|
</ToolbarItem>
|
||||||
toggle={<KebabToggle onToggle={onKebabToggle} />}
|
<ToolbarItem>
|
||||||
isOpen={isKebabOpen}
|
<Dropdown
|
||||||
isPlain
|
onSelect={onKebabSelect}
|
||||||
dropdownItems={[
|
toggle={<KebabToggle onToggle={onKebabToggle} />}
|
||||||
<DropdownItem key="action" component="button">
|
isOpen={isKebabOpen}
|
||||||
{t("delete")}
|
isPlain
|
||||||
</DropdownItem>,
|
dropdownItems={[
|
||||||
]}
|
<DropdownItem key="action" component="button">
|
||||||
/>
|
{t("delete")}
|
||||||
</ToolbarItem>
|
</DropdownItem>,
|
||||||
</>
|
]}
|
||||||
}
|
/>
|
||||||
>
|
</ToolbarItem>
|
||||||
<GroupsList list={filteredData || rawData} refresh={loader}/>
|
</>
|
||||||
</TableToolbar>
|
}
|
||||||
<GroupsCreateModal
|
>
|
||||||
isCreateModalOpen={isCreateModalOpen}
|
<GroupsList list={filteredData || rawData} refresh={loader} />
|
||||||
handleModalToggle={handleModalToggle}
|
</TableToolbar>
|
||||||
setIsCreateModalOpen={setIsCreateModalOpen}
|
<GroupsCreateModal
|
||||||
createGroupName={createGroupName}
|
isCreateModalOpen={isCreateModalOpen}
|
||||||
setCreateGroupName={setCreateGroupName}
|
handleModalToggle={handleModalToggle}
|
||||||
refresh={loader}
|
setIsCreateModalOpen={setIsCreateModalOpen}
|
||||||
/>
|
createGroupName={createGroupName}
|
||||||
</>
|
setCreateGroupName={setCreateGroupName}
|
||||||
|
refresh={loader}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className="pf-u-text-align-center">
|
<div className="pf-u-text-align-center">
|
||||||
<Spinner />
|
<Spinner />
|
||||||
|
|
Loading…
Reference in a new issue