mirror of
https://github.com/woodchen-ink/nezha-dash-v1.git
synced 2025-07-18 17:41:56 +08:00
feat: gpu info
This commit is contained in:
parent
a4bdf10c72
commit
3d4bd79ad5
@ -111,28 +111,27 @@ export const NetworkChartClient = React.memo(function NetworkChart({
|
||||
|
||||
const defaultChart = "All";
|
||||
|
||||
const [activeCharts, setActiveCharts] = React.useState<string[]>([defaultChart]);
|
||||
const [activeCharts, setActiveCharts] = React.useState<string[]>([
|
||||
defaultChart,
|
||||
]);
|
||||
|
||||
const handleButtonClick = useCallback(
|
||||
(chart: string) => {
|
||||
const handleButtonClick = useCallback((chart: string) => {
|
||||
setActiveCharts((prev) => {
|
||||
if (chart === defaultChart) {
|
||||
return [defaultChart];
|
||||
}
|
||||
|
||||
const newCharts = prev.filter(c => c !== defaultChart);
|
||||
const newCharts = prev.filter((c) => c !== defaultChart);
|
||||
const chartIndex = newCharts.indexOf(chart);
|
||||
|
||||
if (chartIndex === -1) {
|
||||
return newCharts.length === 0 ? [chart] : [...newCharts, chart];
|
||||
} else {
|
||||
const result = newCharts.filter(c => c !== chart);
|
||||
const result = newCharts.filter((c) => c !== chart);
|
||||
return result.length === 0 ? [defaultChart] : result;
|
||||
}
|
||||
});
|
||||
},
|
||||
[],
|
||||
);
|
||||
}, []);
|
||||
|
||||
const getColorByIndex = useCallback(
|
||||
(chart: string) => {
|
||||
|
@ -179,8 +179,20 @@ export default function ServerDetailOverview({
|
||||
<CardContent className="px-1.5 py-1">
|
||||
<section className="flex flex-col items-start gap-0.5">
|
||||
<p className="text-xs text-muted-foreground">{"CPU"}</p>
|
||||
{server.host.cpu ? (
|
||||
<div className="text-xs"> {server.host.cpu}</div>
|
||||
{server.host.cpu.length > 0 ? (
|
||||
<div className="text-xs"> {server.host.cpu.join(", ")}</div>
|
||||
) : (
|
||||
<div className="text-xs"> {t("serverDetail.unknown")}</div>
|
||||
)}
|
||||
</section>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
|
||||
<CardContent className="px-1.5 py-1">
|
||||
<section className="flex flex-col items-start gap-0.5">
|
||||
<p className="text-xs text-muted-foreground">{"GPU"}</p>
|
||||
{server.host.gpu.length > 0 ? (
|
||||
<div className="text-xs">{server.host.gpu.join(", ")}</div>
|
||||
) : (
|
||||
<div className="text-xs"> {t("serverDetail.unknown")}</div>
|
||||
)}
|
||||
|
@ -16,6 +16,7 @@ export interface NezhaServerHost {
|
||||
platform: string;
|
||||
platform_version: string;
|
||||
cpu: string[];
|
||||
gpu: string[];
|
||||
mem_total: number;
|
||||
disk_total: number;
|
||||
swap_total: number;
|
||||
|
Loading…
x
Reference in New Issue
Block a user