Add system info
This commit is contained in:
42
remote_frontend/src/api/SysInfoApi.ts
Normal file
42
remote_frontend/src/api/SysInfoApi.ts
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user