fix: workspace popup - use HBox+buildWidget pattern like task btn

This commit is contained in:
pipeline 2026-08-12 14:07:22 +08:00
parent 16a51e2c83
commit 3cf1d04e36

View File

@ -115,7 +115,7 @@
"event": "click",
"actiontype": "script",
"target": "self",
"script": "fetch('/pipeline-sdlc/api/cockpit_context.dspy').then(function(r){return r.json()}).then(function(d){var pid=d.project_id||'';var pn=d.project_name||'';if(!pid){var pw=new bricks.PopupWindow({title:'提示',cwidth:30,cheight:8,auto_open:true});pw.content_w.add_widget(new bricks.Text({text:'请先选择项目',cfontsize:1,color:'#64748b',padding:'20px'}));return;}var pw=new bricks.PopupWindow({title:pn+' - 工作空间',cwidth:80,cheight:36,auto_open:true});var tv={'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'}}]};var fv={'widgettype':'VScrollPanel','id':'ws_files','options':{'css':'filler','padding':'8px','gap':'4px'}};var hsplit={'widgettype':'Splitter','options':{'direction':'horizontal','split':'30%'},'subwidgets':[tv,fv]};var rb=pw.dom_element.querySelector('.resizebox');rb.innerHTML='';bricks.widgetBuild(hsplit,rb).then(function(w){if(w)rb.appendChild(w.dom_element)});});"
"script": "fetch('/pipeline-sdlc/api/cockpit_context.dspy').then(function(r){return r.json()}).then(function(d){var pid=d.project_id||'';var pn=d.project_name||'';if(!pid){var pw=new bricks.PopupWindow({title:'提示',cwidth:30,cheight:8,auto_open:true});pw.content_w.add_widget(new bricks.Text({text:'请先选择项目',cfontsize:1,color:'#64748b',padding:'20px'}));return;}var pw=new bricks.PopupWindow({title:pn+' - 工作空间',cwidth:80,cheight:36,auto_open:true});var tv={'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'}}]};var fv={'widgettype':'VScrollPanel','id':'ws_files','options':{'css':'filler','padding':'8px','gap':'4px'}};var hsplit={'widgettype':'Splitter','options':{'direction':'horizontal','split':'30%'},'subwidgets':[tv,fv]};var hb=new bricks.HBox({css:'filler',gap:'0'});var tv2=bricks.widgetBuild({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'}}]},hb);var fv2=bricks.widgetBuild({widgettype:'VScrollPanel',id:'ws_files',options:{css:'filler',padding:'8px',gap:'4px'}},hb);Promise.all([tv2,fv2]).then(function(){pw.content_w.add_widget(hb);hb.dom_element.style.width='100%';hb.dom_element.style.height='100%';});});"
}
]
}