workspace: content in options instead of subwidgets
This commit is contained in:
parent
90af3f67a1
commit
b3b97632ac
@ -1,4 +1,4 @@
|
|||||||
# workspace_popup.dspy - 返回工作空间 PopupWindow widget 定义
|
# workspace_popup.dspy - 返回 PopupWindow,内容直接放 resizebox
|
||||||
|
|
||||||
uid = await get_user()
|
uid = await get_user()
|
||||||
if not uid:
|
if not uid:
|
||||||
@ -14,9 +14,7 @@ async with DBPools().sqlorContext(dbname) as sor:
|
|||||||
|
|
||||||
pname = ''
|
pname = ''
|
||||||
if pid:
|
if pid:
|
||||||
proj = await sor.sqlExe(
|
proj = await sor.sqlExe("SELECT name FROM sd_projects WHERE id=${p}$", {"p": pid})
|
||||||
"SELECT name FROM sd_projects WHERE id=${p}$",
|
|
||||||
{"p": pid})
|
|
||||||
if proj:
|
if proj:
|
||||||
pname = getattr(proj[0], 'name', '')
|
pname = getattr(proj[0], 'name', '')
|
||||||
|
|
||||||
@ -25,66 +23,37 @@ async with DBPools().sqlorContext(dbname) as sor:
|
|||||||
"widgettype": "PopupWindow",
|
"widgettype": "PopupWindow",
|
||||||
"options": {
|
"options": {
|
||||||
"title": "提示",
|
"title": "提示",
|
||||||
"cwidth": 30,
|
"cwidth": 30, "cheight": 8, "auto_open": True
|
||||||
"cheight": 8,
|
|
||||||
"auto_open": True
|
|
||||||
},
|
},
|
||||||
"subwidgets": [{
|
"subwidgets": [{
|
||||||
"widgettype": "Text",
|
"widgettype": "Text",
|
||||||
"options": {
|
"options": {"text": "请先选择项目", "cfontsize": 1, "color": "#64748b", "padding": "20px"}
|
||||||
"text": "请先选择项目",
|
|
||||||
"cfontsize": 1,
|
|
||||||
"color": "#64748b",
|
|
||||||
"padding": "20px"
|
|
||||||
}
|
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
|
content_widget = {
|
||||||
|
"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"}}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"widgettype": "VScrollPanel", "id": "ws_files",
|
||||||
|
"options": {"css": "filler", "padding": "8px", "gap": "4px"}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
resp = {
|
resp = {
|
||||||
"widgettype": "PopupWindow",
|
"widgettype": "PopupWindow",
|
||||||
"options": {
|
"options": {
|
||||||
"title": pname + " - 工作空间",
|
"title": pname + " - 工作空间",
|
||||||
"cwidth": 80,
|
"cwidth": 80, "cheight": 36, "auto_open": True,
|
||||||
"cheight": 36,
|
"content": content_widget
|
||||||
"auto_open": True
|
}
|
||||||
},
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user