Files
Termix/src/types/ui-types.ts
T

438 lines
9.2 KiB
TypeScript
Raw Normal View History

2026-05-11 01:23:11 -05:00
export type Host = {
id: string;
name: string;
username: string;
ip: string;
port: number;
folder: string;
online: boolean;
2026-05-28 22:29:20 -05:00
cpu: number | null;
ram: number | null;
2026-05-11 01:23:11 -05:00
lastAccess: string;
tags?: string[];
2026-06-29 13:28:26 -05:00
authType:
| "password"
| "key"
| "credential"
| "none"
| "opkssh"
| "tailscale"
| "vault"
| "agent";
2026-06-21 15:55:41 -05:00
useWarpgate?: boolean;
2026-05-11 01:23:11 -05:00
credentialId?: string;
2026-06-29 13:28:26 -05:00
vaultProfileId?: string;
2026-05-28 22:29:20 -05:00
overrideCredentialUsername?: boolean;
2026-05-11 01:23:11 -05:00
password?: string;
2026-06-04 15:16:53 -04:00
hasPassword?: boolean;
sudoPassword?: string;
hasSudoPassword?: boolean;
2026-05-28 22:29:20 -05:00
hasKey?: boolean;
hasKeyPassword?: boolean;
2026-05-11 01:23:11 -05:00
key?: string;
keyPassword?: string;
keyType?: string;
notes?: string;
macAddress?: string;
2026-06-21 15:55:41 -05:00
wolBroadcastAddress?: string;
2026-05-11 01:23:11 -05:00
pin?: boolean;
enableTerminal: boolean;
+2
2026-06-16 15:59:53 -05:00
enableCommandHistory: boolean;
2026-05-11 01:23:11 -05:00
terminalConfig?: {
cursorBlink: boolean;
cursorStyle: "block" | "underline" | "bar";
fontSize: number;
fontFamily: string;
letterSpacing: number;
lineHeight: number;
theme: string;
scrollback: number;
bellStyle: "none" | "sound" | "visual" | "both";
rightClickSelectsWord: boolean;
fastScrollModifier: "alt" | "ctrl" | "shift";
fastScrollSensitivity: number;
minimumContrastRatio: number;
backspaceMode: "normal" | "control-h";
agentForwarding: boolean;
autoMosh: boolean;
moshCommand: string;
autoTmux: boolean;
sudoPasswordAutoFill: boolean;
sudoPassword?: string;
keepaliveInterval?: number;
keepaliveCountMax?: number;
environmentVariables: { key: string; value: string }[];
2026-05-28 22:29:20 -05:00
startupSnippetId?: number | null;
2026-06-21 15:55:41 -05:00
linkClickBehavior?: "confirm" | "direct";
2026-06-29 13:28:26 -05:00
agentSocketPath?: string;
2026-05-11 01:23:11 -05:00
};
useSocks5?: boolean;
socks5Host?: string;
socks5Port?: number;
+2
2026-07-26 18:47:27 -05:00
connectionOrigin?: "local" | "remote" | null;
2026-05-11 01:23:11 -05:00
socks5Username?: string;
socks5Password?: string;
socks5ProxyChain?: {
host: string;
port: number;
2026-05-28 22:29:20 -05:00
type: 4 | 5 | "http" | string;
2026-05-11 01:23:11 -05:00
username?: string;
password?: string;
}[];
jumpHosts?: { hostId: string }[];
portKnockSequence?: {
port: number;
protocol: "tcp" | "udp";
delay: number;
}[];
enableTunnel: boolean;
serverTunnels: {
mode: "local" | "remote" | "dynamic";
bindHost?: string;
targetHost?: string;
sourcePort: number;
endpointHost: string;
endpointPort: number;
maxRetries: number;
retryInterval: number;
autoStart: boolean;
}[];
enableFileManager: boolean;
2026-06-21 15:55:41 -05:00
scpLegacy?: boolean;
2026-05-11 01:23:11 -05:00
defaultPath?: string;
enableDocker: boolean;
2026-06-29 13:28:26 -05:00
dockerConfig?: {
runtime?: "docker" | "podman";
} | null;
+2
2026-06-16 15:59:53 -05:00
enableProxmox: boolean;
enableTmuxMonitor: boolean;
proxmoxConfig?: {
defaultCredentialId: number | null;
2026-06-21 15:55:41 -05:00
defaultAuthType?: string;
+2
2026-06-16 15:59:53 -05:00
windowsPatterns: string;
dockerPatterns: string;
preferredPrefixes: string;
+8
2026-07-19 12:29:52 -05:00
autoSyncEnabled?: boolean;
syncIntervalMinutes?: number;
markMissingGuests?: boolean;
lastSyncAt?: string;
lastSyncStatus?: "success" | "error";
lastSyncError?: string | null;
lastSyncResult?: {
created: number;
updated: number;
markedMissing: number;
skipped: number;
errors: string[];
};
+2
2026-06-16 15:59:53 -05:00
} | null;
2026-05-11 01:23:11 -05:00
statsConfig?: {
statusCheckEnabled: boolean;
statusCheckInterval: number;
useGlobalStatusInterval: boolean;
metricsEnabled: boolean;
metricsInterval: number;
useGlobalMetricsInterval: boolean;
enabledWidgets: string[];
};
quickActions: { name: string; snippetId: string }[];
enableSsh: boolean;
enableRdp: boolean;
enableVnc: boolean;
enableTelnet: boolean;
sshPort: number;
rdpPort: number;
vncPort: number;
telnetPort: number;
+2
2026-07-26 18:47:27 -05:00
rdpAuthType?: "direct" | "credential" | "none";
2026-06-21 15:55:41 -05:00
rdpCredentialId?: string;
2026-05-11 01:23:11 -05:00
rdpUser?: string;
rdpPassword?: string;
+2
2026-07-26 18:47:27 -05:00
hasRdpPassword?: boolean;
2026-05-11 01:23:11 -05:00
domain?: string;
security?: string;
ignoreCert?: boolean;
+2
2026-07-26 18:47:27 -05:00
vncAuthType?: "direct" | "credential";
2026-06-21 15:55:41 -05:00
vncCredentialId?: string;
2026-05-11 01:23:11 -05:00
vncPassword?: string;
+2
2026-07-26 18:47:27 -05:00
hasVncPassword?: boolean;
2026-05-11 01:23:11 -05:00
vncUser?: string;
+2
2026-07-26 18:47:27 -05:00
telnetAuthType?: "direct" | "credential";
telnetCredentialId?: string;
2026-05-11 01:23:11 -05:00
telnetUser?: string;
telnetPassword?: string;
+2
2026-07-26 18:47:27 -05:00
hasTelnetPassword?: boolean;
2026-05-11 01:23:11 -05:00
2026-06-04 15:16:53 -04:00
guacamoleConfig?: Record<string, unknown>;
2026-05-28 22:29:20 -05:00
forceKeyboardInteractive?: boolean;
+8
2026-07-19 12:29:52 -05:00
isShared?: boolean;
permissionLevel?: SharePermissionLevel;
sharedExpiresAt?: string;
ownerUsername?: string;
2026-05-11 01:23:11 -05:00
};
+8
2026-07-19 12:29:52 -05:00
export type SharePermissionLevel = "connect" | "view" | "edit" | "manage";
2026-05-11 01:23:11 -05:00
export type Credential = {
id: string;
name: string;
username: string;
type: "password" | "key";
value?: string;
2026-06-29 13:28:26 -05:00
password?: string;
2026-05-11 01:23:11 -05:00
publicKey?: string;
passphrase?: string;
description?: string;
folder?: string;
tags?: string[];
};
2026-06-29 13:28:26 -05:00
// HashiCorp Vault SSH signer profile — shareable connection settings only
// (no secrets). Users authenticate to Vault via OIDC at connect time.
export type VaultProfile = {
id: string;
name: string;
description?: string;
folder?: string;
tags?: string[];
vaultAddr: string;
vaultNamespace?: string;
oidcMount?: string;
oidcRole?: string;
sshMount?: string;
sshRole: string;
validPrincipals?: string;
keyType?: string;
shared: boolean;
owned: boolean;
};
2026-05-11 01:23:11 -05:00
export type HostFolder = {
name: string;
children: (Host | HostFolder)[];
+2
2026-06-16 15:59:53 -05:00
path?: string;
color?: string;
icon?: string;
+2
2026-07-26 18:47:27 -05:00
credentialId?: number | null;
2026-05-11 01:23:11 -05:00
};
export type TabType =
| "dashboard"
| "terminal"
| "rdp"
| "vnc"
| "telnet"
+2
2026-06-16 15:59:53 -05:00
| "host-metrics"
2026-05-11 01:23:11 -05:00
| "files"
| "host-manager"
| "user-profile"
| "admin-settings"
| "docker"
2026-05-28 22:29:20 -05:00
| "tunnel"
+2
2026-06-16 15:59:53 -05:00
| "network_graph"
2026-06-29 13:28:26 -05:00
| "tmux_monitor" // --- tmux-monitor ---
| "serial"
| "homepage";
export type SerialConfig = {
path: string;
baudRate: number;
dataBits: 5 | 6 | 7 | 8;
stopBits: 1 | 2;
parity: "none" | "even" | "odd";
};
2026-05-11 01:23:11 -05:00
export type TunnelStatusValue =
| "CONNECTED"
| "CONNECTING"
| "DISCONNECTING"
| "DISCONNECTED"
| "ERROR"
| "WAITING";
export type TunnelMode = "local" | "remote" | "dynamic";
export type Tunnel = {
id: string;
hostId: string;
sourcePort: number;
endpointHost: string;
endpointPort: number;
status: TunnelStatusValue;
mode: TunnelMode;
reason?: string;
retryCount?: number;
maxRetries?: number;
};
export type Tab = {
id: string;
2026-05-28 22:05:25 -04:00
instanceId: string;
2026-05-11 01:23:11 -05:00
type: TabType;
label: string;
2026-06-21 15:55:41 -05:00
customLabel?: string;
2026-05-11 01:23:11 -05:00
host?: Host;
2026-05-28 22:05:25 -04:00
openedAt: number;
restoredSessionId?: string | null;
+2
2026-07-26 18:47:27 -05:00
/** Set when this tab joins someone else's live shared session instead of connecting/attaching its own. */
joinSharedSessionId?: string | null;
joinShareId?: string | null;
2026-06-21 15:55:41 -05:00
initialFilePath?: string;
2026-06-29 13:28:26 -05:00
serialConfig?: SerialConfig;
2026-05-28 22:29:20 -05:00
terminalRef?: import("react").RefObject<{
2026-06-29 13:28:26 -05:00
disconnect?: () => void;
isConnected?: () => boolean;
2026-05-28 22:29:20 -05:00
sendInput?: (data: string) => void;
reconnect?: () => void;
2026-06-04 15:16:53 -04:00
fit?: () => void;
notifyResize?: () => void;
2026-06-21 15:55:41 -05:00
getApplicationCursorKeysMode?: () => boolean;
+2
2026-07-26 18:47:27 -05:00
openShareModal?: () => void;
canShare?: () => boolean;
2026-05-28 22:29:20 -05:00
} | null>;
2026-05-11 01:23:11 -05:00
};
export type DockerContainerStatus =
| "running"
| "exited"
| "paused"
| "created"
| "restarting";
export type DockerContainer = {
id: string;
name: string;
image: string;
status: DockerContainerStatus;
cpu: number;
memory: string;
ports: string[];
created: string;
};
export type DashboardCardId =
| "stats_bar"
| "counters_bar"
| "quick_actions"
| "host_status"
| "recent_activity"
2026-06-21 15:55:41 -05:00
| "network_graph"
2026-06-29 13:28:26 -05:00
| "service_links"
| "homepage_preview";
2026-05-11 01:23:11 -05:00
export type DashboardCardConfig = {
id: DashboardCardId;
label: string;
description: string;
defaultEnabled: boolean;
};
export type CardColSpan = "full" | "wide" | "half" | "narrow";
export type CardRowSize = "short" | "medium" | "tall" | "flex";
export type CardLayoutConfig = {
id: DashboardCardId;
colSpan: CardColSpan;
rowSize: CardRowSize;
order: number;
};
export type LayoutPresetId = "default" | "compact" | "focus" | "wide";
export type LayoutPreset = {
id: LayoutPresetId;
label: string;
description: string;
cards: CardLayoutConfig[];
};
export type UserProfileSection =
| "account"
| "appearance"
| "security"
| "api-keys";
export type AdminSection =
| "general"
+2
2026-06-16 15:59:53 -05:00
| "sso"
2026-05-11 01:23:11 -05:00
| "users"
| "sessions"
| "roles"
2026-06-21 15:55:41 -05:00
| "host-defaults"
2026-05-11 01:23:11 -05:00
| "database"
+2
2026-06-16 15:59:53 -05:00
| "api-keys"
2026-06-21 15:55:41 -05:00
| "audit-log"
| "ssl";
2026-05-11 01:23:11 -05:00
export type AccentColorId = string;
export type ThemeId =
| "dark"
| "light"
| "system"
| "dracula"
| "catppuccin"
| "nord"
| "solarized"
| "tokyo-night"
| "one-dark"
| "gruvbox";
export type FontSizeId = "xs" | "sm" | "md" | "lg" | "xl";
export type ToolsTab = "ssh-tools" | "snippets" | "history" | "split-screen";
export type SplitMode =
| "none"
| "2-way"
| "3-way"
2026-05-28 22:29:20 -05:00
| "3-way-horizontal"
2026-05-11 01:23:11 -05:00
| "4-way"
| "5-way"
| "6-way";
export type Snippet = {
id: number;
name: string;
description?: string;
2026-05-28 22:29:20 -05:00
content: string;
folder: string | null;
2026-05-28 22:05:25 -04:00
order: number;
2026-06-21 15:55:41 -05:00
hostIds?: number[];
2026-05-11 01:23:11 -05:00
};
export const FOLDER_ICONS = [
"folder",
"server",
"cloud",
"database",
"box",
"network",
"copy",
"settings",
"cpu",
"globe",
] as const;
export type FolderIconId = (typeof FOLDER_ICONS)[number];
export type SnippetFolder = {
id: number;
name: string;
color: string;
icon: FolderIconId;
open: boolean;
};
export type HistoryEntry = {
id: number;
command: string;
host: string;
time: string;
};