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()
|
uid = await get_user()
|
||||||
if not uid:
|
if not uid:
|
||||||
@ -12,79 +12,53 @@ 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",
|
"widgettype": "Text",
|
||||||
"options": {
|
"options": {
|
||||||
"title": "提示",
|
"text": "请先选择项目",
|
||||||
"cwidth": 30,
|
"cfontsize": 1,
|
||||||
"cheight": 8,
|
"color": "#64748b",
|
||||||
"auto_open": True
|
"padding": "20px"
|
||||||
},
|
}
|
||||||
"subwidgets": [{
|
|
||||||
"widgettype": "Text",
|
|
||||||
"options": {
|
|
||||||
"text": "请先选择项目",
|
|
||||||
"cfontsize": 1,
|
|
||||||
"color": "#64748b",
|
|
||||||
"padding": "20px"
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
resp = {
|
resp = {
|
||||||
"widgettype": "PopupWindow",
|
"widgettype": "Splitter",
|
||||||
"options": {
|
"options": {
|
||||||
"title": pname + " - 工作空间",
|
"direction": "horizontal",
|
||||||
"cwidth": 80,
|
"split": "30%"
|
||||||
"cheight": 36,
|
|
||||||
"auto_open": True
|
|
||||||
},
|
},
|
||||||
"subwidgets": [{
|
"subwidgets": [
|
||||||
"widgettype": "Splitter",
|
{
|
||||||
"options": {
|
"widgettype": "Tree",
|
||||||
"direction": "horizontal",
|
"id": "ws_tree",
|
||||||
"split": "30%"
|
"options": {
|
||||||
},
|
"dataurl": "/pipeline-sdlc/api/workspace_tree.dspy",
|
||||||
"subwidgets": [
|
"css": "filler",
|
||||||
{
|
"padding": "4px",
|
||||||
"widgettype": "Tree",
|
"cheight": "100%"
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
{
|
"binds": [{
|
||||||
"widgettype": "VScrollPanel",
|
"wid": "self",
|
||||||
"id": "ws_files",
|
"event": "selected",
|
||||||
|
"actiontype": "urlwidget",
|
||||||
|
"target": "ws_files",
|
||||||
"options": {
|
"options": {
|
||||||
"css": "filler",
|
"url": "/pipeline-sdlc/api/workspace_files.dspy"
|
||||||
"padding": "8px",
|
|
||||||
"gap": "4px"
|
|
||||||
}
|
}
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "VScrollPanel",
|
||||||
|
"id": "ws_files",
|
||||||
|
"options": {
|
||||||
|
"css": "filler",
|
||||||
|
"padding": "8px",
|
||||||
|
"gap": "4px"
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
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
Loading…
x
Reference in New Issue
Block a user