488 lines
18 KiB
XML
488 lines
18 KiB
XML
{% set roles = get_user_roles(get_user()) %}
|
||
{
|
||
"widgettype": "VBox",
|
||
"options": {
|
||
"width": "100%",
|
||
"height": "100%"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "VScrollPanel",
|
||
"options": {
|
||
"css": "filler"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "HBox",
|
||
"options": {
|
||
"width": "100%",
|
||
"alignItems": "center",
|
||
"marginBottom": "24px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "Title2",
|
||
"options": {
|
||
"fontWeight": "700",
|
||
"otext": "数据概览",
|
||
"i18n": true
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "Filler"
|
||
},
|
||
{
|
||
"widgettype": "Text",
|
||
"options": {
|
||
"text": "最后更新: {{get_today_usage(request) and request._run_ns.curDateString() or ''}}",
|
||
"fontSize": "13px"
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "Button",
|
||
"options": {
|
||
"label": "⛶",
|
||
"border": "none",
|
||
"borderRadius": "6px",
|
||
"padding": "4px 12px",
|
||
"fontSize": "16px",
|
||
"marginLeft": "12px",
|
||
"cursor": "pointer"
|
||
},
|
||
"binds": [
|
||
{
|
||
"wid": "self",
|
||
"event": "click",
|
||
"actiontype": "script",
|
||
"target": "self",
|
||
"script": "if (!document.fullscreenElement) { document.documentElement.requestFullscreen(); } else { document.exitFullscreen(); }"
|
||
}
|
||
]
|
||
}
|
||
]
|
||
}
|
||
{% if 'owner.*' in roles or 'reseller.*' in roles %}
|
||
,{
|
||
"widgettype": "ResponsableBox",
|
||
"options": {
|
||
"gap": "16px",
|
||
"minWidth": "220px",
|
||
"marginBottom": "24px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "stat_today_usage",
|
||
"options": {
|
||
"period_seconds": 30,
|
||
"url": "{{entire_url('stat_today_usage.ui')}}"
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "stat_today_amount",
|
||
"options": {
|
||
"period_seconds": 30,
|
||
"url": "{{entire_url('stat_today_amount.ui')}}"
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "stat_total_users",
|
||
"options": {
|
||
"period_seconds": 60,
|
||
"url": "{{entire_url('stat_total_users.ui')}}"
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "stat_active_users",
|
||
"options": {
|
||
"period_seconds": 60,
|
||
"url": "{{entire_url('stat_active_users.ui')}}"
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "stat_concurrent",
|
||
"options": {
|
||
"period_seconds": 15,
|
||
"url": "{{entire_url('stat_concurrent.ui')}}"
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "stat_errors",
|
||
"options": {
|
||
"period_seconds": 30,
|
||
"url": "{{entire_url('stat_errors.ui')}}"
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"widgettype": "ResponsableBox",
|
||
"options": {
|
||
"gap": "16px",
|
||
"minWidth": "220px",
|
||
"marginBottom": "24px"
|
||
},
|
||
"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')}}"
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"widgettype": "HBox",
|
||
"options": {
|
||
"width": "100%",
|
||
"gap": "20px",
|
||
"height": "auto"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "VBox",
|
||
"options": {
|
||
"css": "card",
|
||
"width": "100%",
|
||
"borderRadius": "12px",
|
||
"padding": "20px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "HBox",
|
||
"options": {
|
||
"width": "100%",
|
||
"alignItems": "center",
|
||
"marginBottom": "16px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "Title4",
|
||
"options": {
|
||
"fontWeight": "600",
|
||
"otext": "Top 3 模型(今日调用)",
|
||
"i18n": true
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "Filler"
|
||
},
|
||
{
|
||
"widgettype": "Button",
|
||
"options": {
|
||
"label": "刷新",
|
||
"border": "none",
|
||
"borderRadius": "6px",
|
||
"padding": "4px 12px",
|
||
"fontSize": "12px"
|
||
},
|
||
"binds": [
|
||
{
|
||
"wid": "self",
|
||
"event": "click",
|
||
"actiontype": "method",
|
||
"target": "-@RefreshWidget",
|
||
"method": "render_urldata",
|
||
"params": {}
|
||
}
|
||
]
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "chart_top_models",
|
||
"options": {
|
||
"period_seconds": 30,
|
||
"url": "{{entire_url('chart_top_models.ui')}}"
|
||
}
|
||
}
|
||
]
|
||
}
|
||
]
|
||
}
|
||
{% endif %}
|
||
{% if 'customer.*' in roles %}
|
||
,{
|
||
"widgettype": "VBox",
|
||
"options": {
|
||
"css": "card",
|
||
"width": "100%",
|
||
"borderRadius": "12px",
|
||
"padding": "20px",
|
||
"marginTop": "20px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "HBox",
|
||
"options": {
|
||
"width": "100%",
|
||
"alignItems": "center",
|
||
"marginBottom": "16px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "Title4",
|
||
"options": {
|
||
"fontWeight": "600",
|
||
"otext": "我的今日模型使用",
|
||
"i18n": true
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "Filler"
|
||
},
|
||
{
|
||
"widgettype": "Button",
|
||
"options": {
|
||
"label": "刷新",
|
||
"border": "none",
|
||
"borderRadius": "6px",
|
||
"padding": "4px 12px",
|
||
"fontSize": "12px"
|
||
},
|
||
"binds": [
|
||
{
|
||
"wid": "self",
|
||
"event": "click",
|
||
"actiontype": "method",
|
||
"target": "-@ChartBar",
|
||
"method": "render_urldata",
|
||
"params": {}
|
||
}
|
||
]
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"widgettype": "urlwidget",
|
||
"options": {
|
||
"url": "{{entire_url('user_today_models_chart.ui')}}"
|
||
}
|
||
}
|
||
]
|
||
}
|
||
{% endif %}
|
||
{% if 'owner.*' not in roles and 'reseller.*' not in roles and 'customer.*' in roles %}
|
||
,{
|
||
"widgettype": "VBox",
|
||
"options": {
|
||
"css": "card",
|
||
"width": "100%",
|
||
"borderRadius": "12px",
|
||
"padding": "20px",
|
||
"marginTop": "20px",
|
||
"cursor": "pointer"
|
||
},
|
||
"binds": [
|
||
{
|
||
"wid": "self",
|
||
"event": "click",
|
||
"actiontype": "urlwidget",
|
||
"target": "app.sage_main_content",
|
||
"options": {
|
||
"url": "{{entire_url('/dashboard_for_sage/customer_usage.ui')}}"
|
||
},
|
||
"mode": "replace"
|
||
}
|
||
],
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "HBox",
|
||
"options": {
|
||
"width": "100%",
|
||
"alignItems": "center"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "Svg",
|
||
"options": {
|
||
"svg": "<svg width=\"28\" height=\"28\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M3 3v18h18\"/><path d=\"M18 17V9\"/><path d=\"M13 17V5\"/><path d=\"M8 17v-3\"/></svg>",
|
||
"width": "28px",
|
||
"height": "28px",
|
||
"marginRight": "12px"
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "VBox",
|
||
"options": {},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "Title4",
|
||
"options": {
|
||
"fontWeight": "600",
|
||
"otext": "客户专属监控",
|
||
"i18n": true
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "Text",
|
||
"options": {
|
||
"fontSize": "13px",
|
||
"otext": "查看本组织各模型每日/每月调用次数与金额统计",
|
||
"i18n": true
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"widgettype": "Filler"
|
||
},
|
||
{
|
||
"widgettype": "Svg",
|
||
"options": {
|
||
"svg": "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"9 18 15 12 9 6\"/></svg>",
|
||
"width": "24px",
|
||
"height": "24px"
|
||
}
|
||
}
|
||
]
|
||
}
|
||
]
|
||
}
|
||
{% endif %}
|
||
{% if 'owner.*' in roles or 'reseller.*' in roles %}
|
||
,{
|
||
"widgettype": "VBox",
|
||
"options": {
|
||
"css": "card",
|
||
"width": "100%",
|
||
"borderRadius": "12px",
|
||
"padding": "20px",
|
||
"marginTop": "20px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "Title4",
|
||
"options": {
|
||
"fontWeight": "600",
|
||
"marginBottom": "16px",
|
||
"otext": "用户消费排行(Top 5)",
|
||
"i18n": true
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "table_top_users",
|
||
"options": {
|
||
"period_seconds": 30,
|
||
"url": "{{entire_url('table_top_users.ui')}}"
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"widgettype": "VBox",
|
||
"options": {
|
||
"css": "card",
|
||
"width": "100%",
|
||
"borderRadius": "12px",
|
||
"padding": "20px",
|
||
"marginTop": "20px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "Title4",
|
||
"options": {
|
||
"fontWeight": "600",
|
||
"marginBottom": "16px",
|
||
"otext": "用户调用排行(Top 5)",
|
||
"i18n": true
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "table_top_users_count",
|
||
"options": {
|
||
"period_seconds": 30,
|
||
"url": "{{entire_url('table_top_users_count.ui')}}"
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"widgettype": "HBox",
|
||
"options": {
|
||
"width": "100%",
|
||
"gap": "20px",
|
||
"marginTop": "20px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "VBox",
|
||
"options": {
|
||
"css": "card",
|
||
"width": "50%",
|
||
"borderRadius": "12px",
|
||
"padding": "20px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "Title4",
|
||
"options": {
|
||
"fontWeight": "600",
|
||
"marginBottom": "16px",
|
||
"otext": "供应商交易排行(金额 Top 5)",
|
||
"i18n": true
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "table_top_providers_amount",
|
||
"options": {
|
||
"period_seconds": 30,
|
||
"url": "{{entire_url('table_top_providers_amount.ui')}}"
|
||
}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"widgettype": "VBox",
|
||
"options": {
|
||
"css": "card",
|
||
"width": "50%",
|
||
"borderRadius": "12px",
|
||
"padding": "20px"
|
||
},
|
||
"subwidgets": [
|
||
{
|
||
"widgettype": "Title4",
|
||
"options": {
|
||
"fontWeight": "600",
|
||
"marginBottom": "16px",
|
||
"otext": "供应商调用排行(数量 Top 5)",
|
||
"i18n": true
|
||
}
|
||
},
|
||
{
|
||
"widgettype": "RefreshWidget",
|
||
"id": "table_top_providers_count",
|
||
"options": {
|
||
"period_seconds": 30,
|
||
"url": "{{entire_url('table_top_providers_count.ui')}}"
|
||
}
|
||
}
|
||
]
|
||
}
|
||
]
|
||
}
|
||
{% endif %}
|
||
]
|
||
}
|
||
]
|
||
} |