Files
Netcatty/components/vault/MonitorSystemDiskToggle.tsx
T
27f26d8e69 feat(monitor): 优化磁盘IO展示与系统分区告警 [4030] (#4031)
* feat(monitor): 优化磁盘IO展示与系统分区告警 [4030]

* fix(monitor): 修复磁盘监控评审问题 [4030]

* fix(monitor): align Partitions bars with Memory; hide bare / label

Label-above-bar for partition list; single-root `/` hides the label and
centers the bar like Memory/CPU (unchanged). Multi-disk keeps top align +
system alerts. Disk IO adds a spacer row to track usage labels.

Review crops under .github/review/ for PR discussion (drop before merge OK).

* fix(monitor): keep bare-/ align; multi-disk labels stay left

Address Chris density feedback: keep the single root label hidden and vertically centered with Memory, and restore side-by-side labels for multiple disks. Remove the Disk I/O spacer and update the review crops.

* chore(monitor): drop PR #4031 discussion review crops

---------

Co-authored-by: wendeng.dong <wendeng.dong@sailuntire.com>
Co-authored-by: 陈大猫 <16399091+binaricat@users.noreply.github.com>
2026-10-27 23:54:58 -07:00

23 lines
1.1 KiB
TypeScript

import React from "react";
import { ChevronRight, TriangleAlert } from "lucide-react";
import { useI18n } from "../../application/i18n/I18nProvider";
import type { MonitorDiskListRow } from "../../domain/monitorDisks";
export function MonitorSystemDiskToggle({ row, onToggle }: {
row: Extract<MonitorDiskListRow, { kind: "system" }>;
onToggle?: () => void;
}) {
const { t } = useI18n();
return (
<button type="button" data-monitor-system-disks aria-expanded={row.expanded}
disabled={row.alert || !onToggle}
title={row.alert ? t("monitor.systemDisksAlert") : undefined}
onClick={event => { event.stopPropagation(); onToggle?.(); }}
className={`flex h-4 w-full items-center gap-1 rounded text-left text-[10px] outline-none focus-visible:ring-1 focus-visible:ring-ring ${row.alert ? "font-medium text-destructive" : "text-muted-foreground hover:text-foreground"}`}>
<ChevronRight size={11} aria-hidden="true" className={row.expanded ? "rotate-90" : ""} />
{t("monitor.systemDisks", { count: row.count })}
{row.alert && <TriangleAlert size={11} aria-hidden="true" />}
</button>
);
}