接入六个新页面,外壳加内核状态心跳
导航新增「规则」项;设置、配置、规则页接 saved 事件重读配置,仪表盘只 读传 data。心跳每 10 秒探一次内核在不在:kernel.online 原本只在 load() 里更新,用户停在任何页面期间它都是静态快照,内核重启一次,请求页和 仪表盘会锁死在「内核未连接」,各页等它回来的 watch 永远不可达。恢复 在线的那一次顺带拉新运行时数据。
This commit is contained in:
+6
-1
@@ -32,6 +32,11 @@ export const lineProvider = ref<Record<string, string>>({})
|
||||
|
||||
export const kernel = ref<{ online: boolean; version?: string }>({ online: false })
|
||||
|
||||
/** 只探测内核在不在线,不拉运行时数据。给外壳的定时心跳用,各页等内核回来的 watch 靠它可达。 */
|
||||
export async function refreshKernel(): Promise<void> {
|
||||
kernel.value = await api.kernel().catch(() => ({ online: false }))
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新读一遍运行时状态。
|
||||
*
|
||||
@@ -42,7 +47,7 @@ export const kernel = ref<{ online: boolean; version?: string }>({ online: false
|
||||
* 最需要这个界面的时候。
|
||||
*/
|
||||
export async function reloadRuntime(): Promise<void> {
|
||||
kernel.value = await api.kernel().catch(() => ({ online: false }))
|
||||
await refreshKernel()
|
||||
if (!kernel.value.online) {
|
||||
runtime.value = {}
|
||||
providers.value = {}
|
||||
|
||||
Reference in New Issue
Block a user