skypilot-nightly 1.0.0.dev20250527__py3-none-any.whl → 1.0.0.dev20250528__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sky/__init__.py +2 -2
- sky/adaptors/kubernetes.py +13 -1
- sky/backends/cloud_vm_ray_backend.py +2 -2
- sky/check.py +4 -1
- sky/clouds/kubernetes.py +2 -2
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/Mx1iAbDQn1jMHh3UHmK3R/_buildManifest.js +1 -0
- sky/dashboard/out/_next/static/chunks/121-8f55ee3fa6301784.js +20 -0
- sky/dashboard/out/_next/static/chunks/{573-82bd40a37af834f1.js → 173-7db8607cefc20f70.js} +5 -5
- sky/dashboard/out/_next/static/chunks/236-d6900c828331f664.js +6 -0
- sky/dashboard/out/_next/static/chunks/293-351268365226d251.js +1 -0
- sky/dashboard/out/_next/static/chunks/470-4d003c441839094d.js +1 -0
- sky/dashboard/out/_next/static/chunks/578-9146658cead92981.js +6 -0
- sky/dashboard/out/_next/static/chunks/843-256ec920f6d5f41f.js +11 -0
- sky/dashboard/out/_next/static/chunks/856-62b87c68917b08ed.js +1 -0
- sky/dashboard/out/_next/static/chunks/973-1a09cac61cfcc1e1.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-159bffb2fa34ed54.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/{[cluster]-e23fcddf60578a0d.js → [cluster]-9506c00257d10dbd.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/{clusters-8afda8efa5b74997.js → clusters-943992b84fd6f4ee.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/config-41738d1896fc02fe.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/infra-881fcd902fbbd0e5.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-2c29e97a6aa50dd4.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/{jobs-ff7e8e377d02b651.js → jobs-a4efc09e61988f8d.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/users-b2634885d67c49a6.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/workspace/{new-63763ffa3edb4508.js → new-579b3203c7c19d84.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces/{[name]-3ede7a13caf23375.js → [name]-9388e38fac73ee8f.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces-610c49ae3619ee85.js +1 -0
- sky/dashboard/out/_next/static/css/ffd1cd601648c303.css +3 -0
- sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
- sky/dashboard/out/clusters/[cluster].html +1 -1
- sky/dashboard/out/clusters.html +1 -1
- sky/dashboard/out/config.html +1 -1
- sky/dashboard/out/index.html +1 -1
- sky/dashboard/out/infra.html +1 -1
- sky/dashboard/out/jobs/[job].html +1 -1
- sky/dashboard/out/jobs.html +1 -1
- sky/dashboard/out/users.html +1 -1
- sky/dashboard/out/workspace/new.html +1 -1
- sky/dashboard/out/workspaces/[name].html +1 -1
- sky/dashboard/out/workspaces.html +1 -1
- sky/global_user_state.py +181 -134
- sky/provision/kubernetes/utils.py +4 -4
- sky/server/server.py +6 -5
- sky/setup_files/dependencies.py +1 -0
- sky/skylet/constants.py +4 -0
- sky/utils/db_utils.py +34 -46
- sky/utils/subprocess_utils.py +2 -3
- {skypilot_nightly-1.0.0.dev20250527.dist-info → skypilot_nightly-1.0.0.dev20250528.dist-info}/METADATA +2 -1
- {skypilot_nightly-1.0.0.dev20250527.dist-info → skypilot_nightly-1.0.0.dev20250528.dist-info}/RECORD +55 -54
- sky/dashboard/out/_next/static/D5bjIfl4Ob3SV3LJz3CO0/_buildManifest.js +0 -1
- sky/dashboard/out/_next/static/chunks/236-e220ba0c35bf089e.js +0 -6
- sky/dashboard/out/_next/static/chunks/470-1d784f5c8750744a.js +0 -1
- sky/dashboard/out/_next/static/chunks/488-50d843fdb5396d32.js +0 -15
- sky/dashboard/out/_next/static/chunks/578-24f35aa98d38d638.js +0 -6
- sky/dashboard/out/_next/static/chunks/627-31b701e69f52db0c.js +0 -1
- sky/dashboard/out/_next/static/chunks/843-e35d71cf1c7f706e.js +0 -11
- sky/dashboard/out/_next/static/chunks/990-f85643b521f7ca65.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-339b59921ccfe266.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/config-72b8c6c2edfd0e39.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/infra-1521baab6992916b.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-4d913940b4fa6f5a.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/users-9900af52acf8648d.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces-72330c4d0fc9a4a2.js +0 -1
- sky/dashboard/out/_next/static/css/6a1c0d711a4bdaf1.css +0 -3
- /sky/dashboard/out/_next/static/{D5bjIfl4Ob3SV3LJz3CO0 → Mx1iAbDQn1jMHh3UHmK3R}/_ssgManifest.js +0 -0
- /sky/dashboard/out/_next/static/chunks/pages/{_app-3985f074c163a856.js → _app-a631df412d8172de.js} +0 -0
- {skypilot_nightly-1.0.0.dev20250527.dist-info → skypilot_nightly-1.0.0.dev20250528.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250527.dist-info → skypilot_nightly-1.0.0.dev20250528.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250527.dist-info → skypilot_nightly-1.0.0.dev20250528.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250527.dist-info → skypilot_nightly-1.0.0.dev20250528.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[236],{8236:function(e,s,t){t.d(s,{L4:function(){return D},Nk:function(){return I},x2:function(){return R}});var n=t(5893),r=t(7294),a=t(1163),l=t(1664),i=t.n(l),c=t(8799),o=t(803),d=t(7673),h=t(8764),x=t(6989),u=t(8969),m=t(3266),p=t(7324),j=t(9470),f=t(3626),g=t(998);/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let w=(0,g.Z)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),N=(0,g.Z)("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]),b=(0,g.Z)("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);var y=t(9284),v=t(4545),k=t(9307),C=t(3001),S=t(8950),E=t(6378),L=t(6856);let R={active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]},M="__ALL_WORKSPACES__",_=e=>{if(!e)return"-";let s=(0,x.GV)(e);if(r.isValidElement(s)&&s.props&&s.props.children&&(s=r.isValidElement(s.props.children)&&s.props.children.props&&s.props.children.props.children?s.props.children.props.children:s.props.children),"string"!=typeof s)return s;if("just now"===s)return"now";let t=s.match(/^About\s+(\d+)\s+(\w+)\s+ago$/);if(t){let e=t[1],s=t[2],n={second:"sec",seconds:"secs",minute:"min",minutes:"mins",hour:"hr",hours:"hrs",day:"d",days:"d",month:"mo",months:"mos",year:"yr",years:"yrs"};if(n[s])return"~ ".concat(e," ").concat(n[s]," ago")}let n=s.match(/^a[n]?\s+(\w+)\s+ago$/);if(n){let e=n[1],s={second:"sec",minute:"min",hour:"hr",day:"d",month:"mo",year:"yr"};if(s[e])return"1 ".concat(s[e]," ago")}let a=s.match(/^(\d+)\s+(\w+)\s+ago$/);if(a){let e=a[1],s=a[2],t={seconds:"secs",minutes:"mins",hours:"hrs",days:"d",months:"mo",years:"yr"};if(t[s])return"".concat(e," ").concat(t[s]," ago")}return s};function I(){let e=(0,a.useRouter)(),[s,t]=(0,r.useState)(!1),l=r.useRef(null),[o,d]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),h=(0,C.X)(),[g,w]=(0,r.useState)(M),[N,b]=(0,r.useState)([]);return(0,r.useEffect)(()=>{e.isReady&&e.query.workspace&&w(Array.isArray(e.query.workspace)?e.query.workspace[0]:e.query.workspace)},[e.isReady,e.query.workspace]),(0,r.useEffect)(()=>{(async()=>{try{await L.ZP.preloadForPage("jobs");let e=await E.ZP.get(p.fX),s=Object.keys(e),t=(await E.ZP.get(u.getManagedJobs)).jobs||[],n=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],r=new Set(s);n.forEach(e=>r.add(e)),b(Array.from(r).sort())}catch(e){console.error("Error fetching data for workspace filter:",e),b(["default"])}})()},[]),(0,n.jsxs)(j.A,{highlighted:"jobs",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,n.jsxs)("div",{className:"text-base flex items-center",children:[(0,n.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"}),(0,n.jsxs)(S.Ph,{value:g,onValueChange:w,children:[(0,n.jsx)(S.i4,{className:"h-8 w-48 ml-4 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,n.jsx)(S.ki,{placeholder:"Filter by workspace...",children:g===M?"All Workspaces":g})}),(0,n.jsxs)(S.Bw,{children:[(0,n.jsx)(S.Ql,{value:M,children:"All Workspaces"}),N.map(e=>(0,n.jsx)(S.Ql,{value:e,children:e},e))]})]})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(0,n.jsxs)("div",{className:"flex items-center mr-2",children:[(0,n.jsx)(c.Z,{size:15,className:"mt-0"}),(0,n.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,n.jsxs)("button",{onClick:()=>{E.ZP.invalidate(u.getManagedJobs),E.ZP.invalidate(m.getClusters),E.ZP.invalidate(p.fX),l.current&&l.current()},disabled:s,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",title:"Refresh",children:[(0,n.jsx)(f.Z,{className:"h-4 w-4 mr-1.5"}),!h&&(0,n.jsx)("span",{children:"Refresh"})]})]})]}),(0,n.jsx)(O,{refreshInterval:x.yc,setLoading:t,refreshDataRef:l,workspaceFilter:g}),(0,n.jsx)(y.cV,{isOpen:o.isOpen,onClose:()=>d({...o,isOpen:!1}),onConfirm:o.onConfirm,title:o.title,message:o.message})]})}function O(e){let{refreshInterval:s,setLoading:t,refreshDataRef:a,workspaceFilter:l}=e,[p,j]=(0,r.useState)([]),[f,g]=(0,r.useState)({key:null,direction:"ascending"}),[N,b]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!0),[L,I]=(0,r.useState)(1),[O,D]=(0,r.useState)(10),[z,F]=(0,r.useState)(null),W=(0,r.useRef)(null),[U,q]=(0,r.useState)([]),[T,V]=(0,r.useState)({}),[B,J]=(0,r.useState)(!1),[G,H]=(0,r.useState)(!1),[X,$]=(0,r.useState)(!1),[K,Q]=(0,r.useState)("active"),[Y,ee]=(0,r.useState)(!0),[es,et]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),en=async()=>{et({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller? This will temporarily interrupt job management.",onConfirm:async()=>{try{$(!0),b(!0),await (0,u.Ce)("restartcontroller"),await er()}catch(e){console.error("Error restarting controller:",e)}finally{$(!1),b(!1)}}})},er=r.useCallback(async()=>{b(!0),t(!0);try{let[e,s]=await Promise.all([E.ZP.get(u.getManagedJobs),E.ZP.get(m.getClusters)]),{jobs:t,controllerStopped:n}=e,r=s.find(e=>(0,v.Ym)(e.cluster)),a=r?r.status:"NOT_FOUND",l=!1;"STOPPED"==a&&n&&(l=!0),"LAUNCHING"==a?H(!0):H(!1),j(t),J(l)}catch(e){console.error("Error fetching data:",e),j([])}finally{b(!1),t(!1),S(!1)}},[t]);r.useEffect(()=>{a&&(a.current=er)},[a,er]),(0,r.useEffect)(()=>{j([]);let e=!0;er();let t=setInterval(()=>{e&&er()},s);return()=>{e=!1,clearInterval(t)}},[s,er]),(0,r.useEffect)(()=>{I(1)},[K,p.length]),(0,r.useEffect)(()=>{q([]),ee(!0)},[K]);let ea=e=>{let s="ascending";f.key===e&&"ascending"===f.direction&&(s="descending"),g({key:e,direction:s})},el=e=>f.key===e?"ascending"===f.direction?" ↑":" ↓":"";r.useMemo(()=>({active:p.filter(e=>R.active.includes(e.status)).length,finished:p.filter(e=>R.finished.includes(e.status)).length}),[p]);let ei=e=>U.length>0?U.includes(e):R[K].includes(e),ec=r.useMemo(()=>{let e=l&&l!==M?p.filter(e=>(e.workspace||"default").toLowerCase()===l.toLowerCase()):p;return U.length>0?e.filter(e=>U.includes(e.status)):Y?e.filter(e=>R[K].includes(e.status)):[]},[p,K,U,Y,R,l]),eo=r.useMemo(()=>f.key?[...ec].sort((e,s)=>e[f.key]<s[f.key]?"ascending"===f.direction?-1:1:e[f.key]>s[f.key]?"ascending"===f.direction?1:-1:0):ec,[ec,f]),ed=Math.ceil(eo.length/O),eh=(L-1)*O,ex=eh+O,eu=eo.slice(eh,ex),em=e=>{if(U.includes(e)){let s=U.filter(s=>s!==e);0===s.length?(ee(!0),q([])):(q(s),ee(!1))}else q([...U,e]),ee(!1)};return(0,r.useEffect)(()=>{V(p.reduce((e,s)=>(e[s.status]=(e[s.status]||0)+1,e),{}))},[p]),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("div",{className:"flex flex-col space-y-1 mb-1",children:(0,n.jsxs)("div",{className:"flex flex-wrap items-center text-sm mb-1",children:[(0,n.jsx)("span",{className:"mr-2 text-sm font-medium",children:"Statuses:"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[!N&&0===p.length&&!C&&(0,n.jsx)("span",{className:"text-gray-500 mr-2",children:"No jobs found"}),Object.entries(T).map(e=>{let[s,t]=e;return(0,n.jsxs)("button",{onClick:()=>em(s),className:"px-3 py-1 rounded-full flex items-center space-x-2 ".concat(ei(s)||U.includes(s)?(0,k.Cl)(s):"bg-gray-50 text-gray-600 hover:bg-gray-100"),children:[(0,n.jsx)("span",{children:s}),(0,n.jsx)("span",{className:"text-xs ".concat(ei(s)||U.includes(s)?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:t})]},s)}),p.length>0&&(0,n.jsxs)("div",{className:"flex items-center ml-2 gap-2",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"("}),(0,n.jsx)("button",{onClick:()=>{Q("active"),q([]),ee(!0)},className:"text-sm font-medium ".concat("active"===K&&Y?"text-green-700 underline":"text-gray-600 hover:text-green-700 hover:underline"),children:"show all active jobs"}),(0,n.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,n.jsx)("button",{onClick:()=>{Q("finished"),q([]),ee(!0)},className:"text-sm font-medium ".concat("finished"===K&&Y?"text-blue-700 underline":"text-gray-600 hover:text-blue-700 hover:underline"),children:"show all finished jobs"}),(0,n.jsx)("span",{className:"text-gray-500",children:")"})]})]})]})}),(0,n.jsx)(d.Zb,{children:(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("id"),children:["ID",el("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("name"),children:["Name",el("name")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("user"),children:["User",el("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("workspace"),children:["Workspace",el("workspace")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("submitted_at"),children:["Submitted",el("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("job_duration"),children:["Duration",el("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("status"),children:["Status",el("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("resources_str"),children:["Requested",el("resources_str")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("infra"),children:["Infra",el("infra")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("cluster"),children:["Resources",el("cluster")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("recoveries"),children:["Recoveries",el("recoveries")]}),(0,n.jsx)(h.ss,{children:"Details"}),(0,n.jsx)(h.ss,{children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:N&&C?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:12,className:"text-center py-6 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(c.Z,{size:20,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading..."})]})})}):eu.length>0?(0,n.jsx)(n.Fragment,{children:eu.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.name})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,n.jsx)(h.pj,{children:_(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,x.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(k.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.requested_resources}),(0,n.jsx)(h.pj,{children:e.infra&&"-"!==e.infra?(0,n.jsx)(x.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,n.jsxs)("span",{children:[(0,n.jsx)(i(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud||e.infra.split("(")[0].trim()}),e.infra.includes("(")&&(0,n.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})}):(0,n.jsx)("span",{children:e.infra||"-"})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(x.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,n.jsx)("span",{children:e.resources_str})})}),(0,n.jsx)(h.pj,{children:e.recoveries}),(0,n.jsx)(h.pj,{children:e.details?(0,n.jsx)(Z,{text:e.details,rowId:e.id,expandedRowId:z,setExpandedRowId:F}):"-"}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(P,{jobParent:"/jobs",jobId:e.id,managed:!0})})]}),z===e.id&&(0,n.jsx)(A,{text:e.details,colSpan:12,innerRef:W})]},e.id))}):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:12,className:"text-center py-6",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[G&&(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("p",{className:"text-gray-700",children:"The managed job controller is launching. Please wait for it to be ready."}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(c.Z,{size:12,className:"mr-2"}),(0,n.jsx)("span",{className:"text-gray-500",children:"Launching..."})]})]}),!B&&!G&&(0,n.jsx)("p",{className:"text-gray-500",children:"No active jobs"}),B&&(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("p",{className:"text-gray-700",children:"The managed job controller has been stopped. Please restart it to check the latest job status."}),(0,n.jsx)(o.z,{variant:"outline",size:"sm",onClick:en,className:"text-sky-blue hover:text-sky-blue-bright",disabled:N||X,children:X?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(w,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})}),eo.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:O,onChange:e=>{D(parseInt(e.target.value,10)),I(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:30,children:"30"}),(0,n.jsx)("option",{value:50,children:"50"}),(0,n.jsx)("option",{value:100,children:"100"}),(0,n.jsx)("option",{value:200,children:"200"})]}),(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[eh+1," – ",Math.min(ex,eo.length)," of"," ",eo.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{I(e=>Math.max(e-1,1))},disabled:1===L,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{I(e=>Math.min(e+1,ed))},disabled:L===ed||0===ed,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})}),(0,n.jsx)(y.cV,{isOpen:es.isOpen,onClose:()=>et({...es,isOpen:!1}),onConfirm:es.onConfirm,title:es.title,message:es.message})]})}function P(e){let{withLabel:s=!1,jobParent:t,jobId:r,managed:l}=e,i=(0,a.useRouter)(),c=(e,s)=>{e.preventDefault(),e.stopPropagation(),i.push({pathname:"".concat(t,"/").concat(r),query:{tab:s}})};return(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsx)(x.WH,{content:"View Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,n.jsxs)("button",{onClick:e=>c(e,"logs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,n.jsx)(N,{className:"w-4 h-4"}),s&&(0,n.jsx)("span",{className:"ml-1.5",children:"Logs"})]})},"logs"),l&&(0,n.jsx)(x.WH,{content:"View Controller Logs",className:"capitalize text-sm text-muted-foreground",children:(0,n.jsxs)("button",{onClick:e=>c(e,"controllerlogs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,n.jsx)(b,{className:"w-4 h-4"}),s&&(0,n.jsx)("span",{className:"ml-2",children:"Controller Logs"})]})},"controllerlogs")]})}function D(e){let{clusterName:s,clusterJobData:t,loading:a}=e,[l,u]=(0,r.useState)(null),[m,p]=(0,r.useState)({key:null,direction:"ascending"}),[j,f]=(0,r.useState)(1),[g,w]=(0,r.useState)(10),N=(0,r.useRef)(null),[b,y]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=e=>{l&&N.current&&!N.current.contains(e.target)&&u(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[l]);let v=r.useMemo(()=>t||[],[t]);(0,r.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(b)&&y(t)},[t,b]);let C=r.useMemo(()=>m.key?[...v].sort((e,s)=>e[m.key]<s[m.key]?"ascending"===m.direction?-1:1:e[m.key]>s[m.key]?"ascending"===m.direction?1:-1:0):v,[v,m]),S=e=>{let s="ascending";m.key===e&&"ascending"===m.direction&&(s="descending"),p({key:e,direction:s})},E=e=>m.key===e?"ascending"===m.direction?" ↑":" ↓":"",L=Math.ceil(C.length/g),R=(j-1)*g,M=R+g,I=C.slice(R,M);return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)(d.Zb,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold",children:"Cluster Jobs"}),a&&(0,n.jsxs)("div",{className:"flex items-center mr-2",children:[(0,n.jsx)(c.Z,{size:15,className:"mt-0"}),(0,n.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]})]}),(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("id"),children:["ID",E("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("job"),children:["Name",E("job")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("user"),children:["User",E("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("workspace"),children:["Workspace",E("workspace")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("submitted_at"),children:["Submitted",E("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("job_duration"),children:["Duration",E("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("status"),children:["Status",E("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("resources"),children:["Resources",E("resources")]}),(0,n.jsx)(h.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:I.length>0?I.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{className:l===e.id?"selected-row":"",children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:e.id})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:(0,n.jsx)(Z,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:l,setExpandedRowId:u})})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,n.jsx)(h.pj,{children:_(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,x.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(k.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.resources}),(0,n.jsx)(h.pj,{className:"flex content-center items-center",children:(0,n.jsx)(P,{jobParent:"/clusters/".concat(s),jobId:e.id,managed:!1})})]}),l===e.id&&(0,n.jsx)(A,{text:e.job||"Unnamed job",colSpan:9,innerRef:N})]},e.id)):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:"No jobs found"})})})]})]}),C.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:g,onChange:e=>{w(parseInt(e.target.value,10)),f(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:5,children:"5"}),(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:20,children:"20"}),(0,n.jsx)("option",{value:50,children:"50"})]}),(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[R+1," – ",Math.min(M,C.length)," of"," ",C.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{f(e=>Math.max(e-1,1))},disabled:1===j,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{f(e=>Math.min(e+1,L))},disabled:j===L||0===L,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function A(e){let{text:s,colSpan:t,innerRef:r}=e;return(0,n.jsx)(h.SC,{className:"expanded-details",children:(0,n.jsx)(h.pj,{colSpan:t,children:(0,n.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border border-gray-200",ref:r,children:(0,n.jsx)("div",{className:"flex justify-between items-start",children:(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Full Details"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-gray-700",style:{whiteSpace:"pre-wrap"},children:s})]})})})})})}function Z(e){let{text:s,rowId:t,expandedRowId:a,setExpandedRowId:l}=e,i=s.length>50,c=a===t,o=i?"".concat(s.substring(0,50)):s,d=(0,r.useRef)(null);return(0,n.jsxs)("div",{className:"truncated-details relative max-w-full flex items-center",children:[(0,n.jsx)("span",{className:"truncate",children:o}),i&&(0,n.jsx)("button",{ref:d,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(c?null:t)},className:"text-blue-600 hover:text-blue-800 font-medium ml-1 flex-shrink-0","data-button-type":"show-more-less",children:c?"... show less":"... show more"})]})}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[293],{7324:function(e,r,t){t.d(r,{MB:function(){return l},eA:function(){return c},fX:function(){return a},iE:function(){return u},rF:function(){return d},yz:function(){return s},zl:function(){return i}});var o=t(3225);async function a(){try{let e=await fetch("".concat(o.f4,"/workspaces"));if(!e.ok)throw Error("Error scheduling getWorkspaces: ".concat(e.statusText," (status ").concat(e.status,")"));let r=e.headers.get("X-Skypilot-Request-ID");if(!r){console.warn("X-Skypilot-Request-ID header not found in /workspaces response. Attempting to find request_id in response body as a fallback.");try{let t=await e.json();if(t&&t.request_id)r=t.request_id,console.log("Found request_id in /workspaces response body (fallback):",r);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /workspaces.")}catch(r){let e=r.message||"Error processing fallback for request_id from /workspaces response body.";throw console.error("Error in /workspaces request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!r)throw Error("Failed to obtain X-Skypilot-Request-ID from /workspaces response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching workspace data with request_id: ".concat(r));let t=await fetch("".concat(o.f4,"/api/get?request_id=").concat(r));if(!t.ok){let e="Error fetching workspace data for request ID ".concat(r,": ").concat(t.statusText," (status ").concat(t.status,")");try{let o=await t.json();if(o&&o.detail){let t=o.detail;try{let e=JSON.parse(t);e&&e.error?t=e.error:e&&e.result&&e.result.error&&(t=e.result.error)}catch(e){}e="Error fetching workspace data for request ID ".concat(r,": ").concat(t)}}catch(e){}throw Error(e)}let a=await t.json();if(console.log("[Connector Debug] Full resultData from /api/get:",a),"FAILED"===a.status){let e="Unknown error during task execution";if(a.error)"string"==typeof a.error?e=a.error:"object"==typeof a.error&&(e=a.error.message||a.error.detail||JSON.stringify(a.error));else if(a.result&&a.result.error)"string"==typeof a.result.error?e=a.result.error:"object"==typeof a.result.error&&(e=a.result.error.message||a.result.error.detail||JSON.stringify(a.result.error));else if(a.return_value)try{let r=JSON.parse(a.return_value);r.error&&(e="string"==typeof r.error?r.error:r.error.message||r.error.detail||JSON.stringify(r.error))}catch(r){(a.return_value.includes("Error")||a.return_value.includes("Cannot"))&&(e=a.return_value)}throw Error(e)}let s={};if("SUCCEEDED"===a.status&&a.return_value)try{s=JSON.parse(a.return_value),console.log("Successfully parsed workspace data from return_value:",s)}catch(e){throw console.error("Failed to parse workspace data from return_value:",e,"Raw return_value:",a.return_value),Error("Failed to parse workspace data for request ID ".concat(r,": ").concat(e.message))}else a.result&&(console.warn("Using resultData.result as fallback for status ".concat(a.status)),s=a.result);return console.log("Effectively fetched workspace data (to be returned):",s),s||{}}catch(e){throw console.error("Failed to fetch workspaces (in getWorkspaces function):",e.message,e.stack),e}}async function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{let t="".concat(o.f4,"/enabled_clouds"),a=new URLSearchParams;e&&a.append("workspace",e),r&&a.append("expand","true"),a.toString()&&(t+="?".concat(a.toString()));let s=await fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});if(!s.ok)throw Error("Error scheduling getEnabledClouds: ".concat(s.statusText," (status ").concat(s.status,")"));let n=s.headers.get("X-Skypilot-Request-ID");if(!n){console.warn("X-Skypilot-Request-ID header not found in /enabled_clouds response. Attempting to find request_id in response body as a fallback.");try{let e=await s.json();if(e&&e.request_id)n=e.request_id,console.log("Found request_id in /enabled_clouds response body (fallback):",n);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /enabled_clouds.")}catch(r){let e=r.message||"Error processing fallback for request_id from /enabled_clouds response body.";throw console.error("Error in /enabled_clouds request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!n)throw Error("Failed to obtain X-Skypilot-Request-ID from /enabled_clouds response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching enabled_clouds data with request_id: ".concat(n));let c=await fetch("".concat(o.f4,"/api/get?request_id=").concat(n));if(!c.ok){let e="Error fetching enabled_clouds data for request ID ".concat(n,": ").concat(c.statusText," (status ").concat(c.status,")");try{let r=await c.json();if(r&&r.detail){let t=r.detail;try{let e=JSON.parse(t);e&&e.error?t=e.error:e&&e.result&&e.result.error&&(t=e.result.error)}catch(e){}e="Error fetching enabled_clouds data for request ID ".concat(n,": ").concat(t)}}catch(e){}throw Error(e)}let l=await c.json();if(console.log("[Connector Debug] Full resultData from /api/get for enabled_clouds:",l),"FAILED"===l.status){let e=l.error||l.result&&l.result.error||"Unknown error during task execution for enabled_clouds";throw Error("Fetching enabled_clouds data failed for request ID ".concat(n,": ").concat(e))}let i=[];if("SUCCEEDED"===l.status&&l.return_value)try{i=JSON.parse(l.return_value),console.log("Successfully parsed enabled_clouds data from return_value:",i)}catch(e){throw console.error("Failed to parse enabled_clouds data from return_value:",e,"Raw return_value:",l.return_value),Error("Failed to parse enabled_clouds data for request ID ".concat(n,": ").concat(e.message))}else l.result&&(console.warn("Using resultData.result as fallback for enabled_clouds status ".concat(l.status)),i=l.result);return Array.isArray(i)?i:[]}catch(e){throw console.error("Failed to fetch enabled_clouds (in getEnabledClouds function):",e.message,e.stack),e}}async function n(e,r){console.log("Polling for ".concat(r," task completion with request_id: ").concat(e));let t=await fetch("".concat(o.f4,"/api/get?request_id=").concat(e));if(!t.ok){let o="Error fetching ".concat(r," data for request ID ").concat(e,": ").concat(t.statusText," (status ").concat(t.status,")");try{let e=await t.json();if(console.error("[Error Debug] ".concat(r," HTTP error response:"),JSON.stringify(e,null,2)),e&&e.detail){if("object"==typeof e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t&&t.message)o="".concat(r," failed: ").concat(t.message);else if(t&&"object"==typeof t){let e=t.type||JSON.stringify(t);o="".concat(r," failed: ").concat(e)}}catch(t){o="".concat(r," failed: ").concat(e.detail.error)}else if("string"==typeof e.detail)o="".concat(r," failed: ").concat(e.detail);else{let t=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof e&&(e.includes("Cannot")||e.includes("Error")||e.includes("Failed")))return e;if("object"==typeof e&&null!==e)for(let[o,a]of Object.entries(e)){let e=t(a,r?"".concat(r,".").concat(o):o);if(e)return e}return null},a=t(e.detail);a&&(o="".concat(r," failed: ").concat(a))}}}catch(e){console.error("[Error Debug] Failed to parse error response:",e)}throw Error(o)}let a=await t.json();if(console.log("[Connector Debug] ".concat(r," resultData:"),a),"FAILED"===a.status){console.error("[Error Debug] ".concat(r," failed. Full resultData:"),JSON.stringify(a,null,2)),console.error("[Error Debug] resultData.error:",a.error),console.error("[Error Debug] resultData.result:",a.result),console.error("[Error Debug] resultData.return_value:",a.return_value);let e="Unknown error during ".concat(r," task execution");if(a.error)"string"==typeof a.error?e=a.error:"object"==typeof a.error&&(e=a.error.message||a.error.detail||JSON.stringify(a.error));else if(a.result&&a.result.error)"string"==typeof a.result.error?e=a.result.error:"object"==typeof a.result.error&&(e=a.result.error.message||a.result.error.detail||JSON.stringify(a.result.error));else if(a.return_value)try{let r=JSON.parse(a.return_value);r.error&&(e="string"==typeof r.error?r.error:r.error.message||r.error.detail||JSON.stringify(r.error))}catch(r){a.return_value&&(a.return_value.includes("Error")||a.return_value.includes("Cannot"))&&(e=a.return_value)}if(e==="Unknown error during ".concat(r," task execution")){let r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof e&&(e.includes("Cannot")||e.includes("Error")||e.includes("Failed")))return e;if("object"==typeof e&&null!==e)for(let[o,a]of Object.entries(e)){let e=r(a,t?"".concat(t,".").concat(o):o);if(e)return e}return null},t=r(a);t&&(e=t)}throw Error(e)}let s={};if("SUCCEEDED"===a.status&&a.return_value)try{s=JSON.parse(a.return_value),console.log("Successfully parsed ".concat(r," data:"),s)}catch(t){throw console.error("Failed to parse ".concat(r," data from return_value:"),t,"Raw return_value:",a.return_value),Error("Failed to parse ".concat(r," data for request ID ").concat(e,": ").concat(t.message))}else a.result&&(console.warn("Using resultData.result as fallback for ".concat(r," status ").concat(a.status)),s=a.result);return s}async function c(e,r){try{console.log("Updating workspace ".concat(e," with config:"),r);let t=await fetch("".concat(o.f4,"/workspaces/update"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace_name:e,config:r})});if(!t.ok)throw Error("Error scheduling updateWorkspace: ".concat(t.statusText," (status ").concat(t.status,")"));let a=t.headers.get("X-Skypilot-Request-ID");if(!a)throw Error("Failed to obtain request ID for updateWorkspace");return await n(a,"updateWorkspace")}catch(e){throw console.error("Failed to update workspace:",e),e}}let l=async(e,r)=>{try{let t=await fetch("".concat(o.f4,"/workspaces/create"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace_name:e,config:r})});if(!t.ok)throw await t.text(),Error("Error scheduling createWorkspace: ".concat(t.statusText," (status ").concat(t.status,")"));let a=t.headers.get("X-Skypilot-Request-ID");if(!a)throw Error("Failed to obtain request ID for createWorkspace");return await n(a,"createWorkspace")}catch(e){throw console.error("Failed to create workspace:",e),e}};async function i(e){try{console.log("Deleting workspace ".concat(e));let r=await fetch("".concat(o.f4,"/workspaces/delete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace_name:e})});if(!r.ok)throw Error("Error scheduling deleteWorkspace: ".concat(r.statusText," (status ").concat(r.status,")"));let t=r.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("Failed to obtain request ID for deleteWorkspace");console.log("[Delete Debug] Got request ID for deleteWorkspace: ".concat(t));try{let e=await n(t,"deleteWorkspace");return console.log("[Delete Debug] deleteWorkspace completed successfully:",e),e}catch(e){throw console.error("[Delete Debug] deleteWorkspace failed with error:",e),console.error("[Delete Debug] Error message:",e.message),e}}catch(e){throw console.error("Failed to delete workspace:",e),e}}async function u(){try{console.log("Getting entire SkyPilot configuration");let e=await fetch("".concat(o.f4,"/workspaces/config"));if(!e.ok)throw Error("Error scheduling getConfig: ".concat(e.statusText," (status ").concat(e.status,")"));let r=e.headers.get("X-Skypilot-Request-ID");if(!r)throw Error("Failed to obtain request ID for getConfig");return await n(r,"getConfig")}catch(e){throw console.error("Failed to get config:",e),e}}async function d(e){try{console.log("Updating entire SkyPilot configuration with config:",e);let r=await fetch("".concat(o.f4,"/workspaces/config"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:e})});if(!r.ok)throw Error("Error scheduling updateConfig: ".concat(r.statusText," (status ").concat(r.status,")"));let t=r.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("Failed to obtain request ID for updateConfig");return await n(t,"updateConfig")}catch(e){throw console.error("Failed to update config:",e),e}}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[470],{3850:function(e,t,n){n.d(t,{E9:function(){return w},J$:function(){return c},PC:function(){return f},Ps:function(){return a},QT:function(){return h},Vp:function(){return x},W2:function(){return l},Ye:function(){return d},aD:function(){return j},fp:function(){return u},fy:function(){return p},h0:function(){return m},lM:function(){return v},mU:function(){return g},oy:function(){return y}});var r=n(5893);n(7294);var s=n(8507),o=n(8586),i=n(9611);function a(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})})}function l(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function c(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function d(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M6 12l4 4 8-8"})})}function u(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1"}),(0,r.jsx)("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1"})]})}function h(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,r.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,r.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,r.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}function x(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"}),(0,r.jsx)("rect",{width:"20",height:"14",x:"2",y:"6",rx:"2"})]})}function f(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",ry:"2"}),(0,r.jsx)("rect",{x:"9",y:"9",width:"6",height:"6"}),(0,r.jsx)("line",{x1:"9",y1:"1",x2:"9",y2:"4"}),(0,r.jsx)("line",{x1:"15",y1:"1",x2:"15",y2:"4"}),(0,r.jsx)("line",{x1:"9",y1:"20",x2:"9",y2:"23"}),(0,r.jsx)("line",{x1:"15",y1:"20",x2:"15",y2:"23"}),(0,r.jsx)("line",{x1:"20",y1:"9",x2:"23",y2:"9"}),(0,r.jsx)("line",{x1:"20",y1:"14",x2:"23",y2:"14"}),(0,r.jsx)("line",{x1:"1",y1:"9",x2:"4",y2:"9"}),(0,r.jsx)("line",{x1:"1",y1:"14",x2:"4",y2:"14"})]})}function m(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),(0,r.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,r.jsx)("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function p(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}function g(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{transform:"scale(0.85) translate(1.8, 1.8)",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})})}function w(e){return(0,r.jsx)("svg",{...e,stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,r.jsx)("path",{d:"M3 18.5V5a3 3 0 0 1 3-3h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5A3.5 3.5 0 0 1 3 18.5zM19 20v-3H6.5a1.5 1.5 0 0 0 0 3H19zM10 4H6a1 1 0 0 0-1 1v10.337A3.486 3.486 0 0 1 6.5 15H19V4h-2v8l-3.5-2-3.5 2V4z"})]})})}let j=s.Z,y=o.Z;function v(e){return(0,r.jsx)(i.Z,{...e})}},9470:function(e,t,n){n.d(t,{A:function(){return j}});var r=n(5893),s=n(7294),o=n(5675),i=n.n(o),a=n(1163),l=n(1664),c=n.n(l),d=n(3850),u=n(355),h=n(3225),x=n(6989),f=n(3001);let m=(0,s.createContext)(null);function p(e){let{children:t}=e,[n,o]=(0,s.useState)(!0),[i,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{fetch("".concat(h.f4,"/api/health")).then(e=>e.json()).then(e=>{e.user&&e.user.name&&a(e.user.name)}).catch(e=>{console.error("Error fetching user data:",e)})},[]),(0,r.jsx)(m.Provider,{value:{isSidebarOpen:n,toggleSidebar:()=>{o(e=>!e)},userEmail:i},children:t})}function g(){let e,t;let n=(0,a.useRouter)(),o=(0,f.X)(),{userEmail:l}=function(){let e=(0,s.useContext)(m);if(!e)throw Error("useSidebar must be used within a SidebarProvider");return e}(),[p,g]=(0,s.useState)(!1),w=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){w.current&&!w.current.contains(e.target)&&g(!1)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[w]);let j=e=>"/workspaces"===e?n.pathname.startsWith("/workspaces")||n.pathname.startsWith("/workspace"):n.pathname.startsWith(e),y=e=>{let t=j(e);return"inline-flex items-center border-b-2 ".concat(t?"border-transparent text-blue-600":"border-transparent hover:text-blue-600"," ").concat(o?"px-2 py-1":"px-1 pt-1 space-x-2")};return(0,r.jsx)("div",{className:"fixed top-0 left-0 right-0 bg-white z-30 h-14 px-4 border-b border-gray-200 shadow-sm",children:(0,r.jsxs)("div",{className:"flex items-center h-full",children:[(0,r.jsx)("div",{className:"flex items-center ".concat(o?"space-x-2 mr-2":"space-x-4 mr-6"),children:(0,r.jsx)(c(),{href:"/",className:"flex items-center px-1 pt-1 h-full",prefetch:!1,children:(0,r.jsx)("div",{className:"h-20 w-20 flex items-center justify-center",children:(0,r.jsx)(i(),{src:"".concat(h.GW,"/skypilot.svg"),alt:"SkyPilot Logo",width:80,height:80,priority:!0,className:"w-full h-full object-contain"})})})}),(0,r.jsxs)("div",{className:"flex items-center ".concat(o?"space-x-1":"space-x-2 md:space-x-4"," ").concat(o?"mr-2":"mr-6"),children:[(0,r.jsxs)(c(),{href:"/clusters",className:y("/clusters"),prefetch:!1,children:[(0,r.jsx)(d.QT,{className:"w-4 h-4"}),!o&&(0,r.jsx)("span",{children:"Clusters"})]}),(0,r.jsxs)(c(),{href:"/jobs",className:y("/jobs"),prefetch:!1,children:[(0,r.jsx)(d.Vp,{className:"w-4 h-4"}),!o&&(0,r.jsx)("span",{children:"Jobs"})]}),(0,r.jsx)("div",{className:"border-l border-gray-200 h-6 mx-1"}),(0,r.jsxs)(c(),{href:"/infra",className:y("/infra"),prefetch:!1,children:[(0,r.jsx)(d.PC,{className:"w-4 h-4"}),!o&&(0,r.jsx)("span",{children:"Infra"})]}),(0,r.jsxs)(c(),{href:"/workspaces",className:y("/workspaces"),prefetch:!1,children:[(0,r.jsx)(d.E9,{className:"w-4 h-4"}),!o&&(0,r.jsx)("span",{children:"Workspaces"})]}),(0,r.jsxs)(c(),{href:"/users",className:y("/users"),prefetch:!1,children:[(0,r.jsx)(d.oy,{className:"w-4 h-4"}),!o&&(0,r.jsx)("span",{children:"Users"})]})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-1 ".concat(o?"ml-0":"ml-auto"),children:[(0,r.jsx)(x.WH,{content:"Documentation",className:"text-sm text-muted-foreground",children:(0,r.jsxs)("a",{href:"https://skypilot.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-2 py-1 text-gray-600 hover:text-blue-600 transition-colors duration-150 cursor-pointer",title:"Docs",children:[!o&&(0,r.jsx)("span",{className:"mr-1",children:"Docs"}),(0,r.jsx)(d.h0,{className:"".concat(o?"w-4 h-4":"w-3.5 h-3.5")})]})}),(0,r.jsx)(x.WH,{content:"GitHub Repository",className:"text-sm text-muted-foreground",children:(0,r.jsx)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"GitHub",children:(0,r.jsx)(d.fy,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,r.jsx)(x.WH,{content:"Join Slack",className:"text-sm text-muted-foreground",children:(0,r.jsx)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Slack",children:(0,r.jsx)(d.mU,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,r.jsx)(x.WH,{content:"Leave Feedback",className:"text-sm text-muted-foreground",children:(0,r.jsx)("a",{href:"https://github.com/skypilot-org/skypilot/issues/new",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Leave Feedback",children:(0,r.jsx)(d.aD,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,r.jsx)("div",{className:"border-l border-gray-200 h-6"}),(0,r.jsx)(x.WH,{content:"Configuration",className:"text-sm text-muted-foreground",children:(0,r.jsx)(c(),{href:"/config",className:"inline-flex items-center justify-center p-2 rounded-full transition-colors duration-150 cursor-pointer ".concat(j("/config")?"text-blue-600 hover:bg-gray-100":"text-gray-600 hover:bg-gray-100"),title:"Configuration",prefetch:!1,children:(0,r.jsx)(u.Z,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),l&&(0,r.jsxs)("div",{className:"relative",ref:w,children:[(0,r.jsx)("button",{onClick:()=>g(!p),className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"User Profile",children:(0,r.jsx)(d.lM,{className:"".concat(o?"w-5 h-5":"w-6 h-6")})}),p&&(0,r.jsxs)("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg z-50 border border-gray-200",children:[(e=l,t=null,l&&l.includes("@")&&(e=l.split("@")[0],t=l),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"px-4 pt-2 pb-1 text-sm font-medium text-gray-900",children:e}),t&&(0,r.jsx)("div",{className:"px-4 pt-0 pb-2 text-xs text-gray-500",children:t})]})),(0,r.jsx)("div",{className:"border-t border-gray-200 mx-1 my-1"}),(0,r.jsx)(c(),{href:"/users",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-blue-600",onClick:()=>g(!1),prefetch:!1,children:"See all users"})]})]})]})]})})}function w(e){let{children:t,highlighted:n}=e;return(0,f.X)(),(0,r.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,r.jsx)("div",{className:"fixed top-0 left-0 right-0 z-50 shadow-sm",children:(0,r.jsx)(g,{})}),(0,r.jsx)("div",{className:"transition-all duration-200 ease-in-out min-h-screen",style:{paddingTop:"56px"},children:(0,r.jsx)("main",{className:"p-6",children:t})})]})}function j(e){return(0,r.jsx)(p,{children:(0,r.jsx)(w,{...e})})}},8950:function(e,t,n){n.d(t,{Bw:function(){return m},Ph:function(){return d},Ql:function(){return p},i4:function(){return h},ki:function(){return u}});var r=n(5893),s=n(7294),o=n(2067),i=n(5895),a=n(7242),l=n(282),c=n(2350);let d=o.fC;o.ZA;let u=o.B4,h=s.forwardRef((e,t)=>{let{className:n,children:s,...a}=e;return(0,r.jsxs)(o.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...a,children:[s,(0,r.jsx)(o.JO,{asChild:!0,children:(0,r.jsx)(i.Z,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=o.xz.displayName;let x=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(o.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",n),...s,children:(0,r.jsx)(a.Z,{className:"h-4 w-4"})})});x.displayName=o.u_.displayName;let f=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(o.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",n),...s,children:(0,r.jsx)(i.Z,{className:"h-4 w-4"})})});f.displayName=o.$G.displayName;let m=s.forwardRef((e,t)=>{let{className:n,children:s,position:i="popper",...a}=e;return(0,r.jsx)(o.h_,{children:(0,r.jsxs)(o.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:i,...a,children:[(0,r.jsx)(x,{}),(0,r.jsx)(o.l_,{className:(0,c.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,r.jsx)(f,{})]})})});m.displayName=o.VY.displayName,s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(o.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...s})}).displayName=o.__.displayName;let p=s.forwardRef((e,t)=>{let{className:n,children:s,...i}=e;return(0,r.jsxs)(o.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...i,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(o.wU,{children:(0,r.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,r.jsx)(o.eT,{children:s})]})});p.displayName=o.ck.displayName,s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(o.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",n),...s})}).displayName=o.Z0.displayName},6989:function(e,t,n){n.d(t,{$B:function(){return g},GV:function(){return d},LU:function(){return m},Md:function(){return f},WH:function(){return x},q8:function(){return p},yc:function(){return l}});var r=n(5893),s=n(7294),o=n(3302),i=n(1886),a=n(8950);let l=n(1214).nb.REFRESH_INTERVAL;function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}function d(e){if(!e)return"N/A";let t=new Date;return 7>Math.abs((t-e)/864e5)?(0,r.jsx)(x,{content:u(e),className:"capitalize text-sm text-muted-foreground",children:c((0,i.B)(e,t,{addSuffix:!0}))}):(0,r.jsx)(x,{content:c(u(e)),className:"text-sm text-muted-foreground",children:c(e.toLocaleString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).replace(",",""))})}function u(e){return e.toLocaleString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZoneName:"short"}).replace(",","")}let h={placement:"bottom",color:"default"},x=e=>{let{children:t,...n}=e,s=n.content;return n.content=void 0,(0,r.jsx)(o.e,{...h,...n,content:(0,r.jsx)("span",{className:"left-full w-max px-2 py-1 text-sm text-gray-100 bg-gray-500 text-sm capitalize rounded",children:s}),children:t})},f=e=>{let{children:t,...n}=e,s=n.content;return n.content=void 0,(0,r.jsx)(o.e,{...h,...n,content:(0,r.jsx)("span",{className:"left-full w-max px-2 py-1 text-sm text-gray-100 bg-gray-500 text-sm rounded",children:s}),children:t})};function m(e){if(!e&&0!==e)return"-";let t=e=Math.floor(e),n="",r=0;for(let e of[{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(t>=e.value&&r<2){let s=Math.floor(t/e.value);n+="".concat(s).concat(e.label," "),t%=e.value,r++}return n.trim()||"0s"}function p(e){return e?(e=e.split("\n").filter(e=>!e.match(/<rich_.*?\[bold cyan\]/)&&!e.match(/<rich_.*>.*<\/rich_.*>/)&&!e.match(/├──/)&&!e.match(/└──/)).join("\n").replace(/\x1b\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGKH]/g,"")).split("\n").map(e=>{let t=e.match(/^([IWED])\s+(\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+([^:]+:\d+\])(.*)/);if(t){let[e,n,r,s,o]=t,i={I:"INFO",W:"WARNING",E:"ERROR",D:"DEBUG"}[n]||"";return'<span class="log-line '.concat(i,'"><span class="level">').concat(n,'</span><span class="timestamp">').concat(r,'</span><span class="location">').concat(s,'</span><span class="message">').concat(o,"</span></span>")}let n=e.match(/^(\([^)]+\))(.*)$/);if(n){let[e,t,r]=n;return'<span class="log-line"><span class="log-prefix">'.concat(t,'</span><span class="log-rest">').concat(r,"</span></span>")}return'<span class="log-line"><span class="message">'.concat(e,"</span></span>")}).join("\n"):""}function g(e){let{logs:t,controller:n=!1}=e,[o,i]=(0,s.useState)("all"),[l,c]=(0,s.useState)(t),[d,u]=(0,s.useState)([]);return(0,s.useEffect)(()=>{u(function(e){let t;let n=/\((head|worker\d+),/g,r=new Set;for(;null!==(t=n.exec(e));)r.add(t[1]);return Array.from(r).sort((e,t)=>"head"===e?-1:"head"===t?1:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"}))}(t))},[t]),(0,s.useEffect)(()=>{"all"===o?c(t):c(t.split("\n").filter(e=>e.includes("(".concat(o,","))).join("\n"))},[o,t]),(0,r.jsxs)("div",{children:[(0,r.jsx)("style",{children:'\n .logs-container {\n background-color: #f7f7f7;\n padding: 16px;\n max-height: calc(100vh - 300px);\n overflow-y: auto;\n overflow-x: hidden;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;\n line-height: 1.5;\n border-radius: 6px;\n min-height: fit-content;\n }\n\n .log-line {\n display: block;\n white-space: pre-wrap;\n margin: 2px 0;\n }\n\n .log-line .level {\n display: inline;\n width: 1ch;\n margin-right: 1ch;\n font-weight: bold;\n }\n\n .log-line.INFO .level {\n color: #2563eb;\n }\n\n .log-line.WARNING .level {\n color: #d97706;\n }\n\n .log-line.ERROR .level {\n color: #dc2626;\n }\n\n .log-line.DEBUG .level {\n color: #6b7280;\n }\n\n .log-line .timestamp {\n color: #059669;\n margin-right: 1ch;\n white-space: nowrap;\n }\n\n .log-line .location {\n color: #6366f1;\n margin-right: 1ch;\n white-space: nowrap;\n }\n\n .log-line .message {\n color: #111827;\n word-break: break-word;\n white-space: pre-wrap;\n }\n\n .log-line .log-prefix {\n color: #6366f1;\n font-weight: 500;\n }\n\n .log-line .log-rest {\n color: #111827;\n word-break: break-word;\n white-space: pre-wrap;\n }\n'}),!n&&(0,r.jsx)("div",{style:{marginBottom:"1rem"},children:(0,r.jsxs)(a.Ph,{onValueChange:e=>i(e),value:o,children:[(0,r.jsx)(a.i4,{"aria-label":"Node",className:"focus:ring-0 focus:ring-offset-0",children:(0,r.jsx)(a.ki,{placeholder:"Select Node"})}),(0,r.jsxs)(a.Bw,{children:[(0,r.jsx)(a.Ql,{value:"all",children:"All Nodes"}),d.map(e=>(0,r.jsx)(a.Ql,{value:e,children:e},e))]})]})}),(0,r.jsx)("div",{className:"logs-container",dangerouslySetInnerHTML:{__html:p(l)}})]})}},3001:function(e,t,n){n.d(t,{X:function(){return s}});var r=n(7294);function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,n]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let t=()=>{n(window.innerWidth<e)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e]),t}},1214:function(e,t,n){n.d(t,{MO:function(){return o},ej:function(){return r},nb:function(){return s}});let r={DEFAULT_TTL:12e4},s={REFRESH_INTERVAL:3e4,GPU_REFRESH_INTERVAL:3e4},o={NAME_TRUNCATE_LENGTH:20}},2350:function(e,t,n){n.d(t,{cn:function(){return o}});var r=n(512),s=n(8388);function o(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,s.m6)((0,r.W)(t))}}}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[578],{9037:function(e,s,t){"use strict";t.d(s,{Cc:function(){return M},GV:function(){return V}});var r=t(5893),n=t(7294),l=t(1163),a=t(8799),c=t(6989),i=t(1664),o=t.n(i),d=t(803),h=t(7673),x=t(8764),u=t(3266),p=t(7324),j=t(4545),m=t(3626),f=t(998);/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let w=(0,f.Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),k=(0,f.Z)("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var g=t(9470),y=t(9284),N=t(9307),v=t(3001),C=t(8950),b=t(6378),S=t(6856);let _="__ALL_WORKSPACES__";function M(){let e=(0,l.useRouter)(),[s,t]=(0,n.useState)(!1),i=n.useRef(null),[d,h]=(0,n.useState)(!1),[x,j]=(0,n.useState)(!1),[f,w]=(0,n.useState)(null),[k,N]=(0,n.useState)(_),[M,O]=(0,n.useState)([]),R=(0,v.X)();return(0,n.useEffect)(()=>{e.isReady&&e.query.workspace&&N(Array.isArray(e.query.workspace)?e.query.workspace[0]:e.query.workspace)},[e.isReady,e.query.workspace]),(0,n.useEffect)(()=>{(async()=>{try{await S.ZP.preloadForPage("clusters");let e=await b.ZP.get(p.fX),s=Object.keys(e),t=await b.ZP.get(u.getClusters),r=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],n=new Set(s);r.includes("default")&&n.has("default"),r.forEach(e=>n.add(e)),O(Array.from(n).sort())}catch(e){console.error("Error fetching data for workspace filter:",e),O(["default"])}})()},[]),(0,r.jsxs)(g.A,{highlighted:"clusters",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)(o(),{href:"/clusters",className:"text-sky-blue hover:underline leading-none",children:"Sky Clusters"}),(0,r.jsxs)(C.Ph,{value:k,onValueChange:N,children:[(0,r.jsx)(C.i4,{className:"h-8 w-48 ml-4 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,r.jsx)(C.ki,{placeholder:"Filter by workspace...",children:k===_?"All Workspaces":k})}),(0,r.jsxs)(C.Bw,{children:[(0,r.jsx)(C.Ql,{value:_,children:"All Workspaces"}),M.map(e=>(0,r.jsx)(C.Ql,{value:e,children:e},e))]})]})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[s&&(0,r.jsxs)("div",{className:"flex items-center mr-2",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.jsxs)("button",{onClick:()=>{b.ZP.invalidate(u.getClusters),b.ZP.invalidate(p.fX),i.current&&i.current()},disabled:s,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(m.Z,{className:"h-4 w-4 mr-1.5"}),!R&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsx)(L,{refreshInterval:c.yc,setLoading:t,refreshDataRef:i,workspaceFilter:k,onOpenSSHModal:e=>{w(e),h(!0)},onOpenVSCodeModal:e=>{w(e),j(!0)}}),(0,r.jsx)(y.Oh,{isOpen:d,onClose:()=>h(!1),cluster:f}),(0,r.jsx)(y._R,{isOpen:x,onClose:()=>j(!1),cluster:f})]})}function L(e){let{refreshInterval:s,setLoading:t,refreshDataRef:l,workspaceFilter:i,onOpenSSHModal:p,onOpenVSCodeModal:m}=e,[f,w]=(0,n.useState)([]),[k,g]=(0,n.useState)({key:null,direction:"ascending"}),[y,v]=(0,n.useState)(!1),[C,S]=(0,n.useState)(!0),[M,L]=(0,n.useState)(1),[O,R]=(0,n.useState)(10),Z=n.useCallback(async()=>{t(!0),v(!0),w(await b.ZP.get(u.getClusters)),t(!1),v(!1),S(!1)},[t]),E=n.useMemo(()=>{let e=f;return i&&i!==_&&(e=f.filter(e=>(e.workspace||"default").toLowerCase()===i.toLowerCase())),(0,j.R0)(e,k.key,k.direction)},[f,k,i]);n.useEffect(()=>{l&&(l.current=Z)},[l,Z]),(0,n.useEffect)(()=>{w([]);let e=!0;Z();let t=setInterval(()=>{e&&Z()},s);return()=>{e=!1,clearInterval(t)}},[s,Z]),(0,n.useEffect)(()=>{L(1)},[f.length]);let A=e=>{let s="ascending";k.key===e&&"ascending"===k.direction&&(s="descending"),g({key:e,direction:s})},W=e=>k.key===e?"ascending"===k.direction?" ↑":" ↓":"",q=Math.ceil(E.length/O),P=(M-1)*O,z=P+O,I=E.slice(P,z);return(0,r.jsxs)("div",{children:[(0,r.jsx)(h.Zb,{children:(0,r.jsxs)(x.iA,{children:[(0,r.jsx)(x.xD,{children:(0,r.jsxs)(x.SC,{children:[(0,r.jsxs)(x.ss,{className:"sortable whitespace-nowrap",onClick:()=>A("status"),children:["Status",W("status")]}),(0,r.jsxs)(x.ss,{className:"sortable whitespace-nowrap",onClick:()=>A("cluster"),children:["Cluster",W("cluster")]}),(0,r.jsxs)(x.ss,{className:"sortable whitespace-nowrap",onClick:()=>A("user"),children:["User",W("user")]}),(0,r.jsxs)(x.ss,{className:"sortable whitespace-nowrap",onClick:()=>A("workspace"),children:["Workspace",W("workspace")]}),(0,r.jsxs)(x.ss,{className:"sortable whitespace-nowrap",onClick:()=>A("infra"),children:["Infra",W("infra")]}),(0,r.jsxs)(x.ss,{className:"sortable whitespace-nowrap",onClick:()=>A("resources_str"),children:["Resources",W("resources_str")]}),(0,r.jsxs)(x.ss,{className:"sortable whitespace-nowrap",onClick:()=>A("time"),children:["Started",W("time")]}),(0,r.jsx)(x.ss,{children:"Actions"})]})}),(0,r.jsx)(x.RM,{children:y&&C?(0,r.jsx)(x.SC,{children:(0,r.jsx)(x.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):I.length>0?I.map((e,s)=>(0,r.jsxs)(x.SC,{children:[(0,r.jsx)(x.pj,{children:(0,r.jsx)(N.OE,{status:e.status})}),(0,r.jsx)(x.pj,{children:(0,r.jsx)(o(),{href:"/clusters/".concat(e.cluster),className:"text-blue-600",children:e.cluster})}),(0,r.jsx)(x.pj,{children:e.user}),(0,r.jsx)(x.pj,{children:(0,r.jsx)(o(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,r.jsx)(x.pj,{children:(0,r.jsx)(c.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(o(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud}),e.infra.includes("(")&&(0,r.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})})}),(0,r.jsx)(x.pj,{children:(0,r.jsx)(c.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{children:e.resources_str})})}),(0,r.jsx)(x.pj,{children:(0,c.GV)(e.time)}),(0,r.jsx)(x.pj,{className:"text-left",children:(0,r.jsx)(V,{cluster:e.cluster,status:e.status,onOpenSSHModal:p,onOpenVSCodeModal:m})})]},s)):(0,r.jsx)(x.SC,{children:(0,r.jsx)(x.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:"No active clusters"})})})]})}),f.length>0&&(0,r.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,r.jsxs)("div",{className:"relative inline-block",children:[(0,r.jsxs)("select",{value:O,onChange:e=>{R(parseInt(e.target.value,10)),L(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:30,children:"30"}),(0,r.jsx)("option",{value:50,children:"50"}),(0,r.jsx)("option",{value:100,children:"100"}),(0,r.jsx)("option",{value:200,children:"200"})]}),(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,r.jsxs)("div",{children:[P+1," – ",Math.min(z,f.length)," of"," ",f.length]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(d.z,{variant:"ghost",size:"icon",onClick:()=>{L(e=>Math.max(e-1,1))},disabled:1===M,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,r.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,r.jsx)(d.z,{variant:"ghost",size:"icon",onClick:()=>{L(e=>Math.min(e+1,q))},disabled:M===q||0===q,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,r.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}let O=(e,s)=>{s&&s(e)},R=(e,s)=>{s?s(e):window.open("ssh://".concat(e))},Z=e=>"RUNNING"===e?["connect","VSCode"]:[],E={connect:(0,r.jsx)(w,{className:"w-4 h-4 text-gray-500 inline-block"}),VSCode:(0,r.jsx)(k,{className:"w-4 h-4 text-gray-500 inline-block"})};function V(e){let{withLabel:s=!1,cluster:t,status:n,onOpenSSHModal:l,onOpenVSCodeModal:a}=e,i=Z(n),o=(0,v.X)(),d=e=>{switch(e){case"connect":R(t,l);break;case"VSCode":O(t,a);break;default:return}};return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"flex items-center space-x-4",children:Object.entries(E).map(e=>{let t,n,[l,a]=e;switch(l){case"connect":t="Connect",n="Connect with SSH";break;case"VSCode":t="VSCode",n="Open in VS Code"}return(s||(t=""),i.includes(l))?(0,r.jsx)(c.WH,{content:n,className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:()=>d(l),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[a,!o&&(0,r.jsx)("span",{className:"ml-1.5",children:t})]})},l):(0,r.jsx)(c.WH,{content:n,className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("span",{className:"opacity-30 flex items-center cursor-not-allowed text-sm",title:l,children:[a,!o&&(0,r.jsx)("span",{className:"ml-1.5",children:t})]})},l)})})})}},9008:function(e,s,t){e.exports=t(7219)}}]);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[843],{9333:function(e,s,l){"use strict";l.d(s,{Z:function(){return a}});/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let a=(0,l(998).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},1812:function(e,s,l){"use strict";l.d(s,{X:function(){return n}});var a=l(5893),t=l(7294);let r=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s.charAt(0).toUpperCase()+s.slice(1)},n=e=>{let{error:s,title:l="Error",onDismiss:n}=e,[c,i]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s&&i(!1)},[s]),!s||c)return null;let o="string"==typeof s?s:r(s);return(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,a.jsx)("div",{className:"ml-3",children:(0,a.jsxs)("div",{className:"text-sm text-red-800",children:[(0,a.jsxs)("strong",{children:[l,":"]})," ",o]})})]}),(0,a.jsx)("button",{onClick:()=>{i(!0),n&&n()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,a.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},5843:function(e,s,l){"use strict";l.d(s,{I:function(){return z}});var a=l(5893),t=l(7294),r=l(1163),n=l(7324),c=l(3266),i=l(8969),o=l(9470),d=l(1664),u=l.n(d),x=l(9008),h=l.n(x),m=l(7673),f=l(803),g=l(2350);let p=t.forwardRef((e,s)=>{let{className:l,...t}=e;return(0,a.jsx)("textarea",{className:(0,g.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",l),ref:s,...t})});p.displayName="Textarea";var b=l(8799),j=l(282),y=l(3626);/**
|
7
|
+
* @license lucide-react v0.407.0 - ISC
|
8
|
+
*
|
9
|
+
* This source code is licensed under the ISC license.
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
11
|
+
*/let N=(0,l(998).Z)("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);var k=l(9333),v=l(326);let w=e=>{let{className:s="",variant:l="default",children:t,...r}=e;return(0,a.jsx)("div",{role:"alert",className:"".concat("relative w-full rounded-lg border p-4 flex items-start space-x-2"," ").concat({default:"bg-blue-50 border-blue-200 text-blue-800",destructive:"bg-red-50 border-red-200 text-red-800"}[l]," ").concat(s),...r,children:t})},C=e=>{let{className:s="",children:l,...t}=e;return(0,a.jsx)("div",{className:"text-sm leading-relaxed ".concat(s),...t,children:l})};var L=l(3850),E=l(1812),S=l(8236),M=l(3320),D=l.n(M),A=l(3225);let W=e=>{let{message:s}=e;return s?(0,a.jsxs)(w,{className:"border-green-200 bg-green-50",children:[(0,a.jsx)(j.Z,{className:"h-4 w-4 text-green-600"}),(0,a.jsx)(C,{className:"text-green-800",children:s})]}):null},R=e=>{let{workspaceName:s,config:l,enabledClouds:t=[]}=e;if(!l)return null;let r="default"===s,n=0===Object.keys(l).length;if(r&&n)return(0,a.jsx)("div",{className:"text-sm text-gray-500 mb-3 italic p-3 bg-sky-50 rounded border border-sky-200",children:"Workspace 'default' can use all accessible infrastructure."});let c=[],i=[],o=[],d=new Set(t.map(e=>e.toLowerCase()));Object.entries(l).forEach(e=>{let[s,l]=e,t=A.MN[s.toLowerCase()],r=d.has(null==t?void 0:t.toLowerCase());if((null==l?void 0:l.disabled)===!0)i.push(t);else if(l&&Object.keys(l).length>0){let e="";"gcp"===s.toLowerCase()&&l.project_id?e=" (Project ID: ".concat(l.project_id,")"):"aws"===s.toLowerCase()&&l.region&&(e=" (Region: ".concat(l.region,")")),r?c.push((0,a.jsxs)("span",{className:"block",children:[t,e," is enabled."]},"".concat(s,"-enabled"))):o.push((0,a.jsxs)("span",{className:"block text-amber-700",children:[t,e," is configured but not currently available."]},"".concat(s,"-configured-not-enabled")))}else r?c.push((0,a.jsxs)("span",{className:"block",children:[t," is enabled (using default settings)."]},"".concat(s,"-default-enabled"))):o.push((0,a.jsxs)("span",{className:"block text-amber-700",children:[t," is configured but not currently available."]},"".concat(s,"-default-not-enabled")))});let u=[];if(i.length>0){let e=i.join(" and ");u.push((0,a.jsxs)("span",{className:"block",children:[e," ",1===i.length?"is":"are"," explicitly disabled."]},"disabled-clouds"))}return(u.push(...c),u.push(...o),u.length>0)?(0,a.jsx)("div",{className:"text-sm text-gray-700 mb-3 p-3 bg-sky-50 rounded border border-sky-200",children:u}):!r&&n?(0,a.jsx)("div",{className:"text-sm text-gray-500 mb-3 italic p-3 bg-sky-50 rounded border border-sky-200",children:"This workspace has no specific cloud resource configurations and can use all accessible infrastructure."}):null};function z(e){let{workspaceName:s,isNewWorkspace:l=!1}=e,d=(0,r.useRouter)(),[x,g]=(0,t.useState)({}),[j,w]=(0,t.useState)({}),[C,M]=(0,t.useState)(""),[A,z]=(0,t.useState)(!0),[O,Z]=(0,t.useState)(!1),[_,T]=(0,t.useState)(!1),[Y,I]=(0,t.useState)(null),[J,P]=(0,t.useState)(null),[V,H]=(0,t.useState)(null),[X,B]=(0,t.useState)({showDialog:!1,deleting:!1,error:null}),[F,U]=(0,t.useState)({totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:[]}),[G,q]=(0,t.useState)(!1),K=(0,t.useCallback)(async()=>{z(!0),I(null);try{let e;let l=(await (0,n.fX)())[s]||{};g(l),w(l),e=0===Object.keys(l).length?"".concat(s,":\n # Empty workspace configuration - uses all accessible infrastructure\n"):D().dump({[s]:l},{indent:2,lineWidth:-1,noRefs:!0,skipInvalid:!0,flowLevel:-1}),M(e)}catch(e){console.error("Error fetching workspace config:",e),I(e)}finally{z(!1)}},[s]),Q=(0,t.useCallback)(async()=>{if(!l){q(!0);try{let[e,l,a]=await Promise.all([(0,c.getClusters)(),(0,i.getManagedJobs)(),(0,n.yz)(s,!0)]),t=e.filter(e=>(e.workspace||"default")===s),r=t.filter(e=>"RUNNING"===e.status||"LAUNCHING"===e.status),o={};e.forEach(e=>{o[e.cluster]=e.workspace||"default"});let d=l.jobs||[],u=new Set(S.x2.active),x=0;d.forEach(e=>{let l=e.cluster_name||e.resources&&e.resources.cluster_name;l&&o[l]===s&&u.has(e.status)&&x++}),U({totalClusterCount:t.length,runningClusterCount:r.length,managedJobsCount:x,clouds:Array.isArray(a)?a:[]})}catch(e){console.error("Failed to fetch workspace stats:",e)}finally{q(!1)}}},[s,l]);(0,t.useEffect)(()=>{l?(z(!1),M("".concat(s,":\n # New workspace configuration\n # Leave empty to use all accessible infrastructure\n"))):(K(),Q())},[s,l,K,Q]),(0,t.useEffect)(()=>{T(JSON.stringify(x)!==JSON.stringify(j))},[x,j]);let $=e=>{M(e),H(null);try{let l=D().load(e)||{},a=Object.keys(l);if(0===a.length)g({});else if(1===a.length){let e=a[0];if(e!==s){H('Workspace name cannot be changed. Expected "'.concat(s,'" but found "').concat(e,'".'));return}let t=l[s]||{};g(t)}else H("Configuration must contain only one workspace. Found: ".concat(a.join(", ")))}catch(e){H("Invalid YAML: ".concat(e.message))}},ee=async()=>{Z(!0),I(null),P(null);try{if(V)throw Error("Please fix YAML errors before saving");let e=D().load(C)||{},a=Object.keys(e);if(a.length>0&&a[0]!==s)throw Error('Workspace name cannot be changed. Expected "'.concat(s,'".'));l?(await (0,n.MB)(s,x),P("Workspace created successfully!"),setTimeout(()=>{d.push("/workspaces/".concat(s))},1500)):(await (0,n.eA)(s,x),P("Workspace updated successfully!"),w(x),Q())}catch(e){console.error("Error saving workspace:",e),I(e)}finally{Z(!1)}},es=async()=>{B(e=>({...e,deleting:!0,error:null}));try{await (0,n.zl)(s),P("Workspace deleted successfully!"),setTimeout(()=>{d.push("/workspaces")},1500)}catch(e){console.error("Error deleting workspace:",e),B(s=>({...s,deleting:!1,error:e}))}},el=()=>{B({showDialog:!1,deleting:!1,error:null})},ea=async()=>{await Promise.all([K(),Q()])};if(!d.isReady)return(0,a.jsx)("div",{children:"Loading..."});let et=l?"Create New Workspace | SkyPilot Dashboard":"Workspace: ".concat(s," | SkyPilot Dashboard");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h(),{children:(0,a.jsx)("title",{children:et})}),(0,a.jsxs)(o.A,{highlighted:"workspaces",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsxs)("div",{className:"text-base flex items-center",children:[(0,a.jsx)(u(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)(u(),{href:l?"/workspace/new":"/workspaces/".concat(s),className:"text-sky-blue hover:underline",children:l?"New Workspace":s}),_&&(0,a.jsx)("span",{className:"ml-3 px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded",children:"Unsaved changes"})]}),(0,a.jsxs)("div",{className:"text-sm flex items-center",children:[(A||O||G)&&(0,a.jsxs)("div",{className:"flex items-center mr-4",children:[(0,a.jsx)(b.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:O?"Saving...":"Loading..."})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[!l&&(0,a.jsxs)("button",{onClick:ea,disabled:A||O||G,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,a.jsx)(y.Z,{className:"w-4 h-4 mr-1.5"}),"Refresh"]}),!l&&"default"!==s&&(0,a.jsxs)("button",{onClick:()=>B({...X,showDialog:!0}),disabled:X.deleting||O,className:"text-red-600 hover:text-red-700 font-medium inline-flex items-center",children:[(0,a.jsx)(N,{className:"w-4 h-4 mr-1.5"}),"Delete"]})]})]})]}),A?(0,a.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,a.jsx)(b.Z,{size:24,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading workspace configuration..."})]}):(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)(E.X,{error:Y,title:"Error",onDismiss:()=>I(null)}),(0,a.jsx)(W,{message:J}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[!l&&(0,a.jsx)("div",{className:"lg:col-span-1",children:(0,a.jsxs)(m.Zb,{className:"h-full",children:[(0,a.jsx)(m.Ol,{children:(0,a.jsxs)(m.ll,{className:"text-base font-normal",children:[(0,a.jsx)("span",{className:"font-semibold",children:"Workspace:"})," ",s]})}),(0,a.jsxs)(m.aY,{className:"text-sm pb-2 flex-1",children:[(0,a.jsxs)("div",{className:"py-2 flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,a.jsx)(L.QT,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,a.jsx)("span",{children:"Clusters (Running / Total)"})]}),(0,a.jsx)("span",{className:"font-normal text-gray-800",children:G?"...":"".concat(F.runningClusterCount," / ").concat(F.totalClusterCount)})]}),(0,a.jsxs)("div",{className:"py-2 flex items-center justify-between border-t border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,a.jsx)(L.Vp,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,a.jsx)("span",{children:"Managed Jobs"})]}),(0,a.jsx)("span",{className:"font-normal text-gray-800",children:G?"...":F.managedJobsCount})]})]}),(0,a.jsxs)("div",{className:"px-6 pb-6 text-sm pt-3",children:[(0,a.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Enabled Infra"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:G?(0,a.jsx)("span",{className:"text-gray-500",children:"Loading..."}):F.clouds.length>0?F.clouds.map(e=>(0,a.jsxs)("div",{className:"flex items-center text-gray-700",children:[(0,a.jsx)(L.Ye,{className:"w-3.5 h-3.5 mr-1.5 text-green-500"}),(0,a.jsx)("span",{children:e})]},e)):(0,a.jsx)("span",{className:"text-gray-500 italic",children:"No enabled infrastructure"})}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(R,{workspaceName:s,config:j,enabledClouds:F.clouds})})]})]})}),(0,a.jsx)("div",{className:l?"lg:col-span-3":"lg:col-span-2",children:(0,a.jsxs)(m.Zb,{className:"h-full flex flex-col",children:[(0,a.jsx)(m.Ol,{children:(0,a.jsx)(m.ll,{className:"text-base font-normal",children:l?"New Workspace YAML":"Edit Workspace YAML"})}),(0,a.jsx)(m.aY,{className:"flex-1 flex flex-col",children:(0,a.jsxs)("div",{className:"space-y-4 flex-1 flex flex-col",children:[V&&(0,a.jsx)(E.X,{error:V,onDismiss:()=>H(null)}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,a.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Configure infra-specific settings for this workspace. Leave empty to use all accessible infrastructure. Refer to"," ",(0,a.jsx)("a",{href:"https://docs.skypilot.co/en/latest/admin/workspaces.html#configuration",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600",children:"SkyPilot Docs"})," ","for more details."]}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Example configuration:"}),(0,a.jsx)("div",{className:"p-3 bg-gray-50 border rounded-lg",children:(0,a.jsx)("pre",{className:"text-xs font-mono text-gray-600 whitespace-pre-wrap",children:"".concat(s||"my-workspace",":\n gcp:\n project_id: xxx\n disabled: false\n kubernetes:\n allowed_contexts:\n - context-1")})})]}),(0,a.jsx)(p,{value:C,onChange:e=>$(e.target.value),className:"font-mono text-sm flex-1 resize-none",style:{minHeight:"350px"},spellCheck:!1,placeholder:"# Enter workspace configuration in YAML format"}),(0,a.jsx)("div",{className:"flex justify-end space-x-3 pt-3 border-gray-200",children:(0,a.jsxs)(f.z,{onClick:ee,disabled:O||V||A,className:"inline-flex items-center bg-blue-600 hover:bg-blue-700 text-white",children:[(0,a.jsx)(k.Z,{className:"w-4 h-4 mr-1.5"}),O?"Applying...":"Apply"]})})]})]})})]})})]})]}),(0,a.jsx)(v.Vq,{open:X.showDialog,onOpenChange:el,children:(0,a.jsxs)(v.cZ,{className:"sm:max-w-md",children:[(0,a.jsxs)(v.fK,{className:"",children:[(0,a.jsx)(v.$N,{children:"Delete Workspace"}),(0,a.jsxs)(v.Be,{children:['Are you sure you want to delete workspace "',s,'"? This action cannot be undone.']})]}),X.error&&(0,a.jsx)(E.X,{error:X.error,title:"Deletion Failed",onDismiss:()=>B(e=>({...e,error:null}))}),(0,a.jsxs)(v.cN,{className:"",children:[(0,a.jsx)(f.z,{variant:"outline",onClick:el,disabled:X.deleting,children:"Cancel"}),(0,a.jsx)(f.z,{variant:"destructive",onClick:es,disabled:X.deleting,children:X.deleting?"Deleting...":"Delete"})]})]})})]})]})}},9008:function(e,s,l){e.exports=l(7219)}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[856],{3266:function(e,t,r){r.d(t,{QL:function(){return u},Sl:function(){return l},getClusters:function(){return c}});var a=r(7294),o=r(5821),n=r(3225);let s={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function c(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=await fetch("".concat(n.f4,"/status"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cluster_names:e,all_users:!0})}),r=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("X-Request-ID"),a=await fetch("".concat(n.f4,"/api/get?request_id=").concat(r)),o=await a.json();return(o.return_value?JSON.parse(o.return_value):[]).map(e=>{let t="",r=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let r=Math.floor((t-3)/2),a=r+(t-3)%2;return 0===r?e.substring(0,a)+"...":e.substring(0,a)+"..."+e.substring(e.length-r)}(t,25)),{status:s[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:r?"".concat(e.cloud," (").concat(r,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,jobs:[],events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}})}catch(e){return console.error("Error fetching clusters:",e),[]}}async function l(e){let{clusterName:t,jobId:r,onNewLog:a,workspace:s}=e;try{let e=(await fetch("".concat(n.f4,"/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({follow:!1,cluster_name:t,job_id:r,override_skypilot_config:{active_workspace:s||"default"}})})).body.getReader();for(;;){let{done:t,value:r}=await e.read();if(t)break;let o=new TextDecoder().decode(r);a(o)}}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,o.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function i(e){let{clusterName:t,workspace:r}=e;try{let e=await fetch("".concat(n.f4,"/queue"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:r}})}),a=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),o=await fetch("".concat(n.f4,"/api/get?request_id=").concat(a)),s=await o.json();return JSON.parse(s.return_value).map(e=>{let r=e.end_at?e.end_at:Date.now()/1e3,a=0,o=0;return e.submitted_at&&(a=r-e.submitted_at),e.start_at&&(o=r-e.start_at),{id:e.job_id,status:e.status,job:e.job_name,user:e.username,gpus:e.accelerators||{},submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,resources:e.resources,cluster:t,total_duration:a,job_duration:o,infra:"",logs:""}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function u(e){let{cluster:t,job:r=null}=e,[o,n]=(0,a.useState)(null),[s,l]=(0,a.useState)(null),[u,d]=(0,a.useState)(!0),[g,h]=(0,a.useState)(!0),f=(0,a.useCallback)(async()=>{if(t)try{d(!0);let e=await c({clusterNames:[t]});return n(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{d(!1)}return null},[t]),p=(0,a.useCallback)(async e=>{if(t)try{h(!0);let r=await i({clusterName:t,workspace:e||"default"});l(r)}catch(e){console.error("Error fetching cluster job data:",e)}finally{h(!1)}},[t]),b=(0,a.useCallback)(async()=>{let e=await f();e&&await p(e.workspace)},[f,p]);return(0,a.useEffect)(()=>{(async()=>{let e=await f();e&&await p(e.workspace)})()},[t,r,f,p]),{clusterData:o,clusterJobData:s,loading:u||g,refreshData:b}}},2045:function(e,t,r){r.d(t,{l4:function(){return n}});var a=r(3225);async function o(e,t){try{let r=[];try{let e=await fetch("".concat(a.f4,"/enabled_clouds"),{method:"GET",headers:{"Content-Type":"application/json"}}),t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),o=await fetch("".concat(a.f4,"/api/get?request_id=").concat(t)),n=await o.json();r=n.return_value?JSON.parse(n.return_value):[],console.log("Enabled clouds:",r)}catch(e){console.error("Error fetching enabled clouds:",e),r=[]}let o={};a.$m.forEach(e=>{let t=r.includes(e.toLowerCase());o[e]={name:e,clusters:0,jobs:0,enabled:t}}),e.forEach(e=>{if(e.cloud){let t=e.cloud;o[t]&&(o[t].clusters+=1,o[t].enabled=!0)}}),t.forEach(e=>{if(e.cloud){let t=e.cloud;o[t]&&(o[t].jobs+=1,o[t].enabled=!0)}});let n=a.$m.length,s=Object.values(o).filter(e=>e.enabled).length;return{clouds:Object.values(o).filter(e=>e.enabled).sort((e,t)=>t.clusters-e.clusters||t.jobs-e.jobs),totalClouds:n,enabledClouds:s}}catch(e){return console.error("Error fetching cloud infrastructure:",e),{clouds:[],totalClouds:a.$m.length,enabledClouds:0}}}async function n(){let{getClusters:e}=await Promise.resolve().then(r.bind(r,3266)),{getManagedJobs:t}=await Promise.resolve().then(r.bind(r,8969)),[a,n]=await Promise.all([e(),t()]),c=a||[],l=(null==n?void 0:n.jobs)||[],[i,u]=await Promise.all([s(c,l),o(c,l)]);return{gpuData:i,cloudData:u}}async function s(e,t){return await d({clusters:e||[],jobs:t||[]})}async function c(){try{let e=await fetch("".concat(a.f4,"/realtime_kubernetes_gpu_availability"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:null,name_filter:null,quantity_filter:null})});if(!e.ok)return console.error("Error fetching Kubernetes context GPUs (in getKubernetesContextGPUs): ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for Kubernetes GPU availability (in getKubernetesContextGPUs)"),[];let r=await fetch("".concat(a.f4,"/api/get?request_id=").concat(t)),o=await r.text();if(500===r.status){try{let e=JSON.parse(o);if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("[infra.jsx] getKubernetesContextGPUs: Server error detail:",t.message)}catch(t){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing server error JSON:",t,"Original error text:",e.detail.error)}}catch(e){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing 500 error response JSON:",e,"Raw text was:",o)}return[]}let n=JSON.parse(o);return n.return_value?JSON.parse(n.return_value):[]}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesContextGPUs:",e),[]}}async function l(){try{let e=await fetch("".concat(a.f4,"/all_contexts"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)return console.error("Error fetching all contexts: ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for /all_contexts"),[];let r=await fetch("".concat(a.f4,"/api/get?request_id=").concat(t)),o=await r.json();return o.return_value?JSON.parse(o.return_value):[]}catch(e){return console.error("[infra.jsx] Error in getAllContexts:",e),[]}}async function i(e){try{let t=await fetch("".concat(a.f4,"/kubernetes_node_info"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:e})}),r=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("x-request-id"),o=await fetch("".concat(a.f4,"/api/get?request_id=").concat(r));if(500===o.status){try{let e=await o.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Kubernetes per node GPUs:",t.message)}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{}}let n=await o.json();return(n.return_value?JSON.parse(n.return_value):{}).node_info_dict||{}}catch(t){return console.error("[infra.jsx] Error in getKubernetesPerNodeGPUs for context",e,":",t),{}}}async function u(e){try{let t=e.clusters,r=e.jobs,a={};return t.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(a[t]||(a[t]={clusters:0,jobs:0}),a[t].clusters+=1)}),r.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(a[t]||(a[t]={clusters:0,jobs:0}),a[t].jobs+=1)}),a}catch(e){return console.error("=== Error in getContextClustersAndJobs ===",e),{}}}async function d(e){try{let n=await l();if(!n||0===n.length)return console.log("No contexts found from /all_contexts endpoint."),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}};let s=await u(e),d=await c(),g=new Map;d&&d.forEach(e=>{g.set(e[0],e[1])});let h={},f={},p={};for(let e of n){f[e]||(f[e]=[]);let n=g.get(e);if(n&&n.length>0)for(let t of n){let r=t[0],a=t[1].join(", "),o=t[2],n=t[3];r in h?(h[r].gpu_total+=o,h[r].gpu_free+=n):h[r]={gpu_total:o,gpu_free:n,gpu_name:r},f[e].push({gpu_name:r,gpu_requestable_qty_per_node:a,gpu_total:o,gpu_free:n,context:e})}let s=await i(e);if(s&&Object.keys(s).length>0)for(let n in s){var t,r,a,o;let c=s[n],l=c.accelerator_type||"-",i=null!==(a=null===(t=c.total)||void 0===t?void 0:t.accelerator_count)&&void 0!==a?a:0,u=null!==(o=null===(r=c.free)||void 0===r?void 0:r.accelerators_available)&&void 0!==o?o:0;p["".concat(e,"/").concat(n)]={node_name:c.name,gpu_name:l,gpu_total:i,gpu_free:u,context:e},"-"===l||f[e].some(e=>e.gpu_name===l)||(l in h||(h[l]={gpu_total:0,gpu_free:0,gpu_name:l}),f[e].find(e=>e.gpu_name===l)||f[e].push({gpu_name:l,gpu_requestable_qty_per_node:"-",gpu_total:0,gpu_free:0,context:e}))}0===f[e].length&&s&&Object.keys(s).length}return{allContextNames:n.sort(),allGPUs:Object.values(h).sort((e,t)=>e.gpu_name.localeCompare(t.gpu_name)),perContextGPUs:Object.values(f).flat().sort((e,t)=>e.context.localeCompare(t.context)||e.gpu_name.localeCompare(t.gpu_name)),perNodeGPUs:Object.values(p).sort((e,t)=>e.context.localeCompare(t.context)||e.node_name.localeCompare(t.node_name)||e.gpu_name.localeCompare(t.gpu_name)),contextStats:s}}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesGPUs:",e),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}}}}r(3266),r(8969)},8969:function(e,t,r){r.d(t,{Ce:function(){return i},NJ:function(){return l},Pr:function(){return c},getManagedJobs:function(){return s}});var a=r(7294),o=r(5821),n=r(3225);async function s(){let{allUsers:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=(await fetch("".concat(n.f4,"/jobs/queue"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({all_users:e})})).headers.get("X-Skypilot-Request-ID"),r=await fetch("".concat(n.f4,"/api/get?request_id=").concat(t));if(500===r.status){try{let e=await r.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t.type&&t.type===n.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 a=await r.json();return{jobs:(a.return_value?JSON.parse(a.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 r=(e.end_at?e.end_at:Date.now()/1e3)-e.submitted_at,a=e.cloud,o=e.cluster_resources;if(!a){if(e.cluster_resources&&"-"!==e.cluster_resources)try{a=e.cluster_resources.split("(")[0].split("x").pop().trim(),o=e.cluster_resources.replace("".concat(a,"("),"(").replace("x ","x")}catch(e){a="Unknown"}else a="Unknown"}let n="",s=n=e.zone?e.zone:e.region;n&&n.length>15&&(n=n.substring(0,15)+"...");let c=a+" ("+n+")";"-"===n&&(c=a);let l=a+" ("+s+")";return"-"===s&&(l=a),{id:e.job_id,task:e.task_name,name:e.job_name,job_duration:e.job_duration,total_duration:r,workspace:e.workspace,status:e.status,requested_resources:e.resources,resources_str:o,resources_str_full:e.cluster_resources_full||o,cloud:a,region:e.region,infra:c,full_infra:l,recoveries:e.recovery_count,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}}),controllerStopped:!1}}catch(e){return console.error("Error fetching managed job data:",e),{jobs:[],controllerStopped:!1}}}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,[t,r]=(0,a.useState)(null),[o,n]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{(async function(){try{n(!0);let e=await s({allUsers:!0});r(e)}catch(e){console.error("Error fetching managed job data:",e)}finally{n(!1)}})()},[e]),{jobData:t,loading:o}}async function l(e){let{jobId:t,controller:r=!1,signal:a,onNewLog:s}=e,c=new Promise(e=>{setTimeout(()=>{e({timeout:!0})},1e4)}),l=(async()=>{try{let e=(await fetch("".concat(n.f4,"/jobs/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({controller:r,follow:!1,job_id:t}),...a?{signal:a}:{}})).body.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;let a=new TextDecoder().decode(r);s(a)}}finally{e.cancel()}return{timeout:!1}}catch(e){if("AbortError"===e.name)return{timeout:!1};throw e}})();if((await Promise.race([l,c])).timeout){(0,o.C)("Log request for job ".concat(t," timed out after ").concat(1e4,"ms"),"error");return}}async function i(e,t,r){let a="",s="",c="",l={};if("restartcontroller"===e)a="Restarting",s="restarted",c="jobs/queue",l={all_users:!0,refresh:!0},t="controller";else throw Error("Invalid action: ".concat(e));(0,o.C)("".concat(a," job ").concat(t,"..."),"info");try{try{let e=(await fetch("".concat(n.f4,"/").concat(c),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})).headers.get("X-Skypilot-Request-ID"),i=await fetch("".concat(n.f4,"/api/get?request_id=").concat(e));if(200===i.status)(0,o.C)("Job ".concat(t," ").concat(s," successfully."),"success");else if(500===i.status)try{let e=await i.json();if(e.detail&&e.detail.error)try{let s=JSON.parse(e.detail.error);s.type&&s.type===n.Bo?(0,o.C)("".concat(a," job ").concat(t," is not supported!"),"error",1e4):s.type&&s.type===n.mF?(0,o.C)("Cluster ".concat(r," does not exist."),"error"):s.type&&s.type===n.iW?(0,o.C)("Cluster ".concat(r," is not up."),"error"):(0,o.C)("".concat(a," job ").concat(t," failed: ").concat(s.type),"error")}catch(r){(0,o.C)("".concat(a," job ").concat(t," failed: ").concat(e.detail.error),"error")}else(0,o.C)("".concat(a," job ").concat(t," failed with no details."),"error")}catch(e){(0,o.C)("".concat(a," job ").concat(t," failed with parse error."),"error")}else(0,o.C)("".concat(a," job ").concat(t," failed with status ").concat(i.status,"."),"error")}catch(e){console.error("Fetch error:",e),(0,o.C)("Network error ".concat(a," job ").concat(t,": ").concat(e.message),"error")}}catch(e){console.error("Error in handleStop:",e),(0,o.C)("Critical error ".concat(a," job ").concat(t,": ").concat(e.message),"error")}}},5821:function(e,t,r){r.d(t,{C:function(){return a}});function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,a=document.getElementById("toast-container");a||((a=document.createElement("div")).id="toast-container",a.className="fixed top-0 right-0 p-4 z-[9999] flex flex-col items-end space-y-2",document.body.appendChild(a));let o=document.createElement("div");switch(o.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":o.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":o.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":o.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:o.className+=" bg-blue-100 border-blue-500 text-blue-800"}return o.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 '),a.appendChild(o),o.querySelector("button").addEventListener("click",()=>{a.removeChild(o)}),setTimeout(()=>{a.contains(o)&&a.removeChild(o)},r),o}},3081:function(e,t,r){r.d(t,{R:function(){return l},i:function(){return i}});var a=r(3225),o=r(3266),n=r(8969);let s=e=>e&&e.includes("@")?e.split("@")[0]:e||"N/A",c=e=>e&&e.includes("@")?e:"-";async function l(){try{let e=await fetch("".concat(a.f4,"/users"));if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return(await e.json()).map(e=>({userId:e.id,username:e.name}))||[]}catch(e){return console.error("Failed to fetch users:",e),[]}}async function i(){let[e,t,r]=await Promise.all([l(),(0,o.getClusters)(),(0,n.getManagedJobs)()]),a=r.jobs||[];return(e||[]).map(e=>{let r=(t||[]).filter(t=>t.user_hash===e.userId),o=(a||[]).filter(t=>t.user_hash===e.userId);return{...e,usernameDisplay:s(e.username),fullEmail:c(e.username),clusterCount:r.length,jobCount:o.length}})}},6856:function(e,t,r){var a=r(6378),o=r(3266),n=r(8969),s=r(7324),c=r(3081),l=r(2045);let i={base:{getClusters:{fn:o.getClusters,args:[]},getManagedJobs:{fn:n.getManagedJobs,args:[]},getWorkspaces:{fn:s.fX,args:[]},getUsers:{fn:c.R,args:[]},getUsersWithCounts:{fn:c.i,args:[]},getInfraData:{fn:l.l4,args:[]}},dynamic:{getEnabledClouds:{fn:s.yz,requiresWorkspaces:!0}},pages:{clusters:["getClusters","getWorkspaces"],jobs:["getManagedJobs","getClusters","getWorkspaces"],infra:["getInfraData"],workspaces:["getWorkspaces","getClusters","getManagedJobs","getEnabledClouds"],users:["getUsersWithCounts"]}};class u{async preloadForPage(e,t){let{backgroundPreload:r=!0,force:a=!1}=t||{};if(!i.pages[e]){console.warn("Unknown page: ".concat(e));return}console.log("[CachePreloader] Preloading cache for page: ".concat(e));try{await this._loadPageData(e,a),r&&this._backgroundPreloadOtherPages(e)}catch(t){console.error("[CachePreloader] Error preloading for page ".concat(e,":"),t)}}async _loadPageData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=i.pages[e],o=[];for(let e of r)if(i.base[e]){let{fn:r,args:n}=i.base[e];t&&a.ZP.invalidate(r,n),o.push(a.ZP.get(r,n))}else"getEnabledClouds"===e&&o.push(this._loadEnabledCloudsForAllWorkspaces(t));await Promise.allSettled(o),console.log("[CachePreloader] Loaded data for page: ".concat(e))}async _loadEnabledCloudsForAllWorkspaces(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&a.ZP.invalidate(s.fX);let t=await a.ZP.get(s.fX),r=Object.keys(t||{}).map(t=>(e&&a.ZP.invalidate(s.yz,[t]),a.ZP.get(s.yz,[t])));await Promise.allSettled(r)}catch(e){console.error("[CachePreloader] Error loading enabled clouds:",e)}}_backgroundPreloadOtherPages(e){if(this.isPreloading)return;this.isPreloading=!0;let t=Object.keys(i.pages).filter(t=>t!==e);console.log("[CachePreloader] Background preloading pages: ".concat(t.join(", "))),Promise.allSettled(t.map(async e=>{try{await this._loadPageData(e,!1),console.log("[CachePreloader] Background loaded: ".concat(e))}catch(t){console.error("[CachePreloader] Background load failed for ".concat(e,":"),t)}})).then(()=>{this.isPreloading=!1,console.log("[CachePreloader] Background preloading complete")})}async preloadBaseFunctions(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];console.log("[CachePreloader] Preloading all base functions");let t=Object.entries(i.base).map(t=>{let[r,{fn:o,args:n}]=t;return e&&a.ZP.invalidate(o,n),a.ZP.get(o,n).catch(e=>{console.error("[CachePreloader] Failed to preload ".concat(r,":"),e)})});await Promise.allSettled(t),console.log("[CachePreloader] Base functions preloaded")}getCacheStats(){return{...a.ZP.getStats(),isPreloading:this.isPreloading,preloadPromises:this.preloadPromises.size}}clearCache(){a.ZP.clear(),this.isPreloading=!1,this.preloadPromises.clear(),console.log("[CachePreloader] Cache cleared")}constructor(){this.isPreloading=!1,this.preloadPromises=new Map}}let d=new u;t.ZP=d},6378:function(e,t,r){let a=r(1214).ej.DEFAULT_TTL;class o{async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.ttl||a,n=!1!==r.refreshOnAccess,s=this._generateKey(e,t),c=e.name||"anonymous",l=this.cache.get(s),i=Date.now();if(l&&i-l.lastUpdated<o){let r=Math.round((i-l.lastUpdated)/1e3);return this._debug("Cache HIT for ".concat(c," (age: ").concat(r,"s, TTL: ").concat(Math.round(o/1e3),"s)")),n&&(this.cache.set(s,{data:l.data,lastUpdated:i}),this._debug("Cache TTL refreshed for ".concat(c))),this.backgroundJobs.has(s)||this._refreshInBackground(e,t,s),l.data}try{let r=await e(...t);return this.cache.set(s,{data:r,lastUpdated:i}),r}catch(e){if(l)return console.warn("Failed to fetch fresh data for ".concat(s,", returning stale data:"),e),l.data;throw e}}invalidate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=this._generateKey(e,t);this.cache.delete(r),this.backgroundJobs.delete(r)}invalidateFunction(e){let t=e.name||"anonymous",r=[];for(let e of this.cache.keys())e.startsWith("".concat(t,"_"))&&r.push(e);r.forEach(e=>{this.cache.delete(e),this.backgroundJobs.delete(e)})}clear(){this.cache.clear(),this.backgroundJobs.clear()}getStats(){return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,keys:Array.from(this.cache.keys())}}getDetailedStats(){let e=Date.now(),t=[];for(let[r,a]of this.cache.entries()){let o=e-a.lastUpdated;t.push({key:r,age:Math.round(o/1e3),lastUpdated:new Date(a.lastUpdated).toISOString(),hasBackgroundJob:this.backgroundJobs.has(r)})}return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,entries:t.sort((e,t)=>e.age-t.age)}}setDebugMode(e){this.debugMode=e}_debug(e){for(var t=arguments.length,r=Array(t>1?t-1:0),a=1;a<t;a++)r[a-1]=arguments[a];this.debugMode&&console.log("[DashboardCache] ".concat(e),...r)}_refreshInBackground(e,t,r){this.backgroundJobs.set(r,!0),e(...t).then(e=>{this.cache.set(r,{data:e,lastUpdated:Date.now()})}).catch(e=>{console.warn("Background refresh failed for ".concat(r,":"),e)}).finally(()=>{this.backgroundJobs.delete(r)})}_generateKey(e,t){let r=e.name||"anonymous",a=t.length>0?JSON.stringify(t):"";return"".concat(r,"_").concat(a)}constructor(){this.cache=new Map,this.backgroundJobs=new Map,this.debugMode=!1}}let n=new o;t.ZP=n}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[973],{9307:function(e,t,s){s.d(t,{Cl:function(){return c},OE:function(){return d}});var r=s(5893);s(7294);var a=s(8799),n=s(6989),l=s(3850);let c=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"}},o=e=>{switch(e){case"LAUNCHING":case"STARTING":return(0,r.jsx)(a.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":default:return(0,r.jsx)(l.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,r.jsx)(l.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,r.jsx)(l.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,r.jsx)(l.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)(l.J$,{className:"w-3 h-3 mr-1"})}},i=e=>{let t=c(e),s=o(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)(n.WH,{content:t,className:"text-muted-foreground text-sm",children:(0,r.jsx)("span",{children:i(t)})})}},9284:function(e,t,s){s.d(t,{Oh:function(){return m},_R:function(){return f},cV:function(){return x}});var r=s(5893),a=s(7294),n=s(326),l=s(803),c=s(7673),o=s(8671),i=s(6989),d=s(3225),u=s(3001);function m(e){let{isOpen:t,onClose:s,cluster:d}=e,[u,m]=a.useState(!1),f=e=>{navigator.clipboard.writeText(e),m(!0),setTimeout(()=>m(!1),2e3)},x=["sky status ".concat(d),"ssh ".concat(d)],h=x.join("\n");return(0,r.jsx)(n.Vq,{open:t,onOpenChange:s,children:(0,r.jsxs)(n.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(n.fK,{children:[(0,r.jsxs)(n.$N,{children:["Connect to: ",(0,r.jsx)("span",{className:"font-light",children:d})]}),(0,r.jsx)(n.Be,{children:"Use these instructions to connect to your cluster via SSH."})]}),(0,r.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium mb-2",children:"SSH Command"}),(0,r.jsx)(c.Zb,{className:"p-3 bg-gray-50",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("pre",{className:"text-sm w-full whitespace-pre-wrap",children:x.map((e,t)=>(0,r.jsx)("code",{className:"block",children:e},t))}),(0,r.jsx)(i.WH,{content:u?"Copied!":"Copy command",children:(0,r.jsx)(l.z,{variant:"ghost",size:"icon",onClick:()=>f(h),className:"h-8 w-8 rounded-full",children:(0,r.jsx)(o.Z,{className:"h-4 w-4"})})})]})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium mb-2",children:"Additional Information"}),(0,r.jsxs)("p",{className:"text-sm text-secondary-foreground",children:["Make sure to run"," ",(0,r.jsxs)("code",{className:"text-sm",children:["sky status ",d]})," first to have SkyPilot set up the SSH access."]})]})]})]})})}function f(e){let{isOpen:t,onClose:s,cluster:a}=e,m=(0,u.X)();return(0,r.jsx)(n.Vq,{open:t,onOpenChange:s,children:(0,r.jsx)(n.cZ,{className:"sm:max-w-3xl",children:(0,r.jsxs)(n.fK,{children:[(0,r.jsxs)(n.$N,{children:["Connect to: ",(0,r.jsx)("span",{className:"font-light",children:a})]}),(0,r.jsx)(n.Be,{children:(0,r.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium mb-2 my-2",children:"Setup SSH access"}),(0,r.jsx)(c.Zb,{className:"p-3 bg-gray-50",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("pre",{className:"text-sm",children:(0,r.jsxs)("code",{children:["sky status ",a]})}),(0,r.jsx)(i.WH,{content:"Copy command",children:(0,r.jsx)(l.z,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText("sky status ".concat(a)),className:"h-8 w-8 rounded-full",children:(0,r.jsx)(o.Z,{className:"h-4 w-4"})})})]})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium mb-2 my-2",children:"Connect with VSCode/Cursor"}),(0,r.jsx)(c.Zb,{className:"p-3 bg-gray-50",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("pre",{className:"text-sm",children:(0,r.jsxs)("code",{children:["code --remote ssh-remote+",a]})}),(0,r.jsx)(i.WH,{content:"Copy command",children:(0,r.jsx)(l.z,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText("code --remote ssh-remote+".concat(a)),className:"h-8 w-8 rounded-full",children:(0,r.jsx)(o.Z,{className:"h-4 w-4"})})})]})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium",children:"Or use the GUI to connect"}),(0,r.jsx)("div",{className:"relative ".concat(m?"-mt-5":"-mt-10"),style:{paddingBottom:"70%"},children:(0,r.jsxs)("video",{className:"absolute top-0 left-0 w-full h-full rounded-lg",controls:!0,autoPlay:!0,muted:!0,preload:"metadata",children:[(0,r.jsx)("source",{src:"".concat(d.GW,"/videos/cursor-small.mp4"),type:"video/mp4"}),"Your browser does not support the video tag."]})})]})]})})]})})})}function x(e){let{isOpen:t,onClose:s,onConfirm:a,title:c,message:o,confirmText:i="Confirm",confirmVariant:d="destructive"}=e;return(0,r.jsx)(n.Vq,{open:t,onOpenChange:s,children:(0,r.jsxs)(n.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(n.fK,{children:[(0,r.jsx)(n.$N,{children:c}),(0,r.jsx)(n.Be,{children:o})]}),(0,r.jsxs)(n.cN,{className:"flex justify-end gap-2 pt-4",children:[(0,r.jsx)(l.z,{variant:"outline",onClick:s,children:"Cancel"}),(0,r.jsx)(l.z,{variant:d,onClick:()=>{a(),s()},children:i})]})]})})}},803:function(e,t,s){s.d(t,{z:function(){return i}});var r=s(5893),a=s(7294),n=s(8426),l=s(2003),c=s(2350);let o=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),i=a.forwardRef((e,t)=>{let{className:s,variant:a,size:l,asChild:i=!1,...d}=e,u=i?n.g7:"button";return(0,r.jsx)(u,{className:(0,c.cn)(o({variant:a,size:l,className:s})),ref:t,...d})});i.displayName="Button"},7673:function(e,t,s){s.d(t,{Ol:function(){return i},Zb:function(){return o},aY:function(){return m},eW:function(){return f},ll:function(){return d}});var r=s(5893),a=s(7294),n=s(5697),l=s.n(n),c=s(2350);let o=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",s),...n,children:a})});o.displayName="Card",o.propTypes={className:l().string,children:l().node};let i=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("flex flex-col space-y-1.5 p-6",s),...n,children:a})});i.displayName="CardHeader",i.propTypes={className:l().string,children:l().node};let d=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("h3",{ref:t,className:(0,c.cn)("text-2xl font-semibold leading-none tracking-tight",s),...n,children:a})});d.displayName="CardTitle",d.propTypes={className:l().string,children:l().node};let u=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("p",{ref:t,className:(0,c.cn)("text-sm text-muted-foreground",s),...n,children:a})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let m=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("p-6 pt-0",s),...n,children:a})});m.displayName="CardContent",m.propTypes={className:l().string,children:l().node};let f=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("flex items-center p-6 pt-0",s),...n,children:a})});f.displayName="CardFooter",f.propTypes={className:l().string,children:l().node}},326:function(e,t,s){s.d(t,{$N:function(){return x},Be:function(){return h},Vq:function(){return o},cN:function(){return f},cZ:function(){return u},fK:function(){return m}});var r=s(5893),a=s(7294),n=s(6327),l=s(2350),c=s(3767);let o=n.fC;n.xz;let i=n.h_;n.x8;let d=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(n.aV,{ref:t,className:(0,l.cn)("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...a})});d.displayName=n.aV.displayName;let u=a.forwardRef((e,t)=>{let{className:s,children:a,...o}=e;return(0,r.jsxs)(i,{children:[(0,r.jsx)(d,{}),(0,r.jsxs)(n.VY,{ref:t,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...o,children:[a,(0,r.jsxs)(n.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-500",children:[(0,r.jsx)(c.Z,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});u.displayName=n.VY.displayName;let m=e=>{let{className:t,...s}=e;return(0,r.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...s})};m.displayName="DialogHeader";let f=e=>{let{className:t,...s}=e;return(0,r.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s})};f.displayName="DialogFooter";let x=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(n.Dx,{ref:t,className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight",s),...a})});x.displayName=n.Dx.displayName;let h=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(n.dk,{ref:t,className:(0,l.cn)("text-sm text-gray-500",s),...a})});h.displayName=n.dk.displayName},8764:function(e,t,s){s.d(t,{RM:function(){return o},SC:function(){return i},iA:function(){return l},pj:function(){return u},ss:function(){return d},xD:function(){return c}});var r=s(5893),a=s(7294),n=s(2350);let l=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:t,className:(0,n.cn)("w-full caption-bottom text-base",s),...a})})});l.displayName="Table";let c=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("thead",{ref:t,className:(0,n.cn)("[&_tr]:border-b",s),...a})});c.displayName="TableHeader";let o=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tbody",{ref:t,className:(0,n.cn)("[&_tr:last-child]:border-0",s),...a})});o.displayName="TableBody",a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tfoot",{ref:t,className:(0,n.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a})}).displayName="TableFooter";let i=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tr",{ref:t,className:(0,n.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...a})});i.displayName="TableRow";let d=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("th",{ref:t,className:(0,n.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",s),...a})});d.displayName="TableHead";let u=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("td",{ref:t,className:(0,n.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a})});u.displayName="TableCell",a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("caption",{ref:t,className:(0,n.cn)("mt-4 text-base text-muted-foreground",s),...a})}).displayName="TableCaption"},4545:function(e,t,s){function r(e){return e.startsWith("sky-jobs-controller-")}function a(e,t,s){return null===t?e:[...e].sort((e,r)=>e[t]<r[t]?"ascending"===s?-1:1:e[t]>r[t]?"ascending"===s?1:-1:0)}s.d(t,{R0:function(){return a},Ym:function(){return r}})}}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[826],{4966:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters/[cluster]/[job]",function(){return s(190)}])},3626:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/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 c},OE:function(){return d}});var r=s(5893);s(7294);var a=s(8799),n=s(6989),l=s(3850);let c=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"}},i=e=>{switch(e){case"LAUNCHING":case"STARTING":return(0,r.jsx)(a.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":default:return(0,r.jsx)(l.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,r.jsx)(l.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,r.jsx)(l.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,r.jsx)(l.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)(l.J$,{className:"w-3 h-3 mr-1"})}},o=e=>{let t=c(e),s=i(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)(n.WH,{content:t,className:"text-muted-foreground text-sm",children:(0,r.jsx)("span",{children:o(t)})})}},7673:function(e,t,s){"use strict";s.d(t,{Ol:function(){return o},Zb:function(){return i},aY:function(){return m},eW:function(){return x},ll:function(){return d}});var r=s(5893),a=s(7294),n=s(5697),l=s.n(n),c=s(2350);let i=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",s),...n,children:a})});i.displayName="Card",i.propTypes={className:l().string,children:l().node};let o=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("flex flex-col space-y-1.5 p-6",s),...n,children:a})});o.displayName="CardHeader",o.propTypes={className:l().string,children:l().node};let d=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("h3",{ref:t,className:(0,c.cn)("text-2xl font-semibold leading-none tracking-tight",s),...n,children:a})});d.displayName="CardTitle",d.propTypes={className:l().string,children:l().node};let u=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("p",{ref:t,className:(0,c.cn)("text-sm text-muted-foreground",s),...n,children:a})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let m=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("p-6 pt-0",s),...n,children:a})});m.displayName="CardContent",m.propTypes={className:l().string,children:l().node};let x=a.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("flex items-center p-6 pt-0",s),...n,children:a})});x.displayName="CardFooter",x.propTypes={className:l().string,children:l().node}},3266:function(e,t,s){"use strict";s.d(t,{QL:function(){return d},Sl:function(){return i},getClusters:function(){return c}});var r=s(7294),a=s(5821),n=s(3225);let l={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function c(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=await fetch("".concat(n.f4,"/status"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cluster_names:e,all_users:!0})}),s=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("X-Request-ID"),r=await fetch("".concat(n.f4,"/api/get?request_id=").concat(s)),a=await r.json();return(a.return_value?JSON.parse(a.return_value):[]).map(e=>{let t="",s=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let s=Math.floor((t-3)/2),r=s+(t-3)%2;return 0===s?e.substring(0,r)+"...":e.substring(0,r)+"..."+e.substring(e.length-s)}(t,25)),{status:l[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:s?"".concat(e.cloud," (").concat(s,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,jobs:[],events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}})}catch(e){return console.error("Error fetching clusters:",e),[]}}async function i(e){let{clusterName:t,jobId:s,onNewLog:r,workspace:l}=e;try{let e=(await fetch("".concat(n.f4,"/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({follow:!1,cluster_name:t,job_id:s,override_skypilot_config:{active_workspace:l||"default"}})})).body.getReader();for(;;){let{done:t,value:s}=await e.read();if(t)break;let a=new TextDecoder().decode(s);r(a)}}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,a.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function o(e){let{clusterName:t,workspace:s}=e;try{let e=await fetch("".concat(n.f4,"/queue"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:s}})}),r=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),a=await fetch("".concat(n.f4,"/api/get?request_id=").concat(r)),l=await a.json();return JSON.parse(l.return_value).map(e=>{let s=e.end_at?e.end_at:Date.now()/1e3,r=0,a=0;return e.submitted_at&&(r=s-e.submitted_at),e.start_at&&(a=s-e.start_at),{id:e.job_id,status:e.status,job:e.job_name,user:e.username,gpus:e.accelerators||{},submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,resources:e.resources,cluster:t,total_duration:r,job_duration:a,infra:"",logs:""}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function d(e){let{cluster:t,job:s=null}=e,[a,n]=(0,r.useState)(null),[l,i]=(0,r.useState)(null),[d,u]=(0,r.useState)(!0),[m,x]=(0,r.useState)(!0),h=(0,r.useCallback)(async()=>{if(t)try{u(!0);let e=await c({clusterNames:[t]});return n(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{u(!1)}return null},[t]),f=(0,r.useCallback)(async e=>{if(t)try{x(!0);let s=await o({clusterName:t,workspace:e||"default"});i(s)}catch(e){console.error("Error fetching cluster job data:",e)}finally{x(!1)}},[t]),N=(0,r.useCallback)(async()=>{let e=await h();e&&await f(e.workspace)},[h,f]);return(0,r.useEffect)(()=>{(async()=>{let e=await h();e&&await f(e.workspace)})()},[t,s,h,f]),{clusterData:a,clusterJobData:l,loading:d||m,refreshData:N}}},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 a=document.createElement("div");switch(a.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":a.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":a.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":a.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:a.className+=" bg-blue-100 border-blue-500 text-blue-800"}return a.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(a),a.querySelector("button").addEventListener("click",()=>{r.removeChild(a)}),setTimeout(()=>{r.contains(a)&&r.removeChild(a)},s),a}s.d(t,{C:function(){return r}})},190:function(e,t,s){"use strict";s.r(t),s.d(t,{JobDetailPage:function(){return j}});var r=s(5893),a=s(7294),n=s(9470),l=s(7673),c=s(1664),i=s.n(c),o=s(1163),d=s(3266),u=s(6989),m=s(3626),x=s(8799),h=s(9307),f=s(3001),N=s(9008),g=s.n(N);function b(e){let{cluster:t,job:s,jobData:a,onRefresh:n,isRefreshing:l,loading:c}=e,o=(0,f.X)();return(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)(i(),{href:"/clusters",className:"text-sky-blue hover:underline",children:"Sky Clusters"}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsx)(i(),{href:"/clusters/".concat(t),className:"text-sky-blue hover:underline",children:t}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsxs)(i(),{href:"/clusters/".concat(t,"/").concat(s),className:"text-sky-blue hover:underline",children:[s,a.job&&"-"!=a.job?" (".concat(a.job,")"):""]})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(c||l)&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(x.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"text-sm ml-2 text-gray-500",children:"Loading..."})]}),(0,r.jsx)(u.WH,{content:"Refresh",className:"text-muted-foreground",children:(0,r.jsxs)("button",{onClick:n,disabled:c||l,className:"text-sm text-sky-blue hover:text-sky-blue-bright font-medium mx-2 flex items-center",children:[(0,r.jsx)(m.Z,{className:"w-4 h-4 mr-1.5"}),!o&&(0,r.jsx)("span",{children:"Refresh"})]})})]})]})}function j(){let e=(0,o.useRouter)(),{cluster:t,job:s}=e.query,{clusterData:c,clusterJobData:f,loading:N,refreshData:j}=(0,d.QL)({cluster:t}),[p,y]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!0),[E,_]=(0,a.useState)(!1),[C,k]=(0,a.useState)([]),[D,T]=(0,a.useState)(!1),R=(0,a.useMemo)(()=>["INIT","PENDING","SETTING_UP"],[]),S=(0,a.useMemo)(()=>{if(!f||!s)return!0;let e=f.find(e=>e.id==s);return e&&R.includes(e.status)},[f,s,R]);a.useEffect(()=>{!N&&v&&w(!1)},[N,v]),(0,a.useEffect)(()=>{let e=!0;return t&&s&&!S?(_(!0),(0,d.Sl)({clusterName:t,jobId:s,onNewLog:t=>{if(e){let e=(0,u.q8)(t);k(t=>[...t,e])}},workspace:null==c?void 0:c.workspace}).then(()=>{e&&_(!1)}).catch(t=>{e&&(console.error("Error streaming logs:",t),_(!1))})):_(!1),()=>{e=!1}},[t,s,D,S,c]);let I=async()=>{y(!0),T(e=>!e),k([]);try{j&&await j()}catch(e){console.error("Error refreshing data:",e)}finally{y(!1)}};if(!e.isReady)return(0,r.jsx)("div",{children:"Loading..."});let L={id:s};if(c&&f){let e=f.find(e=>e.id==s);e&&(L={...e,infra:c.infra,cluster:c.cluster,user:c.user})}let O=t&&s?"Job: ".concat(s," @ ").concat(t," | SkyPilot Dashboard"):"Job Details | SkyPilot Dashboard";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(g(),{children:(0,r.jsx)("title",{children:O})}),(0,r.jsxs)(n.A,{highlighted:"clusters",children:[(0,r.jsx)(b,{cluster:t,job:s,jobData:L,onRefresh:I,isRefreshing:p,loading:N}),N&&v?(0,r.jsxs)("div",{className:"flex items-center justify-center h-64",children:[(0,r.jsx)(x.Z,{size:24,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsx)("div",{id:"details",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)("h2",{className:"text-lg font-semibold",children:"Details"})}),(0,r.jsx)("div",{className:"p-4",children:(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"}),(0,r.jsx)("div",{className:"text-base mt-1",children:L.id})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job Name"}),(0,r.jsx)("div",{className:"text-base mt-1",children:L.job})]}),(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)(h.OE,{status:L.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:L.user})]}),L.resources&&(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:L.resources||"N/A"})]}),L.cluster&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cluster"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsx)(i(),{href:"/clusters/".concat(L.cluster),className:"text-sky-blue hover:underline",children:L.cluster})})]})]})})]})}),(0,r.jsx)("div",{id:"logs",className:"mt-6",children:(0,r.jsxs)(l.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)("h2",{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)(u.WH,{content:"Refresh logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>{T(e=>!e),k([])},disabled:E,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(m.Z,{className:"w-4 h-4 ".concat(E?"animate-spin":"")})})})]}),(0,r.jsx)("div",{className:"p-4",children:S?(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"})}):E?(0,r.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,r.jsx)(x.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",children:(0,r.jsx)(u.$B,{logs:C.join("")})})})]})})]})]})]})}t.default=j},9008:function(e,t,s){e.exports=s(7219)}},function(e){e.O(0,[173,470,888,774,179],function(){return e(e.s=4966)}),_N_E=e.O()}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[722],{8706:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters/[cluster]",function(){return t(6996)}])},6996:function(e,s,t){"use strict";t.r(s);var l=t(5893),i=t(7294),a=t(8799),r=t(8236),n=t(1163),c=t(9470),d=t(1664),x=t.n(d),m=t(9037),u=t(9307),h=t(7673),j=t(3266),o=t(3626),f=t(6989),N=t(9284),v=t(3001),b=t(9008),g=t.n(b);function y(e){let{clusterData:s,clusterJobData:t,loading:i}=e;return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"mb-6",children:(0,l.jsxs)(h.Zb,{children:[(0,l.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,l.jsx)("h3",{className:"text-lg font-semibold",children:"Details"})}),(0,l.jsx)("div",{className:"p-4",children:(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,l.jsx)("div",{className:"text-base mt-1",children:(0,l.jsx)(u.OE,{status:s.status})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cluster"}),(0,l.jsx)("div",{className:"text-base mt-1",children:s.cluster})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,l.jsx)("div",{className:"text-base mt-1",children:s.user})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Infra"}),(0,l.jsx)("div",{className:"text-base mt-1",children:s.infra?(0,l.jsx)(f.Md,{content:s.full_infra||s.infra,className:"text-sm text-muted-foreground",children:(0,l.jsxs)("span",{children:[(0,l.jsx)(x(),{href:"/infra",className:"text-blue-600 hover:underline",children:s.cloud||s.infra.split("(")[0].trim()}),s.infra.includes("(")&&(0,l.jsx)("span",{children:" "+s.infra.substring(s.infra.indexOf("("))})]})}):"N/A"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Resources"}),(0,l.jsx)("div",{className:"text-base mt-1",children:s.resources_str_full||s.resources_str||"N/A"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Started"}),(0,l.jsx)("div",{className:"text-base mt-1",children:s.time?new Date(s.time).toLocaleString():"N/A"})]})]})})]})}),(0,l.jsx)("div",{children:t&&(0,l.jsx)(r.L4,{clusterName:s.cluster,clusterJobData:t,loading:i})})]})}s.default=function(){let e=(0,n.useRouter)(),{cluster:s}=e.query,[t,r]=(0,i.useState)(!1),[d,u]=(0,i.useState)(!0),[h,b]=(0,i.useState)(!1),[p,_]=(0,i.useState)(!1),S=(0,v.X)(),{clusterData:k,clusterJobData:w,loading:C,refreshData:O}=(0,j.QL)({cluster:s});i.useEffect(()=>{!C&&d&&u(!1)},[C,d]);let D=async()=>{r(!0),await O(),r(!1)};if(!e.isReady)return(0,l.jsx)("div",{children:"Loading..."});let E=s?"Cluster: ".concat(s," | SkyPilot Dashboard"):"Cluster Details | SkyPilot Dashboard";return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(g(),{children:(0,l.jsx)("title",{children:E})}),(0,l.jsxs)(c.A,{highlighted:"clusters",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,l.jsxs)("div",{className:"text-base flex items-center",children:[(0,l.jsx)(x(),{href:"/clusters",className:"text-sky-blue hover:underline",children:"Sky Clusters"}),(0,l.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,l.jsx)(x(),{href:"/clusters/".concat(s),className:"text-sky-blue hover:underline",children:s})]}),(0,l.jsx)("div",{className:"text-sm flex items-center",children:(0,l.jsxs)("div",{className:"text-sm flex items-center",children:[(C||t)&&(0,l.jsxs)("div",{className:"flex items-center mr-4",children:[(0,l.jsx)(a.Z,{size:15,className:"mt-0"}),(0,l.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),k&&(0,l.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,l.jsx)(f.WH,{content:"Refresh",className:"text-sm text-muted-foreground",children:(0,l.jsxs)("button",{onClick:D,disabled:C||t,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,l.jsx)(o.Z,{className:"w-4 h-4 mr-1.5"}),!S&&(0,l.jsx)("span",{children:"Refresh"})]})}),(0,l.jsx)(m.GV,{withLabel:!0,cluster:k.cluster,status:k.status,onOpenSSHModal:()=>{b(!0)},onOpenVSCodeModal:()=>{_(!0)}})]})]})})]}),C&&d?(0,l.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,l.jsx)(a.Z,{size:24,className:"mr-2"}),(0,l.jsx)("span",{className:"text-gray-500",children:"Loading..."})]}):k?(0,l.jsx)(y,{clusterData:k,clusterJobData:w,loading:C||t}):null,(0,l.jsx)(N.Oh,{isOpen:h,onClose:()=>b(!1),cluster:s}),(0,l.jsx)(N._R,{isOpen:p,onClose:()=>_(!1),cluster:s})]})]})}}},function(e){e.O(0,[
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[722],{8706:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters/[cluster]",function(){return t(6996)}])},6996:function(e,s,t){"use strict";t.r(s);var l=t(5893),i=t(7294),a=t(8799),r=t(8236),n=t(1163),c=t(9470),d=t(1664),x=t.n(d),m=t(9037),u=t(9307),h=t(7673),j=t(3266),o=t(3626),f=t(6989),N=t(9284),v=t(3001),b=t(9008),g=t.n(b);function y(e){let{clusterData:s,clusterJobData:t,loading:i}=e;return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"mb-6",children:(0,l.jsxs)(h.Zb,{children:[(0,l.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,l.jsx)("h3",{className:"text-lg font-semibold",children:"Details"})}),(0,l.jsx)("div",{className:"p-4",children:(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,l.jsx)("div",{className:"text-base mt-1",children:(0,l.jsx)(u.OE,{status:s.status})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cluster"}),(0,l.jsx)("div",{className:"text-base mt-1",children:s.cluster})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,l.jsx)("div",{className:"text-base mt-1",children:s.user})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Infra"}),(0,l.jsx)("div",{className:"text-base mt-1",children:s.infra?(0,l.jsx)(f.Md,{content:s.full_infra||s.infra,className:"text-sm text-muted-foreground",children:(0,l.jsxs)("span",{children:[(0,l.jsx)(x(),{href:"/infra",className:"text-blue-600 hover:underline",children:s.cloud||s.infra.split("(")[0].trim()}),s.infra.includes("(")&&(0,l.jsx)("span",{children:" "+s.infra.substring(s.infra.indexOf("("))})]})}):"N/A"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Resources"}),(0,l.jsx)("div",{className:"text-base mt-1",children:s.resources_str_full||s.resources_str||"N/A"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Started"}),(0,l.jsx)("div",{className:"text-base mt-1",children:s.time?new Date(s.time).toLocaleString():"N/A"})]})]})})]})}),(0,l.jsx)("div",{children:t&&(0,l.jsx)(r.L4,{clusterName:s.cluster,clusterJobData:t,loading:i})})]})}s.default=function(){let e=(0,n.useRouter)(),{cluster:s}=e.query,[t,r]=(0,i.useState)(!1),[d,u]=(0,i.useState)(!0),[h,b]=(0,i.useState)(!1),[p,_]=(0,i.useState)(!1),S=(0,v.X)(),{clusterData:k,clusterJobData:w,loading:C,refreshData:O}=(0,j.QL)({cluster:s});i.useEffect(()=>{!C&&d&&u(!1)},[C,d]);let D=async()=>{r(!0),await O(),r(!1)};if(!e.isReady)return(0,l.jsx)("div",{children:"Loading..."});let E=s?"Cluster: ".concat(s," | SkyPilot Dashboard"):"Cluster Details | SkyPilot Dashboard";return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(g(),{children:(0,l.jsx)("title",{children:E})}),(0,l.jsxs)(c.A,{highlighted:"clusters",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,l.jsxs)("div",{className:"text-base flex items-center",children:[(0,l.jsx)(x(),{href:"/clusters",className:"text-sky-blue hover:underline",children:"Sky Clusters"}),(0,l.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,l.jsx)(x(),{href:"/clusters/".concat(s),className:"text-sky-blue hover:underline",children:s})]}),(0,l.jsx)("div",{className:"text-sm flex items-center",children:(0,l.jsxs)("div",{className:"text-sm flex items-center",children:[(C||t)&&(0,l.jsxs)("div",{className:"flex items-center mr-4",children:[(0,l.jsx)(a.Z,{size:15,className:"mt-0"}),(0,l.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),k&&(0,l.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,l.jsx)(f.WH,{content:"Refresh",className:"text-sm text-muted-foreground",children:(0,l.jsxs)("button",{onClick:D,disabled:C||t,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,l.jsx)(o.Z,{className:"w-4 h-4 mr-1.5"}),!S&&(0,l.jsx)("span",{children:"Refresh"})]})}),(0,l.jsx)(m.GV,{withLabel:!0,cluster:k.cluster,status:k.status,onOpenSSHModal:()=>{b(!0)},onOpenVSCodeModal:()=>{_(!0)}})]})]})})]}),C&&d?(0,l.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,l.jsx)(a.Z,{size:24,className:"mr-2"}),(0,l.jsx)("span",{className:"text-gray-500",children:"Loading..."})]}):k?(0,l.jsx)(y,{clusterData:k,clusterJobData:w,loading:C||t}):null,(0,l.jsx)(N.Oh,{isOpen:h,onClose:()=>b(!1),cluster:s}),(0,l.jsx)(N._R,{isOpen:p,onClose:()=>_(!1),cluster:s})]})]})}}},function(e){e.O(0,[173,121,470,293,856,973,236,578,888,774,179],function(){return e(e.s=8706)}),_N_E=e.O()}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{5833:function(n,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters",function(){return r(3450)}])},3450:function(n,t,r){"use strict";r.r(t),r.d(t,{default:function(){return i}});var u=r(5893);r(7294);var e=r(9008),s=r.n(e),c=r(9037);function i(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(s(),{children:(0,u.jsx)("title",{children:"Clusters | SkyPilot Dashboard"})}),(0,u.jsx)(c.Cc,{})]})}}},function(n){n.O(0,[
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{5833:function(n,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters",function(){return r(3450)}])},3450:function(n,t,r){"use strict";r.r(t),r.d(t,{default:function(){return i}});var u=r(5893);r(7294);var e=r(9008),s=r.n(e),c=r(9037);function i(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(s(),{children:(0,u.jsx)("title",{children:"Clusters | SkyPilot Dashboard"})}),(0,u.jsx)(c.Cc,{})]})}}},function(n){n.O(0,[173,121,470,293,856,973,578,888,774,179],function(){return n(n.s=5833)}),_N_E=n.O()}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[490],{4483:function(e,r,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/config",function(){return n(9649)}])},9333:function(e,r,n){"use strict";n.d(r,{Z:function(){return t}});/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let t=(0,n(998).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},1812:function(e,r,n){"use strict";n.d(r,{X:function(){return i}});var t=n(5893),s=n(7294);let l=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let r=e.message;return r.includes("failed:")&&(r=r.split("failed:")[1].trim()),r.charAt(0).toUpperCase()+r.slice(1)},i=e=>{let{error:r,title:n="Error",onDismiss:i}=e,[a,o]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{r&&o(!1)},[r]),!r||a)return null;let c="string"==typeof r?r:l(r);return(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsxs)("div",{className:"text-sm text-red-800",children:[(0,t.jsxs)("strong",{children:[n,":"]})," ",c]})})]}),(0,t.jsx)("button",{onClick:()=>{o(!0),i&&i()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,t.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},803:function(e,r,n){"use strict";n.d(r,{z:function(){return c}});var t=n(5893),s=n(7294),l=n(8426),i=n(2003),a=n(2350);let o=(0,i.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=s.forwardRef((e,r)=>{let{className:n,variant:s,size:i,asChild:c=!1,...d}=e,u=c?l.g7:"button";return(0,t.jsx)(u,{className:(0,a.cn)(o({variant:s,size:i,className:n})),ref:r,...d})});c.displayName="Button"},7673:function(e,r,n){"use strict";n.d(r,{Ol:function(){return c},Zb:function(){return o},aY:function(){return f},eW:function(){return m},ll:function(){return d}});var t=n(5893),s=n(7294),l=n(5697),i=n.n(l),a=n(2350);let o=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,a.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",n),...l,children:s})});o.displayName="Card",o.propTypes={className:i().string,children:i().node};let c=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,a.cn)("flex flex-col space-y-1.5 p-6",n),...l,children:s})});c.displayName="CardHeader",c.propTypes={className:i().string,children:i().node};let d=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("h3",{ref:r,className:(0,a.cn)("text-2xl font-semibold leading-none tracking-tight",n),...l,children:s})});d.displayName="CardTitle",d.propTypes={className:i().string,children:i().node};let u=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("p",{ref:r,className:(0,a.cn)("text-sm text-muted-foreground",n),...l,children:s})});u.displayName="CardDescription",u.propTypes={className:i().string,children:i().node};let f=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,a.cn)("p-6 pt-0",n),...l,children:s})});f.displayName="CardContent",f.propTypes={className:i().string,children:i().node};let m=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,a.cn)("flex items-center p-6 pt-0",n),...l,children:s})});m.displayName="CardFooter",m.propTypes={className:i().string,children:i().node}},9649:function(e,r,n){"use strict";n.r(r),n.d(r,{default:function(){return g}});var t=n(5893),s=n(7294),l=n(1163),i=n(9470);n(1664);var a=n(9008),o=n.n(a),c=n(803),d=n(7673),u=n(7324),f=n(1812),m=n(8799),x=n(9333),h=n(3320),p=n.n(h);function g(){let e=(0,l.useRouter)(),[r,n]=(0,s.useState)(""),[a,h]=(0,s.useState)(!0),[g,v]=(0,s.useState)(!1),[y,b]=(0,s.useState)(null),[j,N]=(0,s.useState)(!1);(0,s.useEffect)(()=>{w()},[]);let w=async()=>{h(!0),b(null);try{let e=await (0,u.iE)();0===Object.keys(e).length?n(""):n(p().dump(e,{indent:2}))}catch(e){console.error("Error loading config:",e),b(e)}finally{h(!1)}},k=async()=>{v(!0),b(null),N(!1);try{let e=p().load(r);if(null==e&&(e={}),"object"!=typeof e||Array.isArray(e)){let r="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.";Array.isArray(e),r="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.",b(Error(r)),v(!1);return}await (0,u.rF)(e),N(!0),setTimeout(()=>N(!1),3e3)}catch(e){console.error("Error saving config:",e),b(e)}finally{v(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o(),{children:(0,t.jsx)("title",{children:"Edit SkyPilot Configuration | SkyPilot Dashboard"})}),(0,t.jsxs)(i.A,{highlighted:"workspaces",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,t.jsx)("div",{className:"text-base flex items-center",children:(0,t.jsx)("span",{className:"text-sky-blue",children:"SkyPilot Configuration"})}),(0,t.jsx)("div",{className:"text-sm flex items-center",children:(a||g)&&(0,t.jsxs)("div",{className:"flex items-center mr-4",children:[(0,t.jsx)(m.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:g?"Applying...":"Loading..."})]})})]}),(0,t.jsxs)(d.Zb,{className:"w-full",children:[(0,t.jsx)(d.Ol,{children:(0,t.jsx)(d.ll,{className:"text-base font-normal flex items-center justify-between",children:(0,t.jsx)("span",{children:"Edit SkyPilot API Server Configuration"})})}),(0,t.jsxs)(d.aY,{className:"space-y-4",children:[(0,t.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Refer to the"," ",(0,t.jsx)("a",{href:"https://docs.skypilot.co/en/latest/reference/config.html",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:"SkyPilot Docs"})," ","for details. The configuration should be in YAML format."]}),j&&(0,t.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-6",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsx)("p",{className:"text-sm font-medium text-green-800",children:"Configuration saved successfully!"})})]})}),y&&(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(f.X,{error:y,title:"Failed to apply new configuration",onDismiss:()=>b(null)})}),(0,t.jsx)("div",{className:"w-full",children:(0,t.jsx)("textarea",{value:r,onChange:e=>n(e.target.value),className:"w-full h-96 p-3 border border-gray-300 rounded font-mono text-sm resize-vertical focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a?"Loading configuration...":"# Enter SkyPilot configuration in YAML format\n# Example:\n# kubernetes:\n# allowed_contexts: [default, my-context]",disabled:a||g})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-3 pt-3",children:[(0,t.jsx)(c.z,{variant:"outline",onClick:()=>{e.push("/workspaces")},disabled:g,children:"Cancel"}),(0,t.jsx)(c.z,{onClick:k,disabled:a||g,className:"inline-flex items-center bg-blue-600 hover:bg-blue-700 text-white",children:g?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.Z,{size:16,className:"mr-2"}),"Applying..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Z,{className:"w-4 h-4 mr-1.5"}),"Apply"]})})]})]})]})]})]})}},9008:function(e,r,n){e.exports=n(7219)},2003:function(e,r,n){"use strict";n.d(r,{j:function(){return i}});var t=n(512);let s=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=t.W,i=(e,r)=>n=>{var t;if((null==r?void 0:r.variants)==null)return l(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:i,defaultVariants:a}=r,o=Object.keys(i).map(e=>{let r=null==n?void 0:n[e],t=null==a?void 0:a[e];if(null===r)return null;let l=s(r)||s(t);return i[e][l]}),c=n&&Object.entries(n).reduce((e,r)=>{let[n,t]=r;return void 0===t||(e[n]=t),e},{});return l(e,o,null==r?void 0:null===(t=r.compoundVariants)||void 0===t?void 0:t.reduce((e,r)=>{let{class:n,className:t,...s}=r;return Object.entries(s).every(e=>{let[r,n]=e;return Array.isArray(n)?n.includes({...a,...c}[r]):({...a,...c})[r]===n})?[...e,n,t]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}}},function(e){e.O(0,[146,173,320,470,293,888,774,179],function(){return e(e.s=4483)}),_N_E=e.O()}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[588],{3177:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/infra",function(){return s(3822)}])},3626:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let a=(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"}]])},3822:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return S}});var a=s(5893),l=s(7294),r=s(8799),n=s(9470),d=s(3626),c=s(3001),i=s(2045),o=s(3266),x=s(8969),m=s(6378),u=s(6856),h=s(1214),g=s(1163),f=s(1664),p=s.n(f),j=s(6989);let N=h.nb.REFRESH_INTERVAL,b=h.MO.NAME_TRUNCATE_LENGTH;function y(e){let{title:t,isLoading:s,isDataLoaded:l,contexts:n,gpus:d,groupedPerContextGPUs:c,groupedPerNodeGPUs:i,handleContextClick:o,contextStats:x={},isSSH:m=!1}=e;return s&&!l?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:t}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(r.Z,{size:24,className:"mr-3"}),(0,a.jsxs)("span",{className:"text-gray-500",children:["Loading ",t,"..."]})]})]})}):l&&0===n.length?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:t}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["No ",t," found or ",t," is not configured."]})]})}):l&&n.length>0?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:t}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[n.length," ",1===n.length?m?"pool":"context":m?"pools":"contexts"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:m?"Node Pool":"Context"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Jobs"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Nodes"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"GPU Types"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"#GPUs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(n.length>5?"max-h-[250px] overflow-y-auto block":""),children:n.map(e=>{let t=c[e]||[],s=i[e]||[],l=t.reduce((e,t)=>e+(t.gpu_total||0),0),r=x[m?"ssh/".concat(e.replace(/^ssh-/,"")):"kubernetes/".concat(e)]||{clusters:0,jobs:0},n=Object.keys(t.reduce((e,t)=>(e[t.gpu_name]=(e[t.gpu_name]||0)+(t.gpu_total||0),e),{})).join(", "),d=m?e.replace(/^ssh-/,""):e;return(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3",children:(0,a.jsx)(j.Md,{content:d,className:"text-sm text-muted-foreground",children:(0,a.jsx)("span",{className:"text-blue-600 hover:underline cursor-pointer",onClick:()=>o(e),children:d.length>b?"".concat(d.substring(0,Math.floor((b-3)/2)),"...").concat(d.substring(d.length-Math.ceil((b-3)/2))):d})})}),(0,a.jsx)("td",{className:"p-3",children:r.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:r.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:r.jobs>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:r.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:s.length}),(0,a.jsx)("td",{className:"p-3",children:n||"-"}),(0,a.jsx)("td",{className:"p-3",children:l})]},e)})})]})})}),d.length>0&&(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4 whitespace-nowrap",children:["GPU",(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-green-100 text-green-800 rounded-full text-xs font-medium whitespace-nowrap",children:[d.reduce((e,t)=>e+t.gpu_free,0)," ","of"," ",d.reduce((e,t)=>e+t.gpu_total,0)," ","free"]})]}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"Requestable"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/2",children:(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsx)("span",{children:"Utilization"})})})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(d.length>5?"max-h-[250px] overflow-y-auto block":""),children:d.map(e=>{let t=e.gpu_total-e.gpu_free,s=e.gpu_total>0?e.gpu_free/e.gpu_total*100:0,l=e.gpu_total>0?t/e.gpu_total*100:0,r=c?Object.values(c).flat().filter(t=>t.gpu_name===e.gpu_name&&(m?t.context.startsWith("ssh-"):!t.context.startsWith("ssh-"))).map(e=>e.gpu_requestable_qty_per_node).filter((e,t,s)=>s.indexOf(e)===t).join(", "):"-";return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"p-3 font-medium w-24 whitespace-nowrap",children:e.gpu_name}),(0,a.jsxs)("td",{className:"p-3 text-xs text-gray-600",children:[r||"-"," / node"]}),(0,a.jsx)("td",{className:"p-3 w-2/3",children:(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsxs)("div",{className:"flex-1 bg-gray-100 rounded-md h-5 flex overflow-hidden shadow-sm min-w-[100px] w-full",children:[l>0&&(0,a.jsx)("div",{style:{width:"".concat(l,"%")},className:"bg-yellow-500 h-full flex items-center justify-center text-white text-xs font-medium",children:l>15&&"".concat(t," used")}),s>0&&(0,a.jsx)("div",{style:{width:"".concat(s,"%")},className:"bg-green-700 h-full flex items-center justify-center text-white text-xs font-medium",children:s>15&&"".concat(e.gpu_free," free")})]})})})]},e.gpu_name)})})]})})})]})]})}):null}function w(e){let{contextName:t,gpusInContext:s,nodesInContext:l}=e;return t.startsWith("ssh-"),(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm h-full",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4",children:"Available GPUs"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:s.map(e=>{let t=e.gpu_total-e.gpu_free,s=e.gpu_total>0?e.gpu_free/e.gpu_total*100:0,l=e.gpu_total>0?t/e.gpu_total*100:0;return(0,a.jsxs)("div",{className:"p-3 bg-gray-50 rounded-md border border-gray-200 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-1.5 flex-wrap",children:[(0,a.jsxs)("div",{className:"font-medium text-gray-800 text-sm",children:[e.gpu_name,(0,a.jsxs)("span",{className:"text-xs text-gray-500 ml-2",children:["(Requestable: ",e.gpu_requestable_qty_per_node," / node)"]})]}),(0,a.jsxs)("span",{className:"text-xs font-medium",children:[e.gpu_free," free / ",e.gpu_total," total"]})]}),(0,a.jsxs)("div",{className:"w-full bg-gray-100 rounded-md h-4 flex overflow-hidden shadow-sm",children:[l>0&&(0,a.jsx)("div",{style:{width:"".concat(l,"%")},className:"bg-yellow-500 h-full flex items-center justify-center text-white text-xs",children:l>15&&"".concat(t," used")}),s>0&&(0,a.jsx)("div",{style:{width:"".concat(s,"%")},className:"bg-green-700 h-full flex items-center justify-center text-white text-xs",children:s>15&&"".concat(e.gpu_free," free")})]})]},e.gpu_name)})}),l.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4",children:"Nodes"}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-100",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"Node"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"GPU"}),(0,a.jsx)("th",{className:"p-3 text-right font-medium text-gray-600",children:"Availability"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:l.map((e,t)=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.node_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.gpu_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-right text-gray-700",children:"".concat(e.gpu_free," of ").concat(e.gpu_total," free")})]},"".concat(e.node_name,"-").concat(t)))})]})})]})]})})})}function v(){let[e,t]=(0,l.useState)(!0),[s,h]=(0,l.useState)(!0),[f,j]=(0,l.useState)(!0),b=l.useRef(null),v=(0,c.X)(),[_,C]=(0,l.useState)(!1),[S,P]=(0,l.useState)(!1),k=(0,g.useRouter)(),[E,L]=(0,l.useState)([]),[U,I]=(0,l.useState)([]),[M,R]=(0,l.useState)([]),[q,G]=(0,l.useState)([]),[Z,W]=(0,l.useState)([]),[A,D]=(0,l.useState)(0),[T,z]=(0,l.useState)(0),[F,H]=(0,l.useState)({}),[O,J]=(0,l.useState)(null),X=l.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showLoadingIndicators:!0};e.showLoadingIndicators&&(t(!0),h(!0));try{let{gpuData:e,cloudData:t}=await m.ZP.get(i.l4),{allContextNames:s,allGPUs:a,perContextGPUs:l,perNodeGPUs:r,contextStats:n}=e;L(s||[]),I(a||[]),R(l||[]),G(r||[]),H(n||{}),C(!0),W((null==t?void 0:t.clouds)||[]),D((null==t?void 0:t.totalClouds)||0),z((null==t?void 0:t.enabledClouds)||0),P(!0)}catch(e){console.error("Error in fetchData:",e)}finally{t(!1),h(!1),f&&e.showLoadingIndicators&&j(!1)}},[f]);(0,l.useEffect)(()=>{b.current=X},[X]),(0,l.useEffect)(()=>{(async()=>{await u.ZP.preloadForPage("infra"),X({showLoadingIndicators:!0})})()},[]),(0,l.useEffect)(()=>{let e=!0,t=setInterval(()=>{e&&b.current&&b.current({showLoadingIndicators:!1})},N);return()=>{e=!1,clearInterval(t)}},[N]),U.length,U.reduce((e,t)=>e+t.gpu_total,0),U.reduce((e,t)=>e+t.gpu_free,0);let K=l.useMemo(()=>M?M.reduce((e,t)=>{let{context:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e},{}):{},[M]),V=l.useMemo(()=>E.filter(e=>e.startsWith("ssh-")),[E]),$=l.useMemo(()=>E.filter(e=>!e.startsWith("ssh-")),[E]),B=l.useMemo(()=>{if(!M)return[];let e=new Set;return M.forEach(t=>{t.context.startsWith("ssh-")&&e.add(t.gpu_name)}),U.filter(t=>e.has(t.gpu_name))},[U,M]),Q=l.useMemo(()=>{if(!M)return[];let e=new Set;return M.forEach(t=>{t.context.startsWith("ssh-")||e.add(t.gpu_name)}),U.filter(t=>e.has(t.gpu_name))},[U,M]),Y=l.useMemo(()=>q?q.reduce((e,t)=>{let{context:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e},{}):{},[q]);(0,l.useEffect)(()=>{k.query.context&&J(decodeURIComponent(Array.isArray(k.query.context)?k.query.context[0]:k.query.context))},[k.isReady,k.query]);let ee=e=>{J(e),k.replace({pathname:"/infra",query:e?{context:e}:void 0},e?"/infra/".concat(encodeURIComponent(e)):"/infra",{shallow:!0})},et=()=>{J(null),k.replace({pathname:"/infra"},"/infra",{shallow:!0})};(0,l.useEffect)(()=>{let e=e=>{let t=e.match(/\/infra\/([^\/]+)$/);t?J(decodeURIComponent(t[1])):"/infra"===e&&J(null)};return k.events.on("routeChangeComplete",e),()=>{k.events.off("routeChangeComplete",e)}},[k.events]);let es=e||s;return(0,a.jsxs)(n.A,{highlighted:"infra",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsxs)("div",{className:"text-base flex items-center",children:[(0,a.jsx)(p(),{href:"/infra",className:"text-sky-blue hover:underline ".concat(O?"":"cursor-default"),onClick:e=>{O&&(e.preventDefault(),et())},children:"Infrastructure"}),O&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),O.startsWith("ssh-")?(0,a.jsx)("span",{className:"text-sky-blue hover:underline cursor-pointer",onClick:e=>{e.preventDefault(),et()},children:"SSH Node Pool"}):(0,a.jsx)("span",{className:"text-sky-blue hover:underline cursor-pointer",onClick:e=>{e.preventDefault(),et()},children:"Kubernetes"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)("span",{className:"text-sky-blue",children:O.startsWith("ssh-")?O.replace(/^ssh-/,""):O})]})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[es&&(0,a.jsxs)("div",{className:"flex items-center mr-2",children:[(0,a.jsx)(r.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,a.jsxs)("button",{onClick:()=>{m.ZP.invalidate(o.getClusters),m.ZP.invalidate(x.getManagedJobs),m.ZP.invalidate(i.l4),b.current&&b.current({showLoadingIndicators:!0})},disabled:es,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,a.jsx)(d.Z,{className:"h-4 w-4 mr-1.5"}),!v&&"Refresh"]})]})]}),O?e&&!_?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]}):(t=>{let s=K[t]||[],l=Y[t]||[];return e&&!_?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]}):(0,a.jsx)(w,{contextName:t,gpusInContext:s,nodesInContext:l})})(O):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y,{title:"SSH Node Pool",isLoading:e,isDataLoaded:_,contexts:V,gpus:B,groupedPerContextGPUs:K,groupedPerNodeGPUs:Y,handleContextClick:ee,contextStats:F,isSSH:!0}),(0,a.jsx)(y,{title:"Kubernetes",isLoading:e,isDataLoaded:_,contexts:$,gpus:Q,groupedPerContextGPUs:K,groupedPerNodeGPUs:Y,handleContextClick:ee,contextStats:F,isSSH:!1}),s&&!S?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:"Cloud"}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(r.Z,{size:24,className:"mr-3"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading Cloud..."})]})]})}):(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Cloud"}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[T," of ",A," enabled"]})]}),0===Z.length?(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"No enabled clouds available."}):(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-32",children:"Cloud"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Jobs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:Z.map(e=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 font-medium text-gray-700",children:e.name}),(0,a.jsx)("td",{className:"p-3",children:e.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:e.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:e.jobs>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:e.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})})]},e.name))})]})})]})})]})]})}var _=s(9008),C=s.n(_);function S(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(C(),{children:(0,a.jsx)("title",{children:"Infra | SkyPilot Dashboard"})}),(0,a.jsx)(v,{})]})}},9008:function(e,t,s){e.exports=s(7219)}},function(e){e.O(0,[173,470,293,856,888,774,179],function(){return e(e.s=3177)}),_N_E=e.O()}]);
|