# workspace_popup.dspy - 返回工作空间内容 widget(Splitter+Tree),非 PopupWindow uid = await get_user() if not uid: uid = 'user-01' dbname = get_module_dbname('pipeline-sdlc') 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 '' if not pid: resp = { "widgettype": "Text", "options": { "text": "请先选择项目", "cfontsize": 1, "color": "#64748b", "padding": "20px" } } else: resp = { "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)