(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[315],{479:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs/[job]",function(){return s(8099)}])},6639:function(e,t,s){"use strict";s.d(t,{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,s(998).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},3626:function(e,t,s){"use strict";s.d(t,{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,s(998).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"}]])},9307:function(e,t,s){"use strict";s.d(t,{Cl:function(){return l},OE:function(){return d}});var r=s(5893);s(7294);var n=s(8799),a=s(6989),o=s(3850);let l=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"RUNNING":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"TERMINATED":default:return"bg-gray-100 text-gray-800";case"PENDING":case"CANCELLED":case"CANCELLING":return"bg-yellow-50 text-yellow-700";case"SUCCEEDED":return"bg-blue-50 text-blue-700";case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":return"bg-red-50 text-red-700";case"RECOVERING":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"}},c=e=>{switch(e){case"LAUNCHING":case"STARTING":return(0,r.jsx)(n.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":default:return(0,r.jsx)(o.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,r.jsx)(o.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,r.jsx)(o.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,r.jsx)(o.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":return(0,r.jsx)(o.J$,{className:"w-3 h-3 mr-1"})}},i=e=>{let t=l(e),s=c(e);return(0,r.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(t),children:[s,e]})},d=e=>{let{status:t}=e;return(0,r.jsx)(a.WH,{content:t,className:"text-muted-foreground text-sm",children:(0,r.jsx)("span",{children:i(t)})})}},7673:function(e,t,s){"use strict";s.d(t,{Ol:function(){return i},Zb:function(){return c},aY:function(){return m},eW:function(){return x},ll:function(){return d}});var r=s(5893),n=s(7294),a=s(5697),o=s.n(a),l=s(2350);let c=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",s),...a,children:n})});c.displayName="Card",c.propTypes={className:o().string,children:o().node};let i=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",s),...a,children:n})});i.displayName="CardHeader",i.propTypes={className:o().string,children:o().node};let d=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("h3",{ref:t,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",s),...a,children:n})});d.displayName="CardTitle",d.propTypes={className:o().string,children:o().node};let u=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("p",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",s),...a,children:n})});u.displayName="CardDescription",u.propTypes={className:o().string,children:o().node};let m=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",s),...a,children:n})});m.displayName="CardContent",m.propTypes={className:o().string,children:o().node};let x=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",s),...a,children:n})});x.displayName="CardFooter",x.propTypes={className:o().string,children:o().node}},8969:function(e,t,s){"use strict";s.d(t,{Ce:function(){return i},NJ:function(){return c},Pr:function(){return l},getManagedJobs:function(){return o}});var r=s(7294),n=s(5821),a=s(3225);async function o(){let{allUsers:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=(await fetch("".concat(a.f4,"/jobs/queue"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({all_users:e})})).headers.get("X-Skypilot-Request-ID"),s=await fetch("".concat(a.f4,"/api/get?request_id=").concat(t));if(500===s.status){try{let e=await s.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t.type&&t.type===a.iW)return{jobs:[],controllerStopped:!0}}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{jobs:[],controllerStopped:!1}}let r=await s.json();return{jobs:(r.return_value?JSON.parse(r.return_value):[]).map(e=>{let t=[];e.submitted_at&&t.push({time:new Date(1e3*e.submitted_at),event:"Job submitted."}),e.start_at&&t.push({time:new Date(1e3*e.start_at),event:"Job started."}),e.end_at&&("CANCELLING"==e.status||"CANCELLED"==e.status?t.push({time:new Date(1e3*e.end_at),event:"Job cancelled."}):t.push({time:new Date(1e3*e.end_at),event:"Job completed."})),e.last_recovered_at&&e.last_recovered_at!=e.start_at&&t.push({time:new Date(1e3*e.last_recovered_at),event:"Job recovered."});let s=(e.end_at?e.end_at:Date.now()/1e3)-e.submitted_at,r=e.cloud,n=e.cluster_resources;if(!r){if(e.cluster_resources&&"-"!==e.cluster_resources)try{r=e.cluster_resources.split("(")[0].split("x").pop().trim(),n=e.cluster_resources.replace("".concat(r,"("),"(").replace("x ","x")}catch(e){r="Unknown"}else r="Unknown"}let a="",o=a=e.zone?e.zone:e.region;a&&a.length>15&&(a=a.substring(0,15)+"...");let l=r+" ("+a+")";"-"===a&&(l=r);let c=r+" ("+o+")";return"-"===o&&(c=r),{id:e.job_id,task:e.task_name,name:e.job_name,job_duration:e.job_duration,total_duration:s,workspace:e.workspace,status:e.status,priority:e.priority,requested_resources:e.resources,resources_str:n,resources_str_full:e.cluster_resources_full||n,cloud:r,region:e.region,infra:l,full_infra:c,recoveries:e.recovery_count,details:e.details||e.failure_reason,user:e.user_name,user_hash:e.user_hash,submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,events:t,dag_yaml:e.dag_yaml,entrypoint:e.entrypoint}}),controllerStopped:!1}}catch(e){return console.error("Error fetching managed job data:",e),{jobs:[],controllerStopped:!1}}}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,[t,s]=(0,r.useState)(null),[n,a]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{(async function(){try{a(!0);let e=await o({allUsers:!0});s(e)}catch(e){console.error("Error fetching managed job data:",e)}finally{a(!1)}})()},[e]),{jobData:t,loading:n}}async function c(e){let{jobId:t,controller:s=!1,signal:r,onNewLog:o}=e,l=new Promise(e=>{setTimeout(()=>{e({timeout:!0})},1e4)}),c=(async()=>{try{let e=(await fetch("".concat(a.f4,"/jobs/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({controller:s,follow:!1,job_id:t}),...r?{signal:r}:{}})).body.getReader();try{for(;;){let{done:t,value:s}=await e.read();if(t)break;let r=new TextDecoder().decode(s);o(r)}}finally{e.cancel()}return{timeout:!1}}catch(e){if("AbortError"===e.name)return{timeout:!1};throw e}})();if((await Promise.race([c,l])).timeout){(0,n.C)("Log request for job ".concat(t," timed out after ").concat(1e4,"ms"),"error");return}}async function i(e,t,s){let r="",o="",l="",c={};if("restartcontroller"===e)r="Restarting",o="restarted",l="jobs/queue",c={all_users:!0,refresh:!0},t="controller";else throw Error("Invalid action: ".concat(e));(0,n.C)("".concat(r," job ").concat(t,"..."),"info");try{try{let e=(await fetch("".concat(a.f4,"/").concat(l),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})).headers.get("X-Skypilot-Request-ID"),i=await fetch("".concat(a.f4,"/api/get?request_id=").concat(e));if(200===i.status)(0,n.C)("Job ".concat(t," ").concat(o," successfully."),"success");else if(500===i.status)try{let e=await i.json();if(e.detail&&e.detail.error)try{let o=JSON.parse(e.detail.error);o.type&&o.type===a.Bo?(0,n.C)("".concat(r," job ").concat(t," is not supported!"),"error",1e4):o.type&&o.type===a.mF?(0,n.C)("Cluster ".concat(s," does not exist."),"error"):o.type&&o.type===a.iW?(0,n.C)("Cluster ".concat(s," is not up."),"error"):(0,n.C)("".concat(r," job ").concat(t," failed: ").concat(o.type),"error")}catch(s){(0,n.C)("".concat(r," job ").concat(t," failed: ").concat(e.detail.error),"error")}else(0,n.C)("".concat(r," job ").concat(t," failed with no details."),"error")}catch(e){(0,n.C)("".concat(r," job ").concat(t," failed with parse error."),"error")}else(0,n.C)("".concat(r," job ").concat(t," failed with status ").concat(i.status,"."),"error")}catch(e){console.error("Fetch error:",e),(0,n.C)("Network error ".concat(r," job ").concat(t,": ").concat(e.message),"error")}}catch(e){console.error("Error in handleStop:",e),(0,n.C)("Critical error ".concat(r," job ").concat(t,": ").concat(e.message),"error")}}},5821:function(e,t,s){"use strict";function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,r=document.getElementById("toast-container");r||((r=document.createElement("div")).id="toast-container",r.className="fixed top-0 right-0 p-4 z-[9999] flex flex-col items-end space-y-2",document.body.appendChild(r));let n=document.createElement("div");switch(n.className="rounded-md border-l-4 p-4 shadow-md flex items-center justify-between max-w-md w-full mb-2 pointer-events-auto",t){case"success":n.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":n.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":n.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:n.className+=" bg-blue-100 border-blue-500 text-blue-800"}return n.innerHTML='\n      <div class="flex-1 mr-2">\n        <p class="text-sm font-medium">'.concat(e,'</p>\n      </div>\n      <button class="text-gray-500 hover:text-gray-700 focus:outline-none" aria-label="Close toast">\n        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n          <line x1="18" y1="6" x2="6" y2="18"></line>\n          <line x1="6" y1="6" x2="18" y2="18"></line>\n        </svg>\n      </button>\n    '),r.appendChild(n),n.querySelector("button").addEventListener("click",()=>{r.removeChild(n)}),setTimeout(()=>{r.contains(n)&&r.removeChild(n)},s),n}s.d(t,{C:function(){return r}})},8099:function(e,t,s){"use strict";s.r(t);var r=s(5893),n=s(7294),a=s(8799),o=s(1163),l=s(9470),c=s(7673),i=s(8969),d=s(1664),u=s.n(d),m=s(3626),x=s(5895),h=s(6639),f=s(6989),g=s(9307),p=s(3001),j=s(9008),b=s.n(j),y=s(1272);function N(e){let{jobData:t,activeTab:s,setIsLoadingLogs:o,setIsLoadingControllerLogs:l,isLoadingLogs:c,isLoadingControllerLogs:d}=e,[m,p]=(0,n.useState)([]),[j,b]=(0,n.useState)([]),[N,v]=(0,n.useState)(!1),[w,E]=(0,n.useState)({}),_=["PENDING","SUBMITTED","STARTING"].includes(t.status),C=["PENDING","SUBMITTED"].includes(t.status),L=["RECOVERING"].includes(t.status),S=e=>{E(t=>({...t,[e]:!t[e]}))},I=e=>{if(!e)return[];try{let t=[],s=e.split(/^---$/m);for(let e=0;e<s.length;e++){let r=s[e].trim();r&&""!==r&&t.push(r)}return(t.length>1?t.slice(1):t).map((e,t)=>{try{let s=y.ZP.load(e),r=y.ZP.dump(s,{lineWidth:-1,styles:{"!!str":"literal"},quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2}).split("\n"),n=[],a=-1;for(let e=0;e<r.length;e++){let t=r[e],s=t.search(/\S/);0===s&&a>=0&&e>0&&n.push(""),n.push(t),a=s}return{index:t,content:n.join("\n").trim(),preview:k(s)}}catch(s){return console.error("YAML formatting error for document ".concat(t,":"),s),{index:t,content:e,preview:"Invalid YAML"}}})}catch(t){return console.error("YAML formatting error:",t),[{index:0,content:e,preview:"Invalid YAML"}]}},k=e=>"string"==typeof e?e.substring(0,50)+"...":e&&e.name?"name: ".concat(e.name):e&&e.resources?"Task configuration":"YAML document";(0,n.useEffect)(()=>{p([])},[s,t.id]),(0,n.useEffect)(()=>{b([])},[s,t.id]);let T=(0,n.useCallback)((e,t,r,n)=>{let a=!0,o=new AbortController;return"logs"===e&&(_||L)||"controllerlogs"===e&&C?(n(!1),()=>{}):(s===e&&t&&(n(!0),(0,i.NJ)({jobId:t,controller:"controllerlogs"===e,signal:o.signal,onNewLog:e=>{if(a){let t=(0,f.q8)(e);r(e=>[...e,t])}}}).then(()=>{a&&n(!1)}).catch(t=>{a&&("AbortError"!==t.name&&(console.error("Error streaming ".concat(e,":"),t),t.message&&r(e=>[...e,"Error fetching logs: ".concat(t.message)])),n(!1))})),()=>{a=!1})},[s,_,C,L]);return((0,n.useEffect)(()=>T("logs",t.id,p,o),[s,t.id,T,o]),(0,n.useEffect)(()=>T("controllerlogs",t.id,b,l),[s,t.id,T,l]),"logs"===s)?(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",children:_?(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 job to start, please refresh after a while"})}):L?(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 job to recover, please refresh after a while"})}):c?(0,r.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,r.jsx)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):(0,r.jsx)(f.$B,{logs:m.join("")})}):"controllerlogs"===s?(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",children:C?(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 job controller process to start, please refresh after a while"})}):d?(0,r.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,r.jsx)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):(0,r.jsx)(f.$B,{logs:j.join(""),controller:!0})}):(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:"Job ID (Name)"}),(0,r.jsxs)("div",{className:"text-base mt-1",children:[t.id," ",t.name?"(".concat(t.name,")"):""]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,r.jsxs)("div",{className:"text-base mt-1 flex items-center",children:[(0,r.jsx)(g.OE,{status:t.status}),t.priority&&(0,r.jsxs)("span",{className:"ml-2",children:[" (priority: ",t.priority,")"]})]})]}),(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:t.user})]}),(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:t.requested_resources||"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:t.infra?(0,r.jsx)(f.Md,{content:t.full_infra||t.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(u(),{href:"/infra",className:"text-blue-600 hover:underline",children:t.cloud||t.infra.split("(")[0].trim()}),t.infra.includes("(")&&(0,r.jsx)("span",{children:" "+t.infra.substring(t.infra.indexOf("("))})]})}):"-"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Resources"}),(0,r.jsx)("div",{className:"text-base mt-1",children:t.resources_str_full||t.resources_str||"-"})]}),(t.entrypoint||t.dag_yaml)&&(0,r.jsxs)("div",{className:"col-span-2",children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Entrypoint"}),(0,r.jsxs)("div",{className:"space-y-4 mt-3",children:[t.entrypoint&&(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3",children:(0,r.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all",children:t.entrypoint})})}),t.dag_yaml&&"{}"!==t.dag_yaml&&(0,r.jsxs)("div",{children:[(0,r.jsx)("button",{onClick:()=>{v(!N)},className:"flex items-center text-left focus:outline-none mb-2 text-gray-700 hover:text-gray-900 transition-colors duration-200",children:(0,r.jsxs)("div",{className:"flex items-center",children:[N?(0,r.jsx)(x.Z,{className:"w-4 h-4 mr-1"}):(0,r.jsx)(h.Z,{className:"w-4 h-4 mr-1"}),(0,r.jsx)("span",{className:"text-base",children:"Show SkyPilot YAML"})]})}),N&&(0,r.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 max-h-96 overflow-y-auto",children:(()=>{let e=I(t.dag_yaml);return 0===e.length?(0,r.jsx)("div",{className:"text-gray-500",children:"No YAML available"}):1===e.length?(0,r.jsx)("pre",{className:"text-sm text-gray-800 font-mono whitespace-pre-wrap",children:e[0].content}):(0,r.jsx)("div",{className:"space-y-4",children:e.map((e,t)=>(0,r.jsxs)("div",{className:"border-b border-gray-200 pb-4 last:border-b-0",children:[(0,r.jsx)("button",{onClick:()=>S(t),className:"flex items-center justify-between w-full text-left focus:outline-none",children:(0,r.jsxs)("div",{className:"flex items-center",children:[w[t]?(0,r.jsx)(x.Z,{className:"w-4 h-4 mr-2"}):(0,r.jsx)(h.Z,{className:"w-4 h-4 mr-2"}),(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Task ",t+1,": ",e.preview]})]})}),w[t]&&(0,r.jsx)("div",{className:"mt-3 ml-6",children:(0,r.jsx)("pre",{className:"text-sm text-gray-800 font-mono whitespace-pre-wrap",children:e.content})})]},t))})})()})]})]})]})]})}t.default=function(){var e;let t=(0,o.useRouter)(),{job:s,tab:d}=t.query,[x,h]=(0,n.useState)(0),{jobData:g,loading:j}=(0,i.Pr)(x),[y,v]=(0,n.useState)(!1),[w,E]=(0,n.useState)(!0),[_,C]=(0,n.useState)(!1),[L,S]=(0,n.useState)(!1),[I,k]=(0,n.useState)(!1),[T,D]=(0,n.useState)(!1),[R,A]=(0,n.useState)(!1),[O,P]=(0,n.useState)(0),[J,Z]=(0,n.useState)(0),M=(0,p.X)();n.useEffect(()=>{!j&&w&&E(!1)},[j,w]);let U=e=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:"smooth"})};(0,n.useEffect)(()=>{D(!0)},[]),(0,n.useEffect)(()=>{if(!R){let e=new MutationObserver(()=>{let t=document.getElementById("logs-section"),s=document.getElementById("controller-logs-section");("logs"===d&&t||"controllerlogs"===d&&s)&&(A(!0),e.disconnect())});return e.observe(document.body,{childList:!0,subtree:!0}),()=>e.disconnect()}},[R,d]),(0,n.useEffect)(()=>{if(t.isReady&&T&&R&&!I){let e=setTimeout(()=>{"logs"===d?(U("logs-section"),k(!0)):"controllerlogs"===d&&(U("controller-logs-section"),k(!0))},800);return()=>clearTimeout(e)}},[t.isReady,d,I,T,R]),(0,n.useEffect)(()=>{k(!1),A(!1)},[d]);let G=async()=>{v(!0);try{h(e=>e+1),P(e=>e+1),Z(e=>e+1)}catch(e){console.error("Error refreshing data:",e)}finally{v(!1)}};if(!t.isReady)return(0,r.jsx)("div",{children:"Loading..."});let q=null==g?void 0:null===(e=g.jobs)||void 0===e?void 0:e.find(e=>String(e.id)===String(s)),F=s?"Job: ".concat(s," | SkyPilot Dashboard"):"Job Details | SkyPilot Dashboard";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b(),{children:(0,r.jsx)("title",{children:F})}),(0,r.jsxs)(l.A,{highlighted:"managed-jobs",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)(u(),{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)(u(),{href:"/jobs/".concat(s),className:"text-sky-blue hover:underline",children:[s," ",(null==q?void 0:q.name)?"(".concat(q.name,")"):""]})]}),(0,r.jsxs)("div",{className:"text-sm flex items-center",children:[(j||y||_||L)&&(0,r.jsxs)("div",{className:"flex items-center mr-4",children:[(0,r.jsx)(a.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:G,disabled:j||y,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(m.Z,{className:"w-4 h-4 mr-1.5"}),!M&&(0,r.jsx)("span",{children:"Refresh"})]})})]})]}),j&&w?(0,r.jsxs)("div",{className:"flex items-center justify-center py-32",children:[(0,r.jsx)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):q?(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsx)("div",{id:"details-section",children:(0,r.jsxs)(c.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:"Details"})}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(N,{jobData:q,activeTab:"info",setIsLoadingLogs:C,setIsLoadingControllerLogs:S,isLoadingLogs:_,isLoadingControllerLogs:L})})]})}),(0,r.jsx)("div",{id:"logs-section",className:"mt-6",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Logs"}),(0,r.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:"(Logs are not streaming; click refresh to fetch the latest logs.)"})]}),(0,r.jsx)(f.WH,{content:"Refresh logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>{P(e=>e+1)},disabled:_,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(m.Z,{className:"w-4 h-4 ".concat(_?"animate-spin":"")})})})]}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(N,{jobData:q,activeTab:"logs",setIsLoadingLogs:C,setIsLoadingControllerLogs:S,isLoadingLogs:_,isLoadingControllerLogs:L},O)})]})}),(0,r.jsx)("div",{id:"controller-logs-section",className:"mt-6",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Controller Logs"}),(0,r.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:"(Logs are not streaming; click refresh to fetch the latest logs.)"})]}),(0,r.jsx)(f.WH,{content:"Refresh controller logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>{Z(e=>e+1)},disabled:L,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(m.Z,{className:"w-4 h-4 ".concat(L?"animate-spin":"")})})})]}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(N,{jobData:q,activeTab:"controllerlogs",setIsLoadingLogs:C,setIsLoadingControllerLogs:S,isLoadingLogs:_,isLoadingControllerLogs:L},J)})]})})]}):(0,r.jsx)("div",{className:"flex items-center justify-center py-32",children:(0,r.jsx)("span",{children:"Job not found"})})]})]})}}},function(e){e.O(0,[614,798,470,888,774,179],function(){return e(e.s=479)}),_N_E=e.O()}]);