feat: polish release v2 experience (#6800)
This commit is contained in:
1 parent
925b0fb801
commit
a4a903d7c3
295 files changed
+10627
-7115
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { IconBrain } from "@tabler/icons-react";
|
||||
|
||||
import { formatBytesPair } from "@homarr/common";
|
||||
import { useByteFormatter } from "@homarr/settings";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { LabelDisplayModeOption } from "..";
|
||||
@@ -24,24 +24,21 @@ export const SystemResourceMemoryChart = ({
|
||||
usage,
|
||||
}));
|
||||
const t = useI18n("widget.systemResources.card");
|
||||
const { formatBytesPair } = useByteFormatter();
|
||||
|
||||
const percentageUsed =
|
||||
memoryUsageOverTime.length > 0 && totalCapacityInBytes > 0
|
||||
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
memoryUsageOverTime[memoryUsageOverTime.length - 1]! /
|
||||
totalCapacityInBytes
|
||||
memoryUsageOverTime[memoryUsageOverTime.length - 1]! / totalCapacityInBytes
|
||||
: undefined;
|
||||
|
||||
const tooltipLabel = (index: number) => {
|
||||
const used = memoryUsageOverTime[index] ?? 0;
|
||||
const memory = formatBytesPair(Math.round(used), totalCapacityInBytes);
|
||||
const percent =
|
||||
totalCapacityInBytes > 0
|
||||
? Math.round((used / totalCapacityInBytes) * 100)
|
||||
: 0;
|
||||
const percent = totalCapacityInBytes > 0 ? Math.round((used / totalCapacityInBytes) * 100) : 0;
|
||||
return t("memoryTooltip", {
|
||||
used: memory.used,
|
||||
available: memory.available,
|
||||
available: memory.total,
|
||||
percent,
|
||||
});
|
||||
};
|
||||
@@ -56,11 +53,7 @@ export const SystemResourceMemoryChart = ({
|
||||
labelDisplayMode={labelDisplayMode}
|
||||
advanced={advanced}
|
||||
yAxisProps={{ domain: [0, totalCapacityInBytes] }}
|
||||
lastValue={
|
||||
percentageUsed !== undefined
|
||||
? `${Math.round(percentageUsed * 100)}%`
|
||||
: undefined
|
||||
}
|
||||
lastValue={percentageUsed !== undefined ? `${Math.round(percentageUsed * 100)}%` : undefined}
|
||||
chartType={hasShadow ? "area" : "line"}
|
||||
tooltipLabel={tooltipLabel}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user