mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
36267717ac
Introduce workspace-aware System side panel with remote process/tmux/Docker management, terminal popup for interactive attach, capability warmup, review-hardened IPC, performance optimizations, toast action errors, and SSH channel recovery on reconnect.
24 lines
868 B
TypeScript
24 lines
868 B
TypeScript
import type { DockerContainerInfo } from './types';
|
|
|
|
/**
|
|
* A paused container reports Status "Up 5 minutes (Paused)", so a bare
|
|
* /up/i test classifies it as running too. Paused must win, and the
|
|
* machine-readable State field is preferred over the human Status text.
|
|
*/
|
|
export function getContainerFlags(container: DockerContainerInfo): {
|
|
isRunning: boolean;
|
|
isPaused: boolean;
|
|
} {
|
|
const isPaused = container.state === 'paused' || /paused/i.test(container.status);
|
|
const isRunning = !isPaused
|
|
&& (container.state === 'running' || /up/i.test(container.status));
|
|
return { isRunning, isPaused };
|
|
}
|
|
|
|
export function getContainerTone(container: DockerContainerInfo): 'success' | 'warning' | 'muted' {
|
|
const { isRunning, isPaused } = getContainerFlags(container);
|
|
if (isPaused) return 'warning';
|
|
if (isRunning) return 'success';
|
|
return 'muted';
|
|
}
|