feat(client): unified EmptyState across all pages and table empties
- New EmptyState + EmptyStateIllustration components: stacked-cards SVG with grid background, theme-aware light/dark palette. - Variants: default (centered with title + description), compact (horizontal, in-section), fullscreen (vertically centers in viewport). - Wired into Checks, Incidents, Logs (Logs+Queue tabs), Notifications, Maintenance, Status pages, and Team tab — each with i18n title + description and a fullscreen layout when truly empty. - Table.EmptyView now wraps the EmptyState in a divider-bordered card so short messages no longer look orphaned. - Incidents Option-A short-circuit: when summary.total === 0, replace the whole page chrome with EmptyState; otherwise keep filters + cards. - Fallback.tsx (BaseFallback / EmptyFallback / EmptyMonitorFallback / ErrorFallback) refactored to delegate to EmptyState.
This commit is contained in:
1 parent
ff208710d7
commit
031a6fdf3c
12 files changed
+188
-145
No files matched your search
@@ -17,6 +17,7 @@ interface EmptyStateProps {
|
|||||||
secondaryText?: string;
|
secondaryText?: string;
|
||||||
secondaryHref?: string;
|
secondaryHref?: string;
|
||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
|
fullscreen?: boolean;
|
||||||
alert?: ReactNode;
|
alert?: ReactNode;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
}
|
}
|
||||||
@@ -30,6 +31,7 @@ export const EmptyState = ({
|
|||||||
secondaryText,
|
secondaryText,
|
||||||
secondaryHref,
|
secondaryHref,
|
||||||
compact = false,
|
compact = false,
|
||||||
|
fullscreen = false,
|
||||||
alert,
|
alert,
|
||||||
children,
|
children,
|
||||||
}: EmptyStateProps) => {
|
}: EmptyStateProps) => {
|
||||||
@@ -78,6 +80,7 @@ export const EmptyState = ({
|
|||||||
alignItems="center"
|
alignItems="center"
|
||||||
justifyContent="center"
|
justifyContent="center"
|
||||||
sx={{
|
sx={{
|
||||||
|
...(fullscreen && { minHeight: "65vh" }),
|
||||||
py: theme.spacing(LAYOUT.XXL),
|
py: theme.spacing(LAYOUT.XXL),
|
||||||
px: theme.spacing(LAYOUT.MD),
|
px: theme.spacing(LAYOUT.MD),
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
|
|||||||
@@ -1,12 +1,37 @@
|
|||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
|
||||||
interface EmptyStateIllustrationProps {
|
interface EmptyStateIllustrationProps {
|
||||||
width?: number | string;
|
width?: number | string;
|
||||||
height?: number | string;
|
height?: number | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const PALETTE = {
|
||||||
|
light: {
|
||||||
|
grid: "#CBD5E1",
|
||||||
|
backFill: "#F5F7FA",
|
||||||
|
backStroke: "#D5DBE3",
|
||||||
|
backInner: "#B6C2CF",
|
||||||
|
frontFill: "#EEF4FE",
|
||||||
|
frontStroke: "#7DA8E8",
|
||||||
|
frontInner: "#7DA8E8",
|
||||||
|
},
|
||||||
|
dark: {
|
||||||
|
grid: "#3A4452",
|
||||||
|
backFill: "#475569",
|
||||||
|
backStroke: "#64748B",
|
||||||
|
backInner: "#CBD5E1",
|
||||||
|
frontFill: "#1E40AF",
|
||||||
|
frontStroke: "#60A5FA",
|
||||||
|
frontInner: "#DBEAFE",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
export const EmptyStateIllustration = ({
|
export const EmptyStateIllustration = ({
|
||||||
width = 160,
|
width = 160,
|
||||||
height = 120,
|
height = 120,
|
||||||
}: EmptyStateIllustrationProps) => {
|
}: EmptyStateIllustrationProps) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const p = theme.palette.mode === "dark" ? PALETTE.dark : PALETTE.light;
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
viewBox="0 0 160 120"
|
viewBox="0 0 160 120"
|
||||||
@@ -14,50 +39,8 @@ export const EmptyStateIllustration = ({
|
|||||||
height={height}
|
height={height}
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
>
|
>
|
||||||
<defs>
|
|
||||||
<linearGradient
|
|
||||||
id="emptyStateCardFade"
|
|
||||||
x1="0"
|
|
||||||
y1="0"
|
|
||||||
x2="0"
|
|
||||||
y2="1"
|
|
||||||
>
|
|
||||||
<stop
|
|
||||||
offset="0%"
|
|
||||||
stopColor="white"
|
|
||||||
stopOpacity="1"
|
|
||||||
/>
|
|
||||||
<stop
|
|
||||||
offset="65%"
|
|
||||||
stopColor="white"
|
|
||||||
stopOpacity="1"
|
|
||||||
/>
|
|
||||||
<stop
|
|
||||||
offset="100%"
|
|
||||||
stopColor="white"
|
|
||||||
stopOpacity="0.35"
|
|
||||||
/>
|
|
||||||
</linearGradient>
|
|
||||||
<mask
|
|
||||||
id="emptyStateCardMask"
|
|
||||||
maskUnits="userSpaceOnUse"
|
|
||||||
x="0"
|
|
||||||
y="0"
|
|
||||||
width="160"
|
|
||||||
height="120"
|
|
||||||
>
|
|
||||||
<rect
|
|
||||||
x="0"
|
|
||||||
y="0"
|
|
||||||
width="160"
|
|
||||||
height="120"
|
|
||||||
fill="url(#emptyStateCardFade)"
|
|
||||||
/>
|
|
||||||
</mask>
|
|
||||||
</defs>
|
|
||||||
|
|
||||||
<g
|
<g
|
||||||
stroke="#CBD5E1"
|
stroke={p.grid}
|
||||||
strokeWidth="0.75"
|
strokeWidth="0.75"
|
||||||
>
|
>
|
||||||
<line
|
<line
|
||||||
@@ -114,15 +97,15 @@ export const EmptyStateIllustration = ({
|
|||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
<g mask="url(#emptyStateCardMask)">
|
<g>
|
||||||
<rect
|
<rect
|
||||||
x="38"
|
x="38"
|
||||||
y="22"
|
y="22"
|
||||||
width="92"
|
width="92"
|
||||||
height="42"
|
height="42"
|
||||||
rx="6"
|
rx="6"
|
||||||
fill="#F5F7FA"
|
fill={p.backFill}
|
||||||
stroke="#D5DBE3"
|
stroke={p.backStroke}
|
||||||
strokeWidth="0.5"
|
strokeWidth="0.5"
|
||||||
/>
|
/>
|
||||||
<rect
|
<rect
|
||||||
@@ -131,7 +114,7 @@ export const EmptyStateIllustration = ({
|
|||||||
width="14"
|
width="14"
|
||||||
height="22"
|
height="22"
|
||||||
rx="2"
|
rx="2"
|
||||||
fill="#B6C2CF"
|
fill={p.backInner}
|
||||||
opacity="0.5"
|
opacity="0.5"
|
||||||
/>
|
/>
|
||||||
<rect
|
<rect
|
||||||
@@ -140,7 +123,7 @@ export const EmptyStateIllustration = ({
|
|||||||
width="50"
|
width="50"
|
||||||
height="2.5"
|
height="2.5"
|
||||||
rx="1.25"
|
rx="1.25"
|
||||||
fill="#B6C2CF"
|
fill={p.backInner}
|
||||||
opacity="0.7"
|
opacity="0.7"
|
||||||
/>
|
/>
|
||||||
<rect
|
<rect
|
||||||
@@ -149,7 +132,7 @@ export const EmptyStateIllustration = ({
|
|||||||
width="38"
|
width="38"
|
||||||
height="2.5"
|
height="2.5"
|
||||||
rx="1.25"
|
rx="1.25"
|
||||||
fill="#B6C2CF"
|
fill={p.backInner}
|
||||||
opacity="0.55"
|
opacity="0.55"
|
||||||
/>
|
/>
|
||||||
<rect
|
<rect
|
||||||
@@ -158,7 +141,7 @@ export const EmptyStateIllustration = ({
|
|||||||
width="44"
|
width="44"
|
||||||
height="2.5"
|
height="2.5"
|
||||||
rx="1.25"
|
rx="1.25"
|
||||||
fill="#B6C2CF"
|
fill={p.backInner}
|
||||||
opacity="0.55"
|
opacity="0.55"
|
||||||
/>
|
/>
|
||||||
<rect
|
<rect
|
||||||
@@ -167,8 +150,8 @@ export const EmptyStateIllustration = ({
|
|||||||
width="92"
|
width="92"
|
||||||
height="42"
|
height="42"
|
||||||
rx="6"
|
rx="6"
|
||||||
fill="#EEF4FE"
|
fill={p.frontFill}
|
||||||
stroke="#7DA8E8"
|
stroke={p.frontStroke}
|
||||||
strokeWidth="0.5"
|
strokeWidth="0.5"
|
||||||
strokeOpacity="0.4"
|
strokeOpacity="0.4"
|
||||||
/>
|
/>
|
||||||
@@ -178,7 +161,7 @@ export const EmptyStateIllustration = ({
|
|||||||
width="14"
|
width="14"
|
||||||
height="22"
|
height="22"
|
||||||
rx="2"
|
rx="2"
|
||||||
fill="#7DA8E8"
|
fill={p.frontInner}
|
||||||
opacity="0.35"
|
opacity="0.35"
|
||||||
/>
|
/>
|
||||||
<rect
|
<rect
|
||||||
@@ -187,7 +170,7 @@ export const EmptyStateIllustration = ({
|
|||||||
width="50"
|
width="50"
|
||||||
height="2.5"
|
height="2.5"
|
||||||
rx="1.25"
|
rx="1.25"
|
||||||
fill="#7DA8E8"
|
fill={p.frontInner}
|
||||||
opacity="0.55"
|
opacity="0.55"
|
||||||
/>
|
/>
|
||||||
<rect
|
<rect
|
||||||
@@ -196,7 +179,7 @@ export const EmptyStateIllustration = ({
|
|||||||
width="38"
|
width="38"
|
||||||
height="2.5"
|
height="2.5"
|
||||||
rx="1.25"
|
rx="1.25"
|
||||||
fill="#7DA8E8"
|
fill={p.frontInner}
|
||||||
opacity="0.4"
|
opacity="0.4"
|
||||||
/>
|
/>
|
||||||
<rect
|
<rect
|
||||||
@@ -205,7 +188,7 @@ export const EmptyStateIllustration = ({
|
|||||||
width="44"
|
width="44"
|
||||||
height="2.5"
|
height="2.5"
|
||||||
rx="1.25"
|
rx="1.25"
|
||||||
fill="#7DA8E8"
|
fill={p.frontInner}
|
||||||
opacity="0.4"
|
opacity="0.4"
|
||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
|
|||||||
@@ -32,32 +32,29 @@ export const ErrorFallback = ({
|
|||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<EmptyState
|
<EmptyState
|
||||||
|
fullscreen
|
||||||
title={title}
|
title={title}
|
||||||
description={subtitle}
|
description={subtitle}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const bulletsToDescription = (bullets: unknown): string | undefined => {
|
|
||||||
if (!Array.isArray(bullets) || bullets.length === 0) return undefined;
|
|
||||||
return bullets.join(" • ");
|
|
||||||
};
|
|
||||||
|
|
||||||
export const EmptyFallback = ({
|
export const EmptyFallback = ({
|
||||||
title,
|
title,
|
||||||
bullets,
|
description,
|
||||||
actionButtonText,
|
actionButtonText,
|
||||||
actionLink,
|
actionLink,
|
||||||
}: {
|
}: {
|
||||||
title: string;
|
title: string;
|
||||||
bullets: unknown;
|
description?: string;
|
||||||
actionButtonText: string;
|
actionButtonText: string;
|
||||||
actionLink: string;
|
actionLink: string;
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<EmptyState
|
<EmptyState
|
||||||
|
fullscreen
|
||||||
title={title}
|
title={title}
|
||||||
description={bulletsToDescription(bullets)}
|
description={description}
|
||||||
actionText={actionButtonText}
|
actionText={actionButtonText}
|
||||||
actionTo={actionLink}
|
actionTo={actionLink}
|
||||||
/>
|
/>
|
||||||
@@ -66,20 +63,21 @@ export const EmptyFallback = ({
|
|||||||
|
|
||||||
export const EmptyMonitorFallback = ({
|
export const EmptyMonitorFallback = ({
|
||||||
title,
|
title,
|
||||||
bullets,
|
description,
|
||||||
actionButtonText,
|
actionButtonText,
|
||||||
actionLink,
|
actionLink,
|
||||||
}: {
|
}: {
|
||||||
page: string;
|
page: string;
|
||||||
title: string;
|
title: string;
|
||||||
bullets: unknown;
|
description?: string;
|
||||||
actionButtonText: string;
|
actionButtonText: string;
|
||||||
actionLink: string;
|
actionLink: string;
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<EmptyState
|
<EmptyState
|
||||||
|
fullscreen
|
||||||
title={title}
|
title={title}
|
||||||
description={bulletsToDescription(bullets)}
|
description={description}
|
||||||
actionText={actionButtonText}
|
actionText={actionButtonText}
|
||||||
actionTo={actionLink}
|
actionTo={actionLink}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -18,10 +18,9 @@ import {
|
|||||||
ChevronsRight,
|
ChevronsRight,
|
||||||
ChevronLeft,
|
ChevronLeft,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
Coffee,
|
|
||||||
Ellipsis,
|
Ellipsis,
|
||||||
PartyPopper,
|
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
import { EmptyState } from "./EmptyState";
|
||||||
|
|
||||||
import TablePagination from "@mui/material/TablePagination";
|
import TablePagination from "@mui/material/TablePagination";
|
||||||
import type { TablePaginationOwnProps } from "@mui/material/TablePagination";
|
import type { TablePaginationOwnProps } from "@mui/material/TablePagination";
|
||||||
@@ -548,49 +547,18 @@ export const Pagination = ({ ...props }: PaginationProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const EmptyView = ({ text, positive }: { text?: string; positive?: boolean }) => {
|
const EmptyView = ({ text }: { text?: string; positive?: boolean }) => {
|
||||||
const theme = useTheme();
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const Icon = positive ? PartyPopper : Coffee;
|
const theme = useTheme();
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Box
|
||||||
alignItems={"center"}
|
|
||||||
justifyContent={"center"}
|
|
||||||
sx={{
|
sx={{
|
||||||
py: theme.spacing(LAYOUT.XL),
|
border: `1px solid ${theme.palette.divider}`,
|
||||||
px: theme.spacing(LAYOUT.XS),
|
borderRadius: 1,
|
||||||
borderWidth: 1,
|
backgroundColor: theme.palette.background.paper,
|
||||||
borderStyle: "solid",
|
|
||||||
borderColor: theme.palette.divider,
|
|
||||||
borderRadius: theme.shape.borderRadius,
|
|
||||||
textAlign: "center",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<EmptyState title={text ?? t("common.table.empty")} />
|
||||||
sx={{
|
</Box>
|
||||||
width: 64,
|
|
||||||
height: 64,
|
|
||||||
borderRadius: "50%",
|
|
||||||
backgroundColor: theme.palette.action.hover,
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
mb: theme.spacing(SPACING.LG),
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
size={28}
|
|
||||||
strokeWidth={1}
|
|
||||||
color={theme.palette.text.secondary}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle1"
|
|
||||||
color={theme.palette.text.primary}
|
|
||||||
sx={{ fontWeight: 500 }}
|
|
||||||
>
|
|
||||||
{text ?? t("common.table.empty")}
|
|
||||||
</Typography>
|
|
||||||
</Stack>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1,15 +1,18 @@
|
|||||||
import { Stack } from "@mui/material";
|
import { Stack } from "@mui/material";
|
||||||
import { useTheme } from "@mui/material";
|
import { useTheme } from "@mui/material";
|
||||||
import { useState, useMemo } from "react";
|
import { useState, useMemo } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { HeaderTeamControls } from "./components/HeaderTeamControls";
|
import { HeaderTeamControls } from "./components/HeaderTeamControls";
|
||||||
import { TeamTable } from "./components/TeamTable";
|
import { TeamTable } from "./components/TeamTable";
|
||||||
import { InviteTeamMemberDialog } from "./components/InviteTeamMemberDialog";
|
import { InviteTeamMemberDialog } from "./components/InviteTeamMemberDialog";
|
||||||
import { AddTeamMemberDialog } from "./components/AddTeamMemberDialog";
|
import { AddTeamMemberDialog } from "./components/AddTeamMemberDialog";
|
||||||
|
import { EmptyState } from "@/Components/design-elements";
|
||||||
import { useGet } from "@/Hooks/UseApi";
|
import { useGet } from "@/Hooks/UseApi";
|
||||||
import type { User, UserRole } from "@/Types/User";
|
import type { User, UserRole } from "@/Types/User";
|
||||||
|
|
||||||
export const TabTeam = () => {
|
export const TabTeam = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
const [filter, setFilter] = useState<UserRole | "">("");
|
const [filter, setFilter] = useState<UserRole | "">("");
|
||||||
const [inviteDialogOpen, setInviteDialogOpen] = useState(false);
|
const [inviteDialogOpen, setInviteDialogOpen] = useState(false);
|
||||||
const [addMemberDialogOpen, setAddMemberDialogOpen] = useState(false);
|
const [addMemberDialogOpen, setAddMemberDialogOpen] = useState(false);
|
||||||
@@ -33,6 +36,9 @@ export const TabTeam = () => {
|
|||||||
refetch();
|
refetch();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const totalUsers = users?.length ?? 0;
|
||||||
|
const noUsers = users !== undefined && totalUsers === 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(8)}>
|
<Stack gap={theme.spacing(8)}>
|
||||||
<HeaderTeamControls
|
<HeaderTeamControls
|
||||||
@@ -41,7 +47,15 @@ export const TabTeam = () => {
|
|||||||
onInviteClick={handleOpenInviteDialog}
|
onInviteClick={handleOpenInviteDialog}
|
||||||
onAddMemberClick={handleOpenAddMemberDialog}
|
onAddMemberClick={handleOpenAddMemberDialog}
|
||||||
/>
|
/>
|
||||||
<TeamTable users={filteredUsers} />
|
{noUsers ? (
|
||||||
|
<EmptyState
|
||||||
|
fullscreen
|
||||||
|
title={t("pages.account.team.fallback.title")}
|
||||||
|
description={t("pages.account.team.fallback.description")}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<TeamTable users={filteredUsers} />
|
||||||
|
)}
|
||||||
<InviteTeamMemberDialog
|
<InviteTeamMemberDialog
|
||||||
open={inviteDialogOpen}
|
open={inviteDialogOpen}
|
||||||
onClose={handleCloseInviteDialog}
|
onClose={handleCloseInviteDialog}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import {
|
import {
|
||||||
BasePage,
|
BasePage,
|
||||||
|
EmptyState,
|
||||||
TotalChecksBox,
|
TotalChecksBox,
|
||||||
UpChecksBox,
|
UpChecksBox,
|
||||||
DownChecksBox,
|
DownChecksBox,
|
||||||
@@ -102,8 +103,19 @@ const Checks = () => {
|
|||||||
const downChecks = summaryResponse?.downChecks || 0;
|
const downChecks = summaryResponse?.downChecks || 0;
|
||||||
const upChecks = totalChecks - (summaryResponse?.downChecks || 0);
|
const upChecks = totalChecks - (summaryResponse?.downChecks || 0);
|
||||||
|
|
||||||
|
const noMonitors = !isLoadingMonitors && (monitorsResponse?.length ?? 0) === 0;
|
||||||
|
if (noMonitors) {
|
||||||
|
return (
|
||||||
|
<EmptyState
|
||||||
|
fullscreen
|
||||||
|
title={t("pages.checks.fallback.title")}
|
||||||
|
description={t("pages.checks.fallback.description")}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BasePage>
|
<BasePage headerKey="checks">
|
||||||
<Stack
|
<Stack
|
||||||
direction={{ xs: "column", md: "row" }}
|
direction={{ xs: "column", md: "row" }}
|
||||||
gap={4}
|
gap={4}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BasePage } from "@/Components/design-elements";
|
import { BasePage, EmptyState } from "@/Components/design-elements";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import Divider from "@mui/material/Divider";
|
import Divider from "@mui/material/Divider";
|
||||||
@@ -153,8 +153,20 @@ const IncidentsPage = () => {
|
|||||||
refetchSummary();
|
refetchSummary();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const trulyEmpty = summaryData !== undefined && (summaryData?.total ?? 0) === 0;
|
||||||
|
|
||||||
|
if (trulyEmpty) {
|
||||||
|
return (
|
||||||
|
<EmptyState
|
||||||
|
fullscreen
|
||||||
|
title={t("pages.incidents.fallback.title")}
|
||||||
|
description={t("pages.incidents.fallback.description")}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BasePage>
|
<BasePage headerKey="incidents">
|
||||||
<Stack
|
<Stack
|
||||||
direction={{ xs: "column", md: "row" }}
|
direction={{ xs: "column", md: "row" }}
|
||||||
gap={theme.spacing(8)}
|
gap={theme.spacing(8)}
|
||||||
@@ -171,7 +183,7 @@ const IncidentsPage = () => {
|
|||||||
setSelectedResolutionType={setFilter}
|
setSelectedResolutionType={setFilter}
|
||||||
onClearFilters={handleClearFilters}
|
onClearFilters={handleClearFilters}
|
||||||
/>
|
/>
|
||||||
{activeIncidentsCount > 0 ? (
|
{activeIncidentsCount > 0 && (
|
||||||
<>
|
<>
|
||||||
<Typography
|
<Typography
|
||||||
variant="h6"
|
variant="h6"
|
||||||
@@ -193,13 +205,6 @@ const IncidentsPage = () => {
|
|||||||
/>
|
/>
|
||||||
<Divider />
|
<Divider />
|
||||||
</>
|
</>
|
||||||
) : (
|
|
||||||
<Typography
|
|
||||||
variant="body1"
|
|
||||||
sx={{ mb: theme.spacing(4), color: theme.palette.success.main }}
|
|
||||||
>
|
|
||||||
{t("pages.incidents.summaryCard.activeIncidents.active_zero")}
|
|
||||||
</Typography>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Typography
|
<Typography
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Typography from "@mui/material/Typography";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { Select } from "@/Components/inputs";
|
import { Select } from "@/Components/inputs";
|
||||||
import { TableLogs } from "@/Pages/Logs/components/TableLogs";
|
import { TableLogs } from "@/Pages/Logs/components/TableLogs";
|
||||||
|
import { EmptyState } from "@/Components/design-elements";
|
||||||
|
|
||||||
import { useTheme } from "@mui/material";
|
import { useTheme } from "@mui/material";
|
||||||
import { useGet } from "@/Hooks/UseApi";
|
import { useGet } from "@/Hooks/UseApi";
|
||||||
@@ -15,7 +16,7 @@ import type { RootState } from "@/Types/state";
|
|||||||
|
|
||||||
export const TabLogs = () => {
|
export const TabLogs = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { data: logs } = useGet<Log[]>("/logs");
|
const { data: logs, isLoading } = useGet<Log[]>("/logs");
|
||||||
const [selectedLogLevel, setSelectedLogLevel] = useState<LogLevelOption>("all");
|
const [selectedLogLevel, setSelectedLogLevel] = useState<LogLevelOption>("all");
|
||||||
const [page, setPage] = useState(0);
|
const [page, setPage] = useState(0);
|
||||||
const rowsPerPage = useSelector(
|
const rowsPerPage = useSelector(
|
||||||
@@ -33,6 +34,16 @@ export const TabLogs = () => {
|
|||||||
const paginatedLogs =
|
const paginatedLogs =
|
||||||
filteredLogs?.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) ?? [];
|
filteredLogs?.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) ?? [];
|
||||||
|
|
||||||
|
if (!isLoading && (logs?.length ?? 0) === 0) {
|
||||||
|
return (
|
||||||
|
<EmptyState
|
||||||
|
fullscreen
|
||||||
|
title={t("pages.logs.fallback.title")}
|
||||||
|
description={t("pages.logs.fallback.description")}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(8)}>
|
<Stack gap={theme.spacing(8)}>
|
||||||
<Select
|
<Select
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
import { TableJobs, TableFailedJobs } from "./components/TableJobs";
|
import { TableJobs, TableFailedJobs } from "./components/TableJobs";
|
||||||
|
|
||||||
import { useTheme } from "@mui/material";
|
import { useTheme } from "@mui/material";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation, Trans } from "react-i18next";
|
||||||
import { useGet, usePost } from "@/Hooks/UseApi";
|
import { useGet, usePost } from "@/Hooks/UseApi";
|
||||||
import type { QueueData } from "@/Types/Queue";
|
import type { QueueData } from "@/Types/Queue";
|
||||||
import { Metrics } from "@/Pages/Logs/components/Metrics";
|
import { Metrics } from "@/Pages/Logs/components/Metrics";
|
||||||
import { Button } from "@/Components/inputs";
|
import { Button } from "@/Components/inputs";
|
||||||
|
import { EmptyState } from "@/Components/design-elements";
|
||||||
|
|
||||||
export const TabQueue = () => {
|
export const TabQueue = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const {
|
const {
|
||||||
data: queueData,
|
data: queueData,
|
||||||
// isLoading,
|
isLoading,
|
||||||
// error,
|
// error,
|
||||||
refetch,
|
refetch,
|
||||||
} = useGet<QueueData>("/queue/all-metrics", {}, { refreshInterval: 5000 });
|
} = useGet<QueueData>("/queue/all-metrics", {}, { refreshInterval: 5000 });
|
||||||
@@ -23,6 +25,17 @@ export const TabQueue = () => {
|
|||||||
|
|
||||||
const jobs = queueData?.jobs ?? [];
|
const jobs = queueData?.jobs ?? [];
|
||||||
const metrics = queueData?.metrics ?? null;
|
const metrics = queueData?.metrics ?? null;
|
||||||
|
const hasNeverRun = !isLoading && metrics !== null && (metrics.totalRuns ?? 0) === 0;
|
||||||
|
const noQueueData = !isLoading && metrics === null && jobs.length === 0;
|
||||||
|
if (hasNeverRun || noQueueData) {
|
||||||
|
return (
|
||||||
|
<EmptyState
|
||||||
|
fullscreen
|
||||||
|
title={t("pages.logs.queueFallback.title")}
|
||||||
|
description={t("pages.logs.queueFallback.description")}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const handleFlushQueue = async () => {
|
const handleFlushQueue = async () => {
|
||||||
await post("/queue/flush", {});
|
await post("/queue/flush", {});
|
||||||
@@ -32,19 +45,58 @@ export const TabQueue = () => {
|
|||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(8)}>
|
<Stack gap={theme.spacing(8)}>
|
||||||
<Metrics metrics={metrics} />
|
<Metrics metrics={metrics} />
|
||||||
<Typography
|
<Stack gap={theme.spacing(1)}>
|
||||||
variant="h6"
|
<Typography
|
||||||
sx={{ textTransform: "uppercase" }}
|
variant="h6"
|
||||||
>
|
sx={{ textTransform: "uppercase" }}
|
||||||
{t("pages.logs.jobQueue")}
|
>
|
||||||
</Typography>
|
{t("pages.logs.jobQueue")}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
fontSize: 13,
|
||||||
|
color: theme.palette.text.secondary,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Trans
|
||||||
|
i18nKey="pages.logs.jobQueueExplainer"
|
||||||
|
components={{
|
||||||
|
highlight: (
|
||||||
|
<Box
|
||||||
|
component="span"
|
||||||
|
sx={{
|
||||||
|
backgroundColor:
|
||||||
|
theme.palette.mode === "dark"
|
||||||
|
? "rgba(19, 113, 91, 0.18)"
|
||||||
|
: "#ECF7F2",
|
||||||
|
color: theme.palette.text.primary,
|
||||||
|
px: 1,
|
||||||
|
py: 0.25,
|
||||||
|
borderRadius: 0.5,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
<TableJobs jobs={jobs} />
|
<TableJobs jobs={jobs} />
|
||||||
<Typography
|
<Stack gap={theme.spacing(1)}>
|
||||||
variant="h6"
|
<Typography
|
||||||
sx={{ textTransform: "uppercase" }}
|
variant="h6"
|
||||||
>
|
sx={{ textTransform: "uppercase" }}
|
||||||
{t("pages.logs.failedJobs")}
|
>
|
||||||
</Typography>
|
{t("pages.logs.failedJobs")}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
fontSize: 13,
|
||||||
|
color: theme.palette.text.secondary,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("pages.logs.failedJobsExplainer")}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
<TableFailedJobs metrics={metrics} />
|
<TableFailedJobs metrics={metrics} />
|
||||||
<Stack alignItems={"flex-end"}>
|
<Stack alignItems={"flex-end"}>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -32,11 +32,10 @@ const MaintenanceWindowPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<BasePageWithStates
|
<BasePageWithStates
|
||||||
|
headerKey="maintenanceWindow"
|
||||||
page={t("pages.maintenanceWindow.fallback.title")}
|
page={t("pages.maintenanceWindow.fallback.title")}
|
||||||
totalCount={maintenanceWindowCount}
|
totalCount={maintenanceWindowCount}
|
||||||
bullets={
|
description={t("pages.maintenanceWindow.fallback.description")}
|
||||||
t("pages.maintenanceWindow.fallback.checks", { returnObjects: true }) as string[]
|
|
||||||
}
|
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
actionButtonText={t("pages.maintenanceWindow.fallback.actionButton")}
|
actionButtonText={t("pages.maintenanceWindow.fallback.actionButton")}
|
||||||
|
|||||||
@@ -39,10 +39,9 @@ const NotificationsPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<BasePageWithStates
|
<BasePageWithStates
|
||||||
|
headerKey="notifications"
|
||||||
page={t("pages.notifications.fallback.title")}
|
page={t("pages.notifications.fallback.title")}
|
||||||
bullets={
|
description={t("pages.notifications.fallback.description")}
|
||||||
t("pages.notifications.fallback.checks", { returnObjects: true }) as string[]
|
|
||||||
}
|
|
||||||
loading={isLoading || isValidating}
|
loading={isLoading || isValidating}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
totalCount={notifications?.length ?? 0}
|
totalCount={notifications?.length ?? 0}
|
||||||
|
|||||||
@@ -37,11 +37,10 @@ const StatusPages = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<BasePageWithStates
|
<BasePageWithStates
|
||||||
page={t("pages.statusPages.title")}
|
headerKey="statusPages"
|
||||||
|
page={t("pages.statusPages.fallback.title")}
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
bullets={
|
description={t("pages.statusPages.fallback.description")}
|
||||||
t("pages.statusPages.fallback.checks", { returnObjects: true }) as string[]
|
|
||||||
}
|
|
||||||
error={!!error}
|
error={!!error}
|
||||||
totalCount={statusPages?.length ?? 0}
|
totalCount={statusPages?.length ?? 0}
|
||||||
actionButtonText={t("pages.statusPages.fallback.actionButton")}
|
actionButtonText={t("pages.statusPages.fallback.actionButton")}
|
||||||
|
|||||||
Reference in new issue
Block a user