mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-10-30 01:10:50 +08:00
feat(system): 添加设备信息及重启关机控制
关于页展示宿主系统、处理器、架构、内核和资源占用,合并同一文件系统上的系统与 MSD 容量。 新增 Linux 宿主机重启和关机接口,在其他设置中提供二次确认、请求互斥及失败提示。 修正 Linux 磁盘已用空间计算,并补充设备信息和电源控制的后端单元测试。 验证:独立暂存快照前端构建通过;6 项后端测试通过;设置页保存、系统信息及模拟电源控制浏览器测试通过。
This commit is contained in:
@@ -93,6 +93,18 @@ export interface NetworkAddress {
|
||||
ip: string
|
||||
}
|
||||
|
||||
export interface HostInfo {
|
||||
operating_system: string
|
||||
architecture: string
|
||||
kernel: string | null
|
||||
cpu_count: number
|
||||
storage: {
|
||||
system: { total: number; used: number; available: number } | null
|
||||
msd: { total: number; used: number; available: number } | null
|
||||
shared_partition: boolean | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface DeviceInfo {
|
||||
hostname: string
|
||||
cpu_model: string
|
||||
@@ -148,6 +160,7 @@ export const systemApi = {
|
||||
available: number
|
||||
used: number
|
||||
}
|
||||
host?: HostInfo
|
||||
device_info?: DeviceInfo
|
||||
}>('/info'),
|
||||
|
||||
@@ -186,6 +199,12 @@ export const systemApi = {
|
||||
request<{ success: boolean; message?: string }>('/system/restart', {
|
||||
method: 'POST',
|
||||
}),
|
||||
|
||||
hostPower: (action: 'reboot' | 'poweroff') =>
|
||||
request<{ success: boolean; message?: string }>(`/system/${action}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ confirmed: true }),
|
||||
}, { toastOnError: false }),
|
||||
}
|
||||
|
||||
export type UpdateChannel = 'stable' | 'beta'
|
||||
|
||||
Reference in New Issue
Block a user