mirror of
https://github.com/Buriburizaem0n/nezha-dash-v1.git
synced 2026-09-21 10:40:14 +00:00
feat: add server metrics fetching and update translations
- Implemented `fetchServerMetrics` function in `nezha-api.ts` to retrieve server metrics based on metric type and period. - Added new metric types and periods to `nezha-api.ts` type definitions. - Updated English and Chinese translations to include new terms for metrics and periods. - Commented out `ServerDetailSummary` component in `ServerDetail.tsx` for future use.
This commit is contained in:
@@ -158,3 +158,41 @@ export interface SettingResponse {
|
||||
version: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type MetricType =
|
||||
| "cpu"
|
||||
| "memory"
|
||||
| "swap"
|
||||
| "disk"
|
||||
| "net_in_speed"
|
||||
| "net_out_speed"
|
||||
| "net_in_transfer"
|
||||
| "net_out_transfer"
|
||||
| "load1"
|
||||
| "load5"
|
||||
| "load15"
|
||||
| "tcp_conn"
|
||||
| "udp_conn"
|
||||
| "process_count"
|
||||
| "temperature"
|
||||
| "uptime"
|
||||
| "gpu";
|
||||
|
||||
export type MetricPeriod = "1d" | "7d" | "30d";
|
||||
|
||||
export interface MetricDataPoint {
|
||||
ts: number;
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface ServerMetricsData {
|
||||
server_id: number;
|
||||
server_name: string;
|
||||
metric: string;
|
||||
data_points: MetricDataPoint[];
|
||||
}
|
||||
|
||||
export interface ServerMetricsResponse {
|
||||
success: boolean;
|
||||
data: ServerMetricsData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user