feat!: release v2 (#6545)
Co-authored-by: Artur <145776561+arturict@users.noreply.github.com> Co-authored-by: arturict <arturict@users.noreply.github.com> Co-authored-by: Thomas <thomas@ajnart.fr> Co-authored-by: Afonso Jorge Ramos <afonsojorgeramos@gmail.com> Co-authored-by: Danura30082 <danura30082+github@gmail.com> Co-authored-by: Kushie <122986913+kushiemoon-dev@users.noreply.github.com> Co-authored-by: ajnart <thomas@ajnart.fr> Co-authored-by: ajnart <thomas@ajnart.dev> Co-authored-by: chenjun <chenjun@foxmail.com> Co-authored-by: Wikibear <wikibear@users.noreply.github.com> Co-authored-by: Bergasha <bergasha@gmail.com> Co-authored-by: leafyelin <43306196+leafyelin@users.noreply.github.com> Co-authored-by: Lucas Araujo <lucas.lra@gmail.com> Co-authored-by: GreenMonito <86085570+GreenMonito@users.noreply.github.com> Co-authored-by: Nerdy-Technician <roffo@nerdy-technician.social> Co-authored-by: Jun <34545896+jcstrong@users.noreply.github.com> Co-authored-by: Edmond Abraham <54119952+gitedmond@users.noreply.github.com> Co-authored-by: thrawnx <tight.bulb9384@fastmail.com> Co-authored-by: Chris <58918656+nordada@users.noreply.github.com> Co-authored-by: yi111 <153097222+Yi-111-a@users.noreply.github.com> Co-authored-by: Yanis <naamaneyanis@gmail.com> Co-authored-by: Wikibear <me@sej.de> Co-authored-by: alessiottavo <93441886+alessiottavo@users.noreply.github.com>
This commit is contained in:
3286 files changed
+284386
-139176
No files matched your search
@@ -0,0 +1,484 @@
|
||||
"use client";
|
||||
|
||||
import type { CSSProperties } from "react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
ActionIcon,
|
||||
Avatar,
|
||||
Button,
|
||||
Checkbox,
|
||||
Group,
|
||||
Popover,
|
||||
ScrollArea,
|
||||
Stack,
|
||||
Switch,
|
||||
Text,
|
||||
Tooltip,
|
||||
} from "@mantine/core";
|
||||
import { IconArrowDown, IconArrowUp, IconRefresh, IconAdjustments } from "@tabler/icons-react";
|
||||
|
||||
import { useRequiredBoard } from "@homarr/boards/context";
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
import { useWidgetRuntimeActions } from "../runtime-hooks";
|
||||
import { statsEntriesSchema } from "./config";
|
||||
import { StatsTable } from "./table";
|
||||
import type { StatsTableRow } from "./table";
|
||||
import { StatsDetails } from "./details";
|
||||
import { formatStatsValue } from "./format";
|
||||
import { StatsLoading } from "./loading";
|
||||
import classes from "./stats.module.css";
|
||||
|
||||
export default function StatsWidget({
|
||||
integrationIds,
|
||||
widgetRuntimeRef,
|
||||
isEditMode,
|
||||
options,
|
||||
width,
|
||||
displayMode,
|
||||
displayScale = 1,
|
||||
}: WidgetComponentProps<"stats">) {
|
||||
const board = useRequiredBoard();
|
||||
const advanced = displayMode === "advanced";
|
||||
const t = useI18n("widget.stats");
|
||||
const utils = clientApi.useUtils();
|
||||
const [refreshing, setRefreshing] = useState(0);
|
||||
const refreshErrors = useRef(new Map<string, number | null>());
|
||||
const [localTable, setLocalTable] = useState<boolean>();
|
||||
const table = advanced || (localTable ?? options.table);
|
||||
const [localRows, setLocalRows] = useState<boolean>();
|
||||
const [localPlain, setPlain] = useState<boolean>();
|
||||
const [compact, setCompact] = useState<boolean>();
|
||||
const [hidden, setHidden] = useState<string[]>([]);
|
||||
const [order, setOrder] = useState<string[]>([]);
|
||||
const [settingsOpen, setSettingsOpen] = useState(false);
|
||||
const [detailsId, setDetailsId] = useState<string | null>(null);
|
||||
const rows = localRows ?? options.rows;
|
||||
const plain = localPlain ?? options.plain;
|
||||
const pending = useRef(new Set<string>());
|
||||
const retry = useRef(new Map<string, number>());
|
||||
const entries = statsEntriesSchema.safeParse(options.entries).data ?? [];
|
||||
const orderedEntries = entries.toSorted((a, b) => {
|
||||
const position = (id: string) => {
|
||||
const index = order.indexOf(id);
|
||||
if (index >= 0) return index;
|
||||
return order.length + entries.findIndex((entry) => entry.id === id);
|
||||
};
|
||||
return position(a.id) - position(b.id);
|
||||
});
|
||||
const visibleEntries = orderedEntries.filter((entry) => !entry.hidden && !hidden.includes(entry.id));
|
||||
const ids = [...new Set(integrationIds)];
|
||||
// Queries are per integration instance, never per metric. Click and advanced details reuse these snapshots.
|
||||
const visibleIds = ids.filter((id) => advanced || visibleEntries.some((entry) => entry.integrationId === id));
|
||||
const catalogs = clientApi.useQueries((api) =>
|
||||
ids.map((integrationId) => api.widget.stats.catalog({ integrationId }, { staleTime: 60_000, retry: false })),
|
||||
);
|
||||
const snapshots = clientApi.useQueries((api) =>
|
||||
visibleIds.map((integrationId) =>
|
||||
api.widget.stats.snapshot(
|
||||
{ integrationId },
|
||||
{
|
||||
staleTime: 30_000,
|
||||
refetchInterval: 60_000,
|
||||
refetchOnWindowFocus: true,
|
||||
refetchIntervalInBackground: false,
|
||||
retry: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
const hasRefreshError = (integrationId: string) => {
|
||||
const failedSnapshotAt = refreshErrors.current.get(integrationId);
|
||||
if (failedSnapshotAt === undefined) return false;
|
||||
const updatedAt = utils.widget.stats.snapshot.getData({ integrationId })?.updatedAt;
|
||||
if (updatedAt == null) return true;
|
||||
// A different widget or browser may have recovered this shared source after our transport failure.
|
||||
if (failedSnapshotAt === null) return false;
|
||||
return updatedAt <= failedSnapshotAt;
|
||||
};
|
||||
|
||||
const refresh = useCallback(
|
||||
async (integrationId: string, force: boolean) => {
|
||||
if (pending.current.has(integrationId)) return;
|
||||
if (!force && (retry.current.get(integrationId) ?? 0) > Date.now()) return;
|
||||
const previousUpdatedAt = utils.widget.stats.snapshot.getData({ integrationId })?.updatedAt ?? null;
|
||||
pending.current.add(integrationId);
|
||||
refreshErrors.current.delete(integrationId);
|
||||
setRefreshing((value) => value + 1);
|
||||
try {
|
||||
const result = await utils.client.widget.stats.refresh.mutate({ integrationId, force });
|
||||
await utils.widget.stats.snapshot.cancel({ integrationId });
|
||||
utils.widget.stats.snapshot.setData({ integrationId }, result);
|
||||
retry.current.set(integrationId, Date.now() + 60_000);
|
||||
} catch {
|
||||
refreshErrors.current.set(integrationId, previousUpdatedAt);
|
||||
retry.current.set(integrationId, Date.now() + 60_000);
|
||||
await utils.widget.stats.snapshot.invalidate({ integrationId });
|
||||
} finally {
|
||||
pending.current.delete(integrationId);
|
||||
setRefreshing((value) => value - 1);
|
||||
}
|
||||
},
|
||||
[utils],
|
||||
);
|
||||
|
||||
const refreshSources = async () => {
|
||||
await Promise.all(visibleIds.map((id) => refresh(id, true)));
|
||||
};
|
||||
useWidgetRuntimeActions(widgetRuntimeRef, {
|
||||
refresh: refreshSources,
|
||||
getDataStatus: () => {
|
||||
// Read the cache at invocation time: the menu can finish refreshing before React commits our next render.
|
||||
const currentSnapshots = visibleIds.map((integrationId) =>
|
||||
utils.widget.stats.snapshot.getData({ integrationId }),
|
||||
);
|
||||
const timestamps = currentSnapshots.flatMap((snapshot) => {
|
||||
if (snapshot?.updatedAt == null) return [];
|
||||
return [snapshot.updatedAt];
|
||||
});
|
||||
let updatedAt: number | null = null;
|
||||
if (timestamps.length > 0) updatedAt = Math.min(...timestamps);
|
||||
return {
|
||||
updatedAt,
|
||||
hasError:
|
||||
visibleIds.some(hasRefreshError) ||
|
||||
currentSnapshots.some((snapshot) => !!snapshot?.error) ||
|
||||
snapshots.some((snapshot) => !!snapshot.error),
|
||||
isRefreshing: pending.current.size > 0,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (document.hidden) return;
|
||||
for (const [index, integrationId] of visibleIds.entries()) {
|
||||
const snapshot = snapshots[index];
|
||||
if (!snapshot?.data || snapshot.error) continue;
|
||||
if (snapshot.data.updatedAt === null && snapshot.data.retryAt <= Date.now()) void refresh(integrationId, false);
|
||||
}
|
||||
}, [visibleIds, snapshots, refresh]);
|
||||
|
||||
const tableEntries = advanced
|
||||
? ids.flatMap((id) => {
|
||||
const catalog = catalogs[ids.indexOf(id)]?.data;
|
||||
if (!catalog) return [{ id, integrationId: id, metric: "", label: "", compact: false }];
|
||||
return catalog.metrics.map((metric) => ({
|
||||
id: `${id}:${metric.key}`,
|
||||
integrationId: id,
|
||||
metric: metric.key,
|
||||
label: metric.label,
|
||||
compact: false,
|
||||
}));
|
||||
})
|
||||
: visibleEntries;
|
||||
const tableRecords: StatsTableRow[] = tableEntries.map((entry) => {
|
||||
const catalog = catalogs[ids.indexOf(entry.integrationId)];
|
||||
const snapshot = snapshots[visibleIds.indexOf(entry.integrationId)];
|
||||
const metric = catalog?.data?.metrics.find((item) => item.key === entry.metric);
|
||||
const refreshFailed = !!snapshot?.error || hasRefreshError(entry.integrationId);
|
||||
const unavailable =
|
||||
!ids.includes(entry.integrationId) ||
|
||||
(!!catalog?.error && !catalog.data) ||
|
||||
(!!snapshot?.error && !snapshot.data) ||
|
||||
(!!catalog?.data && !metric);
|
||||
const loading =
|
||||
!unavailable && !refreshFailed && !snapshot?.data?.error && (snapshot?.data?.updatedAt == null || !metric);
|
||||
let value = "—";
|
||||
let status = "";
|
||||
if (snapshot?.data && metric)
|
||||
value = formatStatsValue(snapshot.data.values[entry.metric], metric.unit, compact ?? entry.compact);
|
||||
if (refreshFailed) status = t("refreshFailed");
|
||||
if (snapshot?.data?.error) status = t("refreshFailed");
|
||||
if ((refreshFailed || snapshot?.data?.error) && snapshot?.data?.updatedAt == null) status = t("fetchFailed");
|
||||
if (unavailable) {
|
||||
value = t("unavailable");
|
||||
status = t("unavailable");
|
||||
}
|
||||
return {
|
||||
id: entry.id,
|
||||
integrationId: entry.integrationId,
|
||||
source: catalog?.data?.name ?? "",
|
||||
iconUrl: catalog?.data?.iconUrl,
|
||||
metric: entry.label || metric?.label || entry.metric,
|
||||
value,
|
||||
status,
|
||||
loading,
|
||||
};
|
||||
});
|
||||
|
||||
let physicalWidth = width;
|
||||
if (!advanced && Number.isFinite(displayScale) && displayScale > 0) physicalWidth *= displayScale;
|
||||
let minimumWidth = 150;
|
||||
if (rows) minimumWidth = 200;
|
||||
if (advanced) minimumWidth = 280;
|
||||
let itemCount = visibleEntries.length;
|
||||
if (advanced) itemCount = ids.length;
|
||||
const columns = Math.max(1, Math.min(itemCount, Math.floor(physicalWidth / minimumWidth)));
|
||||
let gap = 8;
|
||||
if (options.spacing === "sm") gap = 12;
|
||||
if (options.spacing === "md") gap = 16;
|
||||
const rootStyle = { "--stats-radius": `var(--mantine-radius-${board.itemRadius})` } as CSSProperties;
|
||||
if (!advanced && displayScale > 1) {
|
||||
Object.assign(rootStyle, { "--mantine-scale": 1 / displayScale, "--board-canvas-ui-scale": 1 / displayScale });
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classes.root}
|
||||
data-advanced={advanced || undefined}
|
||||
data-table={table || undefined}
|
||||
data-rows={rows || undefined}
|
||||
data-plain={plain || undefined}
|
||||
style={rootStyle}
|
||||
>
|
||||
<div className={classes.toolbar}>
|
||||
<Popover opened={settingsOpen} onChange={setSettingsOpen} position="top-end" width={300} withinPortal trapFocus>
|
||||
<Popover.Target>
|
||||
<ActionIcon
|
||||
variant="default"
|
||||
size="sm"
|
||||
radius="xl"
|
||||
aria-label={t("viewOptions")}
|
||||
onClick={() => setSettingsOpen((value) => !value)}
|
||||
>
|
||||
<IconAdjustments size={13} />
|
||||
</ActionIcon>
|
||||
</Popover.Target>
|
||||
<Popover.Dropdown>
|
||||
<Stack gap="sm">
|
||||
<Text size="sm" fw={600}>
|
||||
{t("viewOptions")}
|
||||
</Text>
|
||||
<Text size="xs" c="dimmed">
|
||||
{t("localHelp")}
|
||||
</Text>
|
||||
{!advanced && (
|
||||
<Switch
|
||||
label={t("option.table.label")}
|
||||
checked={table}
|
||||
onChange={(event) => setLocalTable(event.currentTarget.checked)}
|
||||
/>
|
||||
)}
|
||||
<Switch
|
||||
disabled={table}
|
||||
label={t("option.rows.label")}
|
||||
checked={rows}
|
||||
onChange={(event) => setLocalRows(event.currentTarget.checked)}
|
||||
/>
|
||||
<Switch
|
||||
disabled={table}
|
||||
label={t("plain")}
|
||||
checked={plain}
|
||||
onChange={(event) => setPlain(event.currentTarget.checked)}
|
||||
/>
|
||||
<Switch
|
||||
label={t("compact")}
|
||||
checked={compact ?? (!advanced && entries.every((entry) => entry.compact))}
|
||||
onChange={(event) => setCompact(event.currentTarget.checked)}
|
||||
/>
|
||||
{!advanced && (
|
||||
<ScrollArea.Autosize mah={240}>
|
||||
<Stack gap={8}>
|
||||
{orderedEntries
|
||||
.filter((entry) => !entry.hidden)
|
||||
.map((entry, index, displayed) => {
|
||||
const catalog = catalogs[ids.indexOf(entry.integrationId)]?.data;
|
||||
const label =
|
||||
entry.label ||
|
||||
catalog?.metrics.find((item) => item.key === entry.metric)?.label ||
|
||||
entry.metric;
|
||||
const move = (delta: number) => {
|
||||
const next = [...orderedEntries];
|
||||
const currentIndex = next.findIndex((item) => item.id === entry.id);
|
||||
const neighbor = displayed[index + delta];
|
||||
if (!neighbor) return;
|
||||
const targetIndex = next.findIndex((item) => item.id === neighbor.id);
|
||||
next.splice(currentIndex, 1);
|
||||
next.splice(targetIndex, 0, entry);
|
||||
setOrder(next.map((item) => item.id));
|
||||
};
|
||||
return (
|
||||
<Group key={entry.id} gap={6} wrap="nowrap">
|
||||
<Checkbox
|
||||
style={{ flex: 1 }}
|
||||
size="xs"
|
||||
label={label}
|
||||
checked={!hidden.includes(entry.id)}
|
||||
onChange={(event) => {
|
||||
if (event.currentTarget.checked)
|
||||
setHidden((values) => values.filter((id) => id !== entry.id));
|
||||
else setHidden((values) => [...values, entry.id]);
|
||||
}}
|
||||
/>
|
||||
<ActionIcon
|
||||
variant="subtle"
|
||||
size="xs"
|
||||
aria-label={`${t("moveUp")}: ${label}`}
|
||||
disabled={index === 0}
|
||||
onClick={() => move(-1)}
|
||||
>
|
||||
<IconArrowUp size={12} />
|
||||
</ActionIcon>
|
||||
<ActionIcon
|
||||
variant="subtle"
|
||||
size="xs"
|
||||
aria-label={`${t("moveDown")}: ${label}`}
|
||||
disabled={index === displayed.length - 1}
|
||||
onClick={() => move(1)}
|
||||
>
|
||||
<IconArrowDown size={12} />
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
);
|
||||
})}
|
||||
</Stack>
|
||||
</ScrollArea.Autosize>
|
||||
)}
|
||||
<Button
|
||||
variant="subtle"
|
||||
size="xs"
|
||||
onClick={() => {
|
||||
setLocalTable(undefined);
|
||||
setLocalRows(undefined);
|
||||
setPlain(undefined);
|
||||
setCompact(undefined);
|
||||
setHidden([]);
|
||||
setOrder([]);
|
||||
}}
|
||||
>
|
||||
{t("resetView")}
|
||||
</Button>
|
||||
</Stack>
|
||||
</Popover.Dropdown>
|
||||
</Popover>
|
||||
<Tooltip label={t("refresh")} events={{ hover: true, focus: true, touch: true }}>
|
||||
<ActionIcon
|
||||
variant="default"
|
||||
size="sm"
|
||||
radius="xl"
|
||||
aria-label={t("refresh")}
|
||||
loading={refreshing > 0}
|
||||
onClick={() => void refreshSources()}
|
||||
>
|
||||
<IconRefresh size={13} />
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{!table && visibleEntries.length === 0 && (
|
||||
<Text size="xs" c="dimmed" ta="center" p="md">
|
||||
{entries.length > 0 ? t("allHidden") : t("empty")}
|
||||
</Text>
|
||||
)}
|
||||
{table && <StatsTable records={tableRecords} showIcon={options.showIcon} isEditMode={isEditMode} />}
|
||||
{!table && (
|
||||
<ScrollArea h="100%" type="hover" offsetScrollbars>
|
||||
<div className={classes.grid} style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`, gap }}>
|
||||
{!advanced &&
|
||||
visibleEntries.map((entry) => {
|
||||
const catalog = catalogs[ids.indexOf(entry.integrationId)];
|
||||
const snapshot = snapshots[visibleIds.indexOf(entry.integrationId)];
|
||||
const metric = catalog?.data?.metrics.find((item) => item.key === entry.metric);
|
||||
const refreshFailed = !!snapshot?.error || hasRefreshError(entry.integrationId);
|
||||
const unavailable =
|
||||
!ids.includes(entry.integrationId) ||
|
||||
(!!catalog?.error && !catalog.data) ||
|
||||
(!!snapshot?.error && !snapshot.data);
|
||||
const loading =
|
||||
!unavailable &&
|
||||
!(catalog?.data && !metric) &&
|
||||
!refreshFailed &&
|
||||
!snapshot?.data?.error &&
|
||||
(snapshot?.data?.updatedAt == null || !metric);
|
||||
let value = "—";
|
||||
if (unavailable || (catalog?.data && !metric)) value = t("unavailable");
|
||||
else if (snapshot?.data && metric)
|
||||
value = formatStatsValue(snapshot.data.values[entry.metric], metric.unit, compact ?? entry.compact);
|
||||
const label = entry.label || metric?.label || entry.metric;
|
||||
const sourceName = catalog?.data?.name ?? "";
|
||||
let accessibleValue = value;
|
||||
if (loading) accessibleValue = t("loading");
|
||||
let loaderSize = 26;
|
||||
if (rows) loaderSize = 18;
|
||||
let loaderIcon: string | undefined;
|
||||
if (options.showIcon) loaderIcon = catalog?.data?.iconUrl;
|
||||
let status = "";
|
||||
if (refreshFailed) status = t("refreshFailed");
|
||||
if (snapshot?.data?.error) status = t("refreshFailed");
|
||||
if ((refreshFailed || snapshot?.data?.error) && snapshot?.data?.updatedAt == null)
|
||||
status = t("fetchFailed");
|
||||
if (unavailable) status = t("unavailable");
|
||||
return (
|
||||
<Popover
|
||||
key={entry.id}
|
||||
opened={detailsId === entry.id}
|
||||
onChange={(opened) => {
|
||||
if (!opened) setDetailsId(null);
|
||||
}}
|
||||
withArrow
|
||||
width="min(360px, calc(100vw - 32px))"
|
||||
withinPortal
|
||||
trapFocus
|
||||
>
|
||||
<Popover.Target>
|
||||
<button
|
||||
type="button"
|
||||
className={classes.card}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setDetailsId((current) => {
|
||||
if (current === entry.id) return null;
|
||||
return entry.id;
|
||||
});
|
||||
}}
|
||||
aria-label={`${label}: ${accessibleValue}. ${sourceName}. ${status}`}
|
||||
aria-busy={loading}
|
||||
>
|
||||
{options.showIcon && catalog?.data && !loading && (
|
||||
<Avatar
|
||||
className={classes.icon}
|
||||
src={catalog.data.iconUrl}
|
||||
size={12}
|
||||
radius={3}
|
||||
alt={sourceName}
|
||||
name={sourceName}
|
||||
imageProps={{ referrerPolicy: "no-referrer" }}
|
||||
styles={{ image: { objectFit: "contain" } }}
|
||||
/>
|
||||
)}
|
||||
<div className={classes.main}>
|
||||
<Text component="div" className={classes.value}>
|
||||
{loading && <StatsLoading iconUrl={loaderIcon} source={sourceName} size={loaderSize} />}
|
||||
{!loading && value}
|
||||
</Text>
|
||||
<Text className={classes.label} lineClamp={2}>
|
||||
{label}
|
||||
</Text>
|
||||
</div>
|
||||
</button>
|
||||
</Popover.Target>
|
||||
<Popover.Dropdown className={classes.details} onClick={(event) => event.stopPropagation()}>
|
||||
{catalog?.data && (
|
||||
<StatsDetails
|
||||
catalog={catalog.data}
|
||||
snapshot={snapshot?.data}
|
||||
selected={entry.metric}
|
||||
showIcon={options.showIcon}
|
||||
unavailable={unavailable}
|
||||
refreshFailed={refreshFailed}
|
||||
/>
|
||||
)}
|
||||
{!catalog?.data && unavailable && t("unavailable")}
|
||||
{!catalog?.data && !unavailable && <StatsLoading />}
|
||||
</Popover.Dropdown>
|
||||
</Popover>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</ScrollArea>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const statsEntrySchema = z.object({
|
||||
id: z.string().min(1).max(128),
|
||||
integrationId: z.string().min(1).max(128),
|
||||
metric: z.string().min(1).max(128),
|
||||
label: z.string().max(128).default(""),
|
||||
hidden: z.boolean().default(false),
|
||||
compact: z.boolean().default(false),
|
||||
});
|
||||
export const statsEntriesSchema = z
|
||||
.array(statsEntrySchema)
|
||||
.max(100)
|
||||
.refine((entries) => new Set(entries.map((entry) => entry.id)).size === entries.length, {
|
||||
message: "Metric entry identifiers must be unique",
|
||||
});
|
||||
export type StatsEntry = z.infer<typeof statsEntrySchema>;
|
||||
@@ -0,0 +1,91 @@
|
||||
import { Avatar, Group, Text } from "@mantine/core";
|
||||
|
||||
import type { RouterOutputs } from "@homarr/api";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import { formatStatsValue } from "./format";
|
||||
import { StatsLoading } from "./loading";
|
||||
import classes from "./stats.module.css";
|
||||
|
||||
export type StatsCatalog = RouterOutputs["widget"]["stats"]["catalog"];
|
||||
export type StatsSnapshot = RouterOutputs["widget"]["stats"]["snapshot"];
|
||||
|
||||
export function StatsDetails({
|
||||
catalog,
|
||||
snapshot,
|
||||
selected,
|
||||
compact = false,
|
||||
showIcon = true,
|
||||
unavailable = false,
|
||||
refreshFailed = false,
|
||||
}: {
|
||||
catalog: StatsCatalog;
|
||||
snapshot?: StatsSnapshot;
|
||||
selected?: string;
|
||||
compact?: boolean;
|
||||
showIcon?: boolean;
|
||||
unavailable?: boolean;
|
||||
refreshFailed?: boolean;
|
||||
}) {
|
||||
const t = useI18n("widget.stats");
|
||||
let metrics = catalog.metrics;
|
||||
if (selected) {
|
||||
metrics = [
|
||||
...catalog.metrics.filter((metric) => metric.key === selected),
|
||||
...catalog.metrics.filter((metric) => metric.key !== selected),
|
||||
].slice(0, 8);
|
||||
}
|
||||
const remaining = catalog.metrics.length - metrics.length;
|
||||
let status = "";
|
||||
if (snapshot?.error || refreshFailed) status = t("refreshFailed");
|
||||
if ((snapshot?.error || refreshFailed) && snapshot?.updatedAt == null) status = t("fetchFailed");
|
||||
if (unavailable) status = t("unavailable");
|
||||
const loading = !unavailable && !refreshFailed && !snapshot?.error && snapshot?.updatedAt == null;
|
||||
let loaderIcon: string | undefined;
|
||||
if (showIcon) loaderIcon = catalog.iconUrl;
|
||||
return (
|
||||
<div className={classes.providerDetails}>
|
||||
<Group gap={8} wrap="nowrap" mb={12}>
|
||||
{showIcon && (
|
||||
<Avatar
|
||||
src={catalog.iconUrl}
|
||||
size={12}
|
||||
radius={2}
|
||||
alt=""
|
||||
imageProps={{ referrerPolicy: "no-referrer" }}
|
||||
styles={{ image: { objectFit: "contain" } }}
|
||||
/>
|
||||
)}
|
||||
<Text size="xs" fw={600} truncate>
|
||||
{catalog.name}
|
||||
</Text>
|
||||
</Group>
|
||||
<dl className={classes.metrics}>
|
||||
{metrics.map((metric) => {
|
||||
let value = "—";
|
||||
if (snapshot) value = formatStatsValue(snapshot.values[metric.key], metric.unit, compact);
|
||||
if (unavailable) value = t("unavailable");
|
||||
return (
|
||||
<div key={metric.key} className={classes.metricRow} data-selected={metric.key === selected || undefined}>
|
||||
<dt>{metric.label}</dt>
|
||||
<dd aria-busy={loading}>
|
||||
{loading && <StatsLoading iconUrl={loaderIcon} source={catalog.name} size={18} />}
|
||||
{!loading && value}
|
||||
</dd>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</dl>
|
||||
{remaining > 0 && (
|
||||
<Text size="xs" c="dimmed" mt={10}>
|
||||
{t("moreMetrics", { count: remaining })}
|
||||
</Text>
|
||||
)}
|
||||
{status && (
|
||||
<Text size="xs" c="orange" mt={10}>
|
||||
{status}
|
||||
</Text>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import type { StatsUnit, StatsValue } from "@homarr/integrations/stats";
|
||||
|
||||
export const formatStatsValue = (value: StatsValue | undefined, unit: StatsUnit, compact: boolean) => {
|
||||
if (value === null || value === undefined) return "—";
|
||||
if (typeof value !== "number") return String(value);
|
||||
if (!Number.isFinite(value)) return "—";
|
||||
const options: Intl.NumberFormatOptions = { maximumFractionDigits: 2 };
|
||||
if (compact) options.notation = "compact";
|
||||
if (unit === "bytes" || unit === "bytesPerSecond") {
|
||||
let scaled = value;
|
||||
const units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
|
||||
let index = 0;
|
||||
while (Math.abs(scaled) >= 1024 && index < units.length - 1) {
|
||||
scaled /= 1024;
|
||||
index += 1;
|
||||
}
|
||||
let suffix = units[index];
|
||||
if (unit === "bytesPerSecond") suffix += "/s";
|
||||
return `${new Intl.NumberFormat(undefined, options).format(scaled)} ${suffix}`;
|
||||
}
|
||||
const formatted = new Intl.NumberFormat(undefined, options).format(value);
|
||||
if (unit === "percent") return `${formatted}%`;
|
||||
if (unit === "seconds") return `${formatted} s`;
|
||||
if (unit === "milliseconds") return `${formatted} ms`;
|
||||
if (unit === "grams") return `${formatted} g`;
|
||||
return formatted;
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
import { IconChartBar } from "@tabler/icons-react";
|
||||
|
||||
import { getWidgetIntegrationConfig } from "@homarr/definitions";
|
||||
|
||||
import { createWidgetDefinition } from "../definition";
|
||||
import { optionsBuilder } from "../options";
|
||||
import { statsEntriesSchema } from "./config";
|
||||
|
||||
export const { definition, componentLoader } = createWidgetDefinition("stats", {
|
||||
icon: IconChartBar,
|
||||
supportsAdvancedFocus: true,
|
||||
...getWidgetIntegrationConfig("stats"),
|
||||
refetchInterval: null,
|
||||
createOptions() {
|
||||
return optionsBuilder.from(
|
||||
(factory) => ({
|
||||
entries: factory.statsEntries(),
|
||||
table: factory.switch({ defaultValue: false }),
|
||||
rows: factory.switch({ defaultValue: false }),
|
||||
plain: factory.switch({ defaultValue: false }),
|
||||
showIcon: factory.switch({ defaultValue: true }),
|
||||
spacing: factory.select({
|
||||
options: (["xs", "sm", "md"] as const).map((value) => ({
|
||||
value,
|
||||
label: (t) => t(`widget.stats.option.spacing.option.${value}.label`),
|
||||
})),
|
||||
defaultValue: "xs",
|
||||
}),
|
||||
}),
|
||||
undefined,
|
||||
(options, ctx) => {
|
||||
const result = statsEntriesSchema.safeParse(options.entries);
|
||||
if (!result.success)
|
||||
ctx.addIssue({ code: "custom", path: ["entries"], message: "Invalid statistics configuration" });
|
||||
},
|
||||
);
|
||||
},
|
||||
}).withDynamicImport(() => import("./component"));
|
||||
@@ -0,0 +1,28 @@
|
||||
.root {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
vertical-align: middle;
|
||||
isolation: isolate;
|
||||
}
|
||||
|
||||
.image {
|
||||
animation: reveal 180ms ease-out both;
|
||||
}
|
||||
|
||||
@keyframes reveal {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.image {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { Avatar, Box } from "@mantine/core";
|
||||
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import classes from "./loading.module.css";
|
||||
|
||||
export function StatsLoading({ iconUrl, source, size = 20 }: { iconUrl?: string; source?: string; size?: number }) {
|
||||
const t = useI18n("widget.stats");
|
||||
let label = t("loading");
|
||||
if (source) label = `${source}: ${label}`;
|
||||
|
||||
return (
|
||||
<Box component="output" w={size} h={size} className={classes.root} aria-label={label}>
|
||||
<Avatar
|
||||
component="span"
|
||||
classNames={{ image: classes.image }}
|
||||
src={iconUrl}
|
||||
size="64%"
|
||||
radius={0}
|
||||
variant="transparent"
|
||||
alt=""
|
||||
aria-hidden="true"
|
||||
imageProps={{ referrerPolicy: "no-referrer" }}
|
||||
styles={{ image: { objectFit: "contain" } }}
|
||||
>
|
||||
<span />
|
||||
</Avatar>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
.root {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
padding: calc(8px * var(--mantine-scale));
|
||||
}
|
||||
.grid {
|
||||
padding: 2px;
|
||||
display: grid;
|
||||
align-content: start;
|
||||
}
|
||||
.card {
|
||||
border: 0;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
container-type: inline-size;
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
min-height: calc(104px * var(--mantine-scale));
|
||||
padding: calc(22px * var(--mantine-scale)) calc(14px * var(--mantine-scale)) calc(14px * var(--mantine-scale));
|
||||
border-radius: var(--stats-radius, 12px);
|
||||
background: rgb(from var(--mantine-primary-color-filled) r g b / calc(var(--opacity, 1) * 0.08));
|
||||
outline: 1px solid transparent;
|
||||
outline-offset: -1px;
|
||||
transition:
|
||||
background 120ms ease,
|
||||
outline-color 120ms ease;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
.card:hover,
|
||||
.card:focus-visible {
|
||||
background: rgb(from var(--mantine-primary-color-filled) r g b / calc(var(--opacity, 1) * 0.14));
|
||||
outline-color: var(--mantine-primary-color-light);
|
||||
}
|
||||
.main {
|
||||
min-width: 0;
|
||||
text-align: center;
|
||||
}
|
||||
.value {
|
||||
font-size: clamp(calc(12px * var(--mantine-scale)), 26cqi, calc(27px * var(--mantine-scale)));
|
||||
font-weight: 650;
|
||||
font-variant-numeric: tabular-nums;
|
||||
letter-spacing: -0.035em;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.label {
|
||||
font-size: calc(11px * var(--mantine-scale));
|
||||
line-height: 1.35;
|
||||
opacity: 0.7;
|
||||
margin-top: calc(5px * var(--mantine-scale));
|
||||
min-height: calc(30px * var(--mantine-scale));
|
||||
}
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: calc(8px * var(--mantine-scale));
|
||||
right: calc(8px * var(--mantine-scale));
|
||||
opacity: 0.8;
|
||||
}
|
||||
.toolbar {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
bottom: 12px;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 120ms ease;
|
||||
}
|
||||
.root:hover .toolbar,
|
||||
.root:focus-within .toolbar {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.root[data-rows] .card {
|
||||
min-height: calc(44px * var(--mantine-scale));
|
||||
padding: calc(10px * var(--mantine-scale)) calc(24px * var(--mantine-scale)) calc(10px * var(--mantine-scale))
|
||||
calc(30px * var(--mantine-scale));
|
||||
}
|
||||
.root[data-rows] .main {
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.root[data-rows] .value {
|
||||
font-size: clamp(calc(14px * var(--mantine-scale)), 10cqi, calc(20px * var(--mantine-scale)));
|
||||
flex-shrink: 0;
|
||||
max-width: 65%;
|
||||
}
|
||||
.root[data-rows] .label {
|
||||
text-align: left;
|
||||
margin-top: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
.root[data-rows] .icon {
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
left: 10px;
|
||||
right: auto;
|
||||
}
|
||||
@media (hover: none) {
|
||||
.toolbar {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.card,
|
||||
.toolbar {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
.root[data-plain] .card,
|
||||
.root[data-plain] .provider {
|
||||
background: transparent;
|
||||
}
|
||||
.root[data-plain] .card {
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid var(--mantine-color-default-border);
|
||||
}
|
||||
.provider {
|
||||
min-width: 0;
|
||||
padding: 18px;
|
||||
border-radius: var(--stats-radius, 12px);
|
||||
background: var(--mantine-color-default);
|
||||
border: 1px solid var(--mantine-color-default-border);
|
||||
}
|
||||
.providerDetails {
|
||||
min-width: 0;
|
||||
text-align: left;
|
||||
}
|
||||
.metrics {
|
||||
margin: 0;
|
||||
}
|
||||
.metricRow {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
align-items: baseline;
|
||||
gap: 16px;
|
||||
padding: 9px 0;
|
||||
border-top: 1px solid var(--mantine-color-default-border);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.metricRow dt {
|
||||
color: var(--mantine-color-dimmed);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.metricRow dd {
|
||||
margin: 0;
|
||||
text-align: right;
|
||||
font-weight: 600;
|
||||
font-variant-numeric: tabular-nums;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.metricRow[data-selected] dt,
|
||||
.metricRow[data-selected] dd {
|
||||
color: var(--mantine-primary-color-light-color);
|
||||
font-weight: 700;
|
||||
}
|
||||
.details {
|
||||
background: var(--mantine-color-body);
|
||||
color: var(--mantine-color-text);
|
||||
border: 1px solid var(--mantine-color-default-border);
|
||||
box-shadow: var(--mantine-shadow-md);
|
||||
padding: 14px 16px;
|
||||
min-width: min(260px, calc(100vw - 32px));
|
||||
max-height: min(500px, calc(100vh - 32px));
|
||||
overflow-y: auto;
|
||||
}
|
||||
.root[data-advanced] .grid {
|
||||
align-items: start;
|
||||
padding: 8px 10px 44px;
|
||||
}
|
||||
.root[data-advanced] .metricRow dd {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.root[data-table] {
|
||||
padding-bottom: 38px;
|
||||
}
|
||||
.root[data-advanced][data-table] {
|
||||
padding-top: 40px;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
.columns {
|
||||
columns: 280px;
|
||||
column-gap: 14px;
|
||||
padding: 2px;
|
||||
}
|
||||
.group {
|
||||
break-inside: avoid;
|
||||
margin-bottom: 14px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--mantine-color-default-border);
|
||||
border-radius: var(--stats-radius, 10px);
|
||||
background: rgb(from var(--mantine-color-body) r g b / 0.35);
|
||||
}
|
||||
.heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border: 0;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
background: var(--mantine-primary-color-light);
|
||||
}
|
||||
.heading:focus-visible {
|
||||
outline: 2px solid var(--mantine-primary-color-filled);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
.chevron {
|
||||
flex-shrink: 0;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
.chevron[data-opened] {
|
||||
transform: none;
|
||||
}
|
||||
.group :global(td) .metric,
|
||||
.group :global(td) .value {
|
||||
white-space: normal;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.value {
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 1.3;
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { Avatar, Group, ScrollArea, Text } from "@mantine/core";
|
||||
import { IconChevronDown } from "@tabler/icons-react";
|
||||
|
||||
import type { DataTableColumn, DataTableProps } from "mantine-datatable";
|
||||
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import { HomarrDataTable } from "../common/homarr-data-table";
|
||||
import classes from "./table.module.css";
|
||||
import { StatsLoading } from "./loading";
|
||||
|
||||
export interface StatsTableRow {
|
||||
id: string;
|
||||
integrationId: string;
|
||||
source: string;
|
||||
iconUrl?: string;
|
||||
metric: string;
|
||||
value: string;
|
||||
status: string;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
interface StatsGroup {
|
||||
id: string;
|
||||
name: string;
|
||||
iconUrl?: string;
|
||||
metrics: StatsTableRow[];
|
||||
}
|
||||
|
||||
export function StatsTable({
|
||||
records,
|
||||
showIcon,
|
||||
isEditMode,
|
||||
}: {
|
||||
records: StatsTableRow[];
|
||||
showIcon: boolean;
|
||||
isEditMode: boolean;
|
||||
}) {
|
||||
const t = useI18n("widget.stats");
|
||||
const groups = useMemo(() => {
|
||||
const sources = new Map<string, StatsGroup>();
|
||||
for (const record of records) {
|
||||
let group = sources.get(record.integrationId);
|
||||
if (!group) {
|
||||
group = { id: record.integrationId, name: record.source, iconUrl: record.iconUrl, metrics: [] };
|
||||
sources.set(record.integrationId, group);
|
||||
}
|
||||
group.metrics.push(record);
|
||||
}
|
||||
return [...sources.values()];
|
||||
}, [records]);
|
||||
if (!groups.length)
|
||||
return (
|
||||
<Text size="xs" c="dimmed" ta="center" p="md">
|
||||
{t("empty")}
|
||||
</Text>
|
||||
);
|
||||
return (
|
||||
<ScrollArea h="100%" type="auto" offsetScrollbars>
|
||||
<div className={classes.columns}>
|
||||
{groups.map((group) => (
|
||||
<IntegrationTable key={group.id} group={group} showIcon={showIcon} isEditMode={isEditMode} />
|
||||
))}
|
||||
</div>
|
||||
</ScrollArea>
|
||||
);
|
||||
}
|
||||
|
||||
function IntegrationTable({
|
||||
group,
|
||||
showIcon,
|
||||
isEditMode,
|
||||
}: {
|
||||
group: StatsGroup;
|
||||
showIcon: boolean;
|
||||
isEditMode: boolean;
|
||||
}) {
|
||||
const [opened, setOpened] = useState(true);
|
||||
const expandedIds: string[] = [];
|
||||
if (opened) expandedIds.push(group.id);
|
||||
const columns = useMemo<DataTableColumn<StatsGroup>[]>(
|
||||
() => [
|
||||
{
|
||||
accessor: "name",
|
||||
width: 1,
|
||||
render: () => (
|
||||
<button
|
||||
type="button"
|
||||
className={classes.heading}
|
||||
aria-expanded={opened}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setOpened((current) => !current);
|
||||
}}
|
||||
>
|
||||
{showIcon && (
|
||||
<Avatar src={group.iconUrl} size={14} radius={2} alt="" imageProps={{ referrerPolicy: "no-referrer" }} />
|
||||
)}
|
||||
<Text component="div" size="xs" fw={650} truncate style={{ flex: 1 }}>
|
||||
{group.name || "—"}
|
||||
</Text>
|
||||
<Text component="span" size="xs" c="dimmed">
|
||||
{group.metrics.length}
|
||||
</Text>
|
||||
<IconChevronDown size={13} className={classes.chevron} data-opened={opened || undefined} />
|
||||
</button>
|
||||
),
|
||||
},
|
||||
],
|
||||
[group, opened, showIcon],
|
||||
);
|
||||
const renderMetrics = useCallback(
|
||||
() => <MetricsTable group={group} isEditMode={isEditMode} showIcon={showIcon} />,
|
||||
[group, isEditMode, showIcon],
|
||||
);
|
||||
const rowExpansion: DataTableProps<StatsGroup>["rowExpansion"] = {
|
||||
trigger: "never",
|
||||
expanded: { recordIds: expandedIds },
|
||||
content: renderMetrics,
|
||||
};
|
||||
return (
|
||||
<section className={classes.group} aria-label={group.name}>
|
||||
<HomarrDataTable<StatsGroup>
|
||||
isEditMode={isEditMode}
|
||||
height="auto"
|
||||
noHeader
|
||||
cellPadding="0"
|
||||
records={[group]}
|
||||
columns={columns}
|
||||
rowExpansion={rowExpansion}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
const renderMetric = (record: StatsTableRow) => (
|
||||
<div>
|
||||
<Text component="div" size="xs" c="dimmed" className={classes.metric}>
|
||||
{record.metric || "—"}
|
||||
</Text>
|
||||
{record.status && (
|
||||
<Text size="xs" c="orange" className={classes.metric}>
|
||||
{record.status}
|
||||
</Text>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
function MetricsTable({ group, isEditMode, showIcon }: { group: StatsGroup; isEditMode: boolean; showIcon: boolean }) {
|
||||
const t = useI18n("widget.stats");
|
||||
const renderValue = (record: StatsTableRow) => {
|
||||
let iconUrl: string | undefined;
|
||||
if (showIcon) iconUrl = record.iconUrl;
|
||||
return (
|
||||
<Group justify="flex-end" gap={0} aria-busy={record.loading}>
|
||||
{record.loading && <StatsLoading iconUrl={iconUrl} source={record.source} size={18} />}
|
||||
{!record.loading && (
|
||||
<Text size="sm" fw={600} className={classes.value}>
|
||||
{record.value}
|
||||
</Text>
|
||||
)}
|
||||
</Group>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<HomarrDataTable<StatsTableRow>
|
||||
isEditMode={isEditMode}
|
||||
height="auto"
|
||||
noHeader
|
||||
fz="xs"
|
||||
cellPadding="5px 12px"
|
||||
records={group.metrics}
|
||||
rowCursor="default"
|
||||
columns={[
|
||||
{ accessor: "metric", title: t("metric"), width: 180, render: renderMetric },
|
||||
{ accessor: "value", title: t("table.value"), width: 110, textAlign: "right", render: renderValue },
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user