fix: workspace_browse 补 import json + 去 pid 残留;workspace_popup 复用 get_workspace_dir

This commit is contained in:
ymq 2026-08-14 18:09:51 +08:00
parent b9a458af53
commit 5e84ddbb07
2 changed files with 5 additions and 11 deletions

View File

@ -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)

View File

@ -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},