style: auto-fix lint and format
This commit is contained in:
1 parent
d6b6287d6d
commit
ab6a0f3b96
5 files changed
+220
-212
No files matched your search
@@ -41,7 +41,11 @@ export default function BeszelAlertsWidget({
|
|||||||
() => ({ integrationIds, includeHistory: options.showHistory, maxHistoryItems: options.maxHistoryItems }),
|
() => ({ integrationIds, includeHistory: options.showHistory, maxHistoryItems: options.maxHistoryItems }),
|
||||||
[integrationIds, options.showHistory, options.maxHistoryItems],
|
[integrationIds, options.showHistory, options.maxHistoryItems],
|
||||||
);
|
);
|
||||||
const { data: results = [], error: alertsError, isPending } = clientApi.widget.beszel.getAlerts.useQuery(alertsInput, {
|
const {
|
||||||
|
data: results = [],
|
||||||
|
error: alertsError,
|
||||||
|
isPending,
|
||||||
|
} = clientApi.widget.beszel.getAlerts.useQuery(alertsInput, {
|
||||||
staleTime: 15_000,
|
staleTime: 15_000,
|
||||||
refetchInterval: 15_000,
|
refetchInterval: 15_000,
|
||||||
retry: false,
|
retry: false,
|
||||||
@@ -120,99 +124,99 @@ export default function BeszelAlertsWidget({
|
|||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{triggeredAlerts.length > 0 && (
|
{triggeredAlerts.length > 0 && (
|
||||||
<Stack gap={6}>
|
|
||||||
<Group gap={6}>
|
|
||||||
<IconFlame size={14} color="var(--mantine-color-red-6)" />
|
|
||||||
<Text size="xs" fw={600} tt="uppercase" c="red">
|
|
||||||
{t("status.triggered")} ({triggeredAlerts.length})
|
|
||||||
</Text>
|
|
||||||
</Group>
|
|
||||||
{triggeredAlerts.map((alert) => (
|
|
||||||
<AlertRow
|
|
||||||
key={alert._key}
|
|
||||||
name={alert.name}
|
|
||||||
value={alert.value}
|
|
||||||
min={alert.min}
|
|
||||||
systemName={systemNameMap[alert.system] ?? alert.system}
|
|
||||||
triggered
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{triggeredAlerts.length > 0 && okAlerts.length > 0 && <Divider />}
|
|
||||||
|
|
||||||
{okAlerts.length > 0 && (
|
|
||||||
<Stack gap={6}>
|
|
||||||
<Group gap={6}>
|
|
||||||
<IconCircleCheck size={14} color="var(--mantine-color-green-6)" />
|
|
||||||
<Text size="xs" fw={600} tt="uppercase" c="dimmed">
|
|
||||||
{t("status.ok")} ({okAlerts.length})
|
|
||||||
</Text>
|
|
||||||
</Group>
|
|
||||||
{okAlerts.map((alert) => (
|
|
||||||
<AlertRow
|
|
||||||
key={alert._key}
|
|
||||||
name={alert.name}
|
|
||||||
value={alert.value}
|
|
||||||
min={alert.min}
|
|
||||||
systemName={systemNameMap[alert.system] ?? alert.system}
|
|
||||||
triggered={false}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Stack>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{options.showHistory && history.length > 0 && (
|
|
||||||
<>
|
|
||||||
<Divider />
|
|
||||||
<Stack gap={6}>
|
<Stack gap={6}>
|
||||||
<Group gap={6}>
|
<Group gap={6}>
|
||||||
<IconHistory size={14} opacity={0.5} />
|
<IconFlame size={14} color="var(--mantine-color-red-6)" />
|
||||||
<Text size="xs" fw={600} tt="uppercase" c="dimmed">
|
<Text size="xs" fw={600} tt="uppercase" c="red">
|
||||||
{t("history")}
|
{t("status.triggered")} ({triggeredAlerts.length})
|
||||||
</Text>
|
</Text>
|
||||||
</Group>
|
</Group>
|
||||||
{history.map((entry) => {
|
{triggeredAlerts.map((alert) => (
|
||||||
const systemName = systemNameMap[entry.system] ?? entry.system;
|
<AlertRow
|
||||||
const isResolved = !!entry.resolved;
|
key={alert._key}
|
||||||
const HistoryIcon = alertIconMap[entry.name] ?? Server;
|
name={alert.name}
|
||||||
return (
|
value={alert.value}
|
||||||
<Group key={entry._key} justify="space-between" wrap="nowrap" gap="xs" pl={4}>
|
min={alert.min}
|
||||||
<Group gap="xs" wrap="nowrap" style={{ minWidth: 0 }}>
|
systemName={systemNameMap[alert.system] ?? alert.system}
|
||||||
<Box
|
triggered
|
||||||
w={3}
|
/>
|
||||||
h={24}
|
))}
|
||||||
style={{ borderRadius: 2, flexShrink: 0 }}
|
</Stack>
|
||||||
bg={isResolved ? "green.6" : "red.6"}
|
)}
|
||||||
/>
|
|
||||||
<HistoryIcon size={12} opacity={0.5} style={{ flexShrink: 0 }} />
|
{triggeredAlerts.length > 0 && okAlerts.length > 0 && <Divider />}
|
||||||
<Stack gap={0} style={{ minWidth: 0 }}>
|
|
||||||
<Text size="xs" fw={500} truncate>
|
{okAlerts.length > 0 && (
|
||||||
{entry.name}
|
<Stack gap={6}>
|
||||||
</Text>
|
<Group gap={6}>
|
||||||
<Text size="xs" c="dimmed" truncate>
|
<IconCircleCheck size={14} color="var(--mantine-color-green-6)" />
|
||||||
{systemName}
|
<Text size="xs" fw={600} tt="uppercase" c="dimmed">
|
||||||
|
{t("status.ok")} ({okAlerts.length})
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
{okAlerts.map((alert) => (
|
||||||
|
<AlertRow
|
||||||
|
key={alert._key}
|
||||||
|
name={alert.name}
|
||||||
|
value={alert.value}
|
||||||
|
min={alert.min}
|
||||||
|
systemName={systemNameMap[alert.system] ?? alert.system}
|
||||||
|
triggered={false}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{options.showHistory && history.length > 0 && (
|
||||||
|
<>
|
||||||
|
<Divider />
|
||||||
|
<Stack gap={6}>
|
||||||
|
<Group gap={6}>
|
||||||
|
<IconHistory size={14} opacity={0.5} />
|
||||||
|
<Text size="xs" fw={600} tt="uppercase" c="dimmed">
|
||||||
|
{t("history")}
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
{history.map((entry) => {
|
||||||
|
const systemName = systemNameMap[entry.system] ?? entry.system;
|
||||||
|
const isResolved = !!entry.resolved;
|
||||||
|
const HistoryIcon = alertIconMap[entry.name] ?? Server;
|
||||||
|
return (
|
||||||
|
<Group key={entry._key} justify="space-between" wrap="nowrap" gap="xs" pl={4}>
|
||||||
|
<Group gap="xs" wrap="nowrap" style={{ minWidth: 0 }}>
|
||||||
|
<Box
|
||||||
|
w={3}
|
||||||
|
h={24}
|
||||||
|
style={{ borderRadius: 2, flexShrink: 0 }}
|
||||||
|
bg={isResolved ? "green.6" : "red.6"}
|
||||||
|
/>
|
||||||
|
<HistoryIcon size={12} opacity={0.5} style={{ flexShrink: 0 }} />
|
||||||
|
<Stack gap={0} style={{ minWidth: 0 }}>
|
||||||
|
<Text size="xs" fw={500} truncate>
|
||||||
|
{entry.name}
|
||||||
|
</Text>
|
||||||
|
<Text size="xs" c="dimmed" truncate>
|
||||||
|
{systemName}
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
</Group>
|
||||||
|
<Stack gap={0} align="flex-end" style={{ flexShrink: 0 }}>
|
||||||
|
<Badge size="xs" variant="dot" color={isResolved ? "green" : "red"}>
|
||||||
|
{isResolved ? t("resolved") : t("status.triggered")}
|
||||||
|
</Badge>
|
||||||
|
<Text size="10px" c="dimmed">
|
||||||
|
{dayjs(entry.created).fromNow()}
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Group>
|
</Group>
|
||||||
<Stack gap={0} align="flex-end" style={{ flexShrink: 0 }}>
|
);
|
||||||
<Badge size="xs" variant="dot" color={isResolved ? "green" : "red"}>
|
})}
|
||||||
{isResolved ? t("resolved") : t("status.triggered")}
|
</Stack>
|
||||||
</Badge>
|
</>
|
||||||
<Text size="10px" c="dimmed">
|
)}
|
||||||
{dayjs(entry.created).fromNow()}
|
</Stack>
|
||||||
</Text>
|
</ScrollArea>
|
||||||
</Stack>
|
|
||||||
</Group>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Stack>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
</ScrollArea>
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,7 +365,11 @@ export default function BeszelSystemGridWidget({
|
|||||||
const board = useRequiredBoard();
|
const board = useRequiredBoard();
|
||||||
const { openModal } = useModalAction(BeszelSystemStatsModal);
|
const { openModal } = useModalAction(BeszelSystemStatsModal);
|
||||||
|
|
||||||
const { data: results = [], error: systemsError, isPending } = clientApi.widget.beszel.getSystems.useQuery(
|
const {
|
||||||
|
data: results = [],
|
||||||
|
error: systemsError,
|
||||||
|
isPending,
|
||||||
|
} = clientApi.widget.beszel.getSystems.useQuery(
|
||||||
{ integrationIds },
|
{ integrationIds },
|
||||||
{ staleTime: 5_000, refetchInterval: 5_000, retry: false },
|
{ staleTime: 5_000, refetchInterval: 5_000, retry: false },
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -314,130 +314,130 @@ export default function BeszelSystemStatsWidget({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{activeStats && (!("error" in activeStats) || !activeStats.error) && (
|
{activeStats && (!("error" in activeStats) || !activeStats.error) && (
|
||||||
<SimpleGrid cols={cols} spacing="md">
|
<SimpleGrid cols={cols} spacing="md">
|
||||||
{options.showCpu && cpuData.length > 0 && (
|
{options.showCpu && cpuData.length > 0 && (
|
||||||
<BeszelChartPanel
|
<BeszelChartPanel
|
||||||
title={t("chart.cpu.title")}
|
title={t("chart.cpu.title")}
|
||||||
subtitle={t("chart.cpu.subtitle")}
|
subtitle={t("chart.cpu.subtitle")}
|
||||||
chartProps={{
|
chartProps={{
|
||||||
h: CHART_HEIGHT,
|
h: CHART_HEIGHT,
|
||||||
data: cpuData,
|
data: cpuData,
|
||||||
series: series.cpu,
|
series: series.cpu,
|
||||||
yAxisFormatter: chartAxisFormatters.percent,
|
yAxisFormatter: chartAxisFormatters.percent,
|
||||||
yAxisDomain: CPU_Y_AXIS_DOMAIN,
|
yAxisDomain: CPU_Y_AXIS_DOMAIN,
|
||||||
tooltipProps: tooltipPercent,
|
tooltipProps: tooltipPercent,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{options.showMemory && memoryData.length > 0 && (
|
{options.showMemory && memoryData.length > 0 && (
|
||||||
<BeszelChartPanel
|
<BeszelChartPanel
|
||||||
title={t("chart.memory.title")}
|
title={t("chart.memory.title")}
|
||||||
subtitle={t("chart.memory.subtitle")}
|
subtitle={t("chart.memory.subtitle")}
|
||||||
chartProps={{
|
chartProps={{
|
||||||
h: CHART_HEIGHT,
|
h: CHART_HEIGHT,
|
||||||
data: memoryData,
|
data: memoryData,
|
||||||
type: "stacked",
|
type: "stacked",
|
||||||
series: series.memory,
|
series: series.memory,
|
||||||
yAxisFormatter: chartAxisFormatters.gb,
|
yAxisFormatter: chartAxisFormatters.gb,
|
||||||
tooltipProps: tooltipGB,
|
tooltipProps: tooltipGB,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{options.showDisk && diskData.length > 0 && (
|
{options.showDisk && diskData.length > 0 && (
|
||||||
<BeszelChartPanel
|
<BeszelChartPanel
|
||||||
title={t("chart.disk.title")}
|
title={t("chart.disk.title")}
|
||||||
subtitle={t("chart.disk.subtitle")}
|
subtitle={t("chart.disk.subtitle")}
|
||||||
chartProps={{
|
chartProps={{
|
||||||
h: CHART_HEIGHT,
|
h: CHART_HEIGHT,
|
||||||
data: diskData,
|
data: diskData,
|
||||||
series: series.disk,
|
series: series.disk,
|
||||||
yAxisFormatter: chartAxisFormatters.gb,
|
yAxisFormatter: chartAxisFormatters.gb,
|
||||||
tooltipProps: tooltipGB,
|
tooltipProps: tooltipGB,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{options.showDiskIO && diskIOData.length > 0 && (
|
{options.showDiskIO && diskIOData.length > 0 && (
|
||||||
<BeszelChartPanel
|
<BeszelChartPanel
|
||||||
title={t("chart.diskIO.title")}
|
title={t("chart.diskIO.title")}
|
||||||
subtitle={t("chart.diskIO.subtitle")}
|
subtitle={t("chart.diskIO.subtitle")}
|
||||||
chartProps={{
|
chartProps={{
|
||||||
h: CHART_HEIGHT,
|
h: CHART_HEIGHT,
|
||||||
data: diskIOData,
|
data: diskIOData,
|
||||||
series: series.diskIO,
|
series: series.diskIO,
|
||||||
yAxisFormatter: chartAxisFormatters.rate,
|
yAxisFormatter: chartAxisFormatters.rate,
|
||||||
tooltipProps: tooltipRate,
|
tooltipProps: tooltipRate,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{options.showNetwork && networkData.length > 0 && (
|
{options.showNetwork && networkData.length > 0 && (
|
||||||
<BeszelChartPanel
|
<BeszelChartPanel
|
||||||
title={t("chart.network.title")}
|
title={t("chart.network.title")}
|
||||||
subtitle={t("chart.network.subtitle")}
|
subtitle={t("chart.network.subtitle")}
|
||||||
chartProps={{
|
chartProps={{
|
||||||
h: CHART_HEIGHT,
|
h: CHART_HEIGHT,
|
||||||
data: networkData,
|
data: networkData,
|
||||||
series: series.network,
|
series: series.network,
|
||||||
yAxisFormatter: chartAxisFormatters.rate,
|
yAxisFormatter: chartAxisFormatters.rate,
|
||||||
tooltipProps: tooltipRate,
|
tooltipProps: tooltipRate,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showDocker && containerSeries.length > 0 && (
|
{showDocker && containerSeries.length > 0 && (
|
||||||
<>
|
<>
|
||||||
{options.showDockerCpu && dockerCpuData.length > 0 && (
|
{options.showDockerCpu && dockerCpuData.length > 0 && (
|
||||||
<BeszelChartPanel
|
<BeszelChartPanel
|
||||||
title={t("chart.dockerCpu.title")}
|
title={t("chart.dockerCpu.title")}
|
||||||
subtitle={t("chart.dockerCpu.subtitle")}
|
subtitle={t("chart.dockerCpu.subtitle")}
|
||||||
chartProps={{
|
chartProps={{
|
||||||
h: CHART_HEIGHT,
|
h: CHART_HEIGHT,
|
||||||
data: dockerCpuData,
|
data: dockerCpuData,
|
||||||
type: "stacked",
|
type: "stacked",
|
||||||
series: containerSeries,
|
series: containerSeries,
|
||||||
yAxisFormatter: chartAxisFormatters.percent,
|
yAxisFormatter: chartAxisFormatters.percent,
|
||||||
tooltipProps: tooltipPercentTotal,
|
tooltipProps: tooltipPercentTotal,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{options.showDockerMemory && dockerMemData.length > 0 && (
|
{options.showDockerMemory && dockerMemData.length > 0 && (
|
||||||
<BeszelChartPanel
|
<BeszelChartPanel
|
||||||
title={t("chart.dockerMemory.title")}
|
title={t("chart.dockerMemory.title")}
|
||||||
subtitle={t("chart.dockerMemory.subtitle")}
|
subtitle={t("chart.dockerMemory.subtitle")}
|
||||||
chartProps={{
|
chartProps={{
|
||||||
h: CHART_HEIGHT,
|
h: CHART_HEIGHT,
|
||||||
data: dockerMemData,
|
data: dockerMemData,
|
||||||
type: "stacked",
|
type: "stacked",
|
||||||
series: containerSeries,
|
series: containerSeries,
|
||||||
yAxisFormatter: chartAxisFormatters.bytes,
|
yAxisFormatter: chartAxisFormatters.bytes,
|
||||||
tooltipProps: tooltipBytesTotal,
|
tooltipProps: tooltipBytesTotal,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{options.showDockerNetwork && dockerNetData.length > 0 && (
|
{options.showDockerNetwork && dockerNetData.length > 0 && (
|
||||||
<BeszelChartPanel
|
<BeszelChartPanel
|
||||||
title={t("chart.dockerNetwork.title")}
|
title={t("chart.dockerNetwork.title")}
|
||||||
subtitle={t("chart.dockerNetwork.subtitle")}
|
subtitle={t("chart.dockerNetwork.subtitle")}
|
||||||
chartProps={{
|
chartProps={{
|
||||||
h: CHART_HEIGHT,
|
h: CHART_HEIGHT,
|
||||||
data: dockerNetData,
|
data: dockerNetData,
|
||||||
series: containerSeries,
|
series: containerSeries,
|
||||||
yAxisFormatter: chartAxisFormatters.rate,
|
yAxisFormatter: chartAxisFormatters.rate,
|
||||||
tooltipProps: tooltipRate,
|
tooltipProps: tooltipRate,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,11 @@ export default function BeszelSystemTableWidget({
|
|||||||
}: WidgetComponentProps<"beszelSystemTable">) {
|
}: WidgetComponentProps<"beszelSystemTable">) {
|
||||||
const t = useScopedI18n("widget.beszelSystemTable");
|
const t = useScopedI18n("widget.beszelSystemTable");
|
||||||
const { openModal } = useModalAction(BeszelSystemStatsModal);
|
const { openModal } = useModalAction(BeszelSystemStatsModal);
|
||||||
const { data: results = [], error: systemsError, isPending } = clientApi.widget.beszel.getSystems.useQuery(
|
const {
|
||||||
|
data: results = [],
|
||||||
|
error: systemsError,
|
||||||
|
isPending,
|
||||||
|
} = clientApi.widget.beszel.getSystems.useQuery(
|
||||||
{ integrationIds },
|
{ integrationIds },
|
||||||
{ staleTime: 5_000, refetchInterval: 5_000, retry: false },
|
{ staleTime: 5_000, refetchInterval: 5_000, retry: false },
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -19,11 +19,7 @@ export function BeszelIntegrationErrorIndicator({ results }: BeszelIntegrationEr
|
|||||||
const label = failed.map((r) => r.integrationName ?? r.integrationId).join(", ");
|
const label = failed.map((r) => r.integrationName ?? r.integrationId).join(", ");
|
||||||
return (
|
return (
|
||||||
<Tooltip label={label} position="left" withArrow>
|
<Tooltip label={label} position="left" withArrow>
|
||||||
<IconAlertTriangle
|
<IconAlertTriangle size={14} color="var(--mantine-color-orange-6)" style={{ cursor: "help", flexShrink: 0 }} />
|
||||||
size={14}
|
|
||||||
color="var(--mantine-color-orange-6)"
|
|
||||||
style={{ cursor: "help", flexShrink: 0 }}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user