added initial access token tab
This commit is contained in:
parent
7c816736d2
commit
b4a73f86c1
5 changed files with 115 additions and 69 deletions
|
@ -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,81 +86,105 @@ 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">
|
||||||
<DeleteConfirm />
|
<KeycloakTabs
|
||||||
<KeycloakDataTable
|
isBox
|
||||||
key={key}
|
inset={{
|
||||||
loader={loader}
|
default: "insetNone",
|
||||||
isPaginated
|
md: "insetSm",
|
||||||
ariaLabelKey="clients:clientList"
|
xl: "inset2xl",
|
||||||
searchPlaceholderKey="clients:searchForClient"
|
"2xl": "insetLg",
|
||||||
toolbarItem={
|
}}
|
||||||
<>
|
>
|
||||||
|
<Tab
|
||||||
|
data-testid="list"
|
||||||
|
eventKey="list"
|
||||||
|
title={<TabTitleText>{t("clientsList")}</TabTitleText>}
|
||||||
|
>
|
||||||
|
<DeleteConfirm />
|
||||||
|
<KeycloakDataTable
|
||||||
|
key={key}
|
||||||
|
loader={loader}
|
||||||
|
isPaginated
|
||||||
|
ariaLabelKey="clients:clientList"
|
||||||
|
searchPlaceholderKey="clients:searchForClient"
|
||||||
|
toolbarItem={
|
||||||
|
<>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Button onClick={() => history.push(`${url}/add-client`)}>
|
<Button onClick={() => history.push(`${url}/add-client`)}>
|
||||||
{t("createClient")}
|
{t("createClient")}
|
||||||
</Button>
|
</Button>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
<ToolbarItem>
|
<ToolbarItem>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => history.push(`${url}/import-client`)}
|
onClick={() => history.push(`${url}/import-client`)}
|
||||||
variant="link"
|
variant="link"
|
||||||
>
|
>
|
||||||
{t("importClient")}
|
{t("importClient")}
|
||||||
</Button>
|
</Button>
|
||||||
</ToolbarItem>
|
</ToolbarItem>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
actions={[
|
actions={[
|
||||||
{
|
{
|
||||||
title: t("common:export"),
|
title: t("common:export"),
|
||||||
onRowClick: (client) => {
|
onRowClick: (client) => {
|
||||||
exportClient(client);
|
exportClient(client);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("common:delete"),
|
title: t("common:delete"),
|
||||||
onRowClick: (client) => {
|
onRowClick: (client) => {
|
||||||
setSelectedClient(client);
|
setSelectedClient(client);
|
||||||
toggleDeleteDialog();
|
toggleDeleteDialog();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
name: "clientId",
|
name: "clientId",
|
||||||
displayKey: "clients:clientID",
|
displayKey: "clients:clientID",
|
||||||
cellRenderer: ClientDetailLink,
|
cellRenderer: ClientDetailLink,
|
||||||
},
|
},
|
||||||
{ name: "protocol", displayKey: "common:type" },
|
{ name: "protocol", displayKey: "common:type" },
|
||||||
{
|
{
|
||||||
name: "description",
|
name: "description",
|
||||||
displayKey: "common:description",
|
displayKey: "common:description",
|
||||||
cellFormatters: [emptyFormatter()],
|
cellFormatters: [emptyFormatter()],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "baseUrl",
|
name: "baseUrl",
|
||||||
displayKey: "clients:homeURL",
|
displayKey: "clients:homeURL",
|
||||||
cellFormatters: [formattedLinkTableCell(), emptyFormatter()],
|
cellFormatters: [formattedLinkTableCell(), emptyFormatter()],
|
||||||
cellRenderer: (client) => {
|
cellRenderer: (client) => {
|
||||||
if (client.rootUrl) {
|
if (client.rootUrl) {
|
||||||
if (
|
if (
|
||||||
!client.rootUrl.startsWith("http") ||
|
!client.rootUrl.startsWith("http") ||
|
||||||
client.rootUrl.indexOf("$") !== -1
|
client.rootUrl.indexOf("$") !== -1
|
||||||
) {
|
) {
|
||||||
client.rootUrl =
|
client.rootUrl =
|
||||||
client.rootUrl
|
client.rootUrl
|
||||||
.replace("${authBaseUrl}", baseUrl)
|
.replace("${authBaseUrl}", baseUrl)
|
||||||
.replace("${authAdminUrl}", baseUrl) +
|
.replace("${authAdminUrl}", baseUrl) +
|
||||||
(client.baseUrl ? client.baseUrl.substr(1) : "");
|
(client.baseUrl ? client.baseUrl.substr(1) : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return client.rootUrl;
|
return client.rootUrl;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
</Tab>
|
||||||
|
<Tab
|
||||||
|
data-testid="initialAccessToken"
|
||||||
|
eventKey="initialAccessToken"
|
||||||
|
title={<TabTitleText>{t("initialAccessToken")}</TabTitleText>}
|
||||||
|
>
|
||||||
|
<InitialAccessTokenList />
|
||||||
|
</Tab>
|
||||||
|
</KeycloakTabs>
|
||||||
</PageSection>
|
</PageSection>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
8
src/clients/InitialAccessTokenList.tsx
Normal file
8
src/clients/InitialAccessTokenList.tsx
Normal 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>;
|
||||||
|
};
|
|
@ -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",
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue