diff --git a/src/workspaces/officerdev/src/apps/SystemMonitor/DockerView.tsx b/src/workspaces/officerdev/src/apps/SystemMonitor/DockerView.tsx index 873d1585..48bc7f49 100644 --- a/src/workspaces/officerdev/src/apps/SystemMonitor/DockerView.tsx +++ b/src/workspaces/officerdev/src/apps/SystemMonitor/DockerView.tsx @@ -12,6 +12,7 @@ export const DockerView = () => { const [containers, setContainers] = useState(null); const [error, setError] = useState(null); const [selected, setSelected] = useState<{ id: string; name: string } | null>(null); + const [filter, setFilter] = useState(''); const alive = useRef(true); useEffect(() => { @@ -43,34 +44,45 @@ export const DockerView = () => { /> ); + const q = filter.trim().toLowerCase(); + const filtered = (containers ?? []).filter((c) => !q || c.name.toLowerCase().includes(q) || c.image.toLowerCase().includes(q)); + return (
-
-
docker · {containers?.length ?? 0} running · click a container for live logs
+
+
+ + docker · {filtered.length}/{containers?.length ?? 0} · click a container for live logs + + setFilter(e.target.value)} + placeholder="filter name or image…" + className="w-56 rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary" + /> +
{error &&
{error}
} -
- {(containers ?? []).map((c) => ( +
+ {filtered.map((c) => ( ))} - {containers && containers.length === 0 &&

no running containers

}
+ {containers && filtered.length === 0 && ( +

{q ? 'no matches' : 'no running containers'}

+ )}
);