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",
|
"allowRemoteResourceManagement": "Remote resource management",
|
||||||
"resources": "Resources",
|
"resources": "Resources",
|
||||||
"resource": "Resource",
|
"resource": "Resource",
|
||||||
|
"emptyResources": "No resources",
|
||||||
|
"emptyResourcesInstructions": "If you want to create a resource, please click the button below.",
|
||||||
"allTypes": "All types",
|
"allTypes": "All types",
|
||||||
"scope": "Scope",
|
"scope": "Scope",
|
||||||
"owner": "Owner",
|
"owner": "Owner",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { useState } from "react";
|
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 { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
|
@ -44,6 +44,7 @@ type ExpandableResourceRepresentation = ResourceRepresentation & {
|
||||||
|
|
||||||
export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
|
export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
|
const navigate = useNavigate();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
@ -294,6 +295,16 @@ export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
|
||||||
instructions={t("common:noSearchResultsInstructions")}
|
instructions={t("common:noSearchResultsInstructions")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{noData && !searching && (
|
||||||
|
<ListEmptyState
|
||||||
|
message={t("emptyResources")}
|
||||||
|
instructions={t("emptyResourcesInstructions")}
|
||||||
|
primaryActionText={t("createResource")}
|
||||||
|
onPrimaryAction={() =>
|
||||||
|
navigate(toCreateResource({ realm, id: clientId }))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</PageSection>
|
</PageSection>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue