yumoqing c7180bda77 fix: rewrite dashboard_refresh.js with correct bricks API
- Replace non-existent bricks.app.find_widget_by_id() with bricks.getWidgetById(id, bricks.app)
- Replace widget.el.textContent with widget.set_text() method
- Fix getBaseUrl() to handle /modulename paths (no .ui suffix) returning /undefined
- Remove chart refresh from JS — use ChartBar's built-in refresh_period: 10
- Update index.ui ChartBar widget with refresh_period: 10
- Also fixed all find_widget_by_id references across skills:
  * bricks-framework SKILL.md (2 occurrences)
  * bricks-framework references: auto-refresh-dashboard.md, auto-refresh-pattern.md, bar.md, line.md, websocket.md
  * module-development-spec references: read-only-module-pattern.md
  * harnessed-module-development SKILL.md (2 occurrences)
  * harnessed-module-development references: reasoning-visualization.md, bricks-ui-pitfalls.md
  * rbac-permission-initialization-pattern references: websocket-debugging.md
2026-05-24 16:05:56 +08:00

206 lines
7.5 KiB
XML

{
"widgettype": "VBox",
"options": {
"width": "100%",
"height": "100%",
"padding": "20px",
"bgcolor": "#f0f2f5"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "Dashboard",
"fontSize": "24px",
"fontWeight": "bold",
"color": "#333",
"marginBottom": "20px"
}
},
{
"widgettype": "ResponsableBox",
"options": {
"gap": "16px",
"minWidth": "250px"
},
"subwidgets": [
{
"widgettype": "VBox",
"id": "card_today_cnt",
"options": {
"bgcolor": "#FFFFFF",
"padding": "24px",
"borderRadius": "8px",
"flex": "1",
"minHeight": "120px",
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "今日调用笔数",
"fontSize": "14px",
"color": "#888",
"marginBottom": "8px"
}
},
{
"widgettype": "Text",
"id": "today_cnt_value",
"options": {
"text": "--",
"fontSize": "32px",
"fontWeight": "bold",
"color": "#1890ff"
}
}
]
},
{
"widgettype": "VBox",
"id": "card_today_amount",
"options": {
"bgcolor": "#FFFFFF",
"padding": "24px",
"borderRadius": "8px",
"flex": "1",
"minHeight": "120px",
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "今日交易金额",
"fontSize": "14px",
"color": "#888",
"marginBottom": "8px"
}
},
{
"widgettype": "Text",
"id": "today_amount_value",
"options": {
"text": "--",
"fontSize": "32px",
"fontWeight": "bold",
"color": "#52c41a"
}
}
]
},
{
"widgettype": "VBox",
"id": "card_total_users",
"options": {
"bgcolor": "#FFFFFF",
"padding": "24px",
"borderRadius": "8px",
"flex": "1",
"minHeight": "120px",
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "用户总数",
"fontSize": "14px",
"color": "#888",
"marginBottom": "8px"
}
},
{
"widgettype": "Text",
"id": "total_users_value",
"options": {
"text": "--",
"fontSize": "32px",
"fontWeight": "bold",
"color": "#722ed1"
}
}
]
},
{
"widgettype": "VBox",
"id": "card_concurrent_users",
"options": {
"bgcolor": "#FFFFFF",
"padding": "24px",
"borderRadius": "8px",
"flex": "1",
"minHeight": "120px",
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "当前并发用户",
"fontSize": "14px",
"color": "#888",
"marginBottom": "8px"
}
},
{
"widgettype": "Text",
"id": "concurrent_users_value",
"options": {
"text": "--",
"fontSize": "32px",
"fontWeight": "bold",
"color": "#fa8c16"
}
}
]
}
]
},
{
"widgettype": "VBox",
"id": "chart_section",
"options": {
"bgcolor": "#FFFFFF",
"padding": "24px",
"borderRadius": "8px",
"marginTop": "20px",
"minHeight": "350px",
"boxShadow": "0 2px 8px rgba(0,0,0,0.1)"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "Top 3 模型(今日)",
"fontSize": "18px",
"fontWeight": "bold",
"color": "#333",
"marginBottom": "16px"
}
},
{
"widgettype": "ChartBar",
"id": "top_models_chart",
"options": {
"height": "300px",
"width": "100%",
"data_url": "{{entire_url('api/get_top_models.dspy')}}",
"nameField": "model_name",
"valueFields": ["cnt", "total_amount"],
"refresh_period": 10
}
}
]
},
{
"widgettype": "Html",
"id": "auto_refresh",
"options": {
"html": "<div id='refresh_indicator' style='position:fixed;bottom:10px;right:10px;font-size:12px;color:#999;'>数据每10秒自动刷新</div>"
}
}
]
}