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