workspace: popupwindow action with inline content

This commit is contained in:
p 2026-08-12 14:33:51 +08:00
parent f72d422551
commit 35261b8b84
2 changed files with 37 additions and 63 deletions

View File

@ -1,4 +1,4 @@
# workspace_popup.dspy - 返回工作空间 PopupWindow widget 定义
# workspace_popup.dspy - 返回工作空间内容 widgetSplitter+Tree PopupWindow
uid = await get_user()
if not uid:
@ -12,79 +12,53 @@ async with DBPools().sqlorContext(dbname) as sor:
{"u": uid})
pid = getattr(recs[0], 'current_project_id', '') if recs else ''
pname = ''
if pid:
proj = await sor.sqlExe(
"SELECT name FROM sd_projects WHERE id=${p}$",
{"p": pid})
if proj:
pname = getattr(proj[0], 'name', '')
if not pid:
resp = {
"widgettype": "PopupWindow",
"widgettype": "Text",
"options": {
"title": "提示",
"cwidth": 30,
"cheight": 8,
"auto_open": True
},
"subwidgets": [{
"widgettype": "Text",
"options": {
"text": "请先选择项目",
"cfontsize": 1,
"color": "#64748b",
"padding": "20px"
}
}]
"text": "请先选择项目",
"cfontsize": 1,
"color": "#64748b",
"padding": "20px"
}
}
else:
resp = {
"widgettype": "PopupWindow",
"widgettype": "Splitter",
"options": {
"title": pname + " - 工作空间",
"cwidth": 80,
"cheight": 36,
"auto_open": True
"direction": "horizontal",
"split": "30%"
},
"subwidgets": [{
"widgettype": "Splitter",
"options": {
"direction": "horizontal",
"split": "30%"
},
"subwidgets": [
{
"widgettype": "Tree",
"id": "ws_tree",
"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"
}
}]
"subwidgets": [
{
"widgettype": "Tree",
"id": "ws_tree",
"options": {
"dataurl": "/pipeline-sdlc/api/workspace_tree.dspy",
"css": "filler",
"padding": "4px",
"cheight": "100%"
},
{
"widgettype": "VScrollPanel",
"id": "ws_files",
"binds": [{
"wid": "self",
"event": "selected",
"actiontype": "urlwidget",
"target": "ws_files",
"options": {
"css": "filler",
"padding": "8px",
"gap": "4px"
"url": "/pipeline-sdlc/api/workspace_files.dspy"
}
}]
},
{
"widgettype": "VScrollPanel",
"id": "ws_files",
"options": {
"css": "filler",
"padding": "8px",
"gap": "4px"
}
]
}]
}
]
}
return json.dumps(resp, ensure_ascii=False)

File diff suppressed because one or more lines are too long