fix: workspace_browse 补 import json + 去 pid 残留;workspace_popup 复用 get_workspace_dir
This commit is contained in:
parent
b9a458af53
commit
5e84ddbb07
@ -6,6 +6,7 @@ if not uid:
|
|||||||
|
|
||||||
dbname = get_module_dbname('pipeline-sdlc')
|
dbname = get_module_dbname('pipeline-sdlc')
|
||||||
import os
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
async with DBPools().sqlorContext(dbname) as sor:
|
async with DBPools().sqlorContext(dbname) as sor:
|
||||||
ws_dir, _ = await get_workspace_dir(sor, uid)
|
ws_dir, _ = await get_workspace_dir(sor, uid)
|
||||||
@ -41,6 +42,5 @@ tree = build_tree(ws_dir)
|
|||||||
|
|
||||||
return json.dumps({
|
return json.dumps({
|
||||||
"workspace": ws_dir,
|
"workspace": ws_dir,
|
||||||
"project_id": pid,
|
|
||||||
"tree": tree,
|
"tree": tree,
|
||||||
}, ensure_ascii=False, default=str)
|
}, ensure_ascii=False, default=str)
|
||||||
|
|||||||
@ -7,20 +7,14 @@ if not uid:
|
|||||||
uid = 'user-01'
|
uid = 'user-01'
|
||||||
|
|
||||||
dbname = get_module_dbname('pipeline-sdlc')
|
dbname = get_module_dbname('pipeline-sdlc')
|
||||||
|
import os
|
||||||
|
|
||||||
async with DBPools().sqlorContext(dbname) as sor:
|
async with DBPools().sqlorContext(dbname) as sor:
|
||||||
recs = await sor.sqlExe(
|
ws_dir, _ = await get_workspace_dir(sor, uid)
|
||||||
"SELECT current_project_id FROM pipeline_agent_settings WHERE user_id=${u}$",
|
|
||||||
{"u": uid})
|
|
||||||
pid = getattr(recs[0], 'current_project_id', '') if recs else ''
|
|
||||||
|
|
||||||
pname = ''
|
pname = os.path.basename(ws_dir) if ws_dir else ''
|
||||||
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 ws_dir:
|
||||||
resp = {
|
resp = {
|
||||||
"widgettype": "PopupWindow",
|
"widgettype": "PopupWindow",
|
||||||
"options": {"title": "提示", "cwidth": 30, "cheight": 8, "auto_open": True},
|
"options": {"title": "提示", "cwidth": 30, "cheight": 8, "auto_open": True},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user