hermes-web-cli/wwwroot/services.ui
yumoqing 6c28e4f6a9 fix: resolve Jinja2 template errors and undefined item variables
- Replace JavaScript ternary operator with Jinja2 if-else syntax in services.ui
- Change all 'item' references to 'data' in List component templates
- Add proper script bindings with data passing for List component actions
- Update main.dspy functions to use correct parameter names from form data
- Add missing update_model and remove_model functions for AI model management
- Ensure all List component interactions properly pass current item data
2026-04-22 14:25:08 +08:00

220 lines
6.3 KiB
XML

{
"widgettype": "VBox",
"options": {
"width": "100%",
"height": "100%",
"padding": "20px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "Connected Services",
"fontSize": "24px",
"fontWeight": "bold",
"color": "#F8FAFC",
"marginBottom": "20px"
}
},
{
"widgettype": "HBox",
"options": {
"width": "100%",
"marginBottom": "20px",
"alignItems": "center"
},
"subwidgets": [
{
"widgettype": "Input",
"id": "service-search",
"options": {
"placeholder": "Search services...",
"width": "300px",
"icon": "fa fa-search"
},
"binds": [
{
"wid": "self",
"event": "input",
"actiontype": "script",
"target": "app.filter_services",
"mode": "call"
}
]
},
{
"widgettype": "Filler"
},
{
"widgettype": "Button",
"options": {
"icon": "fa fa-plus",
"label": "Add Service",
"bgcolor": "#22C55E",
"color": "#FFFFFF",
"border": "none",
"borderRadius": "6px",
"padding": "8px 16px"
},
"binds": [
{
"wid": "self",
"event": "click",
"actiontype": "script",
"target": "app.add_service",
"mode": "call"
}
]
}
]
},
{
"widgettype": "List",
"id": "services-list",
"options": {
"width": "100%",
"height": "calc(100% - 100px)",
"itemHeight": "100px",
"items": []
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {
"width": "100%",
"height": "100%",
"padding": "16px",
"border": "1px solid #334155",
"borderRadius": "8px",
"bgcolor": "#1E293B"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"width": "100%",
"alignItems": "center",
"marginBottom": "8px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "{{data.name}}",
"fontSize": "18px",
"fontWeight": "600",
"color": "#F8FAFC"
}
},
{
"widgettype": "Filler"
},
{
"widgettype": "Badge",
"options": {
"text": "{{data.status}}",
"bgcolor": "{{ '#22C55E' if data.status == 'Connected' else '#EF4444' }}",
"color": "#FFFFFF",
"borderRadius": "12px",
"padding": "4px 12px",
"fontSize": "12px"
}
}
]
},
{
"widgettype": "Text",
"options": {
"text": "{{data.endpoint}}",
"fontSize": "14px",
"color": "#CBD5E1",
"marginBottom": "8px"
}
},
{
"widgettype": "HBox",
"options": {
"width": "100%",
"gap": "12px"
},
"subwidgets": [
{
"widgettype": "Button",
"options": {
"label": "Edit",
"bgcolor": "#3B82F6",
"color": "#FFFFFF",
"border": "none",
"borderRadius": "4px",
"padding": "6px 12px",
"fontSize": "12px"
},
"binds": [
{
"wid": "self",
"event": "click",
"actiontype": "script",
"target": "app.edit_service",
"options": {
"service_id": "{{data.id}}"
},
"mode": "call"
}
]
},
{
"widgettype": "Button",
"options": {
"label": "Remove",
"bgcolor": "#EF4444",
"color": "#FFFFFF",
"border": "none",
"borderRadius": "4px",
"padding": "6px 12px",
"fontSize": "12px"
},
"binds": [
{
"wid": "self",
"event": "click",
"actiontype": "script",
"target": "app.remove_service",
"options": {
"service_id": "{{data.id}}"
},
"mode": "call"
}
]
},
{
"widgettype": "Button",
"options": {
"label": "Test Connection",
"bgcolor": "#8B5CF6",
"color": "#FFFFFF",
"border": "none",
"borderRadius": "4px",
"padding": "6px 12px",
"fontSize": "12px"
},
"binds": [
{
"wid": "self",
"event": "click",
"actiontype": "script",
"target": "app.test_service_connection",
"options": {
"service_id": "{{data.id}}"
},
"mode": "call"
}
]
}
]
}
]
}
]
}
]
}