2021-03-29 18:46:46 +00:00
|
|
|
import React from "react";
|
2021-01-29 13:59:03 +00:00
|
|
|
import { PageSection } from "@patternfly/react-core";
|
2020-11-12 12:55:52 +00:00
|
|
|
import { ViewHeader } from "../components/view-header/ViewHeader";
|
2021-03-29 18:46:46 +00:00
|
|
|
import { useAdminClient } from "../context/auth/AdminClient";
|
2021-01-29 13:59:03 +00:00
|
|
|
import { RolesList } from "./RolesList";
|
2020-09-09 09:07:17 +00:00
|
|
|
|
2021-10-29 16:11:06 +00:00
|
|
|
export default function RealmRolesSection() {
|
2020-11-12 12:55:52 +00:00
|
|
|
const adminClient = useAdminClient();
|
2021-03-22 08:14:24 +00:00
|
|
|
|
2021-03-29 18:46:46 +00:00
|
|
|
const loader = (first?: number, max?: number, search?: string) => {
|
2020-12-07 19:23:18 +00:00
|
|
|
const params: { [name: string]: string | number } = {
|
2021-02-18 06:38:23 +00:00
|
|
|
first: first!,
|
2020-12-07 19:23:18 +00:00
|
|
|
max: max!,
|
|
|
|
};
|
2021-03-22 08:14:24 +00:00
|
|
|
|
|
|
|
const searchParam = search || "";
|
|
|
|
|
|
|
|
if (searchParam) {
|
|
|
|
params.search = searchParam;
|
|
|
|
}
|
|
|
|
|
2021-03-29 18:46:46 +00:00
|
|
|
return adminClient.roles.find(params);
|
2020-12-07 19:23:18 +00:00
|
|
|
};
|
2021-03-22 08:14:24 +00:00
|
|
|
|
2020-09-18 08:04:55 +00:00
|
|
|
return (
|
2020-10-07 15:47:03 +00:00
|
|
|
<>
|
|
|
|
<ViewHeader titleKey="roles:title" subKey="roles:roleExplain" />
|
2021-03-22 08:14:24 +00:00
|
|
|
<PageSection variant="light" padding={{ default: "noPadding" }}>
|
2021-01-29 13:59:03 +00:00
|
|
|
<RolesList loader={loader} />
|
2020-10-07 15:47:03 +00:00
|
|
|
</PageSection>
|
|
|
|
</>
|
2020-09-18 08:04:55 +00:00
|
|
|
);
|
2021-10-29 16:11:06 +00:00
|
|
|
}
|