(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{53985:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs/[job]/[task]",function(){return t(12)}])},6639:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},16826:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},88507:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},13626:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},28586:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},41825:function(e,s,t){"use strict";t.d(s,{l:function(){return h}});var r=t(85893),a=t(67294),n=t(45895),c=t(6639);/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let l=(0,t(60998).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var i=t(470),o=t(17853);let d="skypilot-dcgm-gpu/skypilot-dcgm-gpu-metrics",u=[{label:"15m",value:"15m"},{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"}],x=[{id:"1",title:"GPU Utilization",keyPrefix:"gpu-util"},{id:"2",title:"GPU Memory Utilization",keyPrefix:"gpu-memory"},{id:"3",title:"GPU Temperature",keyPrefix:"gpu-temp"},{id:"4",title:"GPU Power Usage",keyPrefix:"gpu-power"}],m=(e,s,t)=>{let r=(0,o.ki)(),a=new URLSearchParams({orgId:"1",from:t.from,to:t.to,timezone:"browser","var-cluster":s,"var-node":"$__all","var-gpu":"$__all",theme:"light",panelId:e});return"".concat(r,"/d-solo/").concat(d,"?").concat(a.toString(),"&__feature.dashboardSceneSolo")};function h(e){let{clusterNameOnCloud:s,displayName:t,refreshTrigger:h=0,storageKey:f="skypilot-gpu-metrics-expanded",headerExtra:N=null,noMetricsMessage:g="No GPU metrics available."}=e,[j,p]=(0,a.useState)({from:"now-1h",to:"now"}),[b,v]=(0,a.useState)(()=>"true"===localStorage.getItem(f)),y=e=>{p({from:"now-".concat(e),to:"now"})};return(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 ".concat(b?"pt-4":"py-4"),children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)("button",{onClick:()=>{let e=!b;v(e),localStorage.setItem(f,String(e))},className:"flex items-center text-left focus:outline-none hover:text-gray-700 transition-colors duration-200",children:[b?(0,r.jsx)(n.Z,{className:"w-5 h-5 mr-2"}):(0,r.jsx)(c.Z,{className:"w-5 h-5 mr-2"}),(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"GPU Metrics"})]}),N]}),(0,r.jsx)(i.WH,{content:"Open in Grafana",children:(0,r.jsx)("button",{onClick:()=>{let e=new URLSearchParams({orgId:"1",from:j.from,to:j.to,timezone:"browser","var-cluster":s,"var-node":"$__all","var-gpu":"$__all"});window.open((0,o.JP)("/d/".concat(d,"?").concat(e.toString())),"_blank")},className:"p-1.5 rounded-md text-gray-500 hover:text-gray-700 hover:bg-gray-100 transition-colors","aria-label":"Open in Grafana",children:(0,r.jsx)(l,{className:"w-4 h-4"})})})]}),b&&(0,r.jsxs)("div",{className:"p-5",children:[(0,r.jsxs)("div",{className:"mb-4 p-4 bg-gray-50 rounded-md border border-gray-200",children:[(0,r.jsx)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Time Range:"}),(0,r.jsx)("div",{className:"flex gap-1",children:u.map(e=>(0,r.jsx)("button",{onClick:()=>y(e.value),className:"px-2 py-1 text-xs font-medium rounded border transition-colors ".concat(j.from==="now-".concat(e.value)&&"now"===j.to?"bg-sky-blue text-white border-sky-blue":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"),children:e.label},e.value))})]})}),(0,r.jsxs)("div",{className:"mt-2 text-xs text-gray-500",children:["Showing: ",t," • Time: ",j.from," to"," ",j.to]})]}),s?(0,r.jsx)("div",{className:"grid gap-4 [grid-template-columns:repeat(auto-fit,minmax(300px,1fr))]",children:x.map(e=>(0,r.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,r.jsx)("div",{className:"p-2",children:(0,r.jsx)("iframe",{src:m(e.id,s,j),width:"100%",height:"400",frameBorder:"0",title:e.title,className:"rounded"},"".concat(e.keyPrefix,"-").concat(s,"-").concat(j.from,"-").concat(j.to,"-").concat(h))})},e.id))}):(0,r.jsx)("div",{className:"p-4 text-center text-gray-500 bg-gray-50 rounded-md",children:g})]})]})})}},99307:function(e,s,t){"use strict";t.d(s,{Cl:function(){return l},OE:function(){return d}});var r=t(85893);t(67294);var a=t(55739),n=t(470),c=t(53850);let l=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"RUNNING":case"IN_USE":case"READY":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"AUTOSTOPPING":return"bg-purple-100 text-purple-800";case"TERMINATED":case"PENDING":case"UNKNOWN":default:return"bg-gray-100 text-gray-800";case"SUCCEEDED":case"PROVISIONING":case"CONTROLLER_INIT":case"REPLICA_INIT":return"bg-blue-50 text-blue-700";case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":return"bg-red-50 text-red-700";case"CANCELLED":case"CANCELLING":case"NOT_READY":return"bg-yellow-50 text-yellow-700";case"RECOVERING":case"SHUTTING_DOWN":return"bg-orange-50 text-orange-700";case"SUBMITTED":return"bg-indigo-50 text-indigo-700";case"STARTING":return"bg-cyan-50 text-cyan-700";case"FAILED_SETUP":return"bg-pink-50 text-pink-700";case"PREEMPTED":case"NO_REPLICA":return"bg-purple-50 text-purple-700"}},i=e=>{switch(e){case"LAUNCHING":case"STARTING":case"AUTOSTOPPING":case"PROVISIONING":case"SHUTTING_DOWN":return(0,r.jsx)(a.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":case"IN_USE":default:return(0,r.jsx)(c.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":case"PREEMPTED":return(0,r.jsx)(c.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":case"UNKNOWN":return(0,r.jsx)(c.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,r.jsx)(c.Ye,{className:"w-3 h-3 mr-1"});case"PENDING":case"RECOVERING":case"SUBMITTED":case"CANCELLING":case"FAILED_SETUP":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"READY":case"NOT_READY":case"CONTROLLER_INIT":case"REPLICA_INIT":case"NO_REPLICA":return(0,r.jsx)(c.J$,{className:"w-3 h-3 mr-1"})}},o=e=>{let s=l(e),t=i(e);return(0,r.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(s),children:[t,e]})},d=e=>{let{status:s,statusTooltip:t}=e,a=t||s;return(0,r.jsx)(n.Md,{content:a,children:(0,r.jsx)("span",{children:o(s)})})}},20546:function(e,s,t){"use strict";t.d(s,{H:function(){return d}});var r=t(85893);t(67294);var a=t(41664),n=t.n(a),c=t(45697),l=t.n(c);function i(e){return!!e&&"string"==typeof e&&e.toLowerCase().startsWith("sa-")}let o=()=>(0,r.jsx)("span",{className:"px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded font-medium ml-1",children:"SA"}),d=e=>{let{username:s,userHash:t,className:a="flex items-center gap-1",linkClassName:c="text-gray-700 hover:text-blue-600 hover:underline",showBadge:l=!0}=e,d=i(t),u=i(t)?"/users?tab=service-accounts":"/users";return(0,r.jsxs)("div",{className:a,children:[(0,r.jsx)(n(),{href:u,className:c,children:s}),l&&d&&(0,r.jsx)(o,{})]})};d.propTypes={username:l().string.isRequired,userHash:l().string,className:l().string,linkClassName:l().string,showBadge:l().bool}},21494:function(e,s,t){"use strict";t.d(s,{V:function(){return n}});var r=t(67294),a=t(470);function n(e){let{streamFn:s,streamArgs:t,enabled:n=!0,refreshTrigger:c=0,maxLineChars:l=2e3,maxRenderLines:i=5e3,flushIntervalMs:o=100,onError:d=e=>{}}=e,[u,x]=(0,r.useState)([]),[m,h]=(0,r.useState)(!1),[f,N]=(0,r.useState)(!1),[g,j]=(0,r.useState)(0),p=(0,r.useRef)([]),b=(0,r.useRef)(""),v=(0,r.useRef)(new Map),y=(0,r.useRef)(null),E=(0,r.useRef)(null),k=(0,r.useRef)(!1),I=(0,r.useRef)(d);(0,r.useEffect)(()=>{I.current=d},[d]);let w=(0,r.useCallback)(()=>{p.current=[],b.current="",v.current=new Map,k.current=!1,x([]),N(!1)},[]),L=(0,r.useMemo)(()=>[...u,...Array.from(v.current.values())],[u,g]),_=(0,r.useCallback)(()=>{0!==p.current.length&&x(e=>{let s=[...e,...p.current];return p.current=[],s.length>i?s.slice(s.length-i):s})},[i]);return(0,r.useEffect)(()=>{let e=!0;if(w(),!n||!s)return h(!1),()=>{};let r=new AbortController;E.current=r;let c=()=>{y.current||(y.current=setTimeout(()=>{y.current=null,_()},o))},d=e=>{let s=e.match(/^\(([^)]+)\)/);if(s){v.current.set(s[1],e),j(e=>e+1);return}p.current.push(e),p.current.length>2*i&&(p.current=p.current.slice(p.current.length-i))},u=e=>{let s=e.split("\n");s[0]=b.current+s[0];let t=e.endsWith("\n");b.current=t?"":s.pop()||"";let r=s.filter(e=>e.trim());for(let e of(!k.current&&r.length>0&&(k.current=!0,N(!0)),r)){let s=(0,a.Zn)(e);!(0,a.Zt)(s)&&(s.length>l&&(s=s.slice(0,l)+" … [truncated]"),/\d+%\s*\|/.test(s)?d(s):(p.current.push(s),p.current.length>2*i&&(p.current=p.current.slice(p.current.length-i))))}c()};return h(!0),s({...t,onNewLog:s=>{e&&u(s)},signal:r.signal}).then(()=>{e&&(b.current&&(p.current.push(b.current),b.current=""),_(),h(!1))}).catch(s=>{if(!e||"AbortError"===s.name)return;let t=I.current;t&&t(s),x(e=>[...e,"Error fetching logs: ".concat(s.message)]),h(!1)}),()=>{e=!1,y.current&&(clearTimeout(y.current),y.current=null),E.current&&(E.current.abort(),E.current=null),p.current=[],b.current="",v.current.clear()}},[s,t,n,c,_,o,l,i,w]),{lines:L,isLoading:m,hasReceivedFirstChunk:f}}},23001:function(e,s,t){"use strict";t.d(s,{X:function(){return a}});var r=t(67294);function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[s,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let s=()=>{t(window.innerWidth<e)};return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[e]),s}},12:function(e,s,t){"use strict";t.r(s);var r=t(85893),a=t(67294),n=t(55739),c=t(11163),l=t(37673),i=t(68969),o=t(41664),d=t.n(o),u=t(13626),x=t(45895),m=t(6639),h=t(16826),f=t(470),N=t(99307),g=t(23001),j=t(9008),p=t.n(j),b=t(20546),v=t(6378),y=t(21494),E=t(17853),k=t(41825);function I(e){let{taskData:s,taskIndex:t,poolsData:a}=e;return(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Task"}),(0,r.jsxs)("div",{className:"text-base mt-1",children:[t,s.task&&(0,r.jsxs)("span",{className:"text-gray-500",children:[" (",s.task,")"]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsxs)(d(),{href:"/jobs/".concat(s.id),className:"text-sky-blue hover:text-sky-blue-bright hover:underline",children:[s.id,s.name?" (".concat(s.name,")"):""]})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsx)(N.OE,{status:s.status})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsx)(b.H,{username:s.user,userHash:s.user_hash})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Workspace"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsx)(d(),{href:"/workspaces",className:"text-gray-700 hover:text-blue-600 hover:underline",children:s.workspace||"default"})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Duration"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,f.LU)(s.job_duration)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Requested Resources"}),(0,r.jsx)("div",{className:"text-base mt-1",children:s.requested_resources||s.resources_str||"N/A"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Infra"}),(0,r.jsx)("div",{className:"text-base mt-1",children:s.infra?(0,r.jsx)(f.Md,{content:s.full_infra||s.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(d(),{href:"/infra",className:"text-blue-600 hover:underline",children:s.cloud||s.infra.split("(")[0].trim()}),s.infra.includes("(")&&(0,r.jsx)("span",{children:" "+s.infra.substring(s.infra.indexOf("("))})]})}):"-"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Recoveries"}),(0,r.jsx)("div",{className:"text-base mt-1",children:s.recoveries||0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Pool"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,f.os)(s.pool,s.pool_hash,a)})]}),s.details&&(0,r.jsxs)("div",{className:"col-span-2",children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Details"}),(0,r.jsx)("div",{className:"text-base mt-1 text-gray-700 whitespace-pre-wrap",children:s.details})]})]})}function w(e){let{taskData:s,taskIndex:t,refreshFlag:c,setIsLoadingLogs:l,isLoadingLogs:o}=e,d=["PENDING","SUBMITTED","STARTING"].includes(s.status),u=["RECOVERING"].includes(s.status),x=a.useMemo(()=>({jobId:s.id,task:t,controller:!1}),[s.id,t]),m=a.useCallback(e=>{console.error("Error streaming logs:",e)},[]),{lines:h,isLoading:N,hasReceivedFirstChunk:g}=(0,y.V)({streamFn:i.NJ,streamArgs:x,enabled:!d&&!u,refreshTrigger:c,onError:m});return a.useEffect(()=>{l(N)},[N,l]),(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",children:d?(0,r.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,r.jsx)("span",{children:"Waiting for the task to start; refresh in a few moments."})}):u?(0,r.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,r.jsx)("span",{children:"Waiting for the task to recover; refresh in a few moments."})}):g||h.length?(0,r.jsx)(f.$B,{logs:h}):o?(0,r.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,r.jsx)(n.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading logs..."})]}):(0,r.jsx)(f.$B,{logs:h})})}s.default=function(){var e,s;let t=(0,c.useRouter)(),{job:o,task:N}=t.query,[j,b]=(0,a.useState)(0),{jobData:y,loading:L}=(0,i.UA)(o,j),[_,R]=(0,a.useState)([]),[T,S]=(0,a.useState)(!1),[D,C]=(0,a.useState)(!0),[P,A]=(0,a.useState)(!1),[O,U]=(0,a.useState)(0),[G,M]=(0,a.useState)(!0),Z=(0,g.X)(),[F,H]=(0,a.useState)(!1),[W,q]=(0,a.useState)(0);a.useEffect(()=>{!L&&D&&C(!1)},[L,D]),(0,a.useEffect)(()=>{(async function(){try{let e=await v.ZP.get(i.vs,[{}]);R(e.pools||[])}catch(e){console.error("Error fetching pools data:",e),R([])}})()},[]),(0,a.useEffect)(()=>{(async()=>{H(await (0,E.TO)())})()},[]);let z=async()=>{S(!0);try{b(e=>e+1),U(e=>e+1),q(e=>e+1)}catch(e){console.error("Error refreshing data:",e)}finally{S(!1)}},V=()=>{U(e=>e+1)};if(!t.isReady)return(0,r.jsx)("div",{children:"Loading..."});let B=(null==y?void 0:null===(e=y.jobs)||void 0===e?void 0:e.filter(e=>String(e.id)===String(o)))||[],Y=parseInt(N,10),$=B[Y]||null,J=B.length>0?B[0].name:"",K=$?"Task ".concat(N,": ").concat($.task||"Unnamed"," | Job ").concat(o," | SkyPilot Dashboard"):"Task Details | SkyPilot Dashboard";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p(),{children:(0,r.jsx)("title",{children:K})}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"text-base flex items-center flex-wrap",children:[(0,r.jsx)(d(),{href:"/jobs",className:"text-sky-blue hover:underline",children:"Managed Jobs"}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsxs)(d(),{href:"/jobs/".concat(o),className:"text-sky-blue hover:underline",children:[o," ",J?"(".concat(J,")"):""]}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsxs)("span",{className:"text-gray-700",children:["Task ",N,(null==$?void 0:$.task)&&(0,r.jsxs)("span",{className:"text-gray-500",children:[" (",$.task,")"]})]})]}),(0,r.jsxs)("div",{className:"text-sm flex items-center",children:[(L||T||P)&&(0,r.jsxs)("div",{className:"flex items-center mr-4",children:[(0,r.jsx)(n.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,r.jsx)(f.WH,{content:"Refresh",className:"text-muted-foreground",children:(0,r.jsxs)("button",{onClick:z,disabled:L||T,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(u.Z,{className:"w-4 h-4 mr-1.5"}),!Z&&(0,r.jsx)("span",{children:"Refresh"})]})})]})]}),L&&D?(0,r.jsxs)("div",{className:"flex items-center justify-center py-32",children:[(0,r.jsx)(n.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):$?(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsx)("div",{id:"details-section",children:(0,r.jsxs)(l.Zb,{children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Task Details"})}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(I,{taskData:$,taskIndex:Y,poolsData:_})})]})}),F&&(null===(s=$.full_infra)||void 0===s?void 0:s.includes("Kubernetes"))&&!$.pool&&$.cluster_name_on_cloud&&(0,r.jsx)(k.l,{clusterNameOnCloud:$.cluster_name_on_cloud,displayName:$.task||"Task ".concat(N),refreshTrigger:W,storageKey:"skypilot-task-gpu-metrics-expanded"}),(0,r.jsx)("div",{id:"logs-section",className:"mt-6",children:(0,r.jsxs)(l.Zb,{children:[(0,r.jsxs)("button",{onClick:()=>M(!G),className:"flex items-center justify-between w-full px-4 py-4 text-left focus:outline-none",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[G?(0,r.jsx)(x.Z,{className:"w-5 h-5 mr-2 text-gray-500"}):(0,r.jsx)(m.Z,{className:"w-5 h-5 mr-2 text-gray-500"}),(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Logs"}),(0,r.jsxs)("span",{className:"ml-2 text-xs text-gray-500",children:["(Task ",N," logs)"]})]}),G&&(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,r.jsx)(f.WH,{content:"Download task logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),(0,i.jh)({jobId:parseInt(o),controller:!1})},className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(h.Z,{className:"w-4 h-4"})})}),(0,r.jsx)(f.WH,{content:"Refresh logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),V()},disabled:P,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(u.Z,{className:"w-4 h-4 ".concat(P?"animate-spin":"")})})})]})]}),G&&(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(w,{taskData:$,taskIndex:Y,refreshFlag:O,setIsLoadingLogs:A,isLoadingLogs:P})})]})})]}):(0,r.jsx)("div",{className:"flex items-center justify-center py-32",children:(0,r.jsx)("span",{children:"Task not found"})})]})]})}},9008:function(e,s,t){e.exports=t(37219)}},function(e){e.O(0,[739,850,888,774,179],function(){return e(e.s=53985)}),_N_E=e.O()}]);