style: auto-fix lint and format
This commit is contained in:
1 parent
5eebfb7719
commit
515b285ef7
14 files changed
+370
-223
No files matched your search
@@ -8,7 +8,6 @@ import dayjs from "dayjs";
|
||||
|
||||
import type { BeszelContainerStatsRecord, BeszelSystemStatsRecord } from "@homarr/integrations/types";
|
||||
|
||||
|
||||
const formatTime = (timestamp: string) => dayjs(timestamp).format("HH:mm");
|
||||
|
||||
const yAxisBase = { tickMargin: 0, tick: { fontSize: 10 } } as const;
|
||||
@@ -22,8 +21,14 @@ interface ChartPanelProps {
|
||||
export const ChartPanel = ({ title, subtitle, children }: ChartPanelProps) => (
|
||||
<Stack gap={4}>
|
||||
<Group gap="xs">
|
||||
<Text size="sm" fw={600}>{title}</Text>
|
||||
{subtitle && <Text size="xs" c="dimmed">{subtitle}</Text>}
|
||||
<Text size="sm" fw={600}>
|
||||
{title}
|
||||
</Text>
|
||||
{subtitle && (
|
||||
<Text size="xs" c="dimmed">
|
||||
{subtitle}
|
||||
</Text>
|
||||
)}
|
||||
</Group>
|
||||
{children}
|
||||
</Stack>
|
||||
@@ -41,7 +46,12 @@ export const BeszelAreaChart = ({ yAxisFormatter, yAxisDomain, yAxisProps, ...pr
|
||||
withDots={false}
|
||||
withXAxis
|
||||
withYAxis
|
||||
yAxisProps={{ ...yAxisBase, ...(yAxisDomain ? { domain: yAxisDomain } : {}), tickFormatter: yAxisFormatter, ...yAxisProps }}
|
||||
yAxisProps={{
|
||||
...yAxisBase,
|
||||
...(yAxisDomain ? { domain: yAxisDomain } : {}),
|
||||
tickFormatter: yAxisFormatter,
|
||||
...yAxisProps,
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
@@ -52,7 +62,7 @@ export const useSystemChartData = (
|
||||
) =>
|
||||
useMemo(() => {
|
||||
if (!systemStats) return [];
|
||||
return [...systemStats].reverse().map((r) => ({
|
||||
return [...systemStats].toReversed().map((r) => ({
|
||||
time: formatTime(r.created),
|
||||
...mapFn(r.stats),
|
||||
}));
|
||||
@@ -86,7 +96,7 @@ export const useDockerChartData = (
|
||||
useMemo(() => {
|
||||
if (!containerStats?.length) return [];
|
||||
const extract = defaultContainerExtractors[metric]!;
|
||||
return [...containerStats].reverse().map((record) => {
|
||||
return [...containerStats].toReversed().map((record) => {
|
||||
const point: Record<string, unknown> = { time: formatTime(record.created) };
|
||||
for (const name of containerNames) {
|
||||
point[name] = extract(record.stats.find((c) => c.n === name));
|
||||
|
||||
@@ -26,7 +26,19 @@ export const alertColorMap: Record<string, string> = {
|
||||
};
|
||||
|
||||
export const containerColors = [
|
||||
"blue.6", "teal.6", "orange.6", "grape.6", "cyan.6",
|
||||
"pink.6", "lime.6", "violet.6", "indigo.6", "yellow.6",
|
||||
"red.6", "green.6", "blue.4", "teal.4", "orange.4",
|
||||
"blue.6",
|
||||
"teal.6",
|
||||
"orange.6",
|
||||
"grape.6",
|
||||
"cyan.6",
|
||||
"pink.6",
|
||||
"lime.6",
|
||||
"violet.6",
|
||||
"indigo.6",
|
||||
"yellow.6",
|
||||
"red.6",
|
||||
"green.6",
|
||||
"blue.4",
|
||||
"teal.4",
|
||||
"orange.4",
|
||||
];
|
||||
@@ -78,9 +78,7 @@ const PortalTooltipContent = ({ active, label, payload, formatter, showTotal }:
|
||||
|
||||
if (!isActive) return null;
|
||||
|
||||
const sorted = [...(payload ?? [])]
|
||||
.filter((p) => p.value > 0)
|
||||
.sort((a, b) => b.value - a.value);
|
||||
const sorted = [...(payload ?? [])].filter((p) => p.value > 0).toSorted((a, b) => b.value - a.value);
|
||||
|
||||
if (!sorted.length) return null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user