added empty state to list

This commit is contained in:
Erik Jan de Wit 2021-03-04 09:37:46 +01:00
parent 3fe5d8383a
commit 957e08cf1c
3 changed files with 19 additions and 2 deletions

View file

@ -47,7 +47,13 @@ export const CreateInitialAccessToken = () => {
return ( return (
<> <>
{token && ( {token && (
<AccessTokenDialog token={token} toggleDialog={() => setToken("")} /> <AccessTokenDialog
token={token}
toggleDialog={() => {
setToken("");
history.push(`/${realm}/clients/initialAccessToken`);
}}
/>
)} )}
<ViewHeader <ViewHeader
titleKey="clients:createToken" titleKey="clients:createToken"

View file

@ -7,6 +7,7 @@ import { Button } from "@patternfly/react-core";
import { KeycloakDataTable } from "../../components/table-toolbar/KeycloakDataTable"; import { KeycloakDataTable } from "../../components/table-toolbar/KeycloakDataTable";
import { useAdminClient } from "../../context/auth/AdminClient"; import { useAdminClient } from "../../context/auth/AdminClient";
import { useRealm } from "../../context/realm-context/RealmContext"; import { useRealm } from "../../context/realm-context/RealmContext";
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";
export const InitialAccessTokenList = () => { export const InitialAccessTokenList = () => {
const { t } = useTranslation("clients"); const { t } = useTranslation("clients");
@ -56,6 +57,14 @@ export const InitialAccessTokenList = () => {
displayKey: "clients:remainingCount", displayKey: "clients:remainingCount",
}, },
]} ]}
emptyState={
<ListEmptyState
message={t("noTokens")}
instructions={t("noTokensInstructions")}
primaryActionText={t("common:create")}
onPrimaryAction={() => history.push(`${url}/create`)}
/>
}
/> />
); );
}; };

View file

@ -77,10 +77,12 @@
"createToken": "Create initial access token", "createToken": "Create initial access token",
"id": "ID", "id": "ID",
"timestamp": "Created date", "timestamp": "Created date",
"expirs": "Expires", "expires": "Expires",
"count": "Count", "count": "Count",
"remainingCount": "Remaining count", "remainingCount": "Remaining count",
"expiration": "Expiration", "expiration": "Expiration",
"noTokens": "No initial access tokens",
"noTokensInstructions": "You haven't created any initial access tokens. Create a initial access tokens by clicking \"Create\"",
"tokenSaveError": "Could not create initial access token {{error}}", "tokenSaveError": "Could not create initial access token {{error}}",
"initialAccessTokenDetails": "Initial access token details", "initialAccessTokenDetails": "Initial access token details",
"copyInitialAccessToken": "Please copy and paste the initial access token before closing as it can not be retrieved later.", "copyInitialAccessToken": "Please copy and paste the initial access token before closing as it can not be retrieved later.",