scense_runtime/wwwroot/status_page.ui

51 lines
2.1 KiB
XML

{
"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)})"
}
]
}
]
}