fix: 运行时状态入口改真实页面status_page.ui(fetch渲染,原直接GET dspy)

This commit is contained in:
agent.develop 2026-08-30 22:14:26 +08:00
parent a28459244d
commit 8719bc499e
2 changed files with 52 additions and 1 deletions

View File

@ -85,7 +85,7 @@
"actiontype": "urlwidget",
"target": "app.runtime_content",
"options": {
"url": "{{entire_url('/scense_runtime/api/runtime_status.dspy?runtime_id=local')}}"
"url": "{{entire_url('/scense_runtime/status_page.ui')}}"
},
"mode": "replace"
}

51
wwwroot/status_page.ui Normal file
View File

@ -0,0 +1,51 @@
{
"widgettype": "VBox",
"options": {
"width": "100%",
"height": "100%",
"padding": "20px"
},
"binds": [
{
"wid": "self",
"event": "active",
"actiontype": "script",
"target": "self",
"script": "fetch('/scense_runtime/api/runtime_status.dspy?runtime_id=local').then(function(r){return r.json()}).then(function(d){var t=bricks.getWidgetById('rt_status',bricks.app);if(!t)return;var lines=['运行时: '+(d.runtime_id||'local'),'运行状态: '+(d.running?'运行中':'未运行')+(d.paused?'(已暂停)':''),'模式: '+(d.mode||'independent'),'实体数: '+(d.entities||0),'事件队列: '+(d.events||0),'错误数: '+(d.errors||0),'更新时间: '+(d.updated_at||'-')];t.set_text(lines.join('\\n'))}).catch(function(e){var t=bricks.getWidgetById('rt_status',bricks.app);if(t)t.set_text('查询失败: '+e)})"
}
],
"subwidgets": [
{
"widgettype": "Text",
"options": {
"label": "📊 运行时状态",
"fontSize": "20px"
}
},
{
"widgettype": "Text",
"id": "rt_status",
"options": {
"text": "加载中…",
"whiteSpace": "pre-line",
"margin": "12px 0"
}
},
{
"widgettype": "Button",
"options": {
"label": "🔄 刷新",
"css": "primary"
},
"binds": [
{
"wid": "self",
"event": "click",
"actiontype": "script",
"target": "self",
"script": "fetch('/scense_runtime/api/runtime_status.dspy?runtime_id=local').then(function(r){return r.json()}).then(function(d){var t=bricks.getWidgetById('rt_status',bricks.app);if(!t)return;var lines=['运行时: '+(d.runtime_id||'local'),'运行状态: '+(d.running?'运行中':'未运行')+(d.paused?'(已暂停)':''),'模式: '+(d.mode||'independent'),'实体数: '+(d.entities||0),'事件队列: '+(d.events||0),'错误数: '+(d.errors||0),'更新时间: '+(d.updated_at||'-')];t.set_text(lines.join('\\n'))}).catch(function(e){var t=bricks.getWidgetById('rt_status',bricks.app);if(t)t.set_text('查询失败: '+e)})"
}
]
}
]
}