- Replace all 'backgroundColor' properties with 'bgcolor' to comply with bricks-framework specification - Add missing UI files: new_session.ui, sessions.ui, services.ui, settings.ui - Create scripts/main.dspy with all required functions for UI interactions - Fix layout using css: 'filler' for main-content to properly fill remaining width - Ensure all referenced links have corresponding script implementations
103 lines
2.8 KiB
XML
103 lines
2.8 KiB
XML
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"padding": "20px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "Edit Service",
|
|
"fontSize": "24px",
|
|
"fontWeight": "bold",
|
|
"marginBottom": "20px",
|
|
"color": "#F8FAFC"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Form",
|
|
"id": "edit-service-form",
|
|
"options": {
|
|
"fields": [
|
|
{
|
|
"name": "name",
|
|
"label": "Service Name",
|
|
"uitype": "str",
|
|
"required": true,
|
|
"placeholder": "Enter service name"
|
|
},
|
|
{
|
|
"name": "url",
|
|
"label": "Service URL",
|
|
"uitype": "str",
|
|
"required": true,
|
|
"placeholder": "http://localhost:8080"
|
|
},
|
|
{
|
|
"name": "description",
|
|
"label": "Description",
|
|
"uitype": "str",
|
|
"placeholder": "Optional description"
|
|
}
|
|
],
|
|
"data_url": "/hermes-web-cli/hermes_services/?id={{query.service_id}}"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"height": "auto",
|
|
"marginTop": "20px",
|
|
"gap": "10px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"icon": "fa fa-save",
|
|
"label": "Update Service",
|
|
"bgcolor": "#3B82F6",
|
|
"color": "#FFFFFF",
|
|
"border": "none",
|
|
"borderRadius": "6px",
|
|
"padding": "10px 20px"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "script",
|
|
"script": "const formData = bricks.app.get_widget('edit-service-form').get_data(); const serviceId = '{{query.service_id}}'; if (formData.name && formData.url) { fetch(`/hermes-web-cli/hermes_services/?id=${serviceId}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(formData) }).then(() => { bricks.app.load_widget('{{entire_url(\"services.ui\")}}', 'app.main-content', 'replace'); }); }"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"label": "Cancel",
|
|
"bgcolor": "#64748B",
|
|
"color": "#FFFFFF",
|
|
"border": "none",
|
|
"borderRadius": "6px",
|
|
"padding": "10px 20px"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "app.main-content",
|
|
"options": {
|
|
"url": "{{entire_url('services.ui')}}"
|
|
},
|
|
"mode": "replace"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
} |