From af178f98ad2c904bb8340b409987224f17ac8c69 Mon Sep 17 00:00:00 2001 From: ymq Date: Fri, 14 Aug 2026 15:15:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9C=BA=E6=9E=84=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E7=A9=BA=E9=97=B4=E9=85=8D=E7=BD=AE=E8=A1=A8=E5=8D=95=E5=8F=96?= =?UTF-8?q?=E5=80=BC/=E8=B5=8B=E5=80=BC=20bug=20+=20get=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20owner=5Ftype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:bricks.Form.getValue() 返回 FormData 对象(非普通对象),v.remote_host=undefined 传空值报格式非法;setValue 是 InlineForm 方法,Form 无此方法导致加载失败 - 取值 getValue→_getValue(返回 {name:value} 普通对象) - 加载遍历 name_inputs 逐个 setValue - work_env.dspy get 加 owner_type 参数,org 页面加载 org 级(原 user 级优先导致看不到 org 配置) --- wwwroot/api/work_env.dspy | 8 +++++++- wwwroot/sd_org_remote/index.ui | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wwwroot/api/work_env.dspy b/wwwroot/api/work_env.dspy index acba52e..e032eb7 100644 --- a/wwwroot/api/work_env.dspy +++ b/wwwroot/api/work_env.dspy @@ -32,9 +32,15 @@ except Exception: pass if action == 'get': + _ot = (params_kw or {}).get('owner_type', '') try: async with get_sor_context(request._run_ns, 'pipeline') as sor: - env = await get_work_env(sor, user_id, org_id) + if _ot == 'org': + env = await get_work_env(sor, '', org_id) + elif _ot == 'user': + env = await get_work_env(sor, user_id, '') + else: + env = await get_work_env(sor, user_id, org_id) return json.dumps({'ok': True, 'env': env, 'account_name': account_name_for(username)}, ensure_ascii=False) except Exception as e: return json.dumps({'ok': False, 'error': str(e)}, ensure_ascii=False) diff --git a/wwwroot/sd_org_remote/index.ui b/wwwroot/sd_org_remote/index.ui index 3e7b31a..f4b5170 100644 --- a/wwwroot/sd_org_remote/index.ui +++ b/wwwroot/sd_org_remote/index.ui @@ -5,7 +5,7 @@ { "widgettype": "Html", "options": { - "html": "", + "html": "", "height": "0", "width": "0" } @@ -85,7 +85,7 @@ "options": {"label": "保存配置"}, "binds": [{ "wid": "self", "event": "click", "actiontype": "script", "target": "self", - "script": "var f=bricks.getWidgetById('remote_form',bricks.app);var v=f?f.getValue():{};var body=new URLSearchParams();body.append('action','set');body.append('owner_type','org');body.append('mode',v.mode||'local');body.append('remote_host',v.remote_host||'');body.append('remote_port',v.remote_port||'22');body.append('remote_user',v.remote_user||'');body.append('remote_dir',v.remote_dir||'');fetch('/pipeline-sdlc/api/work_env.dspy',{method:'POST',body:body}).then(function(r){return r.json()}).then(function(d){if(d.ok){bricks.show_message({title:'成功',message:'远程空间配置已保存'});}else{bricks.show_error({title:'失败',message:d.error||'未知错误'});}});" + "script": "var f=bricks.getWidgetById('remote_form',bricks.app);var v=f?f._getValue():{};var body=new URLSearchParams();body.append('action','set');body.append('owner_type','org');body.append('mode',v.mode||'local');body.append('remote_host',v.remote_host||'');body.append('remote_port',v.remote_port||'22');body.append('remote_user',v.remote_user||'');body.append('remote_dir',v.remote_dir||'');fetch('/pipeline-sdlc/api/work_env.dspy',{method:'POST',body:body}).then(function(r){return r.json()}).then(function(d){if(d.ok){bricks.show_message({title:'成功',message:'远程空间配置已保存'});}else{bricks.show_error({title:'失败',message:d.error||'未知错误'});}});" }] }, { @@ -94,7 +94,7 @@ "options": {"label": "测试远程连接"}, "binds": [{ "wid": "self", "event": "click", "actiontype": "script", "target": "self", - "script": "var f=bricks.getWidgetById('remote_form',bricks.app);var v=f?f.getValue():{};var body=new URLSearchParams();body.append('action','ensure_remote_bwrap');body.append('remote_host',v.remote_host||'');body.append('remote_port',v.remote_port||'22');body.append('remote_user',v.remote_user||'');fetch('/pipeline-sdlc/api/work_env.dspy',{method:'POST',body:body}).then(function(r){return r.json()}).then(function(d){if(d.ok){bricks.show_message({title:'连接成功',message:'远程 bwrap 位置: '+(d.location||'unknown')});}else{bricks.show_error({title:'连接失败',message:d.error||'未知错误'});}});" + "script": "var f=bricks.getWidgetById('remote_form',bricks.app);var v=f?f._getValue():{};var body=new URLSearchParams();body.append('action','ensure_remote_bwrap');body.append('remote_host',v.remote_host||'');body.append('remote_port',v.remote_port||'22');body.append('remote_user',v.remote_user||'');fetch('/pipeline-sdlc/api/work_env.dspy',{method:'POST',body:body}).then(function(r){return r.json()}).then(function(d){if(d.ok){bricks.show_message({title:'连接成功',message:'远程 bwrap 位置: '+(d.location||'unknown')});}else{bricks.show_error({title:'连接失败',message:d.error||'未知错误'});}});" }] }, {