15 lines
1.1 KiB
XML
15 lines
1.1 KiB
XML
{
|
||
"widgettype": "VBox",
|
||
"options": {"width": "100%", "height": "100%", "padding": "20px"},
|
||
"subwidgets": [
|
||
{"widgettype": "Text", "options": {"label": "恢复快照", "fontSize": "20px", "marginBottom": "16px"}},
|
||
{"widgettype": "Form", "options": {"width": "100%", "maxWidth": "720px"},
|
||
"subwidgets": [
|
||
{"widgettype": "Input", "options": {"name": "id", "label": "快照ID", "required": true, "placeholder": "输入要恢复的快照 id"}}
|
||
],
|
||
"binds": [{"wid": "restore_btn", "event": "click", "actiontype": "script", "options": {"script": "const f = bricks.widget('form_restore'); const d = f.getFormData ? f.getFormData() : f.getData(); bricks_fetch('/world_snapshot/api/snapshot_restore.dspy', {method:'POST', body: JSON.stringify(d), headers:{'Content-Type':'application/json'}}).then(r=>r.json()).then(res=>{ if(res.success){ bricks.message.success('恢复成功,world=' + res.world_id); } else { bricks.message.error((res.message||'') + ' ' + (res.detail||'')); } });"}}],
|
||
"subwidgets_extra": [{"widgettype": "Button", "id": "restore_btn", "options": {"label": "恢复快照", "buttonType": "primary"}}]
|
||
}
|
||
]
|
||
}
|