From dbaf2f7b28aa90626dc6cd462c450d61de244dbf Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 7 Aug 2026 17:57:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20context=5Fbar=E6=94=B9=E4=B8=BAUiCo?= =?UTF-8?q?de=E9=A1=B9=E7=9B=AE=E9=80=89=E6=8B=A9=E5=99=A8+=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/index.ui | 37 ++++++++++++++++++++++++------------- wwwroot/index_cockpit.ui | 37 ++++++++++++++++++++++++------------- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/wwwroot/index.ui b/wwwroot/index.ui index c7ca2f0..b0d4e86 100644 --- a/wwwroot/index.ui +++ b/wwwroot/index.ui @@ -50,36 +50,47 @@ { "widgettype": "Html", "options": { - "html": "", + "html": "", "height": "0", "width": "0" } }, { - "widgettype": "Button", - "id": "project_label", + "widgettype": "Form", + "id": "project_form", "options": { - "label": "📁 当前项目:加载中...", - "css": "link", - "action": "click" + "name": "project_form", + "cols": 1, + "fields": [ + { + "name": "project_id", + "uitype": "code", + "label": "", + "placeholder": "选择项目", + "cwidth": 20, + "dataurl": "/pipeline-sdlc/api/cockpit_project_picker.dspy", + "valueField": "value", + "textField": "text", + "nullable": true + } + ] }, "binds": [ { "wid": "self", - "event": "click", + "event": "changed", "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:32,cheight:16,auto_open:true});var form=new bricks.Form({name:'project_picker',cols:1,fields:[{name:'project_id',uitype:'code',label:'项目',placeholder:'请选择项目',cwidth:26,dataurl:'/pipeline-sdlc/api/cockpit_project_picker.dspy',valueField:'value',textField:'text'}]});var vb=new bricks.VBox({padding:'12px',gap:'12px'});vb.add_widget(new bricks.Text({text:'请选择项目:',cfontsize:0.95,color:'#64748b'}));vb.add_widget(form);pw.content_w.add_widget(vb);setTimeout(function(){var sel=pw.content_w.dom_element.querySelector('select');if(sel)sel.addEventListener('change',function(){var v=sel.value;if(!v)return;fetch('/pipeline-sdlc/api/cockpit_context_update.dspy',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:'project_id='+encodeURIComponent(v)}).then(function(r){return r.json()}).then(function(r){if(r.success){pw.destroy();var pl=bricks.getWidgetById('project_label',bricks.app);var il=bricks.getWidgetById('iteration_label',bricks.app);if(pl)pl.text_w.set_text(r.project_name?'\\ud83d\\udcc1 \\u5f53\\u524d\\u9879\\u76ee\\uff1a'+r.project_name:'\\ud83d\\udcc1 \\u5f53\\u524d\\u9879\\u76ee\\uff1a--');if(il)il.text_w.set_text('\\ud83d\\udd04 \\u5f53\\u524d\\u8fed\\u4ee3\\uff1a'+(r.iteration_name||'--'));}});});},500);return;}var upw=new bricks.PopupWindow({title:pn+' - \\u4efb\\u52a1\\u5217\\u8868',cwidth:60,cheight:30,auto_open:true});var vs=new bricks.VScrollPanel({css:'filler',padding:'12px',gap:'8px'});upw.content_w.add_widget(vs);fetch('/pipeline-sdlc/api/cockpit_project_tasks.dspy').then(function(r){return r.json()}).then(function(data){var tasks=data.tasks||[];if(tasks.length===0){vs.add_widget(new bricks.Text({text:'\\u6682\\u65e0\\u4efb\\u52a1',cfontsize:0.9,color:'#94a3b8'}));return;}for(var i=0;isetTimeout(function(){fetch('/pipeline-sdlc/api/cockpit_context.dspy').then(function(r){return r.json()}).then(function(d){var pl=bricks.getWidgetById('project_label',bricks.app);var il=bricks.getWidgetById('iteration_label',bricks.app);if(pl&&pl.text_w)pl.text_w.set_text(d.project_name?'\\ud83d\\udcc1 \\u5f53\\u524d\\u9879\\u76ee\\uff1a'+d.project_name:'\\ud83d\\udcc1 \\u5f53\\u524d\\u9879\\u76ee\\uff1a--');if(il&&il.text_w)il.text_w.set_text('\\ud83d\\udd04 \\u5f53\\u524d\\u8fed\\u4ee3\\uff1a'+(d.iteration_name||'--'));})},300);", + "html": "", "height": "0", "width": "0" } }, { - "widgettype": "Button", - "id": "project_label", + "widgettype": "Form", + "id": "project_form", "options": { - "label": "📁 当前项目:加载中...", - "css": "link", - "action": "click" + "name": "project_form", + "cols": 1, + "fields": [ + { + "name": "project_id", + "uitype": "code", + "label": "", + "placeholder": "选择项目", + "cwidth": 20, + "dataurl": "/pipeline-sdlc/api/cockpit_project_picker.dspy", + "valueField": "value", + "textField": "text", + "nullable": true + } + ] }, "binds": [ { "wid": "self", - "event": "click", + "event": "changed", "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:32,cheight:16,auto_open:true});var form=new bricks.Form({name:'project_picker',cols:1,fields:[{name:'project_id',uitype:'code',label:'项目',placeholder:'请选择项目',cwidth:26,dataurl:'/pipeline-sdlc/api/cockpit_project_picker.dspy',valueField:'value',textField:'text'}]});var vb=new bricks.VBox({padding:'12px',gap:'12px'});vb.add_widget(new bricks.Text({text:'请选择项目:',cfontsize:0.95,color:'#64748b'}));vb.add_widget(form);pw.content_w.add_widget(vb);setTimeout(function(){var sel=pw.content_w.dom_element.querySelector('select');if(sel)sel.addEventListener('change',function(){var v=sel.value;if(!v)return;fetch('/pipeline-sdlc/api/cockpit_context_update.dspy',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:'project_id='+encodeURIComponent(v)}).then(function(r){return r.json()}).then(function(r){if(r.success){pw.destroy();var pl=bricks.getWidgetById('project_label',bricks.app);var il=bricks.getWidgetById('iteration_label',bricks.app);if(pl)pl.text_w.set_text(r.project_name?'\\ud83d\\udcc1 \\u5f53\\u524d\\u9879\\u76ee\\uff1a'+r.project_name:'\\ud83d\\udcc1 \\u5f53\\u524d\\u9879\\u76ee\\uff1a--');if(il)il.text_w.set_text('\\ud83d\\udd04 \\u5f53\\u524d\\u8fed\\u4ee3\\uff1a'+(r.iteration_name||'--'));}});});},500);return;}var upw=new bricks.PopupWindow({title:pn+' - \\u4efb\\u52a1\\u5217\\u8868',cwidth:60,cheight:30,auto_open:true});var vs=new bricks.VScrollPanel({css:'filler',padding:'12px',gap:'8px'});upw.content_w.add_widget(vs);fetch('/pipeline-sdlc/api/cockpit_project_tasks.dspy').then(function(r){return r.json()}).then(function(data){var tasks=data.tasks||[];if(tasks.length===0){vs.add_widget(new bricks.Text({text:'\\u6682\\u65e0\\u4efb\\u52a1',cfontsize:0.9,color:'#94a3b8'}));return;}for(var i=0;i