Add system info

This commit is contained in:
2024-05-04 09:11:30 +02:00
parent 768ba03807
commit c7306bdd55
10 changed files with 261 additions and 2 deletions

View File

@ -0,0 +1,42 @@
import { APIClient } from "./ApiClient";
export interface SysInfoConfig {
allowed: boolean;
}
export interface LoadAverage {
one: number;
five: number;
fifteen: number;
}
export interface SysInfoStatusSystem {
physical_core_count: number;
uptime: number;
used_memory: number;
available_memory: number;
free_memory: number;
load_average: LoadAverage;
}
export interface SysInfoStatus {
system: SysInfoStatusSystem;
}
export class SysInfoApi {
/**
* Get system info configuration (ie. check if it allowed)
*/
static async GetConfig(): Promise<SysInfoConfig> {
return (await APIClient.exec({ method: "GET", uri: "/sysinfo/config" }))
.data;
}
/**
* Get system status
*/
static async Status(): Promise<SysInfoStatus> {
return (await APIClient.exec({ method: "GET", uri: "/sysinfo/status" }))
.data;
}
}