workspace: popupwindow action with inline content
This commit is contained in:
parent
f72d422551
commit
35261b8b84
@ -1,4 +1,4 @@
|
||||
# workspace_popup.dspy - 返回工作空间 PopupWindow widget 定义
|
||||
# workspace_popup.dspy - 返回工作空间内容 widget(Splitter+Tree),非 PopupWindow
|
||||
|
||||
uid = await get_user()
|
||||
if not uid:
|
||||
@ -12,24 +12,8 @@ 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",
|
||||
"options": {
|
||||
"title": "提示",
|
||||
"cwidth": 30,
|
||||
"cheight": 8,
|
||||
"auto_open": True
|
||||
},
|
||||
"subwidgets": [{
|
||||
"widgettype": "Text",
|
||||
"options": {
|
||||
"text": "请先选择项目",
|
||||
@ -37,18 +21,9 @@ async with DBPools().sqlorContext(dbname) as sor:
|
||||
"color": "#64748b",
|
||||
"padding": "20px"
|
||||
}
|
||||
}]
|
||||
}
|
||||
else:
|
||||
resp = {
|
||||
"widgettype": "PopupWindow",
|
||||
"options": {
|
||||
"title": pname + " - 工作空间",
|
||||
"cwidth": 80,
|
||||
"cheight": 36,
|
||||
"auto_open": True
|
||||
},
|
||||
"subwidgets": [{
|
||||
"widgettype": "Splitter",
|
||||
"options": {
|
||||
"direction": "horizontal",
|
||||
@ -84,7 +59,6 @@ async with DBPools().sqlorContext(dbname) as sor:
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
||||
return json.dumps(resp, ensure_ascii=False)
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user