workspace: standard subwidgets + auto_open

This commit is contained in:
p 2026-08-12 14:36:52 +08:00
parent b3b97632ac
commit 5af747e004

View File

@ -1,4 +1,4 @@
# workspace_popup.dspy - 返回 PopupWindow,内容直接放 resizebox # workspace_popup.dspy - 返回 PopupWindow(用 subwidgets 标准方式)
uid = await get_user() uid = await get_user()
if not uid: if not uid:
@ -21,39 +21,28 @@ async with DBPools().sqlorContext(dbname) as sor:
if not pid: if not pid:
resp = { resp = {
"widgettype": "PopupWindow", "widgettype": "PopupWindow",
"options": { "options": {"title": "提示", "cwidth": 30, "cheight": 8, "auto_open": True},
"title": "提示",
"cwidth": 30, "cheight": 8, "auto_open": True
},
"subwidgets": [{ "subwidgets": [{
"widgettype": "Text", "widgettype": "Text",
"options": {"text": "请先选择项目", "cfontsize": 1, "color": "#64748b", "padding": "20px"} "options": {"text": "请先选择项目", "cfontsize": 1, "color": "#64748b", "padding": "20px"}
}] }]
} }
else: else:
content_widget = { resp = {
"widgettype": "Splitter", "widgettype": "PopupWindow",
"options": {"direction": "horizontal", "split": "30%"}, "options": {"title": pname + " - 工作空间", "cwidth": 80, "cheight": 36, "auto_open": True},
"subwidgets": [ "subwidgets": [{
{ "widgettype": "Splitter",
"options": {"direction": "horizontal", "split": "30%"},
"subwidgets": [{
"widgettype": "Tree", "id": "ws_tree", "widgettype": "Tree", "id": "ws_tree",
"options": {"dataurl": "/pipeline-sdlc/api/workspace_tree.dspy", "css": "filler", "padding": "4px", "cheight": "100%"}, "options": {"dataurl": "/pipeline-sdlc/api/workspace_tree.dspy", "css": "filler", "padding": "4px", "cheight": "100%"},
"binds": [{"wid": "self", "event": "selected", "actiontype": "urlwidget", "target": "ws_files", "options": {"url": "/pipeline-sdlc/api/workspace_files.dspy"}}] "binds": [{"wid": "self", "event": "selected", "actiontype": "urlwidget", "target": "ws_files", "options": {"url": "/pipeline-sdlc/api/workspace_files.dspy"}}]
}, }, {
{
"widgettype": "VScrollPanel", "id": "ws_files", "widgettype": "VScrollPanel", "id": "ws_files",
"options": {"css": "filler", "padding": "8px", "gap": "4px"} "options": {"css": "filler", "padding": "8px", "gap": "4px"}
} }]
] }]
}
resp = {
"widgettype": "PopupWindow",
"options": {
"title": pname + " - 工作空间",
"cwidth": 80, "cheight": 36, "auto_open": True,
"content": content_widget
}
} }
return json.dumps(resp, ensure_ascii=False) return json.dumps(resp, ensure_ascii=False)