import{a as V,g as b}from"./api-DyiqpKJK.js";/* empty css                 *//* empty css               */import{v as W,aA as T,c as j,r as n,x as r,y as t,B as c,O as N,L as d,j as D,I as w,G as F,E as k,M as E,a9 as B,F as g,K as C}from"./vue-core-C3hq3bxF.js";import{E as M,a as h,v as O,b as U,d as A,e as G}from"./element-ui--fm6Vjyy.js";import{_ as $}from"./index-B2BzKGz2.js";import"./ui-components-DQ2lkQGO.js";const K={class:"card-header"},P={class:"workflow-version"},R={class:"workflow-description"},q=W({__name:"WorkflowItemCard",props:{workflow:{}},setup(y){const v=y,p=T(),a=j(()=>v.workflow),l=n(!1),i=()=>{p.push({name:"workflow-studio",params:{id:a.value.id}})},m=async()=>{const f=`/workflow/${a.value.id}/${a.value.status==="running"?"stop":"start"}`;try{l.value=!0;const e=await V.post(f,{},{base:b()});if(e.success)return!0;if(e.message)return h.error(e.message),!1}catch(e){return h.error(e.message),!1}finally{l.value=!1}};return(f,e)=>{const o=M;return t(),r("div",{class:"workflow-card",onClick:i},[c("div",K,[c("h3",P,"版本: "+d(a.value.version),1),N(o,{class:"status-switch",modelValue:a.value.status,"onUpdate:modelValue":e[0]||(e[0]=s=>a.value.status=s),"active-value":"running","inactive-value":"stopped","active-text":"运行中","inactive-text":"已停止",loading:l.value,"before-change":m,onClick:e[1]||(e[1]=s=>s.stopPropagation())},null,8,["modelValue","loading"])]),c("p",R,d(a.value.description),1)])}}}),z=$(q,[["__scopeId","data-v-ac2d2f7a"]]),H={class:"workflow-list-container"},J={key:0,class:"header"},Q={class:"header-title"},X={class:"service-name"},Y={key:0,class:"service-description"},Z={class:"list-area"},ee={key:0,class:"workflow-group-list"},se={class:"workflow-group-title"},te={key:0,class:"workflows-grid"},oe=W({__name:"WorkflowList",setup(y){const v=n(""),p=n(""),a=n(""),l=n({}),i=n(!0),m=n(""),f=o=>{const s={};for(const u of o)s[u.name]||(s[u.name]=[]),s[u.name]?.push(u);return s},e=async()=>{i.value=!0,m.value="";try{const o=await V.get("/status",{base:b()});v.value=o.name||"",p.value=o.version||"",a.value=o.description||"",l.value=f(o.workflows||[])}catch(o){h.error(o?.message||"获取工作流列表失败"),console.error("Failed to fetch workflows:",o)}finally{i.value=!1}};return D(()=>{e()}),(o,s)=>{const u=A,I=G,L=U,S=O;return t(),r("div",H,[i.value?w("",!0):(t(),r("header",J,[c("div",Q,[c("h1",X,d(v.value),1),p.value?(t(),k(u,{key:0},{default:g(()=>[C(d(p.value),1)]),_:1})):w("",!0)]),a.value?(t(),r("p",Y,d(a.value),1)):w("",!0)])),s[1]||(s[1]=c("h2",{class:"list-title"},"工作流列表",-1)),F((t(),r("section",Z,[Object.keys(l.value).length>0?(t(),r("div",ee,[(t(!0),r(E,null,B(Object.keys(l.value),_=>(t(),r("div",{key:_,class:"workflow-group"},[c("h3",se,d(_),1),l.value[_].length>0?(t(),r("div",te,[(t(!0),r(E,null,B(l.value[_],x=>(t(),k(z,{workflow:x,key:x.name},null,8,["workflow"]))),128))])):w("",!0)]))),128))])):(t(),k(L,{key:1,class:"empty-state"},{default:g(()=>[N(I,{type:"primary",onClick:e},{default:g(()=>[...s[0]||(s[0]=[C("重新加载",-1)])]),_:1})]),_:1}))])),[[S,i.value]])])}}}),de=$(oe,[["__scopeId","data-v-e7f19f18"]]);export{de as default};
