Fix settings.ui: Correct TabPanel structure using items instead of tabs, and use Form toolbar actions with proper uitype in fields

This commit is contained in:
yumoqing 2026-04-22 17:40:35 +08:00
parent 701aedfa5a
commit 14ed67907a

View File

@ -22,8 +22,10 @@
"options": {
"width": "100%",
"height": "calc(100% - 60px)",
"tabs": [
"tab_pos": "top",
"items": [
{
"name": "general",
"label": "General",
"content": {
"widgettype": "VBox",
@ -41,7 +43,7 @@
"maxWidth": "600px",
"fields": [
{
"widgettype": "UiCode",
"uitype": "code",
"name": "default-model",
"label": "Default AI Model",
"placeholder": "Select default model...",
@ -49,7 +51,7 @@
"marginBottom": "16px"
},
{
"widgettype": "UiInt",
"uitype": "int",
"name": "session-timeout",
"label": "Session Timeout (minutes)",
"placeholder": "Enter timeout in minutes...",
@ -57,30 +59,32 @@
"marginBottom": "16px"
},
{
"widgettype": "UiCheck",
"uitype": "check",
"name": "auto-save",
"label": "Auto-save sessions",
"checked": true,
"marginBottom": "24px"
}
]
}
},
],
"toolbar": {
"tools": [
{
"widgettype": "Button",
"options": {
"label": "Save General Settings",
"bgcolor": "#22C55E",
"color": "#FFFFFF",
"border": "none",
"borderRadius": "6px",
"padding": "10px 20px",
"fontWeight": "600"
"fontWeight": "600",
"action": "save_general_settings"
}
]
}
},
"binds": [
{
"wid": "self",
"event": "click",
"event": "save_general_settings",
"actiontype": "registerfunction",
"target": "app.settings-tabs",
"rfname": "save_general_settings",
@ -94,6 +98,7 @@
}
},
{
"name": "models",
"label": "AI Models",
"content": {
"widgettype": "VBox",
@ -150,95 +155,73 @@
}
},
{
"name": "security",
"label": "Security",
"content": {
"widgettype": "VBox",
"widgettype": "Form",
"id": "security-settings-form",
"options": {
"width": "100%",
"height": "100%",
"padding": "20px"
},
"subwidgets": [
"maxWidth": "600px",
"fields": [
{
"widgettype": "Text",
"options": {
"text": "Security Settings",
"fontSize": "18px",
"fontWeight": "600",
"color": "#F8FAFC",
"marginBottom": "16px"
}
},
{
"widgettype": "UiCheck",
"options": {
"uitype": "check",
"name": "require-auth",
"label": "Require authentication for API access",
"checked": "{{security.require_auth}}",
"marginBottom": "12px"
}
},
{
"widgettype": "UiCheck",
"options": {
"uitype": "check",
"name": "encrypt-storage",
"label": "Encrypt local storage",
"checked": "{{security.encrypt_storage}}",
"marginBottom": "24px"
}
},
],
"toolbar": {
"tools": [
{
"widgettype": "Button",
"options": {
"label": "Save Security Settings",
"bgcolor": "#22C55E",
"color": "#FFFFFF",
"border": "none",
"borderRadius": "6px",
"padding": "10px 20px",
"fontWeight": "600"
"fontWeight": "600",
"action": "save_security_settings"
}
]
}
},
"binds": [
{
"wid": "self",
"event": "click",
"event": "save_security_settings",
"actiontype": "registerfunction",
"target": "app.settings-tabs",
"rfname": "save_security_settings",
"params": {
"require_auth": "{{require-auth.checked}}",
"encrypt_storage": "{{encrypt-storage.checked}}"
"require_auth": "{{ 'security-settings-form'.data['require-auth'] }}",
"encrypt_storage": "{{ 'security-settings-form'.data['encrypt-storage'] }}"
}
}
]
}
]
}
},
{
"name": "appearance",
"label": "Appearance",
"content": {
"widgettype": "VBox",
"widgettype": "Form",
"id": "appearance-settings-form",
"options": {
"width": "100%",
"height": "100%",
"padding": "20px"
},
"subwidgets": [
"maxWidth": "600px",
"fields": [
{
"widgettype": "Text",
"options": {
"text": "Appearance Settings",
"fontSize": "18px",
"fontWeight": "600",
"color": "#F8FAFC",
"marginBottom": "16px"
}
},
{
"widgettype": "Select",
"id": "theme-select",
"options": {
"uitype": "select",
"name": "theme",
"label": "Theme",
"items": [
{"label": "Dark", "value": "dark"},
@ -249,33 +232,35 @@
"width": "200px",
"marginBottom": "24px"
}
},
],
"toolbar": {
"tools": [
{
"widgettype": "Button",
"options": {
"label": "Save Appearance Settings",
"bgcolor": "#22C55E",
"color": "#FFFFFF",
"border": "none",
"borderRadius": "6px",
"padding": "10px 20px",
"fontWeight": "600"
"fontWeight": "600",
"action": "save_appearance_settings"
}
]
}
},
"binds": [
{
"wid": "self",
"event": "click",
"event": "save_appearance_settings",
"actiontype": "registerfunction",
"target": "app.settings-tabs",
"rfname": "save_appearance_settings",
"params": {
"theme": "{{theme-select.value}}"
"theme": "{{ 'appearance-settings-form'.data.theme }}"
}
}
]
}
]
}
}
]
}