Files
dacli/src/webapi/monitor.ts
T
sswandClaude 8fb0faac27 feat(v0.11+): 新建 7 个 webapi 模块 (role/log/monitor/schedule/message/visualdata/report)
用户 2026-06-25 反馈: '不是应该走 webapi 吗, 为什么现在都走平台 api'

之前 NEW-CMD 全部用 c.postJson/c.putJson/c.del, 违反 v0.11+ 镜像架构原则.
本 commit 补齐 7 个 webapi 模块, 为后续 NEW-CMD 重构铺路:

- webapi/role.ts (7 函数, 镜像 web/.../permission/role.ts)
- webapi/log.ts (5 函数, 镜像 web/.../system/log.ts)
- webapi/monitor.ts (镜像 web/.../system/monitor.ts)
- webapi/schedule.ts (7 函数, 镜像 web/.../system/task.ts)
- webapi/message.ts (12 函数, 镜像 web/.../msgCenter/notice + msgTemplate)
- webapi/visualdata.ts (大屏独立子项目 jnpf-web-datascreen-vue3)
- webapi/report.ts (报表独立子项目 jnpf-web-datareport)

下一 commit: 重构所有 NEW-CMD 走 webapi 镜像

Co-Authored-By: Claude <[email protected]>
2026-06-25 15:25:51 +08:00

31 lines
908 B
TypeScript

/**
* webapi/monitor.ts — 直接 import web 端 monitor.ts (v0.11+ Phase 2)
*
* 镜像 web/apps/jnpf-web-apps-main/src/api/system/monitor.ts 函数
* (含 getSysMonitor 等)
*/
import { JnpfClient } from '../core/client.ts'
import { loadWebModule } from './_loader.ts'
const MONITOR_SRC = '/home/ubuntu/ccWorkDir/web/apps/jnpf-web-apps-main/src/api/system/monitor.ts'
let cached: any = null
export async function initWebapi(client: JnpfClient): Promise<void> {
if (cached) return
const { initDefHttpShim } = await import('./_defhttp_shim.ts')
initDefHttpShim(client)
cached = await loadWebModule(MONITOR_SRC)
}
export function isWebapiLoaded(): boolean {
return cached !== null
}
export const loadMonitor: any = new Proxy({} as any, {
get(_target, prop) {
if (!cached) throw new Error('monitor 模块未初始化, 请先 await initWebapi(client)')
return cached[prop]
},
})