Added empty state (#3366)
This commit is contained in:
parent
49ffd816ea
commit
2c1f62fea8
2 changed files with 14 additions and 1 deletions
|
@ -146,6 +146,8 @@
|
|||
"allowRemoteResourceManagement": "Remote resource management",
|
||||
"resources": "Resources",
|
||||
"resource": "Resource",
|
||||
"emptyResources": "No resources",
|
||||
"emptyResourcesInstructions": "If you want to create a resource, please click the button below.",
|
||||
"allTypes": "All types",
|
||||
"scope": "Scope",
|
||||
"owner": "Owner",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { useState } from "react";
|
||||
import { Link } from "react-router-dom-v5-compat";
|
||||
import { Link, useNavigate } from "react-router-dom-v5-compat";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
Alert,
|
||||
|
@ -44,6 +44,7 @@ type ExpandableResourceRepresentation = ResourceRepresentation & {
|
|||
|
||||
export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
|
||||
const { t } = useTranslation("clients");
|
||||
const navigate = useNavigate();
|
||||
const { adminClient } = useAdminClient();
|
||||
const { addAlert, addError } = useAlerts();
|
||||
const { realm } = useRealm();
|
||||
|
@ -294,6 +295,16 @@ export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
|
|||
instructions={t("common:noSearchResultsInstructions")}
|
||||
/>
|
||||
)}
|
||||
{noData && !searching && (
|
||||
<ListEmptyState
|
||||
message={t("emptyResources")}
|
||||
instructions={t("emptyResourcesInstructions")}
|
||||
primaryActionText={t("createResource")}
|
||||
onPrimaryAction={() =>
|
||||
navigate(toCreateResource({ realm, id: clientId }))
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</PageSection>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue