mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-20 07:04:53 +00:00
* feat(system): add GPU/NPU monitor tab when accelerators are detected Probe nvidia-smi and npu-smi during System capabilities checks and show a GPU sub-tab with utilization, memory/HBM, temperature, power, and compute processes. Reuses the existing SSH exec + parse pattern (same approach as open-source remote GPU monitors) without new dependencies. Related to #2561 Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(system): address GPU monitor Bugbot findings - Use PowerShell nvidia-smi collector for local Windows sessions - Keep GPU tab in loading state while listAccelerators is pending - Render compute processes even when device list is empty - Stop treating Ascend HBM usage rate (%) as megabytes Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(system): address Codex GPU collector review findings - Wrap POSIX accelerator script with JSON.stringify so nested sed quotes cannot break outer sh -c - Parse Ascend proc-mem whitespace-delimited table rows Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(system): show unknown GPU util/memory as -- not 0% ResourceBar now treats null/undefined as unavailable, and the GPU device cards pass through null metrics instead of coalescing to 0. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import React, { memo } from 'react';
|
|
import { cn } from '../../lib/utils';
|
|
|
|
interface ResourceBarProps {
|
|
label: string;
|
|
value: number | null | undefined;
|
|
className?: string;
|
|
}
|
|
|
|
export const ResourceBar = memo(function ResourceBar({ label, value, className }: ResourceBarProps) {
|
|
const finite = typeof value === 'number' && Number.isFinite(value);
|
|
const clamped = finite ? Math.max(0, Math.min(100, value)) : 0;
|
|
return (
|
|
<div className={cn('flex items-center gap-2 min-w-0', className)}>
|
|
<span className="text-[10px] text-muted-foreground w-7 shrink-0">{label}</span>
|
|
<div className="flex-1 h-1 rounded-full bg-muted/50 overflow-hidden min-w-[48px]">
|
|
<div
|
|
className={cn(
|
|
'h-full rounded-full',
|
|
finite && clamped > 85 ? 'bg-destructive/70' : 'bg-primary/70',
|
|
!finite && 'opacity-0',
|
|
)}
|
|
style={{ width: `${clamped}%` }}
|
|
/>
|
|
</div>
|
|
<span className="text-[10px] tabular-nums text-muted-foreground w-10 text-right shrink-0">
|
|
{finite ? `${value.toFixed(1)}%` : '--'}
|
|
</span>
|
|
</div>
|
|
);
|
|
});
|