added initial access token tab

This commit is contained in:
Erik Jan de Wit 2021-03-03 08:02:40 +01:00
parent 7c816736d2
commit b4a73f86c1
5 changed files with 115 additions and 69 deletions

View file

@ -8,6 +8,8 @@ import {
ButtonVariant, ButtonVariant,
PageSection, PageSection,
ToolbarItem, ToolbarItem,
Tab,
TabTitleText,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { ViewHeader } from "../components/view-header/ViewHeader"; import { ViewHeader } from "../components/view-header/ViewHeader";
@ -18,6 +20,8 @@ import { useAlerts } from "../components/alert/Alerts";
import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import { formattedLinkTableCell } from "../components/external-link/FormattedLink"; import { formattedLinkTableCell } from "../components/external-link/FormattedLink";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";
import { InitialAccessTokenList } from "./InitialAccessTokenList";
export const ClientsSection = () => { export const ClientsSection = () => {
const { t } = useTranslation("clients"); const { t } = useTranslation("clients");
@ -82,8 +86,23 @@ export const ClientsSection = () => {
<ViewHeader <ViewHeader
titleKey="clients:clientList" titleKey="clients:clientList"
subKey="clients:clientsExplain" subKey="clients:clientsExplain"
divider={false}
/> />
<PageSection variant="light" className="pf-u-p-0"> <PageSection variant="light" className="pf-u-p-0">
<KeycloakTabs
isBox
inset={{
default: "insetNone",
md: "insetSm",
xl: "inset2xl",
"2xl": "insetLg",
}}
>
<Tab
data-testid="list"
eventKey="list"
title={<TabTitleText>{t("clientsList")}</TabTitleText>}
>
<DeleteConfirm /> <DeleteConfirm />
<KeycloakDataTable <KeycloakDataTable
key={key} key={key}
@ -157,6 +176,15 @@ export const ClientsSection = () => {
}, },
]} ]}
/> />
</Tab>
<Tab
data-testid="initialAccessToken"
eventKey="initialAccessToken"
title={<TabTitleText>{t("initialAccessToken")}</TabTitleText>}
>
<InitialAccessTokenList />
</Tab>
</KeycloakTabs>
</PageSection> </PageSection>
</> </>
); );

View file

@ -0,0 +1,8 @@
import React from "react";
import { useAdminClient } from "../context/auth/AdminClient";
export const InitialAccessTokenList = () => {
const adminClient = useAdminClient();
return <h1>Hello</h1>;
};

View file

@ -52,6 +52,8 @@
"noGeneratedAccessToken": "No generated access token", "noGeneratedAccessToken": "No generated access token",
"generatedAccessTokenIsDisabled": "Generated access token is disabled when no user is selected", "generatedAccessTokenIsDisabled": "Generated access token is disabled when no user is selected",
"clientList": "Clients", "clientList": "Clients",
"clientsList": "Clients list",
"initialAccessToken": "Initial access token",
"clientSettings": "Client details", "clientSettings": "Client details",
"selectEncryptionType": "Select Encryption type", "selectEncryptionType": "Select Encryption type",
"generalSettings": "General Settings", "generalSettings": "General Settings",

View file

@ -36,6 +36,7 @@ export type ViewHeaderProps = {
lowerDropdownMenuTitle?: any; lowerDropdownMenuTitle?: any;
isEnabled?: boolean; isEnabled?: boolean;
onToggle?: (value: boolean) => void; onToggle?: (value: boolean) => void;
divider?: boolean;
}; };
export const ViewHeader = ({ export const ViewHeader = ({
@ -51,6 +52,7 @@ export const ViewHeader = ({
lowerDropdownItems, lowerDropdownItems,
isEnabled = true, isEnabled = true,
onToggle, onToggle,
divider = true,
}: ViewHeaderProps) => { }: ViewHeaderProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { enabled } = useContext(HelpContext); const { enabled } = useContext(HelpContext);

View file

@ -48,6 +48,12 @@ export const routes: RoutesFn = (t: TFunction) => [
breadcrumb: t("clients:clientList"), breadcrumb: t("clients:clientList"),
access: "query-clients", access: "query-clients",
}, },
{
path: "/:realm/clients/:tab?",
component: ClientsSection,
breadcrumb: null,
access: "query-clients",
},
{ {
path: "/:realm/clients/add-client", path: "/:realm/clients/add-client",
component: NewClientForm, component: NewClientForm,