Files
aiops/backend/static/assets/PipelineRunDetail-C9e6xlUh.js
T
Logan.Li 025e74ff4d feat(k8s): Deployment 存储挂载改 Kuboard 一卷一卡布局
每张数据卷同屏展示卷定义与容器挂载(容器/只读读写/路径/subPath)。
2026-06-26 15:00:09 +08:00

4 lines
33 KiB
JavaScript

import{r as n,j as e,a as me}from"./vendor-codemirror-C7mXSpXt.js";import{D as he,a as ue,m as ge,c as ye,d as be,o as fe,g as De,t as S,B as E}from"./index-LZWfu62c.js";import{B as A}from"./badge-B0F5ZNtn.js";import{C as je,b as Ne,c as ve,a as we}from"./card-B-RtdR4H.js";import{p as C}from"./pipeline-Lgvc2XUS.js";import{am as J,an as Re,ao as Pe,X as Be,ap as Fe,f as ee,m as ke,F as Se,v as Ce,aq as Z,T as $e,R as ze,z as _e,J as Ee,ad as Ae,C as T,k as Le,ar as Te,as as Ie,L as $,ab as Oe,b as te,a as G,U as Ue,at as Me}from"./vendor-icons-Aso0-eeY.js";function We(s){return s===0?"-":s<1024?s+" B":s<1024*1024?(s/1024).toFixed(1)+" KB":(s/(1024*1024)).toFixed(1)+" MB"}function Je({open:s,onOpenChange:o,runId:u,buildNumber:c}){const[x,a]=n.useState(null),[P,B]=n.useState(!1),[N,L]=n.useState(""),[v,i]=n.useState(""),[w,z]=n.useState(!1),F=async r=>{if(u){B(!0),L("");try{const m=await C.listRunFiles(u,r||void 0);a(m),i(m?.current||"")}catch(m){L(m?.message||"加载失败"),a(null)}finally{B(!1)}}};n.useEffect(()=>{s&&u&&(i(""),F(""))},[s,u]);const y=async r=>{const m=fe.getState().token||"",b=`${location.protocol}//${location.host}/api/v1/pipelines/runs/${u}/files/download?path=${encodeURIComponent(r.path)}&token=${encodeURIComponent(m)}`;window.open(b,"_blank")},R=v?v.split("/").filter(Boolean):[],I=[""].concat(R.map((r,m)=>"/"+R.slice(0,m+1).join("/")));return e.jsx(he,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:104:5",open:s,onOpenChange:o,children:e.jsxs(ue,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:105:7",showCloseButton:!1,className:ge("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",w?"!max-w-none !w-screen !h-screen !rounded-none":""),style:w?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"700px",width:"85vw"},children:[e.jsxs(ye,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:116:9",className:"sr-only",children:["文件浏览器 #",c]}),e.jsx(be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:117:9",className:"sr-only",children:"流水线构建目录文件浏览"}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:120:9",className:"flex items-center justify-between px-4 py-2.5 border-b border-[var(--dg-border)] shrink-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:121:11",className:"flex items-center gap-2 min-w-0",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:122:13",className:"h-4 w-4 text-[var(--dg-text-secondary)] shrink-0"}),e.jsxs("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:123:13",className:"text-[var(--dg-text-primary)] font-medium text-sm",children:["#",c," 工作区文件"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:127:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:128:13",onClick:()=>z(!w),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:w?e.jsx(Re,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:29",className:"h-4 w-4"}):e.jsx(Pe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:134:13",onClick:()=>o(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(Be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:138:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:144:9",className:"flex items-center gap-0.5 px-4 py-2 text-xs border-b border-[var(--dg-border)] bg-[var(--dg-bg-primary)] overflow-x-auto shrink-0",children:I.map((r,m)=>e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:146:13",className:"flex items-center gap-0.5",children:m===0?e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:148:17",onClick:()=>F(""),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] p-0.5",children:e.jsx(Fe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:152:19",className:"h-3.5 w-3.5"})}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:156:19",className:"h-3 w-3 text-[var(--dg-text-muted)] shrink-0"}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:157:19",onClick:()=>F(r),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] truncate max-w-[120px]",children:R[m-1]})]})},r))}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:170:9",className:"overflow-y-auto",style:{height:w?"calc(100vh - 110px)":"420px"},children:[P&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:172:13",className:"flex items-center justify-center h-full text-[var(--dg-text-muted)] text-sm",children:"加载中..."}),N&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:178:13",className:"flex items-center justify-center h-full text-red-400 text-sm",children:N}),x&&!P&&e.jsxs("table",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:184:13",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:185:15",className:"sticky top-0 bg-[var(--dg-bg-primary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:186:17",className:"text-left text-[var(--dg-text-muted)] text-xs",children:[e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:187:19",className:"py-2 pl-4 pr-2 font-medium",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:188:19",className:"py-2 px-2 font-medium w-24 text-right",children:"大小"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:189:19",className:"py-2 pr-4 pl-2 font-medium w-40 hidden sm:table-cell",children:"修改时间"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:190:19",className:"py-2 pr-4 pl-2 font-medium w-16"})]})}),e.jsxs("tbody",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:193:15",children:[v&&e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:196:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)] cursor-pointer",onClick:()=>{const r=v.split("/").slice(0,-1).join("/");F(r)},children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:203:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(ke,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:204:23",className:"h-4 w-4 text-[var(--dg-text-secondary)]"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:205:23",className:"text-[var(--dg-text-secondary)]",children:".."})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:207:21",className:"py-2 px-2 text-right"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:208:21",className:"py-2 pr-4 pl-2 hidden sm:table-cell"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:209:21",className:"py-2 pr-4 pl-2"})]}),x.dirs?.map(r=>e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:215:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)] cursor-pointer",onClick:()=>F(r.path),children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:220:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:221:23",className:"h-4 w-4 text-amber-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:222:23",className:"text-[var(--dg-text-primary)]",children:r.name})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:224:21",className:"py-2 px-2 text-right text-[var(--dg-text-muted)]",children:"-"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:225:21",className:"py-2 pr-4 pl-2 text-[var(--dg-text-muted)] hidden sm:table-cell",children:r.mod_time}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:226:21",className:"py-2 pr-4 pl-2"})]},r.path)),x.files?.map(r=>e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:232:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:236:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(Se,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:237:23",className:"h-4 w-4 text-sky-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:238:23",className:"text-[var(--dg-text-primary)]",children:r.name})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:240:21",className:"py-2 px-2 text-right text-[var(--dg-text-muted)]",children:We(r.size)}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:241:21",className:"py-2 pr-4 pl-2 text-[var(--dg-text-muted)] hidden sm:table-cell",children:r.mod_time}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:242:21",className:"py-2 pr-4 pl-2",children:e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:243:23",onClick:m=>{m.stopPropagation(),y(r)},className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)] hover:text-white",title:"下载",children:e.jsx(Ce,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:248:25",className:"h-3.5 w-3.5"})})})]},r.path)),x.dirs?.length===0&&x.files?.length===0&&!v&&e.jsx("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:256:19",children:e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:257:21",colSpan:4,className:"py-8 text-center text-[var(--dg-text-muted)]",children:P?"加载中...":"目录为空"})})]})]})]})]})})}const j=[{key:"checkout",label:"代码检出",icon:Ee,color:"#6366F1",order:1},{key:"build",label:"构建",icon:Ae,color:"#F59E0B",order:2},{key:"test",label:"测试",icon:T,color:"#10B981",order:3},{key:"image",label:"镜像打包",icon:Le,color:"#06B6D4",order:4},{key:"deploy",label:"部署",icon:Te,color:"#EF4444",order:5},{key:"verify",label:"验证",icon:Ie,color:"#3B82F6",order:6}].sort((s,o)=>s.order-o.order),Ge={success:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",failed:"bg-red-500/20 text-red-400 border-red-500/30",running:"bg-blue-500/20 text-blue-400 border-blue-500/30",pending:"bg-slate-500/20 text-slate-400 border-slate-500/30",cancelled:"bg-amber-500/20 text-amber-400 border-amber-500/30"},He={success:T,failed:G,running:$,pending:te,cancelled:Oe};function qe(s){if(!s)return"-";if(s<60)return`${s}秒`;const o=Math.floor(s/60),u=s%60;return`${o}分${u}秒`}function Xe(s){return s?new Date(s).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-"}function Ke(s){if(!s)return[];try{const o=typeof s=="string"?JSON.parse(s):s;return Array.isArray(o)?o:[]}catch{return[]}}function Ve(s){const o=new Map;return s&&(Ke(s.stages).forEach(c=>{if(c.name||c.type){const x=c.type||j.find(a=>a.label===c.name)?.key;x&&o.set(x,c.status)}}),o.size===0&&s.status==="success"?j.forEach(c=>o.set(c.key,"success")):o.size===0&&s.status==="failed"?j.forEach((c,x)=>o.set(c.key,x===0?"success":"pending")):o.size===0&&s.status==="running"&&o.set("checkout","running")),o}function Qe(s,o){const u=s.find(x=>x.stage===o);if(u)return u.message;const c=j.find(x=>x.key===o);return c?`${c.label}...`:""}function nt(){const{code:s}=De(),[o,u]=n.useState(null),[c,x]=n.useState([]),[a,P]=n.useState(null),[B,N]=n.useState([]),[L,v]=n.useState(!1),[i,w]=n.useState(null),[z,F]=n.useState(10),[y,R]=n.useState(new Set),[I,r]=n.useState(!1),m=n.useRef(null),b=n.useRef(null),[se,H]=n.useState(!1),[q,oe]=n.useState(null),ne=n.useCallback(async()=>{try{const t=await C.getByCode(s);u(t?.data||t)}catch{}},[s]),f=n.useCallback(async()=>{v(!0);try{const d=(await C.getRunsByCode(s,z))?.list||[];x(d),!a&&d.length>0&&P(d[0])}catch{S.error("获取执行记录失败")}finally{v(!1)}},[s,z]);n.useEffect(()=>{ne(),f()},[]),n.useEffect(()=>{f()},[z]),n.useEffect(()=>{if(!c.some(l=>l.status==="running"))return;const d=setInterval(f,5e3);return()=>clearInterval(d)},[c,f]);const X=n.useCallback(async t=>{try{const d=await C.getRunLogStream(t.id);if(d?.logs){const l=typeof d.logs=="string"?JSON.parse(d.logs):d.logs;N(Array.isArray(l)?l:[])}else N([]);t.status==="running"&&ae(t.id)}catch{N([])}},[]),ae=t=>{b.current&&b.current.close();const d=window.location.protocol==="https:"?"wss:":"ws:",l=localStorage.getItem("token"),p=new WebSocket(`${d}//${window.location.host}/ws/pipeline/${t}/log?token=${l}`);p.onmessage=k=>{try{const h=JSON.parse(k.data);if(h.type==="init"&&h.logs){const g=typeof h.logs=="string"?JSON.parse(h.logs):h.logs;N(Array.isArray(g)?g:[])}else h.type==="done"?(p.close(),f()):h.time&&h.level&&N(g=>[...g,h])}catch{}},p.onclose=()=>{b.current=null},p.onerror=()=>{b.current=null},b.current=p};n.useEffect(()=>(a&&(X(a),w(null)),()=>{b.current&&b.current.close()}),[a,X]),n.useEffect(()=>{m.current?.scrollIntoView({behavior:"smooth"})},[B]);const le=async()=>{try{await C.triggerByCode(s),S.success("已触发"),f()}catch{S.error("触发失败")}},ce=async t=>{try{await C.stopRunByCode(s,t),S.success("已停止"),f()}catch{S.error("停止失败")}},re=async()=>{if(y.size!==0){r(!0);try{await C.batchDeleteRuns(s,Array.from(y)),S.success(`已删除 ${y.size} 条记录`),R(new Set),f()}catch{S.error("批量删除失败")}finally{r(!1)}}},ie=t=>{R(d=>{const l=new Set(d);return l.has(t)?l.delete(t):l.add(t),l})},de=()=>{y.size===c.length?R(new Set):R(new Set(c.map(t=>t.id)))},K=t=>t.triggered_by==="system"?"Cron":t.triggered_by==="git"?"Git Push":t.triggered_by||"Manual",O=Ve(a),V=i?B.filter(t=>t.stage===i):B,Q=i?Qe(B,i):"";return e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:293:5",className:"space-y-4 h-full flex flex-col",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:295:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:296:9",children:[e.jsxs("h2",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:297:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:[e.jsx(Z,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:298:13",className:"w-5 h-5 inline mr-2"}),"流水线详情"]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:301:11",className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[o?.name&&e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:303:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.name}),o?.environment&&e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:308:15",className:"text-xs",style:{backgroundColor:o.environment.color+"20",color:o.environment.color},children:o.environment.display_name}),a&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:316:15",className:"text-sm text-[var(--dg-text-secondary)]",children:["发布 #",a.build_number]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:322:9",className:"flex gap-2 items-center",children:[y.size>0&&e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:324:13",variant:"destructive",size:"sm",onClick:re,disabled:I,children:[e.jsx($e,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:325:15",className:"w-4 h-4 mr-1"}),"删除 (",y.size,")"]}),e.jsxs("select",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:328:11",value:z,onChange:t=>F(Number(t.target.value)),className:"h-8 px-2 text-xs rounded border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] text-[var(--dg-text-primary)]",children:[e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:333:13",value:10,children:"10条/页"}),e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:334:13",value:20,children:"20条/页"}),e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:335:13",value:30,children:"30条/页"})]}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:337:11",variant:"outline",size:"sm",onClick:f,children:[e.jsx(ze,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:338:13",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:340:11",size:"sm",onClick:le,children:[e.jsx(_e,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:341:13",className:"w-4 h-4 mr-1"}),"立即执行"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:347:7",className:"flex items-center gap-0 px-4 py-3 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] overflow-x-auto",children:[j.map((t,d)=>{const l=O.get(t.key)||"",p=l==="success"||l==="completed",k=l==="running"||l==="in_progress",h=l==="failed"||l==="error",g=i===t.key;t.key;const _=O.size>0,D=h?"#EF4444":k?"#3B82F6":p?"#207060":"#6B7280",U=h?"#EF444420":k?"#3B82F620":p?"#20706020":"#6B728010",M=g?D:D+"50",W=t.icon,pe=h?e.jsx(G,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:369:35",className:"h-3.5 w-3.5"}):k?e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:370:27",className:"h-3.5 w-3.5 animate-spin"}):p?e.jsx(T,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:371:27",className:"h-3.5 w-3.5"}):_?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:372:25",className:"text-[10px] opacity-40",children:"○"}):e.jsx(W,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:373:15",className:"h-3.5 w-3.5 opacity-40"}),Y=d===j.length-1,xe=d===0?"8px 0 0 8px":Y?"0 8px 8px 0":"0";return e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:379:13",className:"flex items-center",children:[e.jsxs("button",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:380:15",onClick:()=>w(i===t.key?null:t.key),title:`${t.label}${l?` (${l})`:""} — 点击查看日志`,className:`flex items-center gap-1.5 px-3 py-2 text-[12px] font-semibold border shadow-sm transition-all cursor-pointer
${g?"ring-1 ring-offset-0 scale-[1.02]":"hover:brightness-110"}`,style:{backgroundColor:U,borderColor:M,color:D,borderRadius:xe},children:[pe,e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:393:17",children:t.label})]}),!Y&&e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:396:17",className:"flex items-center justify-center w-5 h-5 -mx-px z-10",children:e.jsx(ee,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:397:19",className:"h-3.5 w-3.5",style:{color:D+"99"}})})]},t.key)}),a&&e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:404:11",className:"ml-auto text-[10px] text-[var(--dg-text-secondary)] opacity-40 shrink-0 pl-3 whitespace-nowrap",children:i?j.find(t=>t.key===i)?.label:"全阶段"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:411:7",className:"flex-1 flex flex-col min-h-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:413:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden mb-4",children:L&&c.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:415:13",className:"text-center py-12",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:416:15",className:"w-6 h-6 animate-spin mx-auto mb-2 text-[var(--dg-text-muted)]"}),"加载中..."]}):c.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:420:13",className:"text-center py-12 border border-dashed border-[var(--dg-border)] rounded-lg m-4",children:[e.jsx(Z,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:421:15",className:"w-10 h-10 mx-auto mb-3 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:422:15",className:"text-[var(--dg-text-secondary)]",children:'暂无执行记录,点击"立即执行"触发构建'})]}):e.jsxs("table",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:425:13",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:426:15",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:427:17",children:[e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:428:19",className:"px-2 py-2.5 w-10",children:e.jsx("input",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:429:21",type:"checkbox",checked:y.size===c.length&&c.length>0,onChange:de,className:"rounded"})}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:432:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] w-16",children:"构建"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:433:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] w-20",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:434:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"触发方式"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:435:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"用户"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:436:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:437:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:438:19",className:"px-3 py-2.5 text-right font-medium text-[var(--dg-text-secondary)] w-32",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:441:15",children:c.map(t=>{const d=He[t.status]||te;return e.jsxs("tr",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:445:21",className:`border-b border-[var(--dg-border)] cursor-pointer transition-colors
${a?.id===t.id?"bg-[var(--dg-blue)]/10":"hover:bg-[var(--dg-bg-tertiary)]/50"}`,onClick:()=>{P(t)},children:[e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:449:23",className:"px-2 py-2.5",onClick:l=>l.stopPropagation(),children:e.jsx("input",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:450:25",type:"checkbox",checked:y.has(t.id),onChange:()=>ie(t.id),className:"rounded"})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:453:23",className:"px-3 py-2.5 font-mono font-semibold text-[var(--dg-text-primary)]",children:["#",t.build_number]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:456:23",className:"px-3 py-2.5",children:e.jsxs(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:457:25",className:`text-xs ${Ge[t.status]||""} flex items-center gap-1 w-fit`,children:[e.jsx(d,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:458:27",className:`w-3 h-3 ${t.status==="running"?"animate-spin":""}`}),t.status==="success"?"成功":t.status==="failed"?"失败":t.status==="running"?"执行中":t.status==="cancelled"?"已取消":"待执行"]})}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:466:23",className:"px-3 py-2.5",children:e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:467:25",variant:"outline",className:"text-xs",children:K(t)})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:469:23",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] flex items-center gap-1",children:[e.jsx(Ue,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:470:25",className:"w-3 h-3"}),t.triggered_by||"admin"]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:473:23",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] font-mono text-xs",children:t.status==="running"?e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:475:27",className:"flex items-center gap-1 text-blue-400",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:476:29",className:"w-3 h-3 animate-spin"}),"执行中..."]}):qe(t.duration)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:480:23",className:"px-3 py-2.5 text-[var(--dg-text-muted)] text-xs hidden md:table-cell",children:Xe(t.created_at)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:483:23",className:"px-3 py-2.5 text-right",onClick:l=>l.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:484:25",className:"flex justify-end gap-1",children:[e.jsx(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:485:27",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>P(t),children:"日志"}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:489:27",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{oe({id:t.id,buildNumber:t.build_number}),H(!0)},children:[e.jsx(J,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:491:29",className:"w-3.5 h-3.5 mr-1"}),"浏览"]}),t.status==="running"&&e.jsx(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:494:29",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>ce(t.id),children:e.jsx(Me,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:496:31",className:"w-3.5 h-3.5"})})]})})]},t.id)})})]})}),a&&e.jsxs(je,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:511:11",className:"flex-1 flex flex-col min-h-0 border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsxs(Ne,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:512:13",className:"py-3 px-4 flex flex-row items-center justify-between border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:513:15",className:"flex items-center gap-3",children:[e.jsxs(ve,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:514:17",className:"text-sm font-mono",children:[o?.name||`#${s}`," #",a.build_number]}),a.status==="running"&&e.jsxs(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:518:19",className:"bg-blue-500/20 text-blue-400 border-blue-500/30 text-xs",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:519:21",className:"w-3 h-3 animate-spin mr-1"}),"实时"]}),i&&e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:523:19",className:"text-xs border-[var(--dg-border)]",variant:"outline",children:j.find(t=>t.key===i)?.label||i})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:528:15",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:529:17",children:["触发: ",K(a)," (",a.triggered_by||"admin",")"]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:530:17",className:"opacity-40",children:"|"}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:531:17",children:["分支: ",a.branch||"-"]}),a.commit_id&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:534:21",className:"opacity-40",children:"|"}),e.jsx("code",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:535:21",className:"bg-amber-400/10 text-amber-400 px-1 py-0.5 rounded text-[10px]",children:a.commit_id.slice(0,8)})]}),a.image_tag&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:542:21",className:"opacity-40",children:"|"}),e.jsxs("code",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:543:21",className:"bg-cyan-400/10 text-cyan-400 px-1 py-0.5 rounded text-[10px]",children:["📦 ",a.image_tag]})]})]})]}),e.jsxs(we,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:550:13",className:"flex-1 p-0 overflow-hidden min-h-0",children:[i&&Q&&e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:553:17",className:"px-4 py-2 border-b border-[var(--dg-border)] bg-[var(--dg-bg-tertiary)]/30",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:554:19",className:"flex items-center gap-2",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:555:21",className:"text-[11px] font-semibold text-[var(--dg-text-secondary)]",children:["[",j.find(t=>t.key===i)?.label||i,"]"]}),(()=>{const t=O.get(i);return t==="success"||t==="completed"?e.jsx(T,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:560:74",className:"h-3.5 w-3.5 text-emerald-400"}):t==="failed"||t==="error"?e.jsx(G,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:561:69",className:"h-3.5 w-3.5 text-red-400"}):t==="running"||t==="in_progress"?e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:562:76",className:"h-3.5 w-3.5 text-blue-400 animate-spin"}):null})(),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:565:21",className:"text-xs text-[var(--dg-text-muted)] truncate font-mono",children:Q})]})}),e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:571:15",className:"h-full overflow-y-auto bg-[#0d1117] font-mono text-xs leading-5 p-4",style:{minHeight:280},children:V.length===0&&a.status!=="running"?e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:573:19",className:"text-center py-12 text-slate-500",children:i?"该阶段暂无日志输出":"暂无日志输出"}):e.jsxs(e.Fragment,{children:[(()=>{let t="";const d={checkout:"border-indigo-500 bg-indigo-500/10",build:"border-amber-500 bg-amber-500/10",test:"border-emerald-500 bg-emerald-500/10",image:"border-cyan-500 bg-cyan-500/10",deploy:"border-red-500 bg-red-500/10",verify:"border-blue-500 bg-blue-500/10"},l={checkout:"⬇",build:"⚙",test:"✓",image:"📦",deploy:"🚀",verify:"🛡"};return V.map((p,k)=>{const h=!i&&p.stage&&p.stage!==t;h&&(t=p.stage||"");const g=p.level==="error",_=p.level==="warn",D=p.level==="success",U=g?"border-l-2 border-red-500 bg-red-500/10":_?"border-l-2 border-amber-500 bg-amber-500/10":D?"border-l-2 border-emerald-500 bg-emerald-500/5":"",M=g?"text-red-200":_?"text-amber-200":D?"text-emerald-200":"text-slate-300",W=g?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:605:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] font-bold bg-red-600/40 text-red-200",children:"ERR"}):_?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:607:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] font-bold bg-amber-600/40 text-amber-200",children:"WARN"}):D?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:609:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] font-bold bg-emerald-600/30 text-emerald-200",children:" OK "}):e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:610:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] bg-slate-600/30 text-slate-400",children:"INFO"});return e.jsxs(me.Fragment,{children:[h&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:614:31",className:`flex items-center gap-2 my-2 py-1 px-2 border-l-4 rounded-r ${d[p.stage||""]||"border-slate-500 bg-slate-500/10"}`,children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:615:33",className:"text-xs",children:l[p.stage||""]||"▸"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:616:33",className:"text-[11px] font-semibold tracking-wider text-slate-200",children:p.stage}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:617:33",className:"flex-1 border-t border-slate-700/50"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:620:29",className:`flex items-start gap-2 px-2 py-0.5 -mx-1 rounded-sm ${U} ${!g&&!_&&!D?"hover:bg-white/[0.03]":""}`,children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:621:31",className:"text-slate-600 shrink-0 w-14 text-right text-[10px] pt-px",children:p.time}),W,e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:623:31",className:`break-all ${M}`,children:p.message})]})]},k)})})(),a.status==="running"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:630:23",className:"flex items-center gap-2 mt-2 py-1.5 px-3 bg-blue-500/10 border-l-4 border-blue-500 rounded-r",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:631:25",className:"w-3 h-3 animate-spin text-blue-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:632:25",className:"text-[11px] text-blue-300 font-medium",children:"流水线执行中,实时输出..."}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:633:25",className:"flex gap-1 ml-1",children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:634:27",className:"w-1 h-1 rounded-full bg-blue-400 animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:635:27",className:"w-1 h-1 rounded-full bg-blue-400 animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:636:27",className:"w-1 h-1 rounded-full bg-blue-400 animate-bounce",style:{animationDelay:"300ms"}})]})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:640:21",ref:m})]})})]})]})]}),e.jsx(Je,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:650:7",open:se,onOpenChange:H,runId:q?.id??null,buildNumber:q?.buildNumber??0})]})}export{nt as default};