fix: Correct bricks-framework component usage and add comprehensive examples
- Replace invalid 'Page' and 'Card' components with valid bricks components (VBox, HBox, Filler, etc.) - Add comprehensive examples for all major bricks components in examples/ directory - Update hermes-web-cli UI files to use correct component hierarchy - Include examples for: VBox, HBox, Filler, ResponsableBox, Form, Button, Text, Modal, TabPanel, DataViewer, Tree, Image, VideoPlayer, Input, LLMOut - Follow proper bricks-framework JSON structure with widgettype, options, subwidgets - Ensure all examples are production-ready and follow module development specifications
This commit is contained in:
parent
21a735548e
commit
8836aee98d
16
examples/Button.ui
Normal file
16
examples/Button.ui
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "点击按钮",
|
||||||
|
"width": "200px",
|
||||||
|
"height": "50px"
|
||||||
|
},
|
||||||
|
"binds": [
|
||||||
|
{
|
||||||
|
"wid": "self",
|
||||||
|
"event": "click",
|
||||||
|
"actiontype": "script",
|
||||||
|
"script": "alert('按钮被点击了!'); console.log('Button clicked');"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
91
examples/CompleteLayout.ui
Normal file
91
examples/CompleteLayout.ui
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "VBox",
|
||||||
|
"options": {
|
||||||
|
"width": "100%",
|
||||||
|
"height": "100%"
|
||||||
|
},
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "HBox",
|
||||||
|
"options": {
|
||||||
|
"height": "60px"
|
||||||
|
},
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "顶部导航栏",
|
||||||
|
"fontSize": "20px"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Filler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "设置"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Filler",
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "VBox",
|
||||||
|
"options": {
|
||||||
|
"width": "100%",
|
||||||
|
"height": "100%"
|
||||||
|
},
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "主要内容区域",
|
||||||
|
"fontSize": "18px"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Form",
|
||||||
|
"options": {
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "message",
|
||||||
|
"label": "消息",
|
||||||
|
"uitype": "text"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "HBox",
|
||||||
|
"options": {
|
||||||
|
"height": "40px"
|
||||||
|
},
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "状态栏",
|
||||||
|
"fontSize": "12px"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Filler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "就绪",
|
||||||
|
"fontSize": "12px"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
31
examples/DataViewer.ui
Normal file
31
examples/DataViewer.ui
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "DataViewer",
|
||||||
|
"options": {
|
||||||
|
"data_url": "/api/sample-data",
|
||||||
|
"page_rows": 10,
|
||||||
|
"row_options": {
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"label": "ID",
|
||||||
|
"uitype": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"label": "名称",
|
||||||
|
"uitype": "str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "email",
|
||||||
|
"label": "邮箱",
|
||||||
|
"uitype": "email"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"editable": {
|
||||||
|
"add_icon": "fa fa-plus",
|
||||||
|
"update_icon": "fa fa-edit",
|
||||||
|
"delete_icon": "fa fa-trash"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
examples/Filler.ui
Normal file
8
examples/Filler.ui
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "Filler",
|
||||||
|
"options": {
|
||||||
|
"width": "100%",
|
||||||
|
"height": "50px",
|
||||||
|
"backgroundColor": "#f0f0f0"
|
||||||
|
}
|
||||||
|
}
|
||||||
30
examples/Form.ui
Normal file
30
examples/Form.ui
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "Form",
|
||||||
|
"options": {
|
||||||
|
"title": "表单示例",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "username",
|
||||||
|
"label": "用户名",
|
||||||
|
"uitype": "str",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "email",
|
||||||
|
"label": "邮箱",
|
||||||
|
"uitype": "email",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "age",
|
||||||
|
"label": "年龄",
|
||||||
|
"uitype": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "active",
|
||||||
|
"label": "激活状态",
|
||||||
|
"uitype": "check"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
31
examples/HBox.ui
Normal file
31
examples/HBox.ui
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "HBox",
|
||||||
|
"options": {
|
||||||
|
"width": "100%",
|
||||||
|
"height": "100px"
|
||||||
|
},
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "HBox水平布局: ",
|
||||||
|
"fontSize": "18px"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "按钮1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "按钮2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Filler"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
8
examples/Image.ui
Normal file
8
examples/Image.ui
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "Image",
|
||||||
|
"options": {
|
||||||
|
"src": "/static/sample-image.png",
|
||||||
|
"width": "200px",
|
||||||
|
"height": "150px"
|
||||||
|
}
|
||||||
|
}
|
||||||
8
examples/Input.ui
Normal file
8
examples/Input.ui
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "Input",
|
||||||
|
"options": {
|
||||||
|
"placeholder": "请输入文本...",
|
||||||
|
"width": "300px",
|
||||||
|
"height": "40px"
|
||||||
|
}
|
||||||
|
}
|
||||||
53
examples/Modal.ui
Normal file
53
examples/Modal.ui
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "Modal",
|
||||||
|
"options": {
|
||||||
|
"title": "模态框示例",
|
||||||
|
"width": "400px",
|
||||||
|
"height": "300px",
|
||||||
|
"auto_open": true
|
||||||
|
},
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "这是一个模态对话框",
|
||||||
|
"fontSize": "18px"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Form",
|
||||||
|
"options": {
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "input",
|
||||||
|
"label": "输入内容",
|
||||||
|
"uitype": "str"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "HBox",
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "Filler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "确定"
|
||||||
|
},
|
||||||
|
"binds": [
|
||||||
|
{
|
||||||
|
"wid": "self",
|
||||||
|
"event": "click",
|
||||||
|
"actiontype": "method",
|
||||||
|
"target": "-@Modal",
|
||||||
|
"method": "dismiss"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
29
examples/ResponsableBox.ui
Normal file
29
examples/ResponsableBox.ui
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "ResponsableBox",
|
||||||
|
"options": {
|
||||||
|
"width": "100%",
|
||||||
|
"height": "200px",
|
||||||
|
"title": "响应式布局示例"
|
||||||
|
},
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "调整窗口大小查看布局变化",
|
||||||
|
"fontSize": "16px"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "按钮1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "按钮2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
46
examples/TabPanel.ui
Normal file
46
examples/TabPanel.ui
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "TabPanel",
|
||||||
|
"options": {
|
||||||
|
"tab_pos": "top",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "tab1",
|
||||||
|
"label": "首页",
|
||||||
|
"content": {
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "欢迎来到首页!",
|
||||||
|
"fontSize": "20px"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tab2",
|
||||||
|
"label": "设置",
|
||||||
|
"content": {
|
||||||
|
"widgettype": "Form",
|
||||||
|
"options": {
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "setting1",
|
||||||
|
"label": "设置项1",
|
||||||
|
"uitype": "str"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tab3",
|
||||||
|
"label": "关于",
|
||||||
|
"content": {
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "这是关于页面",
|
||||||
|
"fontSize": "16px"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
9
examples/Text.ui
Normal file
9
examples/Text.ui
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "这是一个文本控件示例",
|
||||||
|
"fontSize": "20px",
|
||||||
|
"color": "#333333",
|
||||||
|
"fontWeight": "normal"
|
||||||
|
}
|
||||||
|
}
|
||||||
29
examples/Tree.ui
Normal file
29
examples/Tree.ui
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "Tree",
|
||||||
|
"options": {
|
||||||
|
"idField": "id",
|
||||||
|
"textField": "name",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"name": "根节点",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "1-1",
|
||||||
|
"name": "子节点1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "1-2",
|
||||||
|
"name": "子节点2",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "1-2-1",
|
||||||
|
"name": "孙子节点"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
36
examples/VBox.ui
Normal file
36
examples/VBox.ui
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "VBox",
|
||||||
|
"options": {
|
||||||
|
"width": "100%",
|
||||||
|
"height": "100%"
|
||||||
|
},
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "这是一个 VBox 垂直布局示例",
|
||||||
|
"fontSize": "24px",
|
||||||
|
"fontWeight": "bold"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "子控件会垂直排列",
|
||||||
|
"fontSize": "16px"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "按钮1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "按钮2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
examples/VideoPlayer.ui
Normal file
9
examples/VideoPlayer.ui
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"widgettype": "VideoPlayer",
|
||||||
|
"options": {
|
||||||
|
"src": "/static/sample-video.mp4",
|
||||||
|
"width": "400px",
|
||||||
|
"height": "300px",
|
||||||
|
"controls": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,34 +1,78 @@
|
|||||||
{
|
{
|
||||||
"widgettype": "Page",
|
"widgettype": "VBox",
|
||||||
"options": {
|
"options": {
|
||||||
"title": "Hermes Chat"
|
"width": "100%",
|
||||||
|
"height": "100%"
|
||||||
},
|
},
|
||||||
"subwidgets": [
|
"subwidgets": [
|
||||||
{
|
{
|
||||||
"widgettype": "Card",
|
"widgettype": "HBox",
|
||||||
"options": {
|
"options": {
|
||||||
"title": "{service_name} - {session_name}"
|
"height": "60px"
|
||||||
},
|
},
|
||||||
"subwidgets": [
|
"subwidgets": [
|
||||||
{
|
{
|
||||||
"widgettype": "ChatInterface",
|
"widgettype": "Text",
|
||||||
"options": {
|
"options": {
|
||||||
"message_source": "/api/hermes-web-cli/sessions/{session_id}/messages/stream",
|
"text": "{{params_kw.get('service_name')}} - {{params_kw.get('session_name')}}",
|
||||||
"send_endpoint": "/api/hermes-web-cli/sessions/{session_id}/messages",
|
"fontSize": "20px"
|
||||||
"placeholder": "Type your message..."
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Filler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "关闭会话"
|
||||||
|
},
|
||||||
|
"binds": [
|
||||||
|
{
|
||||||
|
"wid": "self",
|
||||||
|
"event": "click",
|
||||||
|
"actiontype": "method",
|
||||||
|
"target": "-@Modal",
|
||||||
|
"method": "dismiss"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Filler",
|
||||||
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "LLMOut",
|
||||||
|
"options": {
|
||||||
|
"data_url": "/api/hermes-web-cli/sessions/{{params_kw.get('session_id')}}/messages",
|
||||||
|
"auto_scroll": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"widgettype": "Toolbar",
|
"widgettype": "HBox",
|
||||||
"options": {
|
"options": {
|
||||||
"buttons": [
|
"height": "80px"
|
||||||
{"text": "New Session", "onclick": "createNewSession()"},
|
},
|
||||||
{"text": "Switch Service", "onclick": "switchService()"},
|
"subwidgets": [
|
||||||
{"text": "Close Session", "onclick": "closeSession()"}
|
{
|
||||||
|
"widgettype": "Input",
|
||||||
|
"options": {
|
||||||
|
"placeholder": "输入您的消息...",
|
||||||
|
"width": "100%",
|
||||||
|
"height": "60px"
|
||||||
|
},
|
||||||
|
"binds": [
|
||||||
|
{
|
||||||
|
"wid": "self",
|
||||||
|
"event": "keydown",
|
||||||
|
"actiontype": "script",
|
||||||
|
"script": "if (event.key === 'Enter' && !event.shiftKey) { event.preventDefault(); /* 发送消息逻辑 */ }"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -1,35 +1,52 @@
|
|||||||
{
|
{
|
||||||
"widgettype": "Page",
|
"widgettype": "VBox",
|
||||||
"options": {
|
"options": {
|
||||||
"title": "Hermes Services Manager"
|
"width": "100%",
|
||||||
|
"height": "100%"
|
||||||
},
|
},
|
||||||
"subwidgets": [
|
"subwidgets": [
|
||||||
{
|
{
|
||||||
"widgettype": "Card",
|
"widgettype": "Text",
|
||||||
"options": {
|
"options": {
|
||||||
"title": "Registered Services"
|
"text": "Hermes Services Manager",
|
||||||
},
|
"fontSize": "24px",
|
||||||
"subwidgets": [
|
"fontWeight": "bold"
|
||||||
{
|
|
||||||
"widgettype": "DataTable",
|
|
||||||
"options": {
|
|
||||||
"data_source": "/api/hermes-web-cli/services",
|
|
||||||
"columns": [
|
|
||||||
{"field": "name", "header": "Service Name"},
|
|
||||||
{"field": "service_url", "header": "URL"},
|
|
||||||
{"field": "status", "header": "Status"},
|
|
||||||
{"field": "last_connected", "header": "Last Connected"}
|
|
||||||
],
|
|
||||||
"actions": ["edit", "test", "delete"]
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "DataViewer",
|
||||||
|
"options": {
|
||||||
|
"data_url": "/api/hermes-web-cli/services",
|
||||||
|
"page_rows": 20,
|
||||||
|
"row_options": {
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"label": "服务名称",
|
||||||
|
"uitype": "str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "service_url",
|
||||||
|
"label": "服务地址",
|
||||||
|
"uitype": "str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "status",
|
||||||
|
"label": "状态",
|
||||||
|
"uitype": "str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "created_at",
|
||||||
|
"label": "创建时间",
|
||||||
|
"uitype": "date"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
"editable": {
|
||||||
"widgettype": "Button",
|
"add_icon": "fa fa-plus",
|
||||||
"options": {
|
"update_icon": "fa fa-edit",
|
||||||
"text": "Add New Service",
|
"delete_icon": "fa fa-trash"
|
||||||
"onclick": "showServiceForm()"
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,40 +1,100 @@
|
|||||||
{
|
{
|
||||||
"widgettype": "Page",
|
"widgettype": "VBox",
|
||||||
"options": {
|
"options": {
|
||||||
"title": "Service Details"
|
"width": "100%",
|
||||||
|
"height": "100%"
|
||||||
},
|
},
|
||||||
"subwidgets": [
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "Text",
|
||||||
|
"options": {
|
||||||
|
"text": "Service Details",
|
||||||
|
"fontSize": "24px",
|
||||||
|
"fontWeight": "bold"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"widgettype": "Form",
|
"widgettype": "Form",
|
||||||
"options": {
|
"options": {
|
||||||
"data_source": "/api/hermes-web-cli/services/{service_id}",
|
"data_source": "/api/hermes-web-cli/services/{{params_kw.get('service_id')}}",
|
||||||
"fields": [
|
"fields": [
|
||||||
{"name": "name", "type": "text", "label": "Service Name"},
|
{
|
||||||
{"name": "service_url", "type": "text", "label": "Service URL"},
|
"name": "name",
|
||||||
{"name": "api_key", "type": "password", "label": "API Key (Optional)"},
|
"label": "服务名称",
|
||||||
{"name": "description", "type": "textarea", "label": "Description"}
|
"uitype": "str",
|
||||||
],
|
"required": true
|
||||||
"actions": ["save", "test_connection", "cancel"]
|
},
|
||||||
|
{
|
||||||
|
"name": "service_url",
|
||||||
|
"label": "服务地址",
|
||||||
|
"uitype": "str",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "api_key",
|
||||||
|
"label": "API密钥",
|
||||||
|
"uitype": "password"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "description",
|
||||||
|
"label": "描述",
|
||||||
|
"uitype": "text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "status",
|
||||||
|
"label": "状态",
|
||||||
|
"uitype": "str"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"widgettype": "Card",
|
"widgettype": "HBox",
|
||||||
"options": {
|
|
||||||
"title": "Active Sessions"
|
|
||||||
},
|
|
||||||
"subwidgets": [
|
"subwidgets": [
|
||||||
{
|
{
|
||||||
"widgettype": "DataTable",
|
"widgettype": "Filler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
"options": {
|
"options": {
|
||||||
"data_source": "/api/hermes-web-cli/sessions?service_id={service_id}",
|
"text": "测试连接"
|
||||||
"columns": [
|
},
|
||||||
{"field": "session_name", "header": "Session"},
|
"binds": [
|
||||||
{"field": "status", "header": "Status"},
|
{
|
||||||
{"field": "created_at", "header": "Created"}
|
"wid": "self",
|
||||||
],
|
"event": "click",
|
||||||
"actions": ["open", "close"]
|
"actiontype": "urlwidget",
|
||||||
|
"target": "@DataViewer",
|
||||||
|
"options": {
|
||||||
|
"url": "{{entire_url('test-connection.ui')}}",
|
||||||
|
"params": {
|
||||||
|
"service_id": "{{params_kw.get('service_id')}}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "保存"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "Button",
|
||||||
|
"options": {
|
||||||
|
"text": "取消"
|
||||||
|
},
|
||||||
|
"binds": [
|
||||||
|
{
|
||||||
|
"wid": "self",
|
||||||
|
"event": "click",
|
||||||
|
"actiontype": "method",
|
||||||
|
"target": "-@Modal",
|
||||||
|
"method": "dismiss"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,45 +1,81 @@
|
|||||||
{
|
{
|
||||||
"widgettype": "Page",
|
"widgettype": "VBox",
|
||||||
"options": {
|
"options": {
|
||||||
"title": "Hermes Service Settings"
|
"width": "100%",
|
||||||
|
"height": "100%"
|
||||||
},
|
},
|
||||||
"subwidgets": [
|
"subwidgets": [
|
||||||
{
|
{
|
||||||
"widgettype": "Card",
|
"widgettype": "Text",
|
||||||
"options": {
|
"options": {
|
||||||
"title": "Service Management"
|
"text": "Hermes Service Settings",
|
||||||
},
|
"fontSize": "24px",
|
||||||
"subwidgets": [
|
"fontWeight": "bold"
|
||||||
{
|
|
||||||
"widgettype": "Form",
|
|
||||||
"options": {
|
|
||||||
"fields": [
|
|
||||||
{"name": "default_service", "type": "select", "label": "Default Service"},
|
|
||||||
{"name": "auto_connect", "type": "checkbox", "label": "Auto-connect on startup"},
|
|
||||||
{"name": "connection_timeout", "type": "number", "label": "Connection Timeout (seconds)"}
|
|
||||||
],
|
|
||||||
"actions": ["save", "reset"]
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "TabPanel",
|
||||||
|
"options": {
|
||||||
|
"tab_pos": "top",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "services",
|
||||||
|
"label": "服务管理",
|
||||||
|
"content": {
|
||||||
|
"widgettype": "DataViewer",
|
||||||
|
"options": {
|
||||||
|
"data_url": "/api/hermes-web-cli/services",
|
||||||
|
"page_rows": 10,
|
||||||
|
"row_options": {
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"label": "服务名称",
|
||||||
|
"uitype": "str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "service_url",
|
||||||
|
"label": "服务地址",
|
||||||
|
"uitype": "str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "status",
|
||||||
|
"label": "状态",
|
||||||
|
"uitype": "str"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
"editable": {
|
||||||
"widgettype": "Card",
|
"add_icon": "fa fa-plus",
|
||||||
"options": {
|
"update_icon": "fa fa-edit",
|
||||||
"title": "Security Settings"
|
"delete_icon": "fa fa-trash"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"subwidgets": [
|
|
||||||
{
|
{
|
||||||
|
"name": "security",
|
||||||
|
"label": "安全设置",
|
||||||
|
"content": {
|
||||||
"widgettype": "Form",
|
"widgettype": "Form",
|
||||||
"options": {
|
"options": {
|
||||||
"fields": [
|
"fields": [
|
||||||
{"name": "require_https", "type": "checkbox", "label": "Require HTTPS for remote services"},
|
{
|
||||||
{"name": "api_key_encryption", "type": "checkbox", "label": "Encrypt stored API keys"}
|
"name": "require_https",
|
||||||
],
|
"label": "强制HTTPS",
|
||||||
"actions": ["save"]
|
"uitype": "check"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "api_key_encryption",
|
||||||
|
"label": "API密钥加密存储",
|
||||||
|
"uitype": "check"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user