Fixed these 2 issues: (#741)
* fix order of alerts where the newest is on the top * removed double loading indicator * fixes showing old alerts again
This commit is contained in:
parent
dd07911a72
commit
1613331bba
4 changed files with 23 additions and 19 deletions
|
@ -23,7 +23,6 @@ export function AlertPanel({ alerts, onCloseAlert }: AlertPanelProps) {
|
||||||
<AlertGroup isToast>
|
<AlertGroup isToast>
|
||||||
{alerts.map(({ key, variant, message, description }) => (
|
{alerts.map(({ key, variant, message, description }) => (
|
||||||
<Alert
|
<Alert
|
||||||
timeout={true}
|
|
||||||
key={key}
|
key={key}
|
||||||
isLiveRegion
|
isLiveRegion
|
||||||
variant={AlertVariant[variant]}
|
variant={AlertVariant[variant]}
|
||||||
|
|
|
@ -27,10 +27,12 @@ export const AlertProvider = ({ children }: { children: ReactNode }) => {
|
||||||
|
|
||||||
const addAlert = (
|
const addAlert = (
|
||||||
message: string,
|
message: string,
|
||||||
variant: AlertVariant = AlertVariant.default,
|
variant: AlertVariant = AlertVariant.success,
|
||||||
description?: string
|
description?: string
|
||||||
) => {
|
) => {
|
||||||
setAlerts([...alerts, { key: createId(), message, variant, description }]);
|
const key = createId();
|
||||||
|
setTimeout(() => hideAlert(key), 8000);
|
||||||
|
setAlerts([{ key, message, variant, description }, ...alerts]);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -142,6 +142,7 @@ export type DataListProps<T> = Omit<
|
||||||
icon?: React.ComponentClass<SVGIconProps>;
|
icon?: React.ComponentClass<SVGIconProps>;
|
||||||
isNotCompact?: boolean;
|
isNotCompact?: boolean;
|
||||||
isRadio?: boolean;
|
isRadio?: boolean;
|
||||||
|
isSearching?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,6 +187,7 @@ export function KeycloakDataTable<T>({
|
||||||
subToolbar,
|
subToolbar,
|
||||||
emptyState,
|
emptyState,
|
||||||
icon,
|
icon,
|
||||||
|
isSearching = false,
|
||||||
...props
|
...props
|
||||||
}: DataListProps<T>) {
|
}: DataListProps<T>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -256,7 +258,7 @@ export function KeycloakDataTable<T>({
|
||||||
? (node as TitleCell).title.props.children
|
? (node as TitleCell).title.props.children
|
||||||
: (node as TitleCell).title
|
: (node as TitleCell).title
|
||||||
? (node as TitleCell).title
|
? (node as TitleCell).title
|
||||||
: (node as JSX.Element).props.children
|
: (node as JSX.Element).props?.children
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
@ -375,8 +377,10 @@ export function KeycloakDataTable<T>({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!rows && loading && <Loading />}
|
{((data && data.length > 0) ||
|
||||||
{((data && data.length > 0) || search !== "" || !emptyState) && (
|
search !== "" ||
|
||||||
|
isSearching ||
|
||||||
|
loading) && (
|
||||||
<PaginatingTableToolbar
|
<PaginatingTableToolbar
|
||||||
count={data?.length || 0}
|
count={data?.length || 0}
|
||||||
first={first}
|
first={first}
|
||||||
|
@ -413,7 +417,7 @@ export function KeycloakDataTable<T>({
|
||||||
)}
|
)}
|
||||||
{!loading &&
|
{!loading &&
|
||||||
(!data || data.length === 0) &&
|
(!data || data.length === 0) &&
|
||||||
(search !== "" || !emptyState) &&
|
(search !== "" || !isSearching) &&
|
||||||
searchPlaceholderKey && (
|
searchPlaceholderKey && (
|
||||||
<ListEmptyState
|
<ListEmptyState
|
||||||
hasIcon={true}
|
hasIcon={true}
|
||||||
|
|
|
@ -272,8 +272,8 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
|
||||||
transforms: [cellWidth(20)],
|
transforms: [cellWidth(20)],
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
isSearching={!!filterType}
|
||||||
emptyState={
|
emptyState={
|
||||||
filterType ? undefined : (
|
|
||||||
<ListEmptyState
|
<ListEmptyState
|
||||||
hasIcon={true}
|
hasIcon={true}
|
||||||
message={t("realm-settings:noKeys")}
|
message={t("realm-settings:noKeys")}
|
||||||
|
@ -284,7 +284,6 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
|
||||||
primaryActionText={t("createRole")}
|
primaryActionText={t("createRole")}
|
||||||
onPrimaryAction={goToCreate}
|
onPrimaryAction={goToCreate}
|
||||||
/>
|
/>
|
||||||
)
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</PageSection>
|
</PageSection>
|
||||||
|
|
Loading…
Reference in a new issue