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 - 返回工作空间内容 widget(Splitter+Tree),非 PopupWindow
uid = await get_user() uid = await get_user()
if not uid: if not uid:
@ -12,24 +12,8 @@ async with DBPools().sqlorContext(dbname) as sor:
{"u": uid}) {"u": uid})
pid = getattr(recs[0], 'current_project_id', '') if recs else '' 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: if not pid:
resp = { resp = {
"widgettype": "PopupWindow",
"options": {
"title": "提示",
"cwidth": 30,
"cheight": 8,
"auto_open": True
},
"subwidgets": [{
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"text": "请先选择项目", "text": "请先选择项目",
@ -37,18 +21,9 @@ async with DBPools().sqlorContext(dbname) as sor:
"color": "#64748b", "color": "#64748b",
"padding": "20px" "padding": "20px"
} }
}]
} }
else: else:
resp = { resp = {
"widgettype": "PopupWindow",
"options": {
"title": pname + " - 工作空间",
"cwidth": 80,
"cheight": 36,
"auto_open": True
},
"subwidgets": [{
"widgettype": "Splitter", "widgettype": "Splitter",
"options": { "options": {
"direction": "horizontal", "direction": "horizontal",
@ -84,7 +59,6 @@ async with DBPools().sqlorContext(dbname) as sor:
} }
} }
] ]
}]
} }
return json.dumps(resp, ensure_ascii=False) return json.dumps(resp, ensure_ascii=False)

File diff suppressed because one or more lines are too long