feat(ui): add type filter toggles
This commit is contained in:
78
server/types.ts
Normal file
78
server/types.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Backend Types for Homelab Topology Visualizer
|
||||
*
|
||||
* Type definitions for server-side operations including:
|
||||
* - Host configuration for SSH connections
|
||||
* - API response types for discovery, config, files, and stats
|
||||
*/
|
||||
|
||||
export interface HostConfig {
|
||||
/** Hostname for display in topology */
|
||||
name: string;
|
||||
/** IP address for SSH connection */
|
||||
ip: string;
|
||||
/** SSH username */
|
||||
sshUser: string;
|
||||
/** Optional path to SSH private key file */
|
||||
sshKeyPath?: string;
|
||||
/** Optional SSH port (defaults to 22) */
|
||||
sshPort?: number;
|
||||
}
|
||||
|
||||
export interface DiscoveryResponse {
|
||||
/** Array of discovered hosts with their status */
|
||||
hosts: Array<{
|
||||
name: string;
|
||||
ip: string;
|
||||
online: boolean;
|
||||
containers?: string[];
|
||||
error?: string;
|
||||
}>;
|
||||
/** Timestamp of discovery run */
|
||||
timestamp: string;
|
||||
/** Any errors encountered during discovery */
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
export interface ConfigResponse {
|
||||
/** Raw YAML configuration content */
|
||||
yaml: string;
|
||||
/** Path to the config file */
|
||||
path: string;
|
||||
/** Error message if config retrieval failed */
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface VolumeMount {
|
||||
/** Source path on host */
|
||||
source: string;
|
||||
/** Destination path in container */
|
||||
destination: string;
|
||||
/** Mount mode (e.g., 'rw', 'ro') */
|
||||
mode: string;
|
||||
}
|
||||
|
||||
export interface FilesResponse {
|
||||
/** Array of volume mounts */
|
||||
volumes: VolumeMount[];
|
||||
/** Error message if file retrieval failed */
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface NetworkStats {
|
||||
/** Bytes received */
|
||||
rx: number;
|
||||
/** Bytes transmitted */
|
||||
tx: number;
|
||||
}
|
||||
|
||||
export interface StatsResponse {
|
||||
/** CPU usage percentage */
|
||||
cpu: number;
|
||||
/** Memory usage percentage */
|
||||
memory: number;
|
||||
/** Network I/O statistics */
|
||||
network: NetworkStats;
|
||||
/** Error message if stats retrieval failed */
|
||||
error?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user