Added hint when no user found (#2257)
This commit is contained in:
parent
49c77c20cd
commit
ceffcba321
4 changed files with 12 additions and 6 deletions
|
@ -7,7 +7,7 @@ import {
|
|||
} from "@patternfly/react-core";
|
||||
|
||||
export type AlertType = {
|
||||
key: number;
|
||||
key: string;
|
||||
message: string;
|
||||
variant: AlertVariant;
|
||||
description?: string;
|
||||
|
@ -15,7 +15,7 @@ export type AlertType = {
|
|||
|
||||
type AlertPanelProps = {
|
||||
alerts: AlertType[];
|
||||
onCloseAlert: (key: number) => void;
|
||||
onCloseAlert: (key: string) => void;
|
||||
};
|
||||
|
||||
export function AlertPanel({ alerts, onCloseAlert }: AlertPanelProps) {
|
||||
|
|
|
@ -26,9 +26,9 @@ export const AlertProvider: FunctionComponent = ({ children }) => {
|
|||
const [alerts, setAlerts] = useState<AlertType[]>([]);
|
||||
const setTimeout = useSetTimeout();
|
||||
|
||||
const createId = () => new Date().getTime();
|
||||
const createId = () => Math.random().toString(16);
|
||||
|
||||
const hideAlert = (key: number) => {
|
||||
const hideAlert = (key: string) => {
|
||||
setAlerts((alerts) => [...alerts.filter((el) => el.key !== key)]);
|
||||
};
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ export default function UsersSection() {
|
|||
const [selectedRows, setSelectedRows] = useState<UserRepresentation[]>([]);
|
||||
|
||||
const [key, setKey] = useState("");
|
||||
const refresh = () => setKey(`${new Date().getTime()}`);
|
||||
const refresh = () => setKey(key + 1);
|
||||
|
||||
useFetch(
|
||||
async () => {
|
||||
|
@ -129,7 +129,11 @@ export default function UsersSection() {
|
|||
}
|
||||
return users;
|
||||
} catch (error) {
|
||||
addError("users:noUsersFoundError", error);
|
||||
if (userStorage?.length) {
|
||||
addError("users:noUsersFoundErrorStorage", error);
|
||||
} else {
|
||||
addError("users:noUsersFoundError", error);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,6 +10,8 @@ export default {
|
|||
createNewUser: "Create new user",
|
||||
noUsersFound: "No users found",
|
||||
noUsersFoundError: "No users found due to {{error}}",
|
||||
noUsersFoundErrorStorage:
|
||||
"No users found, could be due to wrongly configured federated provider {{error}}",
|
||||
noGroups: "No groups",
|
||||
noGroupsText:
|
||||
"You haven't added this user to any groups. Join a group to get started.",
|
||||
|
|
Loading…
Reference in a new issue