Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc7a8579dc | ||
|
|
e617a47395 |
@@ -236,26 +236,23 @@ const SystemCharts = ({
|
|||||||
const labelDisplayMode = isAdvanced ? "textWithIcon" : options.labelDisplayMode;
|
const labelDisplayMode = isAdvanced ? "textWithIcon" : options.labelDisplayMode;
|
||||||
const chartCount = visibleCharts.length;
|
const chartCount = visibleCharts.length;
|
||||||
const chartColumns = useMemo(() => (isAdvanced ? getAdvancedChartColumns(width) : 1), [isAdvanced, width]);
|
const chartColumns = useMemo(() => (isAdvanced ? getAdvancedChartColumns(width) : 1), [isAdvanced, width]);
|
||||||
const chartGap = isAdvanced ? "xs" : 8;
|
const compactChartGap = 8;
|
||||||
|
const compactRowHeight = 56;
|
||||||
|
const chartHeight = isAdvanced
|
||||||
|
? 110
|
||||||
|
: Math.max(
|
||||||
|
28,
|
||||||
|
Math.min(compactRowHeight, (height - Math.max(0, chartCount - 1) * compactChartGap) / Math.max(1, chartCount)),
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// style={{height}}, not h={height} or h={`${height}px`} - Mantine's h prop runs numbers
|
<Stack gap={isAdvanced ? "xs" : compactChartGap} h="auto" miw={0}>
|
||||||
// (and even pixel *strings*, since its rem() converter strips a "px" suffix before checking
|
|
||||||
// whether the remainder is a parseable number) through rem() * var(--mantine-scale), which
|
|
||||||
// silently rescales the value again on top of the board's own zoom. Only calc()/percentage/
|
|
||||||
// non-numeric strings skip that path (why h="100%" below is safe) - a literal style.height
|
|
||||||
// is the only way to set an exact pixel value that isn't run through it.
|
|
||||||
<Stack gap={chartGap} style={{ height: `${height}px` }} miw={0}>
|
|
||||||
{showTitle && (
|
{showTitle && (
|
||||||
<Text size="sm" fw={600} truncate="end">
|
<Text size="sm" fw={600} truncate="end">
|
||||||
{integrationName}
|
{integrationName}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
{/* Divide the available height evenly across however many rows chartColumns wraps the
|
<SimpleGrid cols={chartColumns} spacing={isAdvanced ? "xs" : compactChartGap}>
|
||||||
charts into via CSS grid-auto-rows: 1fr, rather than computing a per-chart pixel height
|
|
||||||
in JS - keeps every chart's own sizing untouched (still h="100%" of its grid cell) and
|
|
||||||
needs no board-zoom-aware math of its own. */}
|
|
||||||
<SimpleGrid cols={chartColumns} spacing={chartGap} style={{ flex: 1, minHeight: 0, gridAutoRows: "1fr" }}>
|
|
||||||
{chartCount === 0 && (
|
{chartCount === 0 && (
|
||||||
<Center h="100%">
|
<Center h="100%">
|
||||||
<Text size="sm" c="dimmed">
|
<Text size="sm" c="dimmed">
|
||||||
@@ -264,7 +261,7 @@ const SystemCharts = ({
|
|||||||
</Center>
|
</Center>
|
||||||
)}
|
)}
|
||||||
{visibleCharts.includes("cpu") && (
|
{visibleCharts.includes("cpu") && (
|
||||||
<Box h="100%">
|
<Box h={chartHeight}>
|
||||||
<SystemResourceCPUChart
|
<SystemResourceCPUChart
|
||||||
cpuUsageOverTime={items.map((item) => item.cpu)}
|
cpuUsageOverTime={items.map((item) => item.cpu)}
|
||||||
hasShadow={options.hasShadow}
|
hasShadow={options.hasShadow}
|
||||||
@@ -274,7 +271,7 @@ const SystemCharts = ({
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
{visibleCharts.includes("memory") && (
|
{visibleCharts.includes("memory") && (
|
||||||
<Box h="100%">
|
<Box h={chartHeight}>
|
||||||
<SystemResourceMemoryChart
|
<SystemResourceMemoryChart
|
||||||
memoryUsageOverTime={items.map((item) => item.memory)}
|
memoryUsageOverTime={items.map((item) => item.memory)}
|
||||||
totalCapacityInBytes={memoryCapacityInBytes}
|
totalCapacityInBytes={memoryCapacityInBytes}
|
||||||
@@ -285,7 +282,7 @@ const SystemCharts = ({
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
{visibleCharts.includes("gpu") && (
|
{visibleCharts.includes("gpu") && (
|
||||||
<Box h="100%">
|
<Box h={chartHeight}>
|
||||||
<SystemResourceGPUChart
|
<SystemResourceGPUChart
|
||||||
gpuUsageOverTime={items.map((item) => item.gpu)}
|
gpuUsageOverTime={items.map((item) => item.gpu)}
|
||||||
hasShadow={options.hasShadow}
|
hasShadow={options.hasShadow}
|
||||||
@@ -296,7 +293,7 @@ const SystemCharts = ({
|
|||||||
)}
|
)}
|
||||||
{showNetwork &&
|
{showNetwork &&
|
||||||
(width >= 300 ? (
|
(width >= 300 ? (
|
||||||
<Group h="100%" gap="xs" grow wrap="nowrap">
|
<Group h={chartHeight} gap="xs" grow wrap="nowrap">
|
||||||
<NetworkTrafficChart
|
<NetworkTrafficChart
|
||||||
usageOverTime={networkItems.map((network) => network.down)}
|
usageOverTime={networkItems.map((network) => network.down)}
|
||||||
isUp={false}
|
isUp={false}
|
||||||
@@ -313,7 +310,7 @@ const SystemCharts = ({
|
|||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
) : (
|
) : (
|
||||||
<Box h="100%">
|
<Box h={chartHeight}>
|
||||||
<CombinedNetworkTrafficChart
|
<CombinedNetworkTrafficChart
|
||||||
usageOverTime={networkItems}
|
usageOverTime={networkItems}
|
||||||
hasShadow={options.hasShadow}
|
hasShadow={options.hasShadow}
|
||||||
|
|||||||
Reference in new issue
Block a user