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