fix: dashboard布局重构 - 修复遮挡/热门模型金额/今日指标缺失

1. 热门模型: valueFields改为[total_amount, cnt],与用户/供应商一致
2. 布局重构:
   - 第一行: 今日调用总量+今日交易金额(2个50%宽卡片)
   - 第二行: 用户总数+活跃用户+在线用户+记账异常(4个25%宽卡片)
   - 第三行: 热门模型+用户排行+供应商排行(3个33%宽图表)
3. 图表高度统一250px,间距16px
4. 移除ResponsableBox改用HBox,避免卡片溢出遮挡
5. 移除stat_new_users_month和stat_total_orgs,精简指标
This commit is contained in:
yumoqing 2026-06-02 00:25:12 +08:00
parent a1fb0089ad
commit 398e90fa17
4 changed files with 30 additions and 42 deletions

View File

@ -1,10 +1,10 @@
{
"widgettype": "ChartBar",
"options": {
"height": "210px",
"height": "250px",
"width": "100%",
"data_url": "{{entire_url('api/top_models.dspy')}}",
"nameField": "model_name",
"valueFields": ["cnt", "total_amount"]
"valueFields": ["total_amount", "cnt"]
}
}

View File

@ -1,7 +1,7 @@
{
"widgettype": "ChartBar",
"options": {
"height": "210px",
"height": "250px",
"data_url": "{{entire_url('api/top_providers.dspy')}}",
"nameField": "provider_name",
"valueFields": ["total_amount", "cnt"]

View File

@ -1,7 +1,7 @@
{
"widgettype": "ChartBar",
"options": {
"height": "210px",
"height": "250px",
"data_url": "{{entire_url('api/top_users.dspy')}}",
"nameField": "user_name",
"valueFields": ["total_amount", "cnt"]

View File

@ -36,7 +36,7 @@
{
"widgettype": "Text",
"options": {
"text": "最后更新: {{get_today_usage(request) and request._run_ns.curDateString() or ''}}",
"text": "{{get_today_usage(request) and request._run_ns.curDateString() or ''}}",
"fontSize": "13px"
}
},
@ -65,11 +65,10 @@
}
{% if 'owner.*' in roles or 'reseller.*' in roles %}
,{
"widgettype": "ResponsableBox",
"widgettype": "HBox",
"options": {
"width": "100%",
"gap": "16px",
"minWidth": "180px",
"marginBottom": "16px"
},
"subwidgets": [
@ -78,7 +77,8 @@
"id": "stat_today_usage",
"options": {
"period_seconds": 30,
"url": "{{entire_url('stat_today_usage.ui')}}"
"url": "{{entire_url('stat_today_usage.ui')}}",
"width": "50%"
}
},
{
@ -86,15 +86,27 @@
"id": "stat_today_amount",
"options": {
"period_seconds": 30,
"url": "{{entire_url('stat_today_amount.ui')}}"
"url": "{{entire_url('stat_today_amount.ui')}}",
"width": "50%"
}
},
}
]
},
{
"widgettype": "HBox",
"options": {
"width": "100%",
"gap": "16px",
"marginBottom": "16px"
},
"subwidgets": [
{
"widgettype": "RefreshWidget",
"id": "stat_total_users",
"options": {
"period_seconds": 60,
"url": "{{entire_url('stat_total_users.ui')}}"
"url": "{{entire_url('stat_total_users.ui')}}",
"width": "25%"
}
},
{
@ -102,7 +114,8 @@
"id": "stat_active_users",
"options": {
"period_seconds": 60,
"url": "{{entire_url('stat_active_users.ui')}}"
"url": "{{entire_url('stat_active_users.ui')}}",
"width": "25%"
}
},
{
@ -110,7 +123,8 @@
"id": "stat_concurrent",
"options": {
"period_seconds": 15,
"url": "{{entire_url('stat_concurrent.ui')}}"
"url": "{{entire_url('stat_concurrent.ui')}}",
"width": "25%"
}
},
{
@ -118,34 +132,8 @@
"id": "stat_errors",
"options": {
"period_seconds": 30,
"url": "{{entire_url('stat_errors.ui')}}"
}
}
]
},
{
"widgettype": "ResponsableBox",
"options": {
"width": "100%",
"gap": "16px",
"minWidth": "180px",
"marginBottom": "16px"
},
"subwidgets": [
{
"widgettype": "RefreshWidget",
"id": "stat_new_users_month",
"options": {
"period_seconds": 120,
"url": "{{entire_url('stat_new_users_month.ui')}}"
}
},
{
"widgettype": "RefreshWidget",
"id": "stat_total_orgs",
"options": {
"period_seconds": 120,
"url": "{{entire_url('stat_total_orgs.ui')}}"
"url": "{{entire_url('stat_errors.ui')}}",
"width": "25%"
}
}
]