skypilot-nightly 1.0.0.dev20250625__py3-none-any.whl → 1.0.0.dev20250627__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 +1 -6
- sky/admin_policy.py +27 -17
- sky/client/cli/command.py +10 -5
- sky/client/sdk.py +91 -15
- sky/clouds/ssh.py +36 -0
- sky/core.py +20 -0
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/HudU4f4Xsy-cP51JvXSZ-/_buildManifest.js +1 -0
- sky/dashboard/out/_next/static/chunks/141-fa5a20cbf401b351.js +11 -0
- sky/dashboard/out/_next/static/chunks/25.76c246239df93d50.js +6 -0
- sky/dashboard/out/_next/static/chunks/43-36177d00f6956ab2.js +1 -0
- sky/dashboard/out/_next/static/chunks/430.ed51037d1a4a438b.js +1 -0
- sky/dashboard/out/_next/static/chunks/690.55f9eed3be903f56.js +16 -0
- sky/dashboard/out/_next/static/chunks/785.dc2686c3c1235554.js +1 -0
- sky/dashboard/out/_next/static/chunks/871-3db673be3ee3750b.js +6 -0
- sky/dashboard/out/_next/static/chunks/875.52c962183328b3f2.js +25 -0
- sky/dashboard/out/_next/static/chunks/973-81b2d057178adb76.js +1 -0
- sky/dashboard/out/_next/static/chunks/982.1b61658204416b0f.js +1 -0
- sky/dashboard/out/_next/static/chunks/984.e8bac186a24e5178.js +1 -0
- sky/dashboard/out/_next/static/chunks/990-0ad5ea1699e03ee8.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/{[cluster]-32ce4f49f2261f55.js → [cluster]-8040f2483897ed0c.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters-f119a5630a1efd61.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/config-6b255eae088da6a3.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/infra/[context]-b302aea4d65766bf.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/infra-ee8cc4d449945d19.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/{jobs-26da173e20af16e4.js → jobs-0a5695ff3075d94a.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/{users-ce29e7420385563d.js → users-4978cbb093e141e7.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/workspace/new-5b59bce9eb208d84.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-cb7e720b739de53a.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/{workspaces-862b120406461b10.js → workspaces-50e230828730cfb3.js} +1 -1
- sky/dashboard/out/_next/static/chunks/webpack-08fdb9e6070127fc.js +1 -0
- sky/dashboard/out/_next/static/css/52082cf558ec9705.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/[context].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/volumes.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/provision/kubernetes/utils.py +18 -2
- sky/server/rest.py +3 -2
- sky/server/server.py +4 -27
- sky/skylet/constants.py +5 -0
- sky/skypilot_config.py +3 -0
- sky/ssh_node_pools/__init__.py +1 -0
- sky/ssh_node_pools/core.py +133 -0
- sky/ssh_node_pools/server.py +232 -0
- sky/utils/kubernetes/deploy_remote_cluster.py +12 -185
- sky/utils/kubernetes/ssh_utils.py +221 -0
- {skypilot_nightly-1.0.0.dev20250625.dist-info → skypilot_nightly-1.0.0.dev20250627.dist-info}/METADATA +1 -1
- {skypilot_nightly-1.0.0.dev20250625.dist-info → skypilot_nightly-1.0.0.dev20250627.dist-info}/RECORD +65 -60
- sky/dashboard/out/_next/static/ZWdSYkqVe3WjnFR8ocqoG/_buildManifest.js +0 -1
- sky/dashboard/out/_next/static/chunks/211.692afc57e812ae1a.js +0 -1
- sky/dashboard/out/_next/static/chunks/310.2671028c20e892c7.js +0 -16
- sky/dashboard/out/_next/static/chunks/37-1f1e94f5a561202a.js +0 -6
- sky/dashboard/out/_next/static/chunks/42.bc85e5b1a4debf22.js +0 -6
- sky/dashboard/out/_next/static/chunks/443.b2242d0efcdf5f47.js +0 -1
- sky/dashboard/out/_next/static/chunks/513.309df9e18a9ff005.js +0 -1
- sky/dashboard/out/_next/static/chunks/66-66ae330df2d3c1c7.js +0 -1
- sky/dashboard/out/_next/static/chunks/682.00e56a220dd26fe1.js +0 -6
- sky/dashboard/out/_next/static/chunks/843-07d25a7e64462fd8.js +0 -11
- sky/dashboard/out/_next/static/chunks/856-cdf66268ec878d0c.js +0 -1
- sky/dashboard/out/_next/static/chunks/973-5b5019ba333e8d62.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters-4aa031d1f42723d8.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/config-3102d02a188f04b3.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/infra/[context]-6f1e02e31eecb5ce.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/infra-fd5dc8a91bd9169a.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspace/new-09ae0f6f972aa871.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-0b4c662a25e4747a.js +0 -1
- sky/dashboard/out/_next/static/chunks/webpack-6133dc1e928bd0b5.js +0 -1
- sky/dashboard/out/_next/static/css/b23cb0257bf96c51.css +0 -3
- /sky/dashboard/out/_next/static/{ZWdSYkqVe3WjnFR8ocqoG → HudU4f4Xsy-cP51JvXSZ-}/_ssgManifest.js +0 -0
- /sky/dashboard/out/_next/static/chunks/pages/{_app-0ef7418d1a3822f3.js → _app-9a3ce3170d2edcec.js} +0 -0
- {skypilot_nightly-1.0.0.dev20250625.dist-info → skypilot_nightly-1.0.0.dev20250627.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250625.dist-info → skypilot_nightly-1.0.0.dev20250627.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250625.dist-info → skypilot_nightly-1.0.0.dev20250627.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250625.dist-info → skypilot_nightly-1.0.0.dev20250627.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[785,430],{2557:function(e,s,t){"use strict";t.d(s,{I:function(){return l}});var r=t(5893),a=t(7294),n=t(2350);let l=a.forwardRef((e,s)=>{let{className:t,type:a,...l}=e;return(0,r.jsx)("input",{type:a,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",t),ref:s,...l})});l.displayName="Input"},6185:function(e,s,t){"use strict";t.d(s,{_:function(){return c}});var r=t(5893),a=t(7294),n=t(9102),l=t(2003),i=t(2350);let o=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)(n.f,{ref:s,className:(0,i.cn)(o(),t),...a})});c.displayName=n.f.displayName},3785:function(e,s,t){"use strict";t.r(s),t.d(s,{NewWorkspace:function(){return b}});var r=t(5893),a=t(7294),n=t(1163),l=t(1664),i=t.n(l),o=t(5152),c=t.n(o),u=t(7324),d=t(803),f=t(2557),m=t(6185),p=t(7673);let x=c()(()=>Promise.all([t.e(616),t.e(799),t.e(804),t.e(798),t.e(947),t.e(989),t.e(470),t.e(969),t.e(43),t.e(973),t.e(938),t.e(141)]).then(t.bind(t,1141)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[1141]},ssr:!1});function b(){(0,n.useRouter)();let[e,s]=(0,a.useState)(""),[t,l]=(0,a.useState)(!1),[o,c]=(0,a.useState)({}),[b,h]=(0,a.useState)(!0);(0,a.useEffect)(()=>{v()},[]);let v=async()=>{try{let e=await (0,u.fX)();c(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{h(!1)}},w=()=>{e.trim()&&!k&&l(!0)},k=e.trim()&&o.hasOwnProperty(e.trim()),y=e.trim()&&!k;return t?(0,r.jsx)(x,{workspaceName:e,isNewWorkspace:!0}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("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:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,r.jsxs)(p.Zb,{className:"max-w-md",children:[(0,r.jsx)(p.Ol,{children:(0,r.jsx)(p.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,r.jsxs)(p.aY,{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(m._,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,r.jsx)(f.I,{id:"workspace-name",value:e,onChange:e=>s(e.target.value),placeholder:"Enter workspace name",autoFocus:!0,onKeyPress:e=>{"Enter"===e.key&&y&&w()}}),k?(0,r.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,r.jsx)(i(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,r.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,r.jsx)(d.z,{onClick:w,disabled:!y||b,className:"w-full bg-blue-600 hover:bg-blue-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:b?"Loading...":"Next: Configure Workspace"})]})]})]})}},1163:function(e,s,t){e.exports=t(6036)},9102:function(e,s,t){"use strict";t.d(s,{f:function(){return i}});var r=t(7294),a=t(5320),n=t(5893),l=r.forwardRef((e,s)=>(0,n.jsx)(a.WV.label,{...e,ref:s,onMouseDown:s=>{s.target.closest("button, input, select, textarea")||(e.onMouseDown?.(s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));l.displayName="Label";var i=l},2003:function(e,s,t){"use strict";t.d(s,{j:function(){return l}});var r=t(512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=r.W,l=(e,s)=>t=>{var r;if((null==s?void 0:s.variants)==null)return n(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:l,defaultVariants:i}=s,o=Object.keys(l).map(e=>{let s=null==t?void 0:t[e],r=null==i?void 0:i[e];if(null===s)return null;let n=a(s)||a(r);return l[e][n]}),c=t&&Object.entries(t).reduce((e,s)=>{let[t,r]=s;return void 0===r||(e[t]=r),e},{});return n(e,o,null==s?void 0:null===(r=s.compoundVariants)||void 0===r?void 0:r.reduce((e,s)=>{let{class:t,className:r,...a}=s;return Object.entries(a).every(e=>{let[s,t]=e;return Array.isArray(t)?t.includes({...i,...c}[s]):({...i,...c})[s]===t})?[...e,t,r]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[871,430],{9037:function(e,s,t){"use strict";t.r(s),t.d(s,{ClusterTable:function(){return E},Clusters:function(){return R},Status2Actions:function(){return F},enabledActions:function(){return V},filterClustersByName:function(){return L},handleVSCodeConnection:function(){return O}});var r=t(5893),l=t(7294),a=t(1163),n=t(8799),i=t(6989),c=t(1664),o=t.n(c),d=t(803),u=t(7673),h=t(8764),m=t(3266),x=t(7324),p=t(3081),f=t(4545),j=t(3626),y=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,y.Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),v=(0,y.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"}]]);t(9470);var g=t(9284),k=t(9307),b=t(3001),N=t(8950),C=t(6378),S=t(6856);t(1272);let _="__ALL_WORKSPACES__",A="__ALL_USERS__";function L(e,s){if(!s||""===s.trim())return e;let t=s.toLowerCase().trim();return e.filter(e=>(e.cluster||"").toLowerCase().includes(t))}let M=(e,s)=>{let t="",r="";return e>=0&&(t=e+"m",r=" "),s&&(t+="".concat(r,"(down)")),""===t&&(t="-"),t},q=(e,s)=>{if(e&&e.includes("@")){let t=e.split("@")[0];return s&&s!==t?"".concat(t," (").concat(s,")"):t}let t=e||s||"N/A";return s&&s!==t?"".concat(t," (").concat(s,")"):t},I=e=>{if(!e||0===e)return"-";let s=e=Math.floor(e),t="",r=0;for(let e of[{value:31536e3,label:"y"},{value:2592e3,label:"mo"},{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(s>=e.value&&r<2){let l=Math.floor(s/e.value);t+="".concat(l).concat(e.label," "),s%=e.value,r++}return t.trim()||"0s"};function R(){var e;let s=(0,a.useRouter)(),[t,c]=(0,l.useState)(!1),d=l.useRef(null),[u,h]=(0,l.useState)(!1),[f,y]=(0,l.useState)(!1),[w,v]=(0,l.useState)(null),[k,L]=(0,l.useState)(_),[M,I]=(0,l.useState)(A),[R,O]=(0,l.useState)(""),[H,V]=(0,l.useState)([]),[W,F]=(0,l.useState)([]),[z,Z]=(0,l.useState)(!1),B=(0,b.X)();(0,l.useEffect)(()=>{s.isReady&&(s.query.workspace&&L(Array.isArray(s.query.workspace)?s.query.workspace[0]:s.query.workspace),s.query.user&&I(Array.isArray(s.query.user)?s.query.user[0]:s.query.user),s.query.name&&O(Array.isArray(s.query.name)?s.query.name[0]:s.query.name))},[s.isReady,s.query.workspace,s.query.user,s.query.name]);let P=(e,t,r)=>{let l={...s.query};e&&e!==_?l.workspace=e:delete l.workspace,t&&t!==A?l.user=t:delete l.user,r&&""!==r.trim()?l.name=r.trim():delete l.name,s.replace({pathname:s.pathname,query:l},void 0,{shallow:!0})},U=e=>{O(e),P(k,M,e)};return(0,l.useEffect)(()=>{(async()=>{try{await S.ZP.preloadForPage("clusters");let e=await C.default.get(x.fX),s=Object.keys(e),t=await C.default.get(m.getClusters),r=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],l=new Set(s);r.includes("default")&&l.has("default"),r.forEach(e=>l.add(e)),V(Array.from(l).sort());let a=await C.default.get(p.R),n=[...new Set(t.map(e=>({userId:e.user_hash||e.user,username:e.user})).filter(e=>e.userId)).values()],i=new Map;a.forEach(e=>{i.set(e.userId,{userId:e.userId,username:e.username,display:q(e.username,e.userId)})}),n.forEach(e=>{i.has(e.userId)||i.set(e.userId,{userId:e.userId,username:e.username,display:q(e.username,e.userId)})}),F(Array.from(i.values()).sort((e,s)=>e.display.localeCompare(s.display)))}catch(e){console.error("Error fetching data for filters:",e),V(["default"]),F([])}})()},[]),(0,r.jsxs)(r.Fragment,{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.jsx)("div",{className:"flex items-center ml-6 space-x-3",children:(0,r.jsxs)("label",{className:"flex items-center cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:z,onChange:e=>Z(e.target.checked),className:"sr-only"}),(0,r.jsx)("div",{className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors ".concat(z?"bg-sky-600":"bg-gray-300"),children:(0,r.jsx)("span",{className:"inline-block h-3 w-3 transform rounded-full bg-white transition-transform ".concat(z?"translate-x-5":"translate-x-1")})}),(0,r.jsx)("span",{className:"ml-2 text-sm text-gray-700",children:"Show history (Last 30 days)"})]})}),(0,r.jsxs)("div",{className:"relative ml-4 mr-2",children:[(0,r.jsx)("input",{type:"text",placeholder:"Filter by cluster name",value:R,onChange:e=>U(e.target.value),className:"h-8 w-32 sm:w-48 px-3 pr-8 text-sm border border-gray-300 rounded-md focus:ring-1 focus:ring-sky-500 focus:border-sky-500 outline-none"}),R&&(0,r.jsx)("button",{onClick:()=>U(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear filter",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsxs)(N.Ph,{value:k,onValueChange:e=>{L(e),P(e,M,R)},children:[(0,r.jsx)(N.i4,{className:"h-8 w-48 ml-2 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,r.jsx)(N.ki,{placeholder:"Filter by workspace...",children:k===_?"All Workspaces":k})}),(0,r.jsxs)(N.Bw,{children:[(0,r.jsx)(N.Ql,{value:_,children:"All Workspaces"}),H.map(e=>(0,r.jsx)(N.Ql,{value:e,children:e},e))]})]}),(0,r.jsxs)(N.Ph,{value:M,onValueChange:e=>{I(e),P(k,e,R)},children:[(0,r.jsx)(N.i4,{className:"h-8 w-48 ml-2 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,r.jsx)(N.ki,{placeholder:"Filter by user...",children:M===A?"All Users":(null===(e=W.find(e=>e.userId===M))||void 0===e?void 0:e.display)||M})}),(0,r.jsxs)(N.Bw,{children:[(0,r.jsx)(N.Ql,{value:A,children:"All Users"}),W.map(e=>(0,r.jsx)(N.Ql,{value:e.userId,children:e.display},e.userId))]})]})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[t&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(n.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,r.jsxs)("button",{onClick:()=>{C.default.invalidate(m.getClusters),C.default.invalidate(m.uR),C.default.invalidate(x.fX),C.default.invalidate(p.R),d.current&&d.current()},disabled:t,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(j.Z,{className:"h-4 w-4 mr-1.5"}),!B&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsx)(E,{refreshInterval:i.yc,setLoading:c,refreshDataRef:d,workspaceFilter:k,userFilter:M,nameFilter:R,showHistory:z,onOpenSSHModal:e=>{v(e),h(!0)},onOpenVSCodeModal:e=>{v(e),y(!0)}}),(0,r.jsx)(g.Oh,{isOpen:u,onClose:()=>h(!1),cluster:w}),(0,r.jsx)(g._R,{isOpen:f,onClose:()=>y(!1),cluster:w})]})}function E(e){let{refreshInterval:s,setLoading:t,refreshDataRef:a,workspaceFilter:c,userFilter:x,nameFilter:p,showHistory:j,onOpenSSHModal:y,onOpenVSCodeModal:w}=e,[v,g]=(0,l.useState)([]),[b,N]=(0,l.useState)({key:null,direction:"ascending"}),[S,q]=(0,l.useState)(!1),[R,E]=(0,l.useState)(!0),[O,H]=(0,l.useState)(1),[V,W]=(0,l.useState)(10),z=l.useCallback(async()=>{t(!0),q(!0);try{let e=await C.default.get(m.getClusters);if(j){let s=await C.default.get(m.uR),t=e.map(e=>({...e,isHistorical:!1})),r=s.map(e=>({...e,isHistorical:!0})),l=[...t];r.forEach(s=>{e.some(e=>(e.cluster||e.name)===(s.cluster||s.name))||l.push(s)}),g(l)}else{let s=e.map(e=>({...e,isHistorical:!1}));g(s)}}catch(e){console.error("Error fetching cluster data:",e),g([])}t(!1),q(!1),E(!1)},[t,j]),Z=l.useMemo(()=>{let e=v;return c&&c!==_&&(e=e.filter(e=>(e.workspace||"default").toLowerCase()===c.toLowerCase())),x&&x!==A&&(e=e.filter(e=>(e.user_hash||e.user)===x)),p&&(e=L(e,p)),(0,f.R0)(e,b.key,b.direction)},[v,b,c,x,p]);l.useEffect(()=>{a&&(a.current=z)},[a,z]),(0,l.useEffect)(()=>{g([]);let e=!0;z();let t=setInterval(()=>{e&&z()},s);return()=>{e=!1,clearInterval(t)}},[s,z]),(0,l.useEffect)(()=>{H(1)},[v.length]);let B=e=>{let s="ascending";b.key===e&&"ascending"===b.direction&&(s="descending"),N({key:e,direction:s})},P=e=>b.key===e?"ascending"===b.direction?" ↑":" ↓":"",U=Math.ceil(Z.length/V),Q=(O-1)*V,X=Q+V,D=Z.slice(Q,X);return(0,r.jsxs)("div",{children:[(0,r.jsx)(u.Zb,{children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)(h.iA,{className:"min-w-full",children:[(0,r.jsx)(h.xD,{children:(0,r.jsxs)(h.SC,{children:[(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>B("status"),children:["Status",P("status")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>B("cluster"),children:["Cluster",P("cluster")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden sm:table-cell",onClick:()=>B("user"),children:["User",P("user")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden md:table-cell",onClick:()=>B("workspace"),children:["Workspace",P("workspace")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden lg:table-cell",onClick:()=>B("infra"),children:["Infra",P("infra")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden xl:table-cell",onClick:()=>B("resources_str"),children:["Resources",P("resources_str")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>B("time"),children:["Started",P("time")]}),j&&(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden lg:table-cell",onClick:()=>B("duration"),children:["Duration",P("duration")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap hidden md:table-cell",onClick:()=>B("autostop"),children:["Autostop",P("autostop")]}),(0,r.jsx)(h.ss,{className:"sticky right-0 bg-white",children:"Actions"})]})}),(0,r.jsx)(h.RM,{children:S&&R?(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(n.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):D.length>0?D.map((e,s)=>(0,r.jsxs)(h.SC,{children:[(0,r.jsx)(h.pj,{children:(0,r.jsx)(k.OE,{status:e.status})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(o(),{href:"/clusters/".concat(e.isHistorical?e.cluster_hash:e.cluster||e.name),className:"text-blue-600",children:e.cluster||e.name})}),(0,r.jsx)(h.pj,{className:"hidden sm:table-cell",children:e.user}),(0,r.jsx)(h.pj,{className:"hidden md:table-cell",children:(0,r.jsx)(o(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,r.jsx)(h.pj,{className:"hidden lg:table-cell",children:(0,r.jsx)(i.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)(h.pj,{className:"hidden xl:table-cell",children:(0,r.jsx)(i.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)(h.pj,{children:(0,r.jsx)(i.Zg,{date:e.time})}),j&&(0,r.jsx)(h.pj,{className:"hidden lg:table-cell",children:I(e.duration)}),(0,r.jsx)(h.pj,{className:"hidden md:table-cell",children:e.isHistorical?"-":M(e.autostop,e.to_down)}),(0,r.jsx)(h.pj,{className:"text-left sticky right-0 bg-white",children:!e.isHistorical&&(0,r.jsx)(F,{cluster:e.cluster,status:e.status,onOpenSSHModal:y,onOpenVSCodeModal:w})})]},s)):(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:j?"No clusters found":"No active clusters"})})})]})})}),v.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:V,onChange:e=>{W(parseInt(e.target.value,10)),H(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:[Q+1," – ",Math.min(X,v.length)," of"," ",v.length]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(d.z,{variant:"ghost",size:"icon",onClick:()=>{H(e=>Math.max(e-1,1))},disabled:1===O,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:()=>{H(e=>Math.min(e+1,U))},disabled:O===U||0===U,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)},H=(e,s)=>{s?s(e):window.open("ssh://".concat(e))},V=e=>"RUNNING"===e?["connect","VSCode"]:[],W={connect:(0,r.jsx)(w,{className:"w-4 h-4 text-gray-500 inline-block"}),VSCode:(0,r.jsx)(v,{className:"w-4 h-4 text-gray-500 inline-block"})};function F(e){let{withLabel:s=!1,cluster:t,status:l,onOpenSSHModal:a,onOpenVSCodeModal:n}=e,c=V(l),o=(0,b.X)(),d=e=>{switch(e){case"connect":H(t,a);break;case"VSCode":O(t,n);break;default:return}};return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"flex items-center space-x-4",children:Object.entries(W).map(e=>{let t,l,[a,n]=e;switch(a){case"connect":t="Connect",l="Connect with SSH";break;case"VSCode":t="VSCode",l="Open in VS Code"}return(s||(t=""),c.includes(a))?(0,r.jsx)(i.WH,{content:l,className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:()=>d(a),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[n,!o&&(0,r.jsx)("span",{className:"ml-1.5",children:t})]})},a):(0,r.jsx)(i.WH,{content:l,className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("span",{className:"opacity-30 flex items-center cursor-not-allowed text-sm",title:a,children:[n,!o&&(0,r.jsx)("span",{className:"ml-1.5",children:t})]})},a)})})})}},1163:function(e,s,t){e.exports=t(6036)},2003:function(e,s,t){"use strict";t.d(s,{j:function(){return n}});var r=t(512);let l=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=r.W,n=(e,s)=>t=>{var r;if((null==s?void 0:s.variants)==null)return a(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:n,defaultVariants:i}=s,c=Object.keys(n).map(e=>{let s=null==t?void 0:t[e],r=null==i?void 0:i[e];if(null===s)return null;let a=l(s)||l(r);return n[e][a]}),o=t&&Object.entries(t).reduce((e,s)=>{let[t,r]=s;return void 0===r||(e[t]=r),e},{});return a(e,c,null==s?void 0:null===(r=s.compoundVariants)||void 0===r?void 0:r.reduce((e,s)=>{let{class:t,className:r,...l}=s;return Object.entries(l).every(e=>{let[s,t]=e;return Array.isArray(t)?t.includes({...i,...o}[s]):({...i,...o})[s]===t})?[...e,t,r]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
|
@@ -0,0 +1,25 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[875,430],{6409:function(e,t,n){"use strict";n.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,n(998).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},3626:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});/**
|
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 r=(0,n(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"}]])},8418:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});/**
|
12
|
+
* @license lucide-react v0.407.0 - ISC
|
13
|
+
*
|
14
|
+
* This source code is licensed under the ISC license.
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
16
|
+
*/let r=(0,n(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"}]])},3767:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});/**
|
17
|
+
* @license lucide-react v0.407.0 - ISC
|
18
|
+
*
|
19
|
+
* This source code is licensed under the ISC license.
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
21
|
+
*/let r=(0,n(998).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},1163:function(e,t,n){e.exports=n(6036)},6327:function(e,t,n){"use strict";n.d(t,{x8:function(){return el},VY:function(){return eo},dk:function(){return ea},aV:function(){return er},h_:function(){return en},fC:function(){return ee},Dx:function(){return ei},xz:function(){return et}});var r=n(7294),o=n(6206),i=n(8771),a=n(5360),l=n(1276),u=n(7342),s=n(6063),c=n(5420),d=n(2651),f=n(9981),p=e=>{let t,n;let{present:o,children:a}=e,l=function(e){var t,n;let[o,i]=r.useState(),a=r.useRef(null),l=r.useRef(e),u=r.useRef("none"),[s,c]=(t=e?"mounted":"unmounted",n={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},r.useReducer((e,t)=>n[e][t]??e,t));return r.useEffect(()=>{let e=m(a.current);u.current="mounted"===s?e:"none"},[s]),(0,f.b)(()=>{let t=a.current,n=l.current;if(n!==e){let r=u.current,o=m(t);e?c("MOUNT"):"none"===o||t?.display==="none"?c("UNMOUNT"):n&&r!==o?c("ANIMATION_OUT"):c("UNMOUNT"),l.current=e}},[e,c]),(0,f.b)(()=>{if(o){let e;let t=o.ownerDocument.defaultView??window,n=n=>{let r=m(a.current).includes(n.animationName);if(n.target===o&&r&&(c("ANIMATION_END"),!l.current)){let n=o.style.animationFillMode;o.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===o.style.animationFillMode&&(o.style.animationFillMode=n)})}},r=e=>{e.target===o&&(u.current=m(a.current))};return o.addEventListener("animationstart",r),o.addEventListener("animationcancel",n),o.addEventListener("animationend",n),()=>{t.clearTimeout(e),o.removeEventListener("animationstart",r),o.removeEventListener("animationcancel",n),o.removeEventListener("animationend",n)}}c("ANIMATION_END")},[o,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:r.useCallback(e=>{a.current=e?getComputedStyle(e):null,i(e)},[])}}(o),u="function"==typeof a?a({present:l.isPresent}):r.Children.only(a),s=(0,i.e)(l.ref,(t=Object.getOwnPropertyDescriptor(u.props,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning?u.ref:(t=Object.getOwnPropertyDescriptor(u,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning?u.props.ref:u.props.ref||u.ref);return"function"==typeof a||l.isPresent?r.cloneElement(u,{ref:s}):null};function m(e){return e?.animationName||"none"}p.displayName="Presence";var g=n(5320),v=n(7552),y=n(6223),N=n(3541),h=n(8426),D=n(5893),b="Dialog",[M,O]=(0,a.b)(b),[R,w]=M(b),j=e=>{let{__scopeDialog:t,children:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=e,c=r.useRef(null),d=r.useRef(null),[f,p]=(0,u.T)({prop:o,defaultProp:i??!1,onChange:a,caller:b});return(0,D.jsx)(R,{scope:t,triggerRef:c,contentRef:d,contentId:(0,l.M)(),titleId:(0,l.M)(),descriptionId:(0,l.M)(),open:f,onOpenChange:p,onOpenToggle:r.useCallback(()=>p(e=>!e),[p]),modal:s,children:n})};j.displayName=b;var x="DialogTrigger",I=r.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=w(x,n),l=(0,i.e)(t,a.triggerRef);return(0,D.jsx)(g.WV.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":z(a.open),...r,ref:l,onClick:(0,o.M)(e.onClick,a.onOpenToggle)})});I.displayName=x;var C="DialogPortal",[E,k]=M(C,{forceMount:void 0}),T=e=>{let{__scopeDialog:t,forceMount:n,children:o,container:i}=e,a=w(C,t);return(0,D.jsx)(E,{scope:t,forceMount:n,children:r.Children.map(o,e=>(0,D.jsx)(p,{present:n||a.open,children:(0,D.jsx)(d.h,{asChild:!0,container:i,children:e})}))})};T.displayName=C;var _="DialogOverlay",A=r.forwardRef((e,t)=>{let n=k(_,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=w(_,e.__scopeDialog);return i.modal?(0,D.jsx)(p,{present:r||i.open,children:(0,D.jsx)(P,{...o,ref:t})}):null});A.displayName=_;var F=(0,h.Z8)("DialogOverlay.RemoveScroll"),P=r.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,o=w(_,n);return(0,D.jsx)(y.Z,{as:F,allowPinchZoom:!0,shards:[o.contentRef],children:(0,D.jsx)(g.WV.div,{"data-state":z(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),W="DialogContent",V=r.forwardRef((e,t)=>{let n=k(W,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=w(W,e.__scopeDialog);return(0,D.jsx)(p,{present:r||i.open,children:i.modal?(0,D.jsx)(U,{...o,ref:t}):(0,D.jsx)(Z,{...o,ref:t})})});V.displayName=W;var U=r.forwardRef((e,t)=>{let n=w(W,e.__scopeDialog),a=r.useRef(null),l=(0,i.e)(t,n.contentRef,a);return r.useEffect(()=>{let e=a.current;if(e)return(0,N.Ry)(e)},[]),(0,D.jsx)(L,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,o.M)(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:(0,o.M)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:(0,o.M)(e.onFocusOutside,e=>e.preventDefault())})}),Z=r.forwardRef((e,t)=>{let n=w(W,e.__scopeDialog),o=r.useRef(!1),i=r.useRef(!1);return(0,D.jsx)(L,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||n.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"!==t.detail.originalEvent.type||(i.current=!0));let r=t.target;n.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),L=r.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:l,...u}=e,d=w(W,n),f=r.useRef(null),p=(0,i.e)(t,f);return(0,v.EW)(),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c.M,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:a,onUnmountAutoFocus:l,children:(0,D.jsx)(s.XB,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":z(d.open),...u,ref:p,onDismiss:()=>d.onOpenChange(!1)})}),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(J,{titleId:d.titleId}),(0,D.jsx)(Q,{contentRef:f,descriptionId:d.descriptionId})]})]})}),S="DialogTitle",$=r.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,o=w(S,n);return(0,D.jsx)(g.WV.h2,{id:o.titleId,...r,ref:t})});$.displayName=S;var B="DialogDescription",q=r.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,o=w(B,n);return(0,D.jsx)(g.WV.p,{id:o.descriptionId,...r,ref:t})});q.displayName=B;var H="DialogClose",X=r.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(H,n);return(0,D.jsx)(g.WV.button,{type:"button",...r,ref:t,onClick:(0,o.M)(e.onClick,()=>i.onOpenChange(!1))})});function z(e){return e?"open":"closed"}X.displayName=H;var K="DialogTitleWarning",[Y,G]=(0,a.k)(K,{contentName:W,titleName:S,docsSlug:"dialog"}),J=({titleId:e})=>{let t=G(K),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
22
|
+
|
23
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
24
|
+
|
25
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return r.useEffect(()=>{e&&!document.getElementById(e)&&console.error(n)},[n,e]),null},Q=({contentRef:e,descriptionId:t})=>{let n=G("DialogDescriptionWarning"),o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${n.contentName}}.`;return r.useEffect(()=>{let n=e.current?.getAttribute("aria-describedby");t&&n&&!document.getElementById(t)&&console.warn(o)},[o,e,t]),null},ee=j,et=I,en=T,er=A,eo=V,ei=$,ea=q,el=X},9102:function(e,t,n){"use strict";n.d(t,{f:function(){return l}});var r=n(7294),o=n(5320),i=n(5893),a=r.forwardRef((e,t)=>(0,i.jsx)(o.WV.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));a.displayName="Label";var l=a},2003:function(e,t,n){"use strict";n.d(t,{j:function(){return a}});var r=n(512);let o=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=r.W,a=(e,t)=>n=>{var r;if((null==t?void 0:t.variants)==null)return i(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:a,defaultVariants:l}=t,u=Object.keys(a).map(e=>{let t=null==n?void 0:n[e],r=null==l?void 0:l[e];if(null===t)return null;let i=o(t)||o(r);return a[e][i]}),s=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{});return i(e,u,null==t?void 0:null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...o}=t;return Object.entries(o).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...l,...s}[t]):({...l,...s})[t]===n})?[...e,n,r]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[973],{9307:function(e,s,t){t.d(s,{Cl:function(){return l},OE:function(){return d}});var r=t(5893);t(7294);var n=t(8799),a=t(6989),c=t(3850);let l=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"RUNNING":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"TERMINATED":default:return"bg-gray-100 text-gray-800";case"PENDING":case"CANCELLED":case"CANCELLING":return"bg-yellow-50 text-yellow-700";case"SUCCEEDED":return"bg-blue-50 text-blue-700";case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":return"bg-red-50 text-red-700";case"RECOVERING":return"bg-orange-50 text-orange-700";case"SUBMITTED":return"bg-indigo-50 text-indigo-700";case"STARTING":return"bg-cyan-50 text-cyan-700";case"FAILED_SETUP":return"bg-pink-50 text-pink-700"}},i=e=>{switch(e){case"LAUNCHING":case"STARTING":return(0,r.jsx)(n.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":default:return(0,r.jsx)(c.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,r.jsx)(c.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,r.jsx)(c.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,r.jsx)(c.Ye,{className:"w-3 h-3 mr-1"});case"PENDING":case"RECOVERING":case"SUBMITTED":case"CANCELLING":case"FAILED_SETUP":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":return(0,r.jsx)(c.J$,{className:"w-3 h-3 mr-1"})}},o=e=>{let s=l(e),t=i(e);return(0,r.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(s),children:[t,e]})},d=e=>{let{status:s}=e;return(0,r.jsx)(a.WH,{content:s,className:"text-muted-foreground text-sm",children:(0,r.jsx)("span",{children:o(s)})})}},9284:function(e,s,t){t.d(s,{Oh:function(){return u},_R:function(){return x},cV:function(){return h}});var r=t(5893),n=t(7294),a=t(326),c=t(803),l=t(7673),i=t(8671),o=t(6989),d=t(3225),m=t(3001);function u(e){let{isOpen:s,onClose:t,cluster:d}=e,[m,u]=n.useState(!1),x=e=>{navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)},h=["sky status ".concat(d),"ssh ".concat(d)],f=h.join("\n");return(0,r.jsx)(a.Vq,{open:s,onOpenChange:t,children:(0,r.jsxs)(a.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(a.fK,{children:[(0,r.jsxs)(a.$N,{children:["Connect to: ",(0,r.jsx)("span",{className:"font-light",children:d})]}),(0,r.jsx)(a.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)(l.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:h.map((e,s)=>(0,r.jsx)("code",{className:"block",children:e},s))}),(0,r.jsx)(o.WH,{content:m?"Copied!":"Copy command",children:(0,r.jsx)(c.z,{variant:"ghost",size:"icon",onClick:()=>x(f),className:"h-8 w-8 rounded-full",children:(0,r.jsx)(i.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 x(e){let{isOpen:s,onClose:t,cluster:n}=e,u=(0,m.X)();return(0,r.jsx)(a.Vq,{open:s,onOpenChange:t,children:(0,r.jsx)(a.cZ,{className:"sm:max-w-3xl",children:(0,r.jsxs)(a.fK,{children:[(0,r.jsxs)(a.$N,{children:["Connect to: ",(0,r.jsx)("span",{className:"font-light",children:n})]}),(0,r.jsx)(a.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)(l.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 ",n]})}),(0,r.jsx)(o.WH,{content:"Copy command",children:(0,r.jsx)(c.z,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText("sky status ".concat(n)),className:"h-8 w-8 rounded-full",children:(0,r.jsx)(i.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)(l.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+",n]})}),(0,r.jsx)(o.WH,{content:"Copy command",children:(0,r.jsx)(c.z,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText("code --remote ssh-remote+".concat(n)),className:"h-8 w-8 rounded-full",children:(0,r.jsx)(i.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(u?"-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 h(e){let{isOpen:s,onClose:t,onConfirm:n,title:l,message:i,confirmText:o="Confirm",confirmVariant:d="destructive",confirmClassName:m=null}=e;return(0,r.jsx)(a.Vq,{open:s,onOpenChange:t,children:(0,r.jsxs)(a.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(a.fK,{children:[(0,r.jsx)(a.$N,{children:l}),(0,r.jsx)(a.Be,{children:i})]}),(0,r.jsxs)(a.cN,{className:"flex justify-end gap-2 pt-4",children:[(0,r.jsx)(c.z,{variant:"outline",onClick:t,children:"Cancel"}),(0,r.jsx)(c.z,{variant:m?void 0:d,className:m,onClick:()=>{n(),t()},children:o})]})]})})}},8764:function(e,s,t){t.d(s,{RM:function(){return i},SC:function(){return o},iA:function(){return c},pj:function(){return m},ss:function(){return d},xD:function(){return l}});var r=t(5893),n=t(7294),a=t(2350);let c=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:s,className:(0,a.cn)("w-full caption-bottom text-base",t),...n})})});c.displayName="Table";let l=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,r.jsx)("thead",{ref:s,className:(0,a.cn)("[&_tr]:border-b",t),...n})});l.displayName="TableHeader";let i=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,r.jsx)("tbody",{ref:s,className:(0,a.cn)("[&_tr:last-child]:border-0",t),...n})});i.displayName="TableBody",n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,r.jsx)("tfoot",{ref:s,className:(0,a.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...n})}).displayName="TableFooter";let o=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,r.jsx)("tr",{ref:s,className:(0,a.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...n})});o.displayName="TableRow";let d=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,r.jsx)("th",{ref:s,className:(0,a.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",t),...n})});d.displayName="TableHead";let m=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,r.jsx)("td",{ref:s,className:(0,a.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...n})});m.displayName="TableCell",n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,r.jsx)("caption",{ref:s,className:(0,a.cn)("mt-4 text-base text-muted-foreground",t),...n})}).displayName="TableCaption"},4545:function(e,s,t){function r(e){return e.startsWith("sky-jobs-controller-")}function n(e,s,t){return null===s?e:[...e].sort((e,r)=>e[s]<r[s]?"ascending"===t?-1:1:e[s]>r[s]?"ascending"===t?1:-1:0)}t.d(s,{R0:function(){return n},Ym:function(){return r}})}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[982,430],{1812:function(e,s,t){"use strict";t.d(s,{X:function(){return a}});var l=t(5893),r=t(7294);let n=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},a=e=>{let{error:s,title:t="Error",onDismiss:a}=e,[i,c]=(0,r.useState)(!1);if((0,r.useEffect)(()=>{s&&c(!1)},[s]),!s||i)return null;let o="string"==typeof s?s:n(s);return(0,l.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,l.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,l.jsx)("div",{className:"ml-3",children:(0,l.jsxs)("div",{className:"text-sm text-red-800",children:[(0,l.jsxs)("strong",{children:[t,":"]})," ",o]})})]}),(0,l.jsx)("button",{onClick:()=>{c(!0),a&&a()},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,l.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,l.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"})})})]})})}},5443:function(e,s,t){"use strict";t.r(s),t.d(s,{Workspaces:function(){return z}});var l=t(5893),r=t(7294),n=t(1163),a=t(3266),i=t(8969),c=t(7324),o=t(7673),d=t(803),u=t(8799),m=t(1272),x=t(326),h=t(3850),p=t(1812),f=t(3626),j=t(3001),g=t(938),N=t(6378),v=t(1214),b=t(6856),w=t(7145);let k=e=>{let{isPrivate:s}=e;return s?(0,l.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-amber-100 text-amber-800 border border-amber-300",children:"Private"}):(0,l.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800 border border-green-300",children:"Public"})},y=e=>{let{workspace:s,onDelete:t,onEdit:r,router:n,rawWorkspacesData:a,checkPermissionAndAct:i,roleLoading:c}=e,m=!0===((null==a?void 0:a[s.name])||{}).private;return(0,l.jsxs)(o.Zb,{children:[(0,l.jsx)(o.Ol,{children:(0,l.jsx)(o.ll,{className:"text-base font-normal",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold",children:"Workspace:"})," ",s.name]}),(0,l.jsx)(k,{isPrivate:m})]})})}),(0,l.jsxs)(o.aY,{className:"text-sm pb-2",children:[(0,l.jsxs)("div",{className:"py-2 flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,l.jsx)(h.QT,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,l.jsx)("span",{children:"Clusters (Running / Total)"})]}),(0,l.jsxs)("button",{onClick:()=>{n.push({pathname:"/clusters",query:{workspace:s.name}})},className:"font-normal text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",children:[s.runningClusterCount," / ",s.totalClusterCount]})]}),(0,l.jsxs)("div",{className:"py-2 flex items-center justify-between border-t border-gray-100",children:[(0,l.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,l.jsx)(h.Vp,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,l.jsx)("span",{children:"Managed Jobs"})]}),(0,l.jsx)("button",{onClick:()=>{n.push({pathname:"/jobs",query:{workspace:s.name}})},className:"font-normal text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",children:s.managedJobsCount})]})]}),(0,l.jsxs)("div",{className:"px-6 pb-3 text-sm pt-3",children:[(0,l.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Enabled Infra"}),(0,l.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:s.clouds.map(e=>(0,l.jsxs)("div",{className:"flex items-center text-gray-700",children:[(0,l.jsx)(h.Ye,{className:"w-3.5 h-3.5 mr-1.5 text-green-500"}),(0,l.jsx)("span",{children:e})]},e))})]}),(0,l.jsxs)(o.eW,{className:"flex justify-end pt-3 gap-2",children:[(0,l.jsx)(d.z,{variant:"outline",size:"sm",onClick:()=>t(s.name),disabled:"default"===s.name||c,title:"default"===s.name?"Cannot delete default workspace":"Delete workspace",className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:c?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(u.Z,{size:12,className:"mr-1"}),(0,l.jsx)("span",{children:"Delete"})]}):"Delete"}),(0,l.jsx)(d.z,{variant:"outline",size:"sm",onClick:()=>{i("cannot edit workspace",()=>{r(s.name)})},disabled:c,children:c?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(u.Z,{size:12,className:"mr-1"}),(0,l.jsx)("span",{children:"Edit"})]}):"Edit"})]})]},s.name)},C=e=>{let{onClick:s,checkPermissionAndAct:t,roleLoading:r}=e;return(0,l.jsx)(o.Zb,{className:"border-2 border-dashed border-sky-300 hover:border-sky-400 cursor-pointer transition-colors flex flex-col",onClick:()=>{t("cannot create workspace",s)},children:(0,l.jsx)("div",{className:"flex-1 flex items-center justify-center p-6",children:(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("div",{className:"w-16 h-16 rounded-full bg-sky-100 flex items-center justify-center mb-4 mx-auto",children:(0,l.jsx)("span",{className:"text-3xl text-sky-600",children:"+"})}),(0,l.jsx)("h3",{className:"text-lg font-medium text-sky-700 mb-2",children:"Create New Workspace"}),(0,l.jsx)("p",{className:"text-sm text-gray-500",children:"Set up a new workspace with custom infrastructure configurations"})]})})},"create-new")},E=e=>{let{workspaceCount:s,runningClusters:t,totalClusters:r,managedJobs:n,router:a}=e;return(0,l.jsx)("div",{className:"bg-sky-50 p-4 rounded-lg shadow mb-6",children:(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row justify-around items-center",children:[(0,l.jsx)("div",{className:"p-2",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(h.E9,{className:"w-5 h-5 mr-2 text-sky-600"}),(0,l.jsx)("span",{className:"text-sm text-gray-600",children:"Workspaces:"}),(0,l.jsx)("span",{className:"ml-1 text-xl font-semibold text-sky-700",children:s})]})}),(0,l.jsx)("div",{className:"p-2",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(h.QT,{className:"w-5 h-5 mr-2 text-sky-600"}),(0,l.jsx)("span",{className:"text-sm text-gray-600",children:"Clusters (Running / Total):"}),(0,l.jsxs)("button",{onClick:()=>a.push("/clusters"),className:"ml-1 text-xl font-semibold text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",children:[t," / ",r]})]})}),(0,l.jsx)("div",{className:"p-2",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(h.Vp,{className:"w-5 h-5 mr-2 text-sky-600"}),(0,l.jsx)("span",{className:"text-sm text-gray-600",children:"Managed Jobs:"}),(0,l.jsx)("button",{onClick:()=>a.push("/jobs"),className:"ml-1 text-xl font-semibold text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",children:n})]})})]})})},D=v.nb.REFRESH_INTERVAL;function z(){let[e,s]=(0,r.useState)([]),[t,o]=(0,r.useState)({runningClusters:0,totalClusters:0,managedJobs:0}),[h,v]=(0,r.useState)(!0),[k,z]=(0,r.useState)(null),[O,S]=(0,r.useState)(!1),[A,L]=(0,r.useState)({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),[R,Z]=(0,r.useState)({open:!1,message:"",userName:""}),[J,T]=(0,r.useState)(null),[P,W]=(0,r.useState)(!1),F=(0,n.useRouter)(),M=(0,j.X)(),V=async()=>{if(J&&Date.now()-J.timestamp<3e5)return J;W(!0);try{let e=await w.x.get("/users/role");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to get user role")}let s=await e.json(),t={role:s.role,name:s.name,timestamp:Date.now()};return T(t),W(!1),t}catch(e){throw W(!1),e}},X=async(e,s)=>{try{let t=await V();if("admin"!==t.role)return Z({open:!0,message:e,userName:t.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),Z({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},_=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&v(!0);try{let[e,t,l]=await Promise.all([N.default.get(c.fX),N.default.get(a.getClusters),N.default.get(i.getManagedJobs,[{allUsers:!0}])]);z(e);let r=Object.keys(e),n=await Promise.all(r.map(e=>N.default.get(c.yz,[e]))),d=Object.fromEntries(r.map((e,s)=>[e,n[s]])),u=Object.fromEntries(t.map(e=>[e.cluster,e.workspace||"default"])),m={};r.forEach(e=>{m[e]={name:e,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}});let x=0;t.forEach(e=>{let s=e.workspace||"default";m[s]||(m[s]={name:s,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}),m[s].totalClusterCount++,("RUNNING"===e.status||"LAUNCHING"===e.status)&&(m[s].runningClusterCount++,x++),e.cloud&&m[s].clouds.add(e.cloud)});let h=l.jobs||[],p=new Set(g.statusGroups.active),f=0;h.forEach(e=>{let s=e.cluster_name||e.resources&&e.resources.cluster_name;if(s){let t=u[s];t&&m[t]&&p.has(e.status)&&m[t].managedJobsCount++}p.has(e.status)&&f++});let j=Object.values(m).filter(e=>r.includes(e.name)).map(e=>({...e,clouds:Array.isArray(d[e.name])?d[e.name]:[]})).sort((e,s)=>e.name.localeCompare(s.name));s(j),o({runningClusters:x,totalClusters:t.length,managedJobs:f})}catch(e){console.error("Error fetching workspace data:",e),s([]),o({runningClusters:0,totalClusters:0,managedJobs:0})}e&&v(!1)};(0,r.useEffect)(()=>{(async()=>{await b.ZP.preloadForPage("workspaces"),_(!0)})();let e=setInterval(()=>{_(!1)},D);return()=>clearInterval(e)},[]);let I=e=>{X("cannot delete workspace",()=>{L({confirmOpen:!0,workspaceToDelete:e,deleting:!1,error:null})})},q=async()=>{if(A.workspaceToDelete){L(e=>({...e,deleting:!0,error:null}));try{await (0,c.zl)(A.workspaceToDelete),L({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),N.default.invalidate(c.fX),await _(!0)}catch(e){console.error("Error deleting workspace:",e),L(s=>({...s,deleting:!1,error:e}))}}},B=()=>{L({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null})};return h&&0===e.length?(0,l.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,l.jsx)(u.Z,{}),(0,l.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading workspaces..."})]}):(0,l.jsxs)("div",{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)("span",{className:"text-sky-blue leading-none",children:"Workspaces"}),(0,l.jsx)(d.z,{variant:"outline",size:"sm",onClick:()=>{X("cannot edit config",()=>{F.push("/config")})},className:"ml-4 px-2 py-1 text-xs",disabled:h||P||!k||0===Object.keys(k).length,children:P?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(u.Z,{size:12,className:"mr-1"}),(0,l.jsx)("span",{children:"Edit All Configs"})]}):"Edit All Configs"})]}),(0,l.jsxs)("div",{className:"flex items-center",children:[h&&(0,l.jsxs)("div",{className:"flex items-center mr-2",children:[(0,l.jsx)(u.Z,{size:15,className:"mt-0"}),(0,l.jsx)("span",{className:"ml-2 text-gray-500 text-xs",children:"Refreshing..."})]}),(0,l.jsxs)("button",{onClick:()=>{N.default.invalidate(c.fX),N.default.invalidate(a.getClusters),N.default.invalidate(i.getManagedJobs,[{allUsers:!0}]),N.default.invalidateFunction(c.yz),_(!0)},disabled:h,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,l.jsx)(f.Z,{className:"h-4 w-4 mr-1.5"}),!M&&(0,l.jsx)("span",{children:"Refresh"})]})]})]}),(0,l.jsx)(E,{workspaceCount:e.length,runningClusters:t.runningClusters,totalClusters:t.totalClusters,managedJobs:t.managedJobs,router:F}),0!==e.length||h?(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[e.map(e=>(0,l.jsx)(y,{workspace:e,onDelete:I,onEdit:e=>F.push("/workspaces/".concat(e)),router:F,rawWorkspacesData:k,checkPermissionAndAct:X,roleLoading:P},e.name)),(0,l.jsx)(C,{onClick:()=>F.push("/workspace/new"),checkPermissionAndAct:X,roleLoading:P})]}):(0,l.jsxs)("div",{className:"text-center py-10",children:[(0,l.jsx)("p",{className:"text-lg text-gray-600",children:"No workspaces found."}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Create a cluster to see its workspace here."})]}),k&&(0,l.jsx)(x.Vq,{open:O,onOpenChange:S,children:(0,l.jsxs)(x.cZ,{className:"sm:max-w-md md:max-w-lg lg:max-w-xl xl:max-w-2xl w-full max-h-[90vh] flex flex-col",children:[(0,l.jsx)(x.fK,{children:(0,l.jsx)(x.$N,{className:"pr-10",children:"All Workspaces Configuration"})}),(0,l.jsx)("div",{className:"flex-grow overflow-y-auto py-4",children:(0,l.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",overflowX:"auto",whiteSpace:"pre",wordBreak:"normal"},children:m.ZP.dump(k,{indent:2})})})]})}),(0,l.jsx)(x.Vq,{open:R.open,onOpenChange:e=>Z(s=>({...s,open:e})),children:(0,l.jsxs)(x.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,l.jsxs)(x.fK,{children:[(0,l.jsx)(x.$N,{children:"Permission Denied"}),(0,l.jsx)(x.Be,{children:P?(0,l.jsxs)("div",{className:"flex items-center py-2",children:[(0,l.jsx)(u.Z,{size:16,className:"mr-2"}),(0,l.jsx)("span",{children:"Checking permissions..."})]}):(0,l.jsx)(l.Fragment,{children:R.userName?(0,l.jsxs)(l.Fragment,{children:[R.userName," is logged in as non-admin and ",R.message,"."]}):R.message})})]}),(0,l.jsx)(x.cN,{children:(0,l.jsx)(d.z,{variant:"outline",onClick:()=>Z(e=>({...e,open:!1})),disabled:P,children:"OK"})})]})}),(0,l.jsx)(x.Vq,{open:A.confirmOpen,onOpenChange:B,children:(0,l.jsxs)(x.cZ,{className:"sm:max-w-md",children:[(0,l.jsxs)(x.fK,{children:[(0,l.jsx)(x.$N,{children:"Delete Workspace"}),(0,l.jsxs)(x.Be,{children:['Are you sure you want to delete workspace "',A.workspaceToDelete,'"? This action cannot be undone.']})]}),(0,l.jsx)(p.X,{error:A.error,title:"Deletion Failed",onDismiss:()=>L(e=>({...e,error:null}))}),(0,l.jsxs)(x.cN,{children:[(0,l.jsx)(d.z,{variant:"outline",onClick:B,disabled:A.deleting,children:"Cancel"}),(0,l.jsx)(d.z,{variant:"destructive",onClick:q,disabled:A.deleting,children:A.deleting?"Deleting...":"Delete"})]})]})})]})}},1163:function(e,s,t){e.exports=t(6036)},2003:function(e,s,t){"use strict";t.d(s,{j:function(){return a}});var l=t(512);let r=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=l.W,a=(e,s)=>t=>{var l;if((null==s?void 0:s.variants)==null)return n(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:a,defaultVariants:i}=s,c=Object.keys(a).map(e=>{let s=null==t?void 0:t[e],l=null==i?void 0:i[e];if(null===s)return null;let n=r(s)||r(l);return a[e][n]}),o=t&&Object.entries(t).reduce((e,s)=>{let[t,l]=s;return void 0===l||(e[t]=l),e},{});return n(e,c,null==s?void 0:null===(l=s.compoundVariants)||void 0===l?void 0:l.reduce((e,s)=>{let{class:t,className:l,...r}=s;return Object.entries(r).every(e=>{let[s,t]=e;return Array.isArray(t)?t.includes({...i,...o}[s]):({...i,...o})[s]===t})?[...e,t,l]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[984],{9984:function(e,t,s){s.r(t),s.d(t,{ContextDetails:function(){return L},GPUs:function(){return Z},InfrastructureSection:function(){return G}});var a=s(5893),l=s(7294),r=s(8799);s(9470);var o=s(6409),n=s(8418),c=s(3626),i=s(3001),d=s(7853),m=s(2045),u=s(3266),h=s(8969),x=s(3225),p=s(5821);async function g(){try{let e=await fetch("".concat(x.f4,"/ssh_node_pools"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}catch(e){return console.error("Error fetching SSH Node Pools:",e),{}}}async function f(e){try{let t=await fetch("".concat(x.f4,"/ssh_node_pools"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error updating SSH Node Pools:",e),e}}async function y(e){try{let t=await fetch("".concat(x.f4,"/ssh_node_pools/").concat(e),{method:"DELETE",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error deleting SSH Node Pool:",e),e}}async function j(e,t){try{let s=new FormData;s.append("key_name",e),s.append("key_file",t);let a=await fetch("".concat(x.f4,"/ssh_node_pools/keys"),{method:"POST",body:s});if(!a.ok)throw Error("HTTP error! status: ".concat(a.status));return await a.json()}catch(e){throw console.error("Error uploading SSH key:",e),e}}async function N(e){try{let t=await fetch("".concat(x.f4,"/ssh_node_pools/").concat(e,"/deploy"),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error deploying SSH Node Pool:",e),e}}async function b(e){try{let t=await fetch("".concat(x.f4,"/ssh_node_pools/").concat(e,"/down"),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error tearing down SSH Node Pool:",e),e}}async function w(e){try{let t=await fetch("".concat(x.f4,"/ssh_node_pools/").concat(e,"/status"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error fetching SSH Node Pool status:",e),e}}async function v(e){let t,{requestId:s,signal:a,onNewLog:l}=e,r=Date.now(),o=new Promise(e=>{let s=()=>{let a=Date.now()-r;a>=3e5?e({timeout:!0}):t=setTimeout(s,3e5-a)};t=setTimeout(s,3e5)}),n=(async()=>{try{let e=await fetch("".concat(x.f4,"/api/stream?request_id=").concat(s,"&format=plain&tail=").concat(1e3,"&follow=true"),{method:"GET",headers:{"Content-Type":"application/json"},...a?{signal:a}:{}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));let o=e.body.getReader();try{for(;;){let{done:e,value:t}=await o.read();if(e)break;r=Date.now();let s=new TextDecoder().decode(t);l(s)}}finally{o.cancel(),t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),c=await Promise.race([n,o]);if(t&&clearTimeout(t),c.timeout){(0,p.C)("SSH deployment log stream timed out after ".concat(300,"s of inactivity"),"warning");return}}async function S(e){let t,{requestId:s,signal:a,onNewLog:l,operationType:r="operation"}=e,o=Date.now(),n=new Promise(e=>{let s=()=>{let a=Date.now()-o;a>=3e5?e({timeout:!0}):t=setTimeout(s,3e5-a)};t=setTimeout(s,3e5)}),c=(async()=>{try{let e=await fetch("".concat(x.f4,"/api/stream?request_id=").concat(s,"&format=plain&tail=").concat(1e3,"&follow=true"),{method:"GET",headers:{"Content-Type":"application/json"},...a?{signal:a}:{}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));let r=e.body.getReader();try{for(;;){let{done:e,value:t}=await r.read();if(e)break;o=Date.now();let s=new TextDecoder().decode(t);l(s)}}finally{r.cancel(),t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),i=await Promise.race([c,n]);if(t&&clearTimeout(t),i.timeout){(0,p.C)("SSH ".concat(r," log stream timed out after ").concat(300,"s of inactivity"),"warning");return}}var _=s(326),C=s(803),P=s(2557),k=s(6185),T=s(9123);function E(e){let{isOpen:t,onClose:s,onSave:o,poolData:n=null,isLoading:c=!1}=e,[i,d]=(0,l.useState)(""),[m,u]=(0,l.useState)(""),[h,x]=(0,l.useState)("ubuntu"),[p,g]=(0,l.useState)(null),[f,y]=(0,l.useState)(""),[N,b]=(0,l.useState)({}),w=null!==n;(0,l.useEffect)(()=>{if(w&&n){var e,t,s;d(n.name||""),u(((null===(e=n.config)||void 0===e?void 0:e.hosts)||[]).join("\n")),x((null===(t=n.config)||void 0===t?void 0:t.user)||"ubuntu"),y((null===(s=n.config)||void 0===s?void 0:s.password)||"")}else d(""),u(""),x("ubuntu"),g(null),y("");b({})},[w,n]);let v=()=>{let e={};return i.trim()||(e.poolName="Pool name is required"),m.trim()||(e.hosts="At least one host is required"),h.trim()||(e.sshUser="SSH user is required"),p||f||(e.auth="Either SSH key file or password is required"),b(e),0===Object.keys(e).length},S=async()=>{if(!v())return;let e={hosts:m.split("\n").map(e=>e.trim()).filter(e=>e.length>0),user:h};try{if(p){let t=p.name;await j(t,p),e.identity_file="~/.sky/ssh_keys/".concat(t)}f&&(e.password=f),o(i,e)}catch(e){console.error("Failed to upload SSH key:",e),b({...N,keyUpload:"Failed to upload SSH key"})}},E=()=>{c||s()};return(0,a.jsx)(_.Vq,{open:t,onOpenChange:E,children:(0,a.jsxs)(_.cZ,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,a.jsx)(_.fK,{children:(0,a.jsx)(_.$N,{children:w?"Edit SSH Node Pool: ".concat(null==n?void 0:n.name):"Add SSH Node Pool"})}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(k._,{htmlFor:"poolName",children:"Pool Name"}),(0,a.jsx)(P.I,{id:"poolName",placeholder:"my-ssh-cluster",value:i,onChange:e=>d(e.target.value),disabled:w,className:"placeholder:text-gray-500 ".concat(N.poolName?"border-red-500":"")}),N.poolName&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:N.poolName})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(k._,{htmlFor:"hosts",children:"Hosts (one per line)"}),(0,a.jsx)(T.g,{id:"hosts",placeholder:"192.168.1.10\n192.168.1.11\nhostname.example.com",value:m,onChange:e=>u(e.target.value),rows:6,className:"placeholder:text-gray-500 ".concat(N.hosts?"border-red-500":"")}),N.hosts&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:N.hosts})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(k._,{htmlFor:"sshUser",children:"SSH User"}),(0,a.jsx)(P.I,{id:"sshUser",placeholder:"ubuntu",value:h,onChange:e=>x(e.target.value),className:"placeholder:text-gray-500 ".concat(N.sshUser?"border-red-500":"")}),N.sshUser&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:N.sshUser})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(k._,{htmlFor:"keyFile",children:"SSH Private Key File"}),(0,a.jsx)(P.I,{id:"keyFile",type:"file",accept:".pem,.key,id_rsa,id_ed25519",onChange:e=>{var t;return g((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)},className:"border-0 bg-transparent p-0 shadow-none focus:ring-0 file:mr-2 file:text-sm file:py-1 file:px-3 file:border file:border-gray-300 file:rounded file:bg-gray-50 hover:file:bg-gray-100 file:cursor-pointer"}),N.keyUpload&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:N.keyUpload})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(k._,{htmlFor:"password",children:"Password (optional, if sudo requires a password)"}),(0,a.jsx)(P.I,{id:"password",type:"password",placeholder:"Leave empty if using passwordless sudo",value:f,onChange:e=>y(e.target.value),className:"placeholder:text-gray-500"})]}),N.auth&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:N.auth})]}),(0,a.jsxs)(_.cN,{children:[(0,a.jsx)(C.z,{variant:"outline",onClick:E,disabled:c,children:"Cancel"}),(0,a.jsx)(C.z,{onClick:S,disabled:c,className:"bg-blue-600 hover:bg-blue-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),"Saving..."]}):w?"Update Pool":"Create Pool"})]})]})})}var H=s(6378),D=s(6856),U=s(1214),I=s(1163),F=s(1664),q=s.n(F),O=s(6989);s(7673);let R=U.nb.REFRESH_INTERVAL,A=U.MO.NAME_TRUNCATE_LENGTH;function G(e){let{title:t,isLoading:s,isDataLoaded:l,contexts:o,gpus:n,groupedPerContextGPUs:c,groupedPerNodeGPUs:i,handleContextClick:d,contextStats:m={},isSSH:u=!1,actionButton:h=null}=e,x=o||[];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===x.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.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:t}),h]}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["No ",t," found or ",t," is not configured."]})]})}):l&&x.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 justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center",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:[x.length," ",1===x.length?u?"pool":"context":u?"pools":"contexts"]})]}),h]}),(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:u?"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(x.length>5?"max-h-[250px] overflow-y-auto block":""),children:x.map(e=>{let t=c[e]||[],s=i[e]||[],l=t.reduce((e,t)=>e+(t.gpu_total||0),0),r=m[u?"ssh/".concat(e.replace(/^ssh-/,"")):"kubernetes/".concat(e)]||{clusters:0,jobs:0},o=Object.keys(t.reduce((e,t)=>(e[t.gpu_name]=(e[t.gpu_name]||0)+(t.gpu_total||0),e),{})).join(", "),n=u?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)(O.Md,{content:n,className:"text-sm text-muted-foreground",children:(0,a.jsx)("span",{className:"text-blue-600 hover:underline cursor-pointer",onClick:()=>d(e),children:n.length>A?"".concat(n.substring(0,Math.floor((A-3)/2)),"...").concat(n.substring(n.length-Math.ceil((A-3)/2))):n})})}),(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:o||"-"}),(0,a.jsx)("td",{className:"p-3",children:l})]},e)})})]})})}),n&&n.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:[n.reduce((e,t)=>e+t.gpu_free,0)," ","of"," ",n.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(n.length>5?"max-h-[250px] overflow-y-auto block":""),children:n.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&&(u?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 L(e){let{contextName:t,gpusInContext:s,nodesInContext:o}=e;t.startsWith("ssh-");let[n,c]=(0,l.useState)([]),[i,m]=(0,l.useState)("$__all"),[u,h]=(0,l.useState)({from:"now-1h",to:"now"}),[x,p]=(0,l.useState)(!1),[g,f]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{f(await (0,d.TO)())})()},[]);let y=(0,l.useCallback)(async()=>{if(g){p(!0);try{let e=(0,d.ki)();for(let t of["/api/datasources/proxy/1/api/v1/label/node/values"])try{let s=await fetch("".concat(e).concat(t),{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(s.ok){let e=await s.json();if(e.data&&e.data.length>0){c(e.data.sort()),console.log("Successfully fetched hosts from ".concat(t,":"),e.data);break}}else console.log("HTTP ".concat(s.status," from ").concat(t,": ").concat(s.statusText))}catch(e){console.log("Failed to fetch from ".concat(t,":"),e);continue}}catch(e){console.error("Error fetching available hosts:",e)}finally{p(!1)}}},[g]);(0,l.useEffect)(()=>{g&&o&&o.length>0&&y()},[o,g,y]);let j=e=>{let t=(0,d.ki)(),s="$__all"===i?"$__all":i;return"".concat(t,"/d-solo/skypilot-dcgm-cluster-dashboard/skypilot-dcgm-kubernetes-cluster-dashboard?orgId=1&timezone=browser&var-datasource=prometheus&var-host=").concat(encodeURIComponent(s),"&var-gpu=$__all&refresh=5s&theme=light&from=").concat(encodeURIComponent(u.from),"&to=").concat(encodeURIComponent(u.to),"&panelId=").concat(e,"&__feature.dashboardSceneSolo")},N=e=>{h({"15m":{from:"now-15m",to:"now"},"1h":{from:"now-1h",to:"now"},"6h":{from:"now-6h",to:"now"},"24h":{from:"now-24h",to:"now"},"7d":{from:"now-7d",to:"now"}}[e])};return(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)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)("h4",{className:"text-lg font-semibold",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)})}),o&&o.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:"IP Address"}),(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:o.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.ip_address||"-"}),(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)))})]})})]}),g&&o&&o.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4 mt-6",children:"GPU Metrics"}),(0,a.jsxs)("div",{className:"mb-4 p-4 bg-gray-50 rounded-md border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:"host-select",className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Node:"}),(0,a.jsxs)("select",{id:"host-select",value:i,onChange:e=>{m(e.target.value)},disabled:x,className:"px-3 py-1 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-sky-blue focus:border-transparent",children:[(0,a.jsx)("option",{value:"$__all",children:"All Nodes"}),n.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),x&&(0,a.jsx)("div",{className:"ml-2",children:(0,a.jsx)(r.Z,{size:16})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Time Range:"}),(0,a.jsx)("div",{className:"flex gap-1",children:[{label:"15m",value:"15m"},{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"}].map(e=>(0,a.jsx)("button",{onClick:()=>N(e.value),className:"px-2 py-1 text-xs font-medium rounded border transition-colors ".concat(u.from==="now-".concat(e.value)&&"now"===u.to?"bg-sky-blue text-white border-sky-blue":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"),children:e.label},e.value))})]})]}),(0,a.jsxs)("div",{className:"mt-2 text-xs text-gray-500",children:["Showing:"," ","$__all"===i?"All nodes":i," • Time: ",u.from," to ",u.to,n.length>0&&(0,a.jsxs)("span",{children:[" • ",n.length," nodes available"]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,a.jsx)("div",{className:"bg-white rounded-md",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:j("6"),width:"100%",height:"400",frameBorder:"0",title:"GPU Utilization",className:"rounded"},"gpu-util-".concat(i,"-").concat(u.from,"-").concat(u.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:j("18"),width:"100%",height:"400",frameBorder:"0",title:"GPU Memory",className:"rounded"},"gpu-memory-".concat(i,"-").concat(u.from,"-").concat(u.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:j("10"),width:"100%",height:"400",frameBorder:"0",title:"GPU Power Consumption",className:"rounded"},"gpu-power-".concat(i,"-").concat(u.from,"-").concat(u.to))})})]})]})]})})})}function z(e){var t;let{poolName:s,gpusInContext:c,nodesInContext:i,handleDeploySSHPool:d,handleEditSSHPool:m,handleDeleteSSHPool:u,poolConfig:h}=e,[x,p]=(0,l.useState)(null),[g,f]=(0,l.useState)(!0),[y,j]=(0,l.useState)({isOpen:!1,action:null,loading:!1}),[N,P]=(0,l.useState)({isOpen:!1,logs:"",isStreaming:!1,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});(0,l.useEffect)(()=>{(async()=>{try{f(!0);let e=await w(s);p(e)}catch(e){console.error("Failed to fetch SSH Node Pool status:",e),p({pool_name:s,status:"Error",reason:"Failed to fetch status"})}finally{f(!1)}})()},[s]);let{deployDisabled:k}=(()=>{if(!x)return{deployDisabled:!0};let e=x.status;return"Ready"===e?{deployDisabled:!0}:"Error"===e?{deployDisabled:!0}:{deployDisabled:!1}})(),T=async()=>{j({...y,loading:!0});try{if("deploy"===y.action){j({isOpen:!1,action:null,loading:!1}),P({isOpen:!0,logs:"",isStreaming:!0,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});try{let e=(await d(s)).request_id;P(t=>({...t,requestId:e}));let t=new AbortController;await v({requestId:e,signal:t.signal,onNewLog:e=>{P(t=>({...t,logs:t.logs+e}))}}),P(e=>({...e,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!0})),setTimeout(async()=>{(async()=>{try{let e=await w(s);p(e)}catch(e){console.error("Failed to fetch SSH Node Pool status after deployment:",e)}})()},1e3)}catch(e){console.error("Deployment failed:",e),P(t=>({...t,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!1,logs:t.logs+"\nDeployment failed: ".concat(e.message)}))}}else if("delete"===y.action){j({isOpen:!1,action:null,loading:!1}),P({isOpen:!0,logs:"",isStreaming:!0,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});try{let e=(await b(s)).request_id;P(t=>({...t,requestId:e})),e&&await S({requestId:e,signal:null,onNewLog:e=>{P(t=>({...t,logs:t.logs+e}))},operationType:"down"}),await u(s),P(e=>({...e,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!0,logs:e.logs+"\nSSH Node Pool teardown completed successfully."}))}catch(e){console.error("Down operation failed:",e),P(t=>({...t,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!1,logs:t.logs+"\nTeardown failed: ".concat(e.message)}))}}}catch(e){console.error("Action failed:",e),j({...y,loading:!1})}},E=()=>{j({isOpen:!1,action:null,loading:!1})},H=()=>{P({isOpen:!1,logs:"",isStreaming:!1,deploymentComplete:!1,deploymentSuccess:!1,requestId:null}),N.deploymentComplete&&setTimeout(()=>{(async()=>{try{let e=await w(s);p(e)}catch(e){console.error("Failed to refresh status:",e)}})()},1e3)},D="deploy"===y.action?{title:"Deploy SSH Node Pool",description:'Are you sure you want to deploy SSH Node Pool "'.concat(s,'"?'),details:["• Set up SkyPilot runtime on the configured SSH hosts","• Install required components and dependencies","• Make the node pool available for workloads","","This process may take a few minutes to complete."]}:{title:"Delete SSH Node Pool",description:'Are you sure you want to delete SSH Node Pool "'.concat(s,'"?'),details:["• Clean up any deployed resources","• Remove the SSH Node Pool configuration"]};return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"SSH Node Pool Details"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)("button",{className:"px-3 py-1 text-sm border rounded flex items-center ".concat(k?"border-gray-300 bg-gray-100 text-gray-400 cursor-not-allowed":"border-green-300 bg-green-50 text-green-700 hover:bg-green-100"),onClick:k?void 0:()=>{j({isOpen:!0,action:"deploy",loading:!1})},disabled:k,children:[(0,a.jsx)(o.Z,{className:"w-4 h-4 mr-2"}),"Deploy"]}),(0,a.jsxs)("button",{className:"px-3 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50 flex items-center text-red-600 hover:text-red-700",onClick:()=>{j({isOpen:!0,action:"delete",loading:!1})},children:[(0,a.jsx)(n.Z,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Pool Name"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Nodes"}),(0,a.jsx)("div",{className:"text-base mt-1",children:i?i.length:0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,a.jsx)("div",{className:"text-base mt-1",children:g?(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading..."})]}):x?(0,a.jsx)(e=>{let{status:t,reason:s}=e,l="Ready"===t,r="Not Ready"===t?"Click Deploy to set up this node pool":s;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium ".concat(l?"bg-green-100":"bg-red-100"," ").concat(l?"text-green-800":"text-red-800"),children:t}),!l&&r&&(0,a.jsxs)("span",{className:"text-sm text-gray-600",children:["(",r,")"]})]})},{status:x.status,reason:x.reason}):(0,a.jsx)("span",{className:"text-gray-500",children:"Unknown"})})]})]})})]})}),(0,a.jsx)(L,{contextName:"ssh-".concat(s),gpusInContext:c,nodesInContext:i}),(0,a.jsx)(_.Vq,{open:y.isOpen,onOpenChange:E,children:(0,a.jsxs)(_.cZ,{className:"sm:max-w-md",children:[(0,a.jsxs)(_.fK,{className:"",children:[(0,a.jsx)(_.$N,{className:"",children:D.title}),(0,a.jsx)(_.Be,{className:"",children:D.description})]}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsxs)("div",{className:"text-sm text-gray-600 space-y-1",children:[(0,a.jsx)("p",{className:"font-medium mb-2",children:"This will:"}),D.details.map((e,t)=>(0,a.jsx)("p",{className:""===e?"pt-2":"",children:e},t))]})}),(0,a.jsxs)(_.cN,{className:"",children:[(0,a.jsx)(C.z,{variant:"outline",onClick:E,disabled:y.loading,className:"",children:"Cancel"}),(0,a.jsx)(C.z,{onClick:T,disabled:y.loading,className:"deploy"===y.action?"bg-green-600 hover:bg-green-700 text-white":"bg-red-600 hover:bg-red-700 text-white",children:y.loading?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),"deploy"===y.action?"Deploying...":"Deleting..."]}):"deploy"===y.action?"Deploy":"Delete"})]})]})}),(0,a.jsx)(_.Vq,{open:N.isOpen,onOpenChange:N.isStreaming?void 0:H,children:(0,a.jsxs)(_.cZ,{className:"sm:max-w-4xl max-h-[80vh]",children:[(0,a.jsxs)(_.fK,{className:"",children:[(0,a.jsxs)(_.$N,{className:"",children:["Deploying SSH Node Pool: ",s]}),(0,a.jsx)(_.Be,{className:"",children:N.isStreaming?"Deployment in progress. Do not close this dialog.":N.deploymentSuccess?"Deployment completed successfully!":"Deployment completed with errors."})]}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsxs)("div",{className:"bg-black text-green-400 p-4 rounded-md font-mono text-sm max-h-96 overflow-y-auto",children:[(0,a.jsx)("pre",{className:"whitespace-pre-wrap",children:(t=N.logs)?t.split("\n").map(e=>(e=e.replace(/\x1b\[[0-9;]*m/g,"")).match(/^D \d{2}-\d{2} \d{2}:\d{2}:\d{2}/)?null:e=(e=e.replace(/├──/g,"├─")).replace(/└──/g,"└─")).filter(e=>null!==e&&""!==e.trim()).join("\n"):""}),N.isStreaming&&(0,a.jsxs)("div",{className:"flex items-center mt-2",children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2 text-green-400"}),(0,a.jsx)("span",{className:"text-green-400",children:"Streaming logs..."})]})]})}),(0,a.jsx)(_.cN,{className:"",children:(0,a.jsx)(C.z,{onClick:H,disabled:N.isStreaming,className:N.deploymentSuccess?"bg-green-600 hover:bg-green-700 text-white":N.deploymentComplete&&!N.deploymentSuccess?"bg-red-600 hover:bg-red-700 text-white":"bg-gray-600 hover:bg-gray-700 text-white",children:N.isStreaming?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{size:16,className:"mr-2"}),"Deploying..."]}):"Close"})})]})})]})}function Z(){let[e,t]=(0,l.useState)(!0),[s,o]=(0,l.useState)(!0),[n,d]=(0,l.useState)(!0),x=l.useRef(null),p=(0,i.X)(),[j,b]=(0,l.useState)(!1),[w,v]=(0,l.useState)(!1),S=(0,I.useRouter)(),[_,C]=(0,l.useState)([]),[P,k]=(0,l.useState)([]),[T,U]=(0,l.useState)([]),[F,O]=(0,l.useState)([]),[A,Z]=(0,l.useState)([]),[M,W]=(0,l.useState)(0),[$,B]=(0,l.useState)(0),[K,J]=(0,l.useState)({}),[V,X]=(0,l.useState)({}),[Q,Y]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(null),[es,ea]=(0,l.useState)(!1),[el,er]=(0,l.useState)(null),eo=l.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showLoadingIndicators:!0};e.showLoadingIndicators&&(t(!0),o(!0));try{let e=await H.default.get(m.l4),{gpuData:t,cloudData:s}=e||{};if(t){let{allContextNames:e,allGPUs:s,perContextGPUs:a,perNodeGPUs:l,contextStats:r}=t;C(e||[]),k(s||[]),U(a||[]),O(l||[]),J(r||{}),b(!0)}else e&&null===e.gpuData?(C([]),k([]),U([]),O([]),J({}),b(!0)):e||console.log("No infra data received from cache");s?(Z(s.clouds||[]),W(s.totalClouds||0),B(s.enabledClouds||0),v(!0)):e&&null===e.cloudData?(Z([]),W(0),B(0),v(!0)):e||console.log("No cloud data received from cache"),await en()}catch(e){console.error("Error in fetchData:",e),C([]),k([]),U([]),O([]),J({}),Z([]),W(0),B(0),b(!0),v(!0)}finally{e.showLoadingIndicators&&(t(!1),o(!1)),n&&e.showLoadingIndicators&&d(!1)}},[n]),en=async()=>{try{let e=await g();X(e)}catch(e){console.error("Failed to fetch SSH Node Pools:",e),X({})}},ec=(e,t)=>{et({name:e,config:t}),Y(!0)},ei=async e=>{try{await y(e),await en(),er(null),S.push("/infra")}catch(e){throw console.error("Failed to delete SSH Node Pool:",e),e}},ed=async e=>{try{await N(e)}catch(e){throw console.error("Failed to deploy SSH Node Pool:",e),e}},em=async(e,t)=>{ea(!0);try{let s={...V};s[e]=t,await f(s),await en(),Y(!1)}catch(e){console.error("Failed to save SSH Node Pool:",e),alert("Failed to save SSH Node Pool. Please try again.")}finally{ea(!1)}};(0,l.useEffect)(()=>{x.current=eo},[eo]),(0,l.useEffect)(()=>{(async()=>{await D.ZP.preloadForPage("infra"),eo({showLoadingIndicators:!0})})()},[eo]),(0,l.useEffect)(()=>{let e=!0,t=setInterval(()=>{e&&x.current&&x.current({showLoadingIndicators:!1})},R);return()=>{e=!1,clearInterval(t)}},[]),(0,l.useEffect)(()=>()=>{b(!1),v(!1),d(!0)},[]),(P||[]).length,(P||[]).reduce((e,t)=>e+t.gpu_total,0),(P||[]).reduce((e,t)=>e+t.gpu_free,0);let eu=l.useMemo(()=>T?T.reduce((e,t)=>{let{context:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e},{}):{},[T]),eh=l.useMemo(()=>_&&Array.isArray(_)?_.filter(e=>e.startsWith("ssh-")):[],[_]),ex=l.useMemo(()=>_&&Array.isArray(_)?_.filter(e=>!e.startsWith("ssh-")):[],[_]),ep=l.useMemo(()=>{if(!T||!P)return[];let e=new Set;return T.forEach(t=>{t.context.startsWith("ssh-")&&e.add(t.gpu_name)}),P.filter(t=>e.has(t.gpu_name))},[P,T]),eg=l.useMemo(()=>{if(!T||!P)return[];let e=new Set;return T.forEach(t=>{t.context.startsWith("ssh-")||e.add(t.gpu_name)}),P.filter(t=>e.has(t.gpu_name))},[P,T]),ef=l.useMemo(()=>F?F.reduce((e,t)=>{let{context:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e},{}):{},[F]);(0,l.useEffect)(()=>{S.isReady&&S.query.context&&er(decodeURIComponent(Array.isArray(S.query.context)?S.query.context[0]:S.query.context))},[S.isReady,S.query.context]);let ey=e=>{er(e),S.push("/infra/".concat(encodeURIComponent(e)))},ej=e||s,eN=j&&w&&!n;return(0,a.jsxs)(a.Fragment,{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)(q(),{href:"/infra",className:"text-sky-blue hover:underline ".concat(el?"":"cursor-default"),children:"Infrastructure"}),el&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),el.startsWith("ssh-")?(0,a.jsx)(q(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"SSH Node Pool"}):(0,a.jsx)(q(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"Kubernetes"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)("span",{className:"text-sky-blue",children:el.startsWith("ssh-")?el.replace(/^ssh-/,""):el})]})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[ej&&(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:()=>{H.default.invalidate(u.getClusters),H.default.invalidate(h.getManagedJobs,[{allUsers:!0}]),H.default.invalidate(m.l4),x.current&&x.current({showLoadingIndicators:!0})},disabled:ej,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4 mr-1.5"}),!p&&"Refresh"]})]})]}),eN?el?e&&!j?(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=eu[t]||[],l=ef[t]||[];if(e&&!j)return(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..."})]});if(t.startsWith("ssh-")){let e=t.replace(/^ssh-/,"");return(0,a.jsx)(z,{poolName:e,gpusInContext:s,nodesInContext:l,handleDeploySSHPool:ed,handleEditSSHPool:ec,handleDeleteSSHPool:ei,poolConfig:V[e]})}return(0,a.jsx)(L,{contextName:t,gpusInContext:s,nodesInContext:l})})(el):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(G,{title:"SSH Node Pool",isLoading:e,isDataLoaded:j,contexts:eh,gpus:ep,groupedPerContextGPUs:eu,groupedPerNodeGPUs:ef,handleContextClick:ey,contextStats:K,isSSH:!0,actionButton:null}),(0,a.jsx)(G,{title:"Kubernetes",isLoading:e,isDataLoaded:j,contexts:ex,gpus:eg,groupedPerContextGPUs:eu,groupedPerNodeGPUs:ef,handleContextClick:ey,contextStats:K,isSSH:!1}),s||!w?(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:[$," of ",M," enabled"]})]}),A&&0!==A.length?(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:A.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))})]})}):(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"No enabled clouds available."})]})})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-32",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading infrastructure data..."})]}),(0,a.jsx)(E,{isOpen:Q,onClose:()=>Y(!1),onSave:em,poolData:ee,isLoading:es})]})}},2557:function(e,t,s){s.d(t,{I:function(){return o}});var a=s(5893),l=s(7294),r=s(2350);let o=l.forwardRef((e,t)=>{let{className:s,type:l,...o}=e;return(0,a.jsx)("input",{type:l,className:(0,r.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium 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",s),ref:t,...o})});o.displayName="Input"},6185:function(e,t,s){s.d(t,{_:function(){return i}});var a=s(5893),l=s(7294),r=s(9102),o=s(2003),n=s(2350);let c=(0,o.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),i=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)(r.f,{ref:t,className:(0,n.cn)(c(),s),...l})});i.displayName=r.f.displayName},9123:function(e,t,s){s.d(t,{g:function(){return o}});var a=s(5893),l=s(7294),r=s(2350);let o=l.forwardRef((e,t)=>{let{className:s,...l}=e;return(0,a.jsx)("textarea",{className:(0,r.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",s),ref:t,...l})});o.displayName="Textarea"},7853:function(e,t,s){s.d(t,{TO:function(){return r},ki:function(){return o}});let a=null,l=null,r=async()=>null!==a?a:l||(l=(async()=>{try{let e="".concat(window.location.origin,"/grafana"),t=await fetch("".concat(e,"/api/health"),{method:"GET",credentials:"include",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return 200==t.status}catch(e){return console.debug("Grafana availability check failed:",e),a=!1,!1}finally{l=null}})()),o=()=>"".concat(window.location.origin,"/grafana")}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[990],{803:function(e,r,t){t.d(r,{z:function(){return i}});var o=t(5893),a=t(7294),n=t(8426),s=t(2003),c=t(2350);let l=(0,s.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,r)=>{let{className:t,variant:a,size:s,asChild:i=!1,...u}=e,d=i?n.g7:"button";return(0,o.jsx)(d,{className:(0,c.cn)(l({variant:a,size:s,className:t})),ref:r,...u})});i.displayName="Button"},7673:function(e,r,t){t.d(r,{Ol:function(){return i},Zb:function(){return l},aY:function(){return f},eW:function(){return p},ll:function(){return u}});var o=t(5893),a=t(7294),n=t(5697),s=t.n(n),c=t(2350);let l=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...n,children:a})});l.displayName="Card",l.propTypes={className:s().string,children:s().node};let i=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("flex flex-col space-y-1.5 p-6",t),...n,children:a})});i.displayName="CardHeader",i.propTypes={className:s().string,children:s().node};let u=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,o.jsx)("h3",{ref:r,className:(0,c.cn)("text-2xl font-semibold leading-none tracking-tight",t),...n,children:a})});u.displayName="CardTitle",u.propTypes={className:s().string,children:s().node};let d=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,o.jsx)("p",{ref:r,className:(0,c.cn)("text-sm text-muted-foreground",t),...n,children:a})});d.displayName="CardDescription",d.propTypes={className:s().string,children:s().node};let f=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("p-6 pt-0",t),...n,children:a})});f.displayName="CardContent",f.propTypes={className:s().string,children:s().node};let p=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("flex items-center p-6 pt-0",t),...n,children:a})});p.displayName="CardFooter",p.propTypes={className:s().string,children:s().node}},7145:function(e,r,t){t.d(r,{x:function(){return a}});var o=t(3225);let a={fetch:async function(e,r){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"POST",a=window.location.origin,n="".concat(a).concat(o.f4).concat(e),s=await fetch(n,{method:t,headers:"POST"===t?{"Content-Type":"application/json"}:{},body:"POST"===t?JSON.stringify(r):void 0}),c=s.headers.get("X-Skypilot-Request-ID")||s.headers.get("X-Request-ID"),l=await fetch("".concat(a).concat(o.f4,"/api/get?request_id=").concat(c)),i=await l.json();return i.return_value?JSON.parse(i.return_value):[]},post:async(e,r)=>{let t=window.location.origin,a="".concat(t).concat(o.f4).concat(e);return await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})},stream:async(e,r,t)=>{let o=(await a.post(e,r)).body.getReader();try{for(;;){let{done:e,value:r}=await o.read();if(e)break;let a=new TextDecoder().decode(r);t(a)}}catch(e){throw console.error("Error in stream:",e),e}},get:async e=>{let r=window.location.origin,t="".concat(r).concat(o.f4).concat(e);return await fetch(t)}}},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 n},zl:function(){return i}});var o=t(7145);async function a(){try{let e=await o.x.get("/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 o.x.get("/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 n={};if("SUCCEEDED"===a.status&&a.return_value)try{n=JSON.parse(a.return_value),console.log("Successfully parsed workspace data from return_value:",n)}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)),n=a.result);return console.log("Effectively fetched workspace data (to be returned):",n),n||{}}catch(e){throw console.error("Failed to fetch workspaces (in getWorkspaces function):",e.message,e.stack),e}}async function n(){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="/enabled_clouds",a=new URLSearchParams;e&&a.append("workspace",e),r&&a.append("expand","true"),a.toString()&&(t+="?".concat(a.toString()));let n=await o.x.get(t);if(!n.ok)throw Error("Error scheduling getEnabledClouds: ".concat(n.statusText," (status ").concat(n.status,")"));let s=n.headers.get("X-Skypilot-Request-ID");if(!s){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 n.json();if(e&&e.request_id)s=e.request_id,console.log("Found request_id in /enabled_clouds response body (fallback):",s);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(!s)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(s));let c=await o.x.get("/api/get?request_id=".concat(s));if(!c.ok){let e="Error fetching enabled_clouds data for request ID ".concat(s,": ").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(s,": ").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(s,": ").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(s,": ").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 s(e,r){console.log("Polling for ".concat(r," task completion with request_id: ").concat(e));let t=await o.x.get("/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 n={};if("SUCCEEDED"===a.status&&a.return_value)try{n=JSON.parse(a.return_value),console.log("Successfully parsed ".concat(r," data:"),n)}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)),n=a.result);return n}async function c(e,r){try{console.log("Updating workspace ".concat(e," with config:"),r);let t=await o.x.post("/workspaces/update",{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 s(a,"updateWorkspace")}catch(e){throw console.error("Failed to update workspace:",e),e}}let l=async(e,r)=>{try{let t=await o.x.post("/workspaces/create",{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 s(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 o.x.post("/workspaces/delete",{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 s(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 o.x.get("/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 s(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 o.x.post("/workspaces/config",{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 s(t,"updateConfig")}catch(e){throw console.error("Failed to update config:",e),e}}},2350:function(e,r,t){t.d(r,{cn:function(){return n}});var o=t(512),a=t(8388);function n(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return(0,a.m6)((0,o.W)(r))}}}]);
|
@@ -3,4 +3,4 @@
|
|
3
3
|
*
|
4
4
|
* This source code is licensed under the ISC license.
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
6
|
-
*/let a=(0,s(998).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},4303:function(e,t,s){"use strict";s.d(t,{_q:function(){return r},pJ:function(){return i}});var a=s(1272);let r=e=>{if(!e)return"No YAML available";try{let t=a.ZP.load(e),s=a.ZP.dump(t,{lineWidth:-1,styles:{"!!str":"literal"},quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2}).split("\n"),r=[],l=-1;for(let e=0;e<s.length;e++){let t=s[e],a=t.search(/\S/);0===a&&l>=0&&e>0&&r.push(""),r.push(t),l=a}return r.join("\n").trim()}catch(t){return console.error("YAML formatting error:",t),e}},l=e=>"string"==typeof e?e.substring(0,50)+"...":e&&e.name?"name: ".concat(e.name):e&&e.resources?"Task configuration":"YAML document",n=(e,t)=>{try{let s=a.ZP.load(e),r=a.ZP.dump(s,{lineWidth:-1,styles:{"!!str":"literal"},quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2}).split("\n"),n=[],i=-1;for(let e=0;e<r.length;e++){let t=r[e],s=t.search(/\S/);0===s&&i>=0&&e>0&&n.push(""),n.push(t),i=s}return{index:t,content:n.join("\n").trim(),preview:l(s)}}catch(s){return console.error("YAML formatting error for document ".concat(t,":"),s),{index:t,content:e,preview:"Invalid YAML"}}},i=e=>{if(!e)return[];try{let t=[],s=e.split(/^---$/m);for(let e=0;e<s.length;e++){let a=s[e].trim();a&&""!==a&&t.push(a)}return(t.length>1?t.slice(1):t).map((e,t)=>n(e,t))}catch(t){return console.error("YAML formatting error:",t),[{index:0,content:e,preview:"Invalid YAML"}]}}},6996:function(e,t,s){"use strict";s.r(t);var a=s(5893),r=s(7294),l=s(8799),n=s(938),i=s(1163);s(9470);var c=s(1664),o=s.n(c),d=s(9037),m=s(9307);s(7673);var u=s(3266),x=s(6378),h=s(3626),f=s(282),v=s(8671),g=s(5895),j=s(6639);s(1272);var b=s(6989),y=s(7853),p=s(9284),N=s(3001),w=s(9008),_=s.n(w),C=s(4303);let k=(e,t)=>{let s="",a="";return e>=0&&(s=e+"m",a=" "),t&&(s+="".concat(a,"(down)")),""===s&&(s="-"),s};function S(e){var t,s;let{clusterData:l,clusterJobData:i,clusterJobsLoading:c,refreshClusterJobsOnly:d,isVSCodeModalOpen:u,setIsVSCodeModalOpen:x,timeRange:h,handleTimeRangePreset:y,buildGrafanaMetricsUrl:p,matchedClusterName:N,isLoadingClusterMatch:w,isGrafanaAvailable:_,isHistoricalCluster:S=!1}=e,[M,A]=(0,r.useState)(!1),[L,O]=(0,r.useState)(!1),[R,T]=(0,r.useState)(!1),P=async()=>{try{let e=l.task_yaml||l.last_creation_yaml,t=(0,C._q)(e);await navigator.clipboard.writeText(t),O(!0),setTimeout(()=>O(!1),2e3)}catch(e){console.error("Failed to copy YAML to clipboard:",e)}},E=async()=>{try{let e=l.command||l.last_creation_command;await navigator.clipboard.writeText(e),T(!0),setTimeout(()=>T(!1),2e3)}catch(e){console.error("Failed to copy command to clipboard:",e)}},Z=(null==l?void 0:l.last_creation_command)||(null==l?void 0:l.last_creation_yaml)||(null==l?void 0:l.command)||(null==l?void 0:l.task_yaml);return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,a.jsx)("h3",{className:"text-lg font-semibold",children:S?"Historical Cluster Details":"Details"})}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(m.OE,{status:l.status})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cluster"}),(0,a.jsx)("div",{className:"text-base mt-1",children:l.cluster||l.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,a.jsx)("div",{className:"text-base mt-1",children:l.user})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:S?"Cloud":"Infra"}),(0,a.jsx)("div",{className:"text-base mt-1",children:S?l.cloud||"N/A":l.infra?(0,a.jsx)(b.Md,{content:l.full_infra||l.infra,className:"text-sm text-muted-foreground",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(o(),{href:"/infra",className:"text-blue-600 hover:underline",children:l.cloud||l.infra.split("(")[0].trim()}),l.infra.includes("(")&&(0,a.jsx)("span",{children:" "+l.infra.substring(l.infra.indexOf("("))})]})}):"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Resources"}),(0,a.jsx)("div",{className:"text-base mt-1",children:l.resources_str_full||l.resources_str||"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Started"}),(0,a.jsx)("div",{className:"text-base mt-1",children:l.time?(0,b.xn)(new Date(l.time)):"N/A"})]}),S?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Duration"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(e=>{if(!e||0===e)return"-";let t=e=Math.floor(e),s="",a=0;for(let e of[{value:31536e3,label:"y"},{value:2592e3,label:"mo"},{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(t>=e.value&&a<2){let r=Math.floor(t/e.value);s+="".concat(r).concat(e.label," "),t%=e.value,a++}return s.trim()||"0s"})(l.duration)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cost"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(e=>{if(null==e||0===e)return"-";let t=Number(e);return isNaN(t)?"-":"$".concat(t.toFixed(2))})(l.total_cost)})]})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Autostop"}),(0,a.jsx)("div",{className:"text-base mt-1",children:k(l.autostop,l.to_down)})]}),Z&&(0,a.jsxs)("div",{className:"col-span-2",children:[(l.command||l.last_creation_command)&&(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Entrypoint"}),l.command&&(0,a.jsx)(b.WH,{content:R?"Copied!":"Copy command",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:E,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:R?(0,a.jsx)(f.Z,{className:"w-4 h-4 text-green-600"}):(0,a.jsx)(v.Z,{className:"w-4 h-4"})})})]}),(0,a.jsxs)("div",{className:"space-y-4 mt-3",children:[(l.command||l.last_creation_command)&&(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3",children:(0,a.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all",children:l.command||l.last_creation_command})})}),(l.task_yaml||l.last_creation_yaml)&&"{}"!==l.task_yaml&&"{}"!==l.last_creation_yaml&&!(null===(t=l.cluster||l.name)||void 0===t?void 0:t.startsWith("sky-jobs-controller-"))&&!(null===(s=l.cluster||l.name)||void 0===s?void 0:s.startsWith("sky-serve-controller-"))&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center mb-2",children:[(0,a.jsxs)("button",{onClick:()=>{A(!M)},className:"flex items-center text-left focus:outline-none text-gray-700 hover:text-gray-900 transition-colors duration-200",children:[M?(0,a.jsx)(g.Z,{className:"w-4 h-4 mr-1"}):(0,a.jsx)(j.Z,{className:"w-4 h-4 mr-1"}),(0,a.jsx)("span",{className:"text-base",children:"Show SkyPilot YAML"})]}),(0,a.jsx)(b.WH,{content:L?"Copied!":"Copy YAML",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:P,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:L?(0,a.jsx)(f.Z,{className:"w-4 h-4 text-green-600"}):(0,a.jsx)(v.Z,{className:"w-4 h-4"})})})]}),M&&(0,a.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 max-h-96 overflow-y-auto",children:(0,a.jsx)("pre",{className:"text-sm text-gray-800 font-mono whitespace-pre-wrap",children:(0,C._q)(l.task_yaml||l.last_creation_yaml)})})]})]})]})]})})]})}),l&&"Kubernetes (in-cluster)"===l.full_infra&&_&&(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"GPU Metrics"})}),(0,a.jsxs)("div",{className:"mb-4 p-4 bg-gray-50 rounded-md border border-gray-200",children:[(0,a.jsx)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Time Range:"}),(0,a.jsx)("div",{className:"flex gap-1",children:[{label:"15m",value:"15m"},{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"}].map(e=>(0,a.jsx)("button",{onClick:()=>y(e.value),className:"px-2 py-1 text-xs font-medium rounded border transition-colors ".concat(h.from==="now-".concat(e.value)&&"now"===h.to?"bg-sky-blue text-white border-sky-blue":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"),children:e.label},e.value))})]})}),(0,a.jsxs)("div",{className:"mt-2 text-xs text-gray-500",children:["Showing: ",null==l?void 0:l.cluster," • Time: ",h.from," to"," ",h.to,w&&(0,a.jsx)("span",{children:" • Finding cluster data..."})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:p("1"),width:"100%",height:"400",frameBorder:"0",title:"GPU Utilization",className:"rounded"},"gpu-util-".concat(null==l?void 0:l.cluster,"-").concat(h.from,"-").concat(h.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:p("2"),width:"100%",height:"400",frameBorder:"0",title:"GPU Memory Utilization",className:"rounded"},"gpu-memory-".concat(null==l?void 0:l.cluster,"-").concat(h.from,"-").concat(h.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:p("4"),width:"100%",height:"400",frameBorder:"0",title:"GPU Power Usage",className:"rounded"},"gpu-power-".concat(null==l?void 0:l.cluster,"-").concat(h.from,"-").concat(h.to))})})]})]})})}),!S&&(0,a.jsx)("div",{className:"mb-8",children:(0,a.jsx)(n.ClusterJobs,{clusterName:l.cluster,clusterJobData:i,loading:c,refreshClusterJobsOnly:d})})]})}t.default=function(){let e=(0,i.useRouter)(),{cluster:t}=e.query,[s,n]=(0,r.useState)(!1),[c,m]=(0,r.useState)(!0),[f,v]=(0,r.useState)(!1),[g,j]=(0,r.useState)(!1),[w,C]=(0,r.useState)(null),[k,M]=(0,r.useState)(!1),[A,L]=(0,r.useState)(!1),O=(0,N.X)(),[R,T]=(0,r.useState)({from:"now-1h",to:"now"}),{clusterData:P,clusterJobData:E,loading:Z,clusterDetailsLoading:U,clusterJobsLoading:D,refreshData:G,refreshClusterJobsOnly:I}=(0,u.QL)({cluster:t}),[J,Y]=(0,r.useState)(null),[F,W]=(0,r.useState)(!1),[q,H]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{H(await (0,y.TO)())})()},[]);let z=(0,r.useCallback)(async()=>{if(q&&(null==P?void 0:P.cluster)){W(!0);try{let e=(0,y.ki)(),t=await fetch("".concat(e).concat("/api/datasources/proxy/1/api/v1/label/label_skypilot_cluster/values"),{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(t.ok){let e=await t.json();if(e.data&&e.data.length>0){let t=e.data.find(e=>e.startsWith(P.cluster));t&&Y(t)}}}catch(e){console.error("Error fetching matching cluster:",e)}finally{W(!1)}}},[null==P?void 0:P.cluster,q]);(0,r.useEffect)(()=>{q&&(null==P?void 0:P.cluster)&&z()},[null==P?void 0:P.cluster,z,q]);let V=e=>{let t=(0,y.ki)(),s=J||(null==P?void 0:P.cluster)||"$__all";return"".concat(t,"/d-solo/skypilot-dcgm-gpu/skypilot-dcgm-gpu-metrics?orgId=1&from=").concat(encodeURIComponent(R.from),"&to=").concat(encodeURIComponent(R.to),"&timezone=browser&var-cluster=").concat(encodeURIComponent(s),"&var-instance=$__all&var-gpu=$__all&theme=light&panelId=").concat(e,"&__feature.dashboardSceneSolo")};r.useEffect(()=>{!U&&c&&m(!1)},[U,c]),r.useEffect(()=>{let e=async()=>{if(t&&!U&&!P){L(!0);try{let e=(await x.default.get(u.uR)).find(e=>e.cluster_hash===t||e.cluster===t);e&&(C(e),M(!0))}catch(e){console.error("Error fetching cluster history:",e)}finally{L(!1)}}};U||P||e()},[t,U,P]);let $=async()=>{n(!0),await G(),n(!1)},B=e=>{T({from:"now-".concat(e),to:"now"})};if(!e.isReady)return(0,a.jsx)("div",{children:"Loading..."});let K=t?"Cluster: ".concat(t," | SkyPilot Dashboard"):"Cluster Details | SkyPilot Dashboard";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(_(),{children:(0,a.jsx)("title",{children:K})}),(0,a.jsxs)(a.Fragment,{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)(o(),{href:"/clusters",className:"text-sky-blue hover:underline",children:"Sky Clusters"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)(o(),{href:"/clusters/".concat(t),className:"text-sky-blue hover:underline",children:t})]}),(0,a.jsx)("div",{className:"text-sm flex items-center",children:(0,a.jsxs)("div",{className:"text-sm flex items-center",children:[(U||s)&&(0,a.jsxs)("div",{className:"flex items-center mr-4",children:[(0,a.jsx)(l.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),P&&(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)(b.WH,{content:"Refresh",className:"text-sm text-muted-foreground",children:(0,a.jsxs)("button",{onClick:$,disabled:U||s,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4 mr-1.5"}),!O&&(0,a.jsx)("span",{children:"Refresh"})]})}),(0,a.jsx)(d.Status2Actions,{withLabel:!0,cluster:P.cluster,status:P.status,onOpenSSHModal:()=>{v(!0)},onOpenVSCodeModal:()=>{j(!0)}})]})]})})]}),U&&c||A?(0,a.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,a.jsx)(l.Z,{size:24,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading cluster details..."})]}):P?(0,a.jsx)(S,{clusterData:P,clusterJobData:E,clusterJobsLoading:D,refreshClusterJobsOnly:I,isVSCodeModalOpen:g,setIsVSCodeModalOpen:j,timeRange:R,handleTimeRangePreset:B,buildGrafanaMetricsUrl:V,matchedClusterName:J,isLoadingClusterMatch:F,isGrafanaAvailable:q,isHistoricalCluster:!1}):k&&w?(0,a.jsx)(S,{clusterData:w,clusterJobData:[],clusterJobsLoading:!1,refreshClusterJobsOnly:()=>{},isVSCodeModalOpen:!1,setIsVSCodeModalOpen:()=>{},timeRange:R,handleTimeRangePreset:B,buildGrafanaMetricsUrl:V,matchedClusterName:null,isLoadingClusterMatch:!1,isGrafanaAvailable:!1,isHistoricalCluster:!0}):(0,a.jsx)("div",{className:"flex justify-center items-center py-12",children:(0,a.jsx)("span",{className:"text-gray-500",children:"Cluster not found in active clusters or history."})}),(0,a.jsx)(p.Oh,{isOpen:f,onClose:()=>v(!1),cluster:t}),(0,a.jsx)(p._R,{isOpen:g,onClose:()=>j(!1),cluster:t})]})]})}},7853:function(e,t,s){"use strict";s.d(t,{TO:function(){return l},ki:function(){return n}});let a=null,r=null,l=async()=>null!==a?a:r||(r=(async()=>{try{let e="".concat(window.location.origin,"/grafana"),t=await fetch("".concat(e,"/api/health"),{method:"GET",credentials:"include",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return a=t.status>=200&&t.status<500}catch(e){return console.debug("Grafana availability check failed:",e),a=!1,!1}finally{r=null}})()),n=()=>"".concat(window.location.origin,"/grafana")},9008:function(e,t,s){e.exports=s(7219)}},function(e){e.O(0,[616,230,799,664,804,798,947,989,470,66,969,856,973,938,37,888,774,179],function(){return e(e.s=8706)}),_N_E=e.O()}]);
|
6
|
+
*/let a=(0,s(998).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},4303:function(e,t,s){"use strict";s.d(t,{_q:function(){return r},pJ:function(){return i}});var a=s(1272);let r=e=>{if(!e)return"No YAML available";try{let t=a.ZP.load(e),s=a.ZP.dump(t,{lineWidth:-1,styles:{"!!str":"literal"},quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2}).split("\n"),r=[],l=-1;for(let e=0;e<s.length;e++){let t=s[e],a=t.search(/\S/);0===a&&l>=0&&e>0&&r.push(""),r.push(t),l=a}return r.join("\n").trim()}catch(t){return console.error("YAML formatting error:",t),e}},l=e=>"string"==typeof e?e.substring(0,50)+"...":e&&e.name?"name: ".concat(e.name):e&&e.resources?"Task configuration":"YAML document",n=(e,t)=>{try{let s=a.ZP.load(e),r=a.ZP.dump(s,{lineWidth:-1,styles:{"!!str":"literal"},quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2}).split("\n"),n=[],i=-1;for(let e=0;e<r.length;e++){let t=r[e],s=t.search(/\S/);0===s&&i>=0&&e>0&&n.push(""),n.push(t),i=s}return{index:t,content:n.join("\n").trim(),preview:l(s)}}catch(s){return console.error("YAML formatting error for document ".concat(t,":"),s),{index:t,content:e,preview:"Invalid YAML"}}},i=e=>{if(!e)return[];try{let t=[],s=e.split(/^---$/m);for(let e=0;e<s.length;e++){let a=s[e].trim();a&&""!==a&&t.push(a)}return(t.length>1?t.slice(1):t).map((e,t)=>n(e,t))}catch(t){return console.error("YAML formatting error:",t),[{index:0,content:e,preview:"Invalid YAML"}]}}},6996:function(e,t,s){"use strict";s.r(t);var a=s(5893),r=s(7294),l=s(8799),n=s(938),i=s(1163);s(9470);var c=s(1664),o=s.n(c),d=s(9037),m=s(9307);s(7673);var u=s(3266),x=s(6378),h=s(3626),f=s(282),v=s(8671),g=s(5895),j=s(6639);s(1272);var b=s(6989),y=s(7853),p=s(9284),N=s(3001),w=s(9008),_=s.n(w),C=s(4303);let k=(e,t)=>{let s="",a="";return e>=0&&(s=e+"m",a=" "),t&&(s+="".concat(a,"(down)")),""===s&&(s="-"),s};function S(e){var t,s;let{clusterData:l,clusterJobData:i,clusterJobsLoading:c,refreshClusterJobsOnly:d,isVSCodeModalOpen:u,setIsVSCodeModalOpen:x,timeRange:h,handleTimeRangePreset:y,buildGrafanaMetricsUrl:p,matchedClusterName:N,isLoadingClusterMatch:w,isGrafanaAvailable:_,isHistoricalCluster:S=!1}=e,[M,A]=(0,r.useState)(!1),[L,O]=(0,r.useState)(!1),[R,T]=(0,r.useState)(!1),P=async()=>{try{let e=l.task_yaml||l.last_creation_yaml,t=(0,C._q)(e);await navigator.clipboard.writeText(t),O(!0),setTimeout(()=>O(!1),2e3)}catch(e){console.error("Failed to copy YAML to clipboard:",e)}},E=async()=>{try{let e=l.command||l.last_creation_command;await navigator.clipboard.writeText(e),T(!0),setTimeout(()=>T(!1),2e3)}catch(e){console.error("Failed to copy command to clipboard:",e)}},Z=(null==l?void 0:l.last_creation_command)||(null==l?void 0:l.last_creation_yaml)||(null==l?void 0:l.command)||(null==l?void 0:l.task_yaml);return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,a.jsx)("h3",{className:"text-lg font-semibold",children:S?"Historical Cluster Details":"Details"})}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(m.OE,{status:l.status})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cluster"}),(0,a.jsx)("div",{className:"text-base mt-1",children:l.cluster||l.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,a.jsx)("div",{className:"text-base mt-1",children:l.user})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:S?"Cloud":"Infra"}),(0,a.jsx)("div",{className:"text-base mt-1",children:S?l.cloud||"N/A":l.infra?(0,a.jsx)(b.Md,{content:l.full_infra||l.infra,className:"text-sm text-muted-foreground",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(o(),{href:"/infra",className:"text-blue-600 hover:underline",children:l.cloud||l.infra.split("(")[0].trim()}),l.infra.includes("(")&&(0,a.jsx)("span",{children:" "+l.infra.substring(l.infra.indexOf("("))})]})}):"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Resources"}),(0,a.jsx)("div",{className:"text-base mt-1",children:l.resources_str_full||l.resources_str||"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Started"}),(0,a.jsx)("div",{className:"text-base mt-1",children:l.time?(0,b.xn)(new Date(l.time)):"N/A"})]}),S?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Duration"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(e=>{if(!e||0===e)return"-";let t=e=Math.floor(e),s="",a=0;for(let e of[{value:31536e3,label:"y"},{value:2592e3,label:"mo"},{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(t>=e.value&&a<2){let r=Math.floor(t/e.value);s+="".concat(r).concat(e.label," "),t%=e.value,a++}return s.trim()||"0s"})(l.duration)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cost"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(e=>{if(null==e||0===e)return"-";let t=Number(e);return isNaN(t)?"-":"$".concat(t.toFixed(2))})(l.total_cost)})]})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Autostop"}),(0,a.jsx)("div",{className:"text-base mt-1",children:k(l.autostop,l.to_down)})]}),Z&&(0,a.jsxs)("div",{className:"col-span-2",children:[(l.command||l.last_creation_command)&&(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Entrypoint"}),l.command&&(0,a.jsx)(b.WH,{content:R?"Copied!":"Copy command",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:E,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:R?(0,a.jsx)(f.Z,{className:"w-4 h-4 text-green-600"}):(0,a.jsx)(v.Z,{className:"w-4 h-4"})})})]}),(0,a.jsxs)("div",{className:"space-y-4 mt-3",children:[(l.command||l.last_creation_command)&&(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3",children:(0,a.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all",children:l.command||l.last_creation_command})})}),(l.task_yaml||l.last_creation_yaml)&&"{}"!==l.task_yaml&&"{}"!==l.last_creation_yaml&&!(null===(t=l.cluster||l.name)||void 0===t?void 0:t.startsWith("sky-jobs-controller-"))&&!(null===(s=l.cluster||l.name)||void 0===s?void 0:s.startsWith("sky-serve-controller-"))&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center mb-2",children:[(0,a.jsxs)("button",{onClick:()=>{A(!M)},className:"flex items-center text-left focus:outline-none text-gray-700 hover:text-gray-900 transition-colors duration-200",children:[M?(0,a.jsx)(g.Z,{className:"w-4 h-4 mr-1"}):(0,a.jsx)(j.Z,{className:"w-4 h-4 mr-1"}),(0,a.jsx)("span",{className:"text-base",children:"Show SkyPilot YAML"})]}),(0,a.jsx)(b.WH,{content:L?"Copied!":"Copy YAML",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:P,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:L?(0,a.jsx)(f.Z,{className:"w-4 h-4 text-green-600"}):(0,a.jsx)(v.Z,{className:"w-4 h-4"})})})]}),M&&(0,a.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 max-h-96 overflow-y-auto",children:(0,a.jsx)("pre",{className:"text-sm text-gray-800 font-mono whitespace-pre-wrap",children:(0,C._q)(l.task_yaml||l.last_creation_yaml)})})]})]})]})]})})]})}),l&&"Kubernetes (in-cluster)"===l.full_infra&&_&&(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"GPU Metrics"})}),(0,a.jsxs)("div",{className:"mb-4 p-4 bg-gray-50 rounded-md border border-gray-200",children:[(0,a.jsx)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Time Range:"}),(0,a.jsx)("div",{className:"flex gap-1",children:[{label:"15m",value:"15m"},{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"}].map(e=>(0,a.jsx)("button",{onClick:()=>y(e.value),className:"px-2 py-1 text-xs font-medium rounded border transition-colors ".concat(h.from==="now-".concat(e.value)&&"now"===h.to?"bg-sky-blue text-white border-sky-blue":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"),children:e.label},e.value))})]})}),(0,a.jsxs)("div",{className:"mt-2 text-xs text-gray-500",children:["Showing: ",null==l?void 0:l.cluster," • Time: ",h.from," to"," ",h.to,w&&(0,a.jsx)("span",{children:" • Finding cluster data..."})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:p("1"),width:"100%",height:"400",frameBorder:"0",title:"GPU Utilization",className:"rounded"},"gpu-util-".concat(null==l?void 0:l.cluster,"-").concat(h.from,"-").concat(h.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:p("2"),width:"100%",height:"400",frameBorder:"0",title:"GPU Memory Utilization",className:"rounded"},"gpu-memory-".concat(null==l?void 0:l.cluster,"-").concat(h.from,"-").concat(h.to))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:p("4"),width:"100%",height:"400",frameBorder:"0",title:"GPU Power Usage",className:"rounded"},"gpu-power-".concat(null==l?void 0:l.cluster,"-").concat(h.from,"-").concat(h.to))})})]})]})})}),!S&&(0,a.jsx)("div",{className:"mb-8",children:(0,a.jsx)(n.ClusterJobs,{clusterName:l.cluster,clusterJobData:i,loading:c,refreshClusterJobsOnly:d})})]})}t.default=function(){let e=(0,i.useRouter)(),{cluster:t}=e.query,[s,n]=(0,r.useState)(!1),[c,m]=(0,r.useState)(!0),[f,v]=(0,r.useState)(!1),[g,j]=(0,r.useState)(!1),[w,C]=(0,r.useState)(null),[k,M]=(0,r.useState)(!1),[A,L]=(0,r.useState)(!1),O=(0,N.X)(),[R,T]=(0,r.useState)({from:"now-1h",to:"now"}),{clusterData:P,clusterJobData:E,loading:Z,clusterDetailsLoading:U,clusterJobsLoading:D,refreshData:G,refreshClusterJobsOnly:I}=(0,u.QL)({cluster:t}),[J,Y]=(0,r.useState)(null),[F,W]=(0,r.useState)(!1),[q,H]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{H(await (0,y.TO)())})()},[]);let z=(0,r.useCallback)(async()=>{if(q&&(null==P?void 0:P.cluster)){W(!0);try{let e=(0,y.ki)(),t=await fetch("".concat(e).concat("/api/datasources/proxy/1/api/v1/label/label_skypilot_cluster/values"),{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(t.ok){let e=await t.json();if(e.data&&e.data.length>0){let t=e.data.find(e=>e.startsWith(P.cluster));t&&Y(t)}}}catch(e){console.error("Error fetching matching cluster:",e)}finally{W(!1)}}},[null==P?void 0:P.cluster,q]);(0,r.useEffect)(()=>{q&&(null==P?void 0:P.cluster)&&z()},[null==P?void 0:P.cluster,z,q]);let V=e=>{let t=(0,y.ki)(),s=J||(null==P?void 0:P.cluster)||"$__all";return"".concat(t,"/d-solo/skypilot-dcgm-gpu/skypilot-dcgm-gpu-metrics?orgId=1&from=").concat(encodeURIComponent(R.from),"&to=").concat(encodeURIComponent(R.to),"&timezone=browser&var-cluster=").concat(encodeURIComponent(s),"&var-instance=$__all&var-gpu=$__all&theme=light&panelId=").concat(e,"&__feature.dashboardSceneSolo")};r.useEffect(()=>{!U&&c&&m(!1)},[U,c]),r.useEffect(()=>{let e=async()=>{if(t&&!U&&!P){L(!0);try{let e=(await x.default.get(u.uR)).find(e=>e.cluster_hash===t||e.cluster===t);e&&(C(e),M(!0))}catch(e){console.error("Error fetching cluster history:",e)}finally{L(!1)}}};U||P||e()},[t,U,P]);let $=async()=>{n(!0),await G(),n(!1)},B=e=>{T({from:"now-".concat(e),to:"now"})};if(!e.isReady)return(0,a.jsx)("div",{children:"Loading..."});let K=t?"Cluster: ".concat(t," | SkyPilot Dashboard"):"Cluster Details | SkyPilot Dashboard";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(_(),{children:(0,a.jsx)("title",{children:K})}),(0,a.jsxs)(a.Fragment,{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)(o(),{href:"/clusters",className:"text-sky-blue hover:underline",children:"Sky Clusters"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)(o(),{href:"/clusters/".concat(t),className:"text-sky-blue hover:underline",children:t})]}),(0,a.jsx)("div",{className:"text-sm flex items-center",children:(0,a.jsxs)("div",{className:"text-sm flex items-center",children:[(U||s)&&(0,a.jsxs)("div",{className:"flex items-center mr-4",children:[(0,a.jsx)(l.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),P&&(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)(b.WH,{content:"Refresh",className:"text-sm text-muted-foreground",children:(0,a.jsxs)("button",{onClick:$,disabled:U||s,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4 mr-1.5"}),!O&&(0,a.jsx)("span",{children:"Refresh"})]})}),(0,a.jsx)(d.Status2Actions,{withLabel:!0,cluster:P.cluster,status:P.status,onOpenSSHModal:()=>{v(!0)},onOpenVSCodeModal:()=>{j(!0)}})]})]})})]}),U&&c||A?(0,a.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,a.jsx)(l.Z,{size:24,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading cluster details..."})]}):P?(0,a.jsx)(S,{clusterData:P,clusterJobData:E,clusterJobsLoading:D,refreshClusterJobsOnly:I,isVSCodeModalOpen:g,setIsVSCodeModalOpen:j,timeRange:R,handleTimeRangePreset:B,buildGrafanaMetricsUrl:V,matchedClusterName:J,isLoadingClusterMatch:F,isGrafanaAvailable:q,isHistoricalCluster:!1}):k&&w?(0,a.jsx)(S,{clusterData:w,clusterJobData:[],clusterJobsLoading:!1,refreshClusterJobsOnly:()=>{},isVSCodeModalOpen:!1,setIsVSCodeModalOpen:()=>{},timeRange:R,handleTimeRangePreset:B,buildGrafanaMetricsUrl:V,matchedClusterName:null,isLoadingClusterMatch:!1,isGrafanaAvailable:!1,isHistoricalCluster:!0}):(0,a.jsx)("div",{className:"flex justify-center items-center py-12",children:(0,a.jsx)("span",{className:"text-gray-500",children:"Cluster not found in active clusters or history."})}),(0,a.jsx)(p.Oh,{isOpen:f,onClose:()=>v(!1),cluster:t}),(0,a.jsx)(p._R,{isOpen:g,onClose:()=>j(!1),cluster:t})]})]})}},7853:function(e,t,s){"use strict";s.d(t,{TO:function(){return l},ki:function(){return n}});let a=null,r=null,l=async()=>null!==a?a:r||(r=(async()=>{try{let e="".concat(window.location.origin,"/grafana"),t=await fetch("".concat(e,"/api/health"),{method:"GET",credentials:"include",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return 200==t.status}catch(e){return console.debug("Grafana availability check failed:",e),a=!1,!1}finally{r=null}})()),n=()=>"".concat(window.location.origin,"/grafana")},9008:function(e,t,s){e.exports=s(7219)}},function(e){e.O(0,[616,230,799,664,804,798,947,989,470,990,969,43,973,938,871,888,774,179],function(){return e(e.s=8706)}),_N_E=e.O()}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{5833:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters",function(){return t(3450)}])},3450:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return l}});var r=t(5893);t(7294);var s=t(9008),u=t.n(s),i=t(5152);let c=t.n(i)()(()=>Promise.all([t.e(616),t.e(230),t.e(799),t.e(664),t.e(804),t.e(798),t.e(989),t.e(470),t.e(990),t.e(969),t.e(43),t.e(973),t.e(871),t.e(491)]).then(t.bind(t,9037)).then(e=>e.Clusters),{loadableGenerated:{webpack:()=>[9037]},ssr:!1});function l(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u(),{children:(0,r.jsx)("title",{children:"Clusters | SkyPilot Dashboard"})}),(0,r.jsx)(c,{})]})}},9008:function(e,n,t){e.exports=t(7219)}},function(e){e.O(0,[888,774,179],function(){return e(e.s=5833)}),_N_E=e.O()}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[490],{4483:function(n,e,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/config",function(){return t(9649)}])},9649:function(n,e,t){"use strict";t.r(e),t.d(e,{default:function(){return c}});var r=t(5893);t(7294);var i=t(9008),o=t.n(i),u=t(5152);let s=t.n(u)()(()=>Promise.all([t.e(616),t.e(230),t.e(799),t.e(798),t.e(989),t.e(990),t.e(25)]).then(t.bind(t,4042)).then(n=>n.Config),{loadableGenerated:{webpack:()=>[4042]},ssr:!1});function c(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o(),{children:(0,r.jsx)("title",{children:"SkyPilot API Server | SkyPilot Dashboard"})}),(0,r.jsx)(s,{})]})}},9008:function(n,e,t){n.exports=t(7219)}},function(n){n.O(0,[888,774,179],function(){return n(n.s=4483)}),_N_E=n.O()}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[233],{1803:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/infra/[context]",function(){return t(1200)}])},1200:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return o}});var r=t(5893);t(7294);var i=t(9008),s=t.n(i),u=t(5152);let c=t.n(u)()(()=>Promise.all([t.e(616),t.e(230),t.e(799),t.e(664),t.e(804),t.e(875),t.e(989),t.e(470),t.e(990),t.e(969),t.e(43),t.e(984)]).then(t.bind(t,9984)).then(e=>e.GPUs),{loadableGenerated:{webpack:()=>[9984]},ssr:!1});function o(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s(),{children:(0,r.jsx)("title",{children:"Infra | SkyPilot Dashboard"})}),(0,r.jsx)(c,{})]})}},9008:function(e,n,t){e.exports=t(7219)}},function(e){e.O(0,[888,774,179],function(){return e(e.s=1803)}),_N_E=e.O()}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[588],{3177:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/infra",function(){return t(9054)}])},9054:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return c}});var r=t(5893);t(7294);var i=t(9008),s=t.n(i),u=t(5152);let a=t.n(u)()(()=>Promise.all([t.e(616),t.e(230),t.e(799),t.e(664),t.e(804),t.e(875),t.e(989),t.e(470),t.e(990),t.e(969),t.e(43),t.e(984)]).then(t.bind(t,9984)).then(e=>e.GPUs),{loadableGenerated:{webpack:()=>[9984]},ssr:!1});function c(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s(),{children:(0,r.jsx)("title",{children:"Infra | SkyPilot Dashboard"})}),(0,r.jsx)(a,{})]})}},9008:function(e,n,t){e.exports=t(7219)}},function(e){e.O(0,[888,774,179],function(){return e(e.s=3177)}),_N_E=e.O()}]);
|
sky/dashboard/out/_next/static/chunks/pages/{jobs-26da173e20af16e4.js → jobs-0a5695ff3075d94a.js}
RENAMED
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[142],{1446:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs",function(){return t(8929)}])},8929:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return a}});var r=t(5893);t(7294);var s=t(9008),i=t.n(s),o=t(5152);let u=t.n(o)()(()=>Promise.all([t.e(616),t.e(230),t.e(799),t.e(664),t.e(804),t.e(947),t.e(989),t.e(470),t.e(
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[142],{1446:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs",function(){return t(8929)}])},8929:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return a}});var r=t(5893);t(7294);var s=t(9008),i=t.n(s),o=t(5152);let u=t.n(o)()(()=>Promise.all([t.e(616),t.e(230),t.e(799),t.e(664),t.e(804),t.e(947),t.e(989),t.e(470),t.e(990),t.e(969),t.e(43),t.e(973),t.e(938),t.e(430)]).then(t.bind(t,938)).then(e=>e.ManagedJobs),{loadableGenerated:{webpack:()=>[938]},ssr:!1});function a(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i(),{children:(0,r.jsx)("title",{children:"Managed Jobs | SkyPilot Dashboard"})}),(0,r.jsx)(u,{})]})}},9008:function(e,n,t){e.exports=t(7219)}},function(e){e.O(0,[888,774,179],function(){return e(e.s=1446)}),_N_E=e.O()}]);
|
sky/dashboard/out/_next/static/chunks/pages/{users-ce29e7420385563d.js → users-4978cbb093e141e7.js}
RENAMED
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[892],{7476:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/users",function(){return r(5126)}])},5126:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return o}});var t=r(5893);r(7294);var s=r(9008),u=r.n(s),i=r(5152);let c=r.n(i)()(()=>Promise.all([r.e(616),r.e(230),r.e(799),r.e(664),r.e(804),r.e(697),r.e(989),r.e(470),r.e(
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[892],{7476:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/users",function(){return r(5126)}])},5126:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return o}});var t=r(5893);r(7294);var s=r(9008),u=r.n(s),i=r(5152);let c=r.n(i)()(()=>Promise.all([r.e(616),r.e(230),r.e(799),r.e(664),r.e(804),r.e(697),r.e(989),r.e(470),r.e(990),r.e(969),r.e(43),r.e(690)]).then(r.bind(r,8310)).then(e=>e.Users),{loadableGenerated:{webpack:()=>[8310]},ssr:!1});function o(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u(),{children:(0,t.jsx)("title",{children:"Users | SkyPilot Dashboard"})}),(0,t.jsx)(c,{})]})}},9008:function(e,n,r){e.exports=r(7219)}},function(e){e.O(0,[888,774,179],function(){return e(e.s=7476)}),_N_E=e.O()}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[963],{5113:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/workspace/new",function(){return r(4250)}])},4250:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return u}});var t=r(5893);r(7294);var s=r(9008),c=r.n(s),i=r(5152);let o=r.n(i)()(()=>Promise.all([r.e(230),r.e(664),r.e(990),r.e(785)]).then(r.bind(r,3785)).then(e=>e.NewWorkspace),{loadableGenerated:{webpack:()=>[3785]},ssr:!1});function u(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c(),{children:(0,t.jsx)("title",{children:"New Workspace | SkyPilot Dashboard"})}),(0,t.jsx)(o,{})]})}},9008:function(e,n,r){e.exports=r(7219)}},function(e){e.O(0,[888,774,179],function(){return e(e.s=5113)}),_N_E=e.O()}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[324,430],{7614:function(n,e,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/workspaces/[name]",function(){return r(9431)}])},9431:function(n,e,r){"use strict";r.r(e),r.d(e,{default:function(){return i}});var u=r(5893);r(7294);var t=r(1163),l=r(1141);function i(){let n=(0,t.useRouter)(),{name:e}=n.query;return n.isReady&&e?(0,u.jsx)(l.WorkspaceEditor,{workspaceName:e}):(0,u.jsx)("div",{children:"Loading..."})}},9008:function(n,e,r){n.exports=r(7219)},1163:function(n,e,r){n.exports=r(6036)},2003:function(n,e,r){"use strict";r.d(e,{j:function(){return i}});var u=r(512);let t=n=>"boolean"==typeof n?`${n}`:0===n?"0":n,l=u.W,i=(n,e)=>r=>{var u;if((null==e?void 0:e.variants)==null)return l(n,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(n=>{let e=null==r?void 0:r[n],u=null==s?void 0:s[n];if(null===e)return null;let l=t(e)||t(u);return i[n][l]}),c=r&&Object.entries(r).reduce((n,e)=>{let[r,u]=e;return void 0===u||(n[r]=u),n},{});return l(n,o,null==e?void 0:null===(u=e.compoundVariants)||void 0===u?void 0:u.reduce((n,e)=>{let{class:r,className:u,...t}=e;return Object.entries(t).every(n=>{let[e,r]=n;return Array.isArray(r)?r.includes({...s,...c}[e]):({...s,...c})[e]===r})?[...n,r,u]:n},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}},function(n){n.O(0,[616,230,799,664,804,798,947,989,470,990,969,43,973,938,141,888,774,179],function(){return n(n.s=7614)}),_N_E=n.O()}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[590],{2592:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/workspaces",function(){return r(4980)}])},4980:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return u}});var t=r(5893);r(7294);var s=r(9008),c=r.n(s),i=r(5152);let o=r.n(i)()(()=>Promise.all([r.e(616),r.e(230),r.e(799),r.e(664),r.e(804),r.e(798),r.e(947),r.e(989),r.e(470),r.e(
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[590],{2592:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/workspaces",function(){return r(4980)}])},4980:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return u}});var t=r(5893);r(7294);var s=r(9008),c=r.n(s),i=r(5152);let o=r.n(i)()(()=>Promise.all([r.e(616),r.e(230),r.e(799),r.e(664),r.e(804),r.e(798),r.e(947),r.e(989),r.e(470),r.e(990),r.e(969),r.e(43),r.e(973),r.e(938),r.e(982)]).then(r.bind(r,5443)).then(e=>e.Workspaces),{loadableGenerated:{webpack:()=>[5443]},ssr:!1});function u(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c(),{children:(0,t.jsx)("title",{children:"Workspaces | SkyPilot Dashboard"})}),(0,t.jsx)(o,{})]})}},9008:function(e,n,r){e.exports=r(7219)}},function(e){e.O(0,[888,774,179],function(){return e(e.s=2592)}),_N_E=e.O()}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){"use strict";var e,t,n,r,c,o,u,a,i,f={},s={};function d(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}},r=!0;try{f[e](n,n.exports,d),r=!1}finally{r&&delete s[e]}return n.exports}d.m=f,e=[],d.O=function(t,n,r,c){if(n){c=c||0;for(var o=e.length;o>0&&e[o-1][2]>c;o--)e[o]=e[o-1];e[o]=[n,r,c];return}for(var u=1/0,o=0;o<e.length;o++){for(var n=e[o][0],r=e[o][1],c=e[o][2],a=!0,i=0;i<n.length;i++)u>=c&&Object.keys(d.O).every(function(e){return d.O[e](n[i])})?n.splice(i--,1):(a=!1,c<u&&(u=c));if(a){e.splice(o--,1);var f=r();void 0!==f&&(t=f)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var c=Object.create(null);d.r(c);var o={};t=t||[null,n({}),n([]),n(n)];for(var u=2&r&&e;"object"==typeof u&&!~t.indexOf(u);u=n(u))Object.getOwnPropertyNames(u).forEach(function(t){o[t]=function(){return e[t]}});return o.default=function(){return e},d.d(c,o),c},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return 544===e?"static/chunks/544.110e53813fb98e2e.js":491===e?"static/chunks/491.b3d264269613fe09.js":937===e?"static/chunks/937.3759f538f11a0953.js":25===e?"static/chunks/25.76c246239df93d50.js":875===e?"static/chunks/875.52c962183328b3f2.js":984===e?"static/chunks/984.e8bac186a24e5178.js":430===e?"static/chunks/430.ed51037d1a4a438b.js":697===e?"static/chunks/697.6460bf72e760addd.js":690===e?"static/chunks/690.55f9eed3be903f56.js":645===e?"static/chunks/645.961f08e39b8ce447.js":785===e?"static/chunks/785.dc2686c3c1235554.js":982===e?"static/chunks/982.1b61658204416b0f.js":"static/chunks/"+e+"-"+({43:"36177d00f6956ab2",141:"fa5a20cbf401b351",230:"d6e363362017ff3a",470:"92dd1614396389be",616:"d6128fa9e7cae6e6",664:"047bc03493fda379",798:"c0525dc3f21e488d",799:"3625946b2ec2eb30",804:"4c9fc53aa74bc191",871:"3db673be3ee3750b",938:"068520cc11738deb",947:"6620842ef80ae879",969:"d3a0b53f728d280a",973:"81b2d057178adb76",989:"db34c16ad7ea6155",990:"0ad5ea1699e03ee8"})[e]+".js"},d.miniCssF=function(e){},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},c="_N_E:",d.l=function(e,t,n,o){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var u,a,i=document.getElementsByTagName("script"),f=0;f<i.length;f++){var s=i[f];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==c+n){u=s;break}}u||(a=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,d.nc&&u.setAttribute("nonce",d.nc),u.setAttribute("data-webpack",c+n),u.src=d.tu(e)),r[e]=[t];var l=function(t,n){u.onerror=u.onload=null,clearTimeout(b);var c=r[e];if(delete r[e],u.parentNode&&u.parentNode.removeChild(u),c&&c.forEach(function(e){return e(n)}),t)return t(n)},b=setTimeout(l.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=l.bind(null,u.onerror),u.onload=l.bind(null,u.onload),a&&document.head.appendChild(u)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.tt=function(){return void 0===o&&(o={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(o=trustedTypes.createPolicy("nextjs#bundler",o))),o},d.tu=function(e){return d.tt().createScriptURL(e)},d.p="/dashboard/_next/",u={272:0},d.f.j=function(e,t){var n=d.o(u,e)?u[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(272!=e){var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var c=d.p+d.u(e),o=Error();d.l(c,function(t){if(d.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;o.message="Loading chunk "+e+" failed.\n("+r+": "+c+")",o.name="ChunkLoadError",o.type=r,o.request=c,n[1](o)}},"chunk-"+e,e)}else u[e]=0}},d.O.j=function(e){return 0===u[e]},a=function(e,t){var n,r,c=t[0],o=t[1],a=t[2],i=0;if(c.some(function(e){return 0!==u[e]})){for(n in o)d.o(o,n)&&(d.m[n]=o[n]);if(a)var f=a(d)}for(e&&e(t);i<c.length;i++)r=c[i],d.o(u,r)&&u[r]&&u[r][0](),u[r]=0;return d.O(f)},(i=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(a.bind(null,0)),i.push=a.bind(null,i.push.bind(i)),d.nc=void 0}();
|