bfa0c6e1ea
* initial version of the advanced tab * added registered nodes * added fine grain open id connect configuration * added open id connect compatibility section * added advanced section * added backend * fixed type * renamed 'advanced' to advancedtab to prevent strange add of '/index.js' by snowpack * fixed storybook stories * change '_' to '-' because '_' is also used * fix spacing buttons * stop passing the form * cypress test for advanced tab * more tests * saml section * changed to use NumberInput * added authetnication flow override * fixed merge error * updated text and added link to settings tab * fixed test * added filter on flows and better reset * added now mandetory error handler * added sorting * Revert "changed to use NumberInput" This reverts commit 7829f2656ae8fc8ed4a4a6b1c4b1961241a09d8e. * allow users to put empty string as value * already on detail page after save * fixed merge error
84 lines
2.6 KiB
TypeScript
84 lines
2.6 KiB
TypeScript
import React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { Link, useHistory, useRouteMatch } from "react-router-dom";
|
|
import { AlertVariant, Button, PageSection } from "@patternfly/react-core";
|
|
import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation";
|
|
|
|
import { useAdminClient } from "../context/auth/AdminClient";
|
|
import { ViewHeader } from "../components/view-header/ViewHeader";
|
|
import { useAlerts } from "../components/alert/Alerts";
|
|
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
|
|
|
|
export const ClientScopesSection = () => {
|
|
const { t } = useTranslation("client-scopes");
|
|
const history = useHistory();
|
|
const { url } = useRouteMatch();
|
|
|
|
const adminClient = useAdminClient();
|
|
const { addAlert } = useAlerts();
|
|
|
|
const loader = async () => await adminClient.clientScopes.find();
|
|
|
|
const ClientScopeDetailLink = (clientScope: ClientScopeRepresentation) => (
|
|
<>
|
|
<Link key={clientScope.id} to={`${url}/${clientScope.id}`}>
|
|
{clientScope.name}
|
|
</Link>
|
|
</>
|
|
);
|
|
return (
|
|
<>
|
|
<ViewHeader
|
|
titleKey="clientScopes"
|
|
subKey="client-scopes:clientScopeExplain"
|
|
/>
|
|
<PageSection variant="light">
|
|
<KeycloakDataTable
|
|
loader={loader}
|
|
ariaLabelKey="client-scopes:clientScopeList"
|
|
searchPlaceholderKey="client-scopes:searchFor"
|
|
toolbarItem={
|
|
<Button onClick={() => history.push(`${url}/new`)}>
|
|
{t("createClientScope")}
|
|
</Button>
|
|
}
|
|
actions={[
|
|
{
|
|
title: t("common:export"),
|
|
onRowClick: () => {},
|
|
},
|
|
{
|
|
title: t("common:delete"),
|
|
onRowClick: async (clientScope) => {
|
|
try {
|
|
await adminClient.clientScopes.del({ id: clientScope.id! });
|
|
addAlert(t("deletedSuccess"), AlertVariant.success);
|
|
return true;
|
|
} catch (error) {
|
|
addAlert(
|
|
t("deleteError", {
|
|
error: error.response.data?.errorMessage || error,
|
|
}),
|
|
AlertVariant.danger
|
|
);
|
|
return false;
|
|
}
|
|
},
|
|
},
|
|
]}
|
|
columns={[
|
|
{
|
|
name: "name",
|
|
cellRenderer: ClientScopeDetailLink,
|
|
},
|
|
{ name: "description" },
|
|
{
|
|
name: "protocol",
|
|
displayKey: "client-scopes:protocol",
|
|
},
|
|
]}
|
|
/>
|
|
</PageSection>
|
|
</>
|
|
);
|
|
};
|