diff --git a/wwwroot/index.ui b/wwwroot/index.ui index fa3fda1..24b54fd 100644 --- a/wwwroot/index.ui +++ b/wwwroot/index.ui @@ -1,4 +1,6 @@ {% set roles = get_user_roles(get_user()) %} +{% set userorgid = get_userorgid() if get_userorgid is defined else '' %} +{% set is_admin = userorgid == '0' %} { "widgettype": "VBox", "id": "datamart_root", @@ -26,6 +28,7 @@ {"widgettype": "RefreshWidget", "id": "rt_fail", "options": {"period_seconds": 30, "url": "{{entire_url('rt_card_fail.ui')}}", "width": "28%"}} ] }, +{% if is_admin %} { "widgettype": "HBox", "options": {"width": "100%", "alignItems": "center", "marginBottom": "8px"}, @@ -43,6 +46,30 @@ {"widgettype": "RefreshWidget", "id": "rt_online", "options": {"period_seconds": 30, "url": "{{entire_url('rt_card_online.ui')}}", "width": "34%"}} ] }, +{% else %} + { + "widgettype": "HBox", + "options": {"width": "100%", "gap": "16px", "marginBottom": "16px"}, + "subwidgets": [ + { + "widgettype": "VBox", + "options": {"css": "card", "width": "50%", "padding": "16px"}, + "subwidgets": [ + {"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "我的模型(按金额Top5)", "i18n": true, "marginBottom": "8px"}}, + {"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_top_models.ui')}}", "width": "100%"}} + ] + }, + { + "widgettype": "VBox", + "options": {"css": "card", "width": "50%", "padding": "16px"}, + "subwidgets": [ + {"widgettype": "Title4", "options": {"fontWeight": "600", "otext": "API Key排行", "i18n": true, "marginBottom": "8px"}}, + {"widgettype": "RefreshWidget", "options": {"period_seconds": 60, "url": "{{entire_url('sect_top_models.ui')}}", "width": "100%"}} + ] + } + ] + }, +{% endif %} { "widgettype": "HBox", "options": {"width": "100%", "gap": "16px", "marginBottom": "16px"}, @@ -79,6 +106,7 @@ } ] }, +{% if is_admin %} { "widgettype": "HBox", "options": {"width": "100%", "gap": "16px"}, @@ -109,6 +137,7 @@ } ] } +{% endif %} ] } ]