Files
Termix/src/types/stats-widgets.ts
T

97 lines
1.8 KiB
TypeScript
Raw Normal View History

+7
2025-11-05 10:36:16 -06:00
export type WidgetType =
| "cpu"
| "memory"
| "disk"
| "network"
| "uptime"
| "processes"
2025-11-17 09:46:05 -06:00
| "system"
2026-01-24 19:49:42 -06:00
| "login_stats"
| "ports"
2026-06-29 13:28:26 -05:00
| "firewall"
| "temperature";
2026-01-24 19:49:42 -06:00
export interface ListeningPort {
protocol: "tcp" | "udp";
localAddress: string;
localPort: number;
state?: string;
pid?: number;
process?: string;
}
export interface PortsMetrics {
source: "ss" | "netstat" | "none";
ports: ListeningPort[];
}
export interface FirewallRule {
chain: string;
target: string;
protocol: string;
source: string;
destination: string;
dport?: string;
sport?: string;
state?: string;
interface?: string;
extra?: string;
}
export interface FirewallChain {
name: string;
policy: string;
rules: FirewallRule[];
}
export interface FirewallMetrics {
type: "iptables" | "nftables" | "none";
status: "active" | "inactive" | "unknown";
chains: FirewallChain[];
}
+7
2025-11-05 10:36:16 -06:00
2026-06-29 13:28:26 -05:00
export interface TemperatureSensor {
label: string;
celsius: number;
}
export interface TemperatureMetrics {
source: "sysfs" | "sensors" | "none";
highestCelsius: number | null;
sensors: TemperatureSensor[];
}
+7
2025-11-05 10:36:16 -06:00
export interface StatsConfig {
enabledWidgets: WidgetType[];
statusCheckEnabled: boolean;
statusCheckInterval: number;
+5
2026-03-08 18:02:14 -05:00
useGlobalStatusInterval?: boolean;
+7
2025-11-05 10:36:16 -06:00
metricsEnabled: boolean;
metricsInterval: number;
+5
2026-03-08 18:02:14 -05:00
useGlobalMetricsInterval?: boolean;
2026-03-14 20:05:05 -05:00
disableTcpPing?: boolean;
+7
2025-11-05 10:36:16 -06:00
}
export const DEFAULT_STATS_CONFIG: StatsConfig = {
2025-11-17 09:46:05 -06:00
enabledWidgets: [
"cpu",
"memory",
"disk",
"network",
"uptime",
"system",
"login_stats",
2026-05-11 01:23:11 -05:00
"processes",
"ports",
"firewall",
2026-06-29 13:28:26 -05:00
"temperature",
2025-11-17 09:46:05 -06:00
],
+7
2025-11-05 10:36:16 -06:00
statusCheckEnabled: true,
statusCheckInterval: 30,
+5
2026-03-08 18:02:14 -05:00
useGlobalStatusInterval: true,
+7
2025-11-05 10:36:16 -06:00
metricsEnabled: true,
metricsInterval: 30,
+5
2026-03-08 18:02:14 -05:00
useGlobalMetricsInterval: true,
2026-03-14 20:05:05 -05:00
disableTcpPing: false,
+7
2025-11-05 10:36:16 -06:00
};