skypilot-nightly 1.0.0.dev20250624__py3-none-any.whl → 1.0.0.dev20250626__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/backends/backend_utils.py +26 -11
- sky/backends/cloud_vm_ray_backend.py +16 -5
- sky/client/cli/command.py +232 -9
- sky/client/sdk.py +195 -91
- sky/clouds/aws.py +10 -7
- sky/clouds/azure.py +10 -7
- sky/clouds/cloud.py +2 -0
- sky/clouds/cudo.py +2 -0
- sky/clouds/do.py +10 -7
- sky/clouds/fluidstack.py +2 -0
- sky/clouds/gcp.py +10 -7
- sky/clouds/hyperbolic.py +10 -7
- sky/clouds/ibm.py +2 -0
- sky/clouds/kubernetes.py +26 -9
- sky/clouds/lambda_cloud.py +10 -7
- sky/clouds/nebius.py +10 -7
- sky/clouds/oci.py +10 -7
- sky/clouds/paperspace.py +10 -7
- sky/clouds/runpod.py +10 -7
- sky/clouds/scp.py +10 -7
- sky/clouds/ssh.py +36 -0
- sky/clouds/vast.py +10 -7
- sky/clouds/vsphere.py +2 -0
- sky/core.py +21 -0
- sky/dag.py +14 -0
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/bs6UB9V4Jq10TIZ5x-kBK/_buildManifest.js +1 -0
- sky/dashboard/out/_next/static/chunks/141-fa5a20cbf401b351.js +11 -0
- sky/dashboard/out/_next/static/chunks/230-d6e363362017ff3a.js +1 -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/470-92dd1614396389be.js +1 -0
- sky/dashboard/out/_next/static/chunks/544.110e53813fb98e2e.js +1 -0
- sky/dashboard/out/_next/static/chunks/645.961f08e39b8ce447.js +1 -0
- sky/dashboard/out/_next/static/chunks/690.55f9eed3be903f56.js +16 -0
- sky/dashboard/out/_next/static/chunks/697.6460bf72e760addd.js +20 -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/{_app-ce31493da9747ef4.js → _app-9a3ce3170d2edcec.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-aff040d7bc5d0086.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-8040f2483897ed0c.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/{clusters-7e9736af1c6345a6.js → clusters-f119a5630a1efd61.js} +1 -1
- 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/[job]-e4b23128db0774cd.js +16 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs-0a5695ff3075d94a.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/users-4978cbb093e141e7.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/volumes-476b670ef33d1ecd.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspace/{new-31aa8bdcb7592635.js → new-5b59bce9eb208d84.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-cb7e720b739de53a.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspaces-50e230828730cfb3.js +1 -0
- 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 -0
- sky/dashboard/out/workspace/new.html +1 -1
- sky/dashboard/out/workspaces/[name].html +1 -1
- sky/dashboard/out/workspaces.html +1 -1
- sky/data/storage_utils.py +2 -4
- sky/exceptions.py +15 -0
- sky/execution.py +5 -0
- sky/global_user_state.py +129 -0
- sky/jobs/client/sdk.py +13 -11
- sky/jobs/server/core.py +4 -0
- sky/models.py +16 -0
- sky/provision/__init__.py +26 -0
- sky/provision/kubernetes/__init__.py +3 -0
- sky/provision/kubernetes/instance.py +38 -77
- sky/provision/kubernetes/utils.py +70 -4
- sky/provision/kubernetes/volume.py +147 -0
- sky/resources.py +20 -76
- sky/serve/client/sdk.py +13 -13
- sky/serve/server/core.py +5 -1
- sky/server/common.py +40 -5
- sky/server/constants.py +5 -1
- sky/server/metrics.py +105 -0
- sky/server/requests/executor.py +30 -14
- sky/server/requests/payloads.py +16 -0
- sky/server/requests/requests.py +35 -1
- sky/server/rest.py +153 -0
- sky/server/server.py +70 -43
- sky/server/state.py +20 -0
- sky/server/stream_utils.py +8 -3
- sky/server/uvicorn.py +153 -13
- sky/setup_files/dependencies.py +2 -0
- sky/skylet/constants.py +19 -3
- 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/task.py +141 -18
- sky/templates/kubernetes-ray.yml.j2 +30 -1
- sky/users/permission.py +2 -0
- sky/utils/context.py +3 -1
- sky/utils/kubernetes/deploy_remote_cluster.py +12 -185
- sky/utils/kubernetes/ssh_utils.py +221 -0
- sky/utils/resources_utils.py +66 -0
- sky/utils/rich_utils.py +6 -0
- sky/utils/schemas.py +146 -3
- sky/utils/status_lib.py +10 -0
- sky/utils/validator.py +11 -1
- sky/volumes/__init__.py +0 -0
- sky/volumes/client/__init__.py +0 -0
- sky/volumes/client/sdk.py +64 -0
- sky/volumes/server/__init__.py +0 -0
- sky/volumes/server/core.py +199 -0
- sky/volumes/server/server.py +85 -0
- sky/volumes/utils.py +158 -0
- sky/volumes/volume.py +198 -0
- {skypilot_nightly-1.0.0.dev20250624.dist-info → skypilot_nightly-1.0.0.dev20250626.dist-info}/METADATA +2 -1
- {skypilot_nightly-1.0.0.dev20250624.dist-info → skypilot_nightly-1.0.0.dev20250626.dist-info}/RECORD +135 -115
- sky/dashboard/out/_next/static/chunks/211.692afc57e812ae1a.js +0 -1
- sky/dashboard/out/_next/static/chunks/350.9e123a4551f68b0d.js +0 -1
- sky/dashboard/out/_next/static/chunks/37-4650f214e2119168.js +0 -6
- sky/dashboard/out/_next/static/chunks/42.2273cc2415291ceb.js +0 -6
- sky/dashboard/out/_next/static/chunks/443.b2242d0efcdf5f47.js +0 -1
- sky/dashboard/out/_next/static/chunks/470-1494c899266cf5c9.js +0 -1
- sky/dashboard/out/_next/static/chunks/513.309df9e18a9ff005.js +0 -1
- sky/dashboard/out/_next/static/chunks/641.c8e452bc5070a630.js +0 -1
- sky/dashboard/out/_next/static/chunks/682.4dd5dc116f740b5f.js +0 -6
- sky/dashboard/out/_next/static/chunks/760-a89d354797ce7af5.js +0 -1
- sky/dashboard/out/_next/static/chunks/843-bde186946d353355.js +0 -11
- sky/dashboard/out/_next/static/chunks/856-bfddc18e16f3873c.js +0 -1
- sky/dashboard/out/_next/static/chunks/901-b424d293275e1fd7.js +0 -1
- sky/dashboard/out/_next/static/chunks/973-56412c7976b4655b.js +0 -1
- sky/dashboard/out/_next/static/chunks/984.ae8c08791d274ca0.js +0 -50
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-4e065c812a52460b.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-520ec1ab65e2f2a4.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/config-e4f473661889e7cd.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/infra/[context]-00fd23b9577492ca.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/infra-8a4bf7370d4d9bb7.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-171c27f4ca94861c.js +0 -16
- sky/dashboard/out/_next/static/chunks/pages/jobs-55e5bcb16d563231.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/users-c9f4d785cdaa52d8.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-ecc5a7003776cfa7.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces-f00cba35691483b1.js +0 -1
- sky/dashboard/out/_next/static/chunks/webpack-c85998e6a5722f21.js +0 -1
- sky/dashboard/out/_next/static/css/6ab927686b492a4a.css +0 -3
- sky/dashboard/out/_next/static/zsALxITkbP8J8NVwSDwMo/_buildManifest.js +0 -1
- /sky/dashboard/out/_next/static/{zsALxITkbP8J8NVwSDwMo → bs6UB9V4Jq10TIZ5x-kBK}/_ssgManifest.js +0 -0
- /sky/dashboard/out/_next/static/chunks/{938-ce7991c156584b06.js → 938-068520cc11738deb.js} +0 -0
- {skypilot_nightly-1.0.0.dev20250624.dist-info → skypilot_nightly-1.0.0.dev20250626.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250624.dist-info → skypilot_nightly-1.0.0.dev20250626.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250624.dist-info → skypilot_nightly-1.0.0.dev20250626.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250624.dist-info → skypilot_nightly-1.0.0.dev20250626.dist-info}/top_level.txt +0 -0
@@ -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))}}}]);
|
sky/dashboard/out/_next/static/chunks/pages/{_app-ce31493da9747ef4.js → _app-9a3ce3170d2edcec.js}
RENAMED
@@ -17,4 +17,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
17
17
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
18
18
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
19
19
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
20
|
-
*/Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return f}});let n=r(260)._(r(7294)),o=r(6725),l=[],u=[],a=!1;function i(e){let t=e(),r={loading:!0,loaded:null,error:null};return r.promise=t.then(e=>(r.loading=!1,r.loaded=e,e)).catch(e=>{throw r.loading=!1,r.error=e,e}),r}class s{promise(){return this._res.promise}retry(){this._clearTimeouts(),this._res=this._loadFn(this._opts.loader),this._state={pastDelay:!1,timedOut:!1};let{_res:e,_opts:t}=this;e.loading&&("number"==typeof t.delay&&(0===t.delay?this._state.pastDelay=!0:this._delay=setTimeout(()=>{this._update({pastDelay:!0})},t.delay)),"number"==typeof t.timeout&&(this._timeout=setTimeout(()=>{this._update({timedOut:!0})},t.timeout))),this._res.promise.then(()=>{this._update({}),this._clearTimeouts()}).catch(e=>{this._update({}),this._clearTimeouts()}),this._update({})}_update(e){this._state={...this._state,error:this._res.error,loaded:this._res.loaded,loading:this._res.loading,...e},this._callbacks.forEach(e=>e())}_clearTimeouts(){clearTimeout(this._delay),clearTimeout(this._timeout)}getCurrentValue(){return this._state}subscribe(e){return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}constructor(e,t){this._loadFn=e,this._opts=t,this._callbacks=new Set,this._delay=null,this._timeout=null,this.retry()}}function d(e){return function(e,t){let r=Object.assign({loader:null,loading:null,delay:200,timeout:null,webpack:null,modules:null},t),l=null;function i(){if(!l){let t=new s(e,r);l={getCurrentValue:t.getCurrentValue.bind(t),subscribe:t.subscribe.bind(t),retry:t.retry.bind(t),promise:t.promise.bind(t)}}return l.promise()}if(!a){let e=r.webpack?r.webpack():r.modules;e&&u.push(t=>{for(let r of e)if(t.includes(r))return i()})}function d(e,t){!function(){i();let e=n.default.useContext(o.LoadableContext);e&&Array.isArray(r.modules)&&r.modules.forEach(t=>{e(t)})}();let u=n.default.useSyncExternalStore(l.subscribe,l.getCurrentValue,l.getCurrentValue);return n.default.useImperativeHandle(t,()=>({retry:l.retry}),[]),n.default.useMemo(()=>{var t;return u.loading||u.error?n.default.createElement(r.loading,{isLoading:u.loading,pastDelay:u.pastDelay,timedOut:u.timedOut,error:u.error,retry:l.retry}):u.loaded?n.default.createElement((t=u.loaded)&&t.default?t.default:t,e):null},[e,u])}return d.preload=()=>i(),d.displayName="LoadableComponent",n.default.forwardRef(d)}(i,e)}function c(e,t){let r=[];for(;e.length;){let n=e.pop();r.push(n(t))}return Promise.all(r).then(()=>{if(e.length)return c(e,t)})}d.preloadAll=()=>new Promise((e,t)=>{c(l).then(e,t)}),d.preloadReady=e=>(void 0===e&&(e=[]),new Promise(t=>{let r=()=>(a=!0,t());c(u,e).then(r,r)})),window.__NEXT_PRELOADREADY=d.preloadReady;let f=d},3225:function(e,t,r){"use strict";r.d(t,{$m:function(){return i},Bo:function(){return u},GW:function(){return o},MN:function(){return s},f4:function(){return n},iW:function(){return a},mF:function(){return l}});let n="/internal/dashboard",o="/dashboard";"/api/v1".replace(/^http/,"ws");let l="ClusterDoesNotExist",u="NotSupportedError",a="ClusterNotUpError",i=["AWS","Azure","GCP","IBM","Lambda","SCP","OCI","RunPod","VAST","vSphere","Cudo","FluidStack","Paperspace","DO","Nebius"],s=Object.fromEntries([...i.map(e=>[e.toLowerCase(),e]),["kubernetes","Kubernetes"],["ssh","SSH Node Pool"]])},2586:function(e,t,r){"use strict";r.r(t);var n=r(5893),o=r(7294),l=r(5152),u=r.n(l),a=r(5697),i=r.n(a);r(6501);var s=r(3225);let d=u()(()=>Promise.all([r.e(616),r.e(
|
20
|
+
*/Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return f}});let n=r(260)._(r(7294)),o=r(6725),l=[],u=[],a=!1;function i(e){let t=e(),r={loading:!0,loaded:null,error:null};return r.promise=t.then(e=>(r.loading=!1,r.loaded=e,e)).catch(e=>{throw r.loading=!1,r.error=e,e}),r}class s{promise(){return this._res.promise}retry(){this._clearTimeouts(),this._res=this._loadFn(this._opts.loader),this._state={pastDelay:!1,timedOut:!1};let{_res:e,_opts:t}=this;e.loading&&("number"==typeof t.delay&&(0===t.delay?this._state.pastDelay=!0:this._delay=setTimeout(()=>{this._update({pastDelay:!0})},t.delay)),"number"==typeof t.timeout&&(this._timeout=setTimeout(()=>{this._update({timedOut:!0})},t.timeout))),this._res.promise.then(()=>{this._update({}),this._clearTimeouts()}).catch(e=>{this._update({}),this._clearTimeouts()}),this._update({})}_update(e){this._state={...this._state,error:this._res.error,loaded:this._res.loaded,loading:this._res.loading,...e},this._callbacks.forEach(e=>e())}_clearTimeouts(){clearTimeout(this._delay),clearTimeout(this._timeout)}getCurrentValue(){return this._state}subscribe(e){return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}constructor(e,t){this._loadFn=e,this._opts=t,this._callbacks=new Set,this._delay=null,this._timeout=null,this.retry()}}function d(e){return function(e,t){let r=Object.assign({loader:null,loading:null,delay:200,timeout:null,webpack:null,modules:null},t),l=null;function i(){if(!l){let t=new s(e,r);l={getCurrentValue:t.getCurrentValue.bind(t),subscribe:t.subscribe.bind(t),retry:t.retry.bind(t),promise:t.promise.bind(t)}}return l.promise()}if(!a){let e=r.webpack?r.webpack():r.modules;e&&u.push(t=>{for(let r of e)if(t.includes(r))return i()})}function d(e,t){!function(){i();let e=n.default.useContext(o.LoadableContext);e&&Array.isArray(r.modules)&&r.modules.forEach(t=>{e(t)})}();let u=n.default.useSyncExternalStore(l.subscribe,l.getCurrentValue,l.getCurrentValue);return n.default.useImperativeHandle(t,()=>({retry:l.retry}),[]),n.default.useMemo(()=>{var t;return u.loading||u.error?n.default.createElement(r.loading,{isLoading:u.loading,pastDelay:u.pastDelay,timedOut:u.timedOut,error:u.error,retry:l.retry}):u.loaded?n.default.createElement((t=u.loaded)&&t.default?t.default:t,e):null},[e,u])}return d.preload=()=>i(),d.displayName="LoadableComponent",n.default.forwardRef(d)}(i,e)}function c(e,t){let r=[];for(;e.length;){let n=e.pop();r.push(n(t))}return Promise.all(r).then(()=>{if(e.length)return c(e,t)})}d.preloadAll=()=>new Promise((e,t)=>{c(l).then(e,t)}),d.preloadReady=e=>(void 0===e&&(e=[]),new Promise(t=>{let r=()=>(a=!0,t());c(u,e).then(r,r)})),window.__NEXT_PRELOADREADY=d.preloadReady;let f=d},3225:function(e,t,r){"use strict";r.d(t,{$m:function(){return i},Bo:function(){return u},GW:function(){return o},MN:function(){return s},f4:function(){return n},iW:function(){return a},mF:function(){return l}});let n="/internal/dashboard",o="/dashboard";"/api/v1".replace(/^http/,"ws");let l="ClusterDoesNotExist",u="NotSupportedError",a="ClusterNotUpError",i=["AWS","Azure","GCP","IBM","Lambda","SCP","OCI","RunPod","VAST","vSphere","Cudo","FluidStack","Paperspace","DO","Nebius"],s=Object.fromEntries([...i.map(e=>[e.toLowerCase(),e]),["kubernetes","Kubernetes"],["ssh","SSH Node Pool"]])},2586:function(e,t,r){"use strict";r.r(t);var n=r(5893),o=r(7294),l=r(5152),u=r.n(l),a=r(5697),i=r.n(a);r(6501);var s=r(3225);let d=u()(()=>Promise.all([r.e(616),r.e(230),r.e(664),r.e(804),r.e(989),r.e(470),r.e(544)]).then(r.bind(r,9470)).then(e=>e.Layout),{loadableGenerated:{webpack:()=>[9470]},ssr:!1});function c(e){let{Component:t,pageProps:r}=e;return(0,o.useEffect)(()=>{let e=document.createElement("link");e.rel="icon",e.href="".concat(s.GW,"/favicon.ico"),document.head.appendChild(e)},[]),(0,n.jsx)(d,{highlighted:r.highlighted,children:(0,n.jsx)(t,{...r})})}c.propTypes={Component:i().elementType.isRequired,pageProps:i().object.isRequired},t.default=c},6501:function(){},5152:function(e,t,r){e.exports=r(9606)},2703:function(e,t,r){"use strict";var n=r(414);function o(){}function l(){}l.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,l,u){if(u!==n){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:l,resetWarningCache:o};return r.PropTypes=r,r}},5697:function(e,t,r){e.exports=r(2703)()},414:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[774,179],function(){return t(1118),t(6036)}),_N_E=e.O()}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[826,544],{4966:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters/[cluster]/[job]",function(){return s(190)}])},3626:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let a=(0,s(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},9307:function(e,t,s){"use strict";s.d(t,{Cl:function(){return l},OE:function(){return d}});var a=s(5893);s(7294);var r=s(8799),n=s(6989),c=s(3850);let l=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"RUNNING":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"TERMINATED":default:return"bg-gray-100 text-gray-800";case"PENDING":case"CANCELLED":case"CANCELLING":return"bg-yellow-50 text-yellow-700";case"SUCCEEDED":return"bg-blue-50 text-blue-700";case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":return"bg-red-50 text-red-700";case"RECOVERING":return"bg-orange-50 text-orange-700";case"SUBMITTED":return"bg-indigo-50 text-indigo-700";case"STARTING":return"bg-cyan-50 text-cyan-700";case"FAILED_SETUP":return"bg-pink-50 text-pink-700"}},o=e=>{switch(e){case"LAUNCHING":case"STARTING":return(0,a.jsx)(r.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":default:return(0,a.jsx)(c.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,a.jsx)(c.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,a.jsx)(c.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,a.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,a.jsx)(c.J$,{className:"w-3 h-3 mr-1"})}},i=e=>{let t=l(e),s=o(e);return(0,a.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(t),children:[s,e]})},d=e=>{let{status:t}=e;return(0,a.jsx)(n.WH,{content:t,className:"text-muted-foreground text-sm",children:(0,a.jsx)("span",{children:i(t)})})}},7673:function(e,t,s){"use strict";s.d(t,{Ol:function(){return i},Zb:function(){return o},aY:function(){return h},eW:function(){return m},ll:function(){return d}});var a=s(5893),r=s(7294),n=s(5697),c=s.n(n),l=s(2350);let o=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",s),...n,children:r})});o.displayName="Card",o.propTypes={className:c().string,children:c().node};let i=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",s),...n,children:r})});i.displayName="CardHeader",i.propTypes={className:c().string,children:c().node};let d=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("h3",{ref:t,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",s),...n,children:r})});d.displayName="CardTitle",d.propTypes={className:c().string,children:c().node};let u=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("p",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",s),...n,children:r})});u.displayName="CardDescription",u.propTypes={className:c().string,children:c().node};let h=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",s),...n,children:r})});h.displayName="CardContent",h.propTypes={className:c().string,children:c().node};let m=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",s),...n,children:r})});m.displayName="CardFooter",m.propTypes={className:c().string,children:c().node}},7145:function(e,t,s){"use strict";s.d(t,{x:function(){return r}});var a=s(3225);let r={fetch:async function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"POST",r=window.location.origin,n="".concat(r).concat(a.f4).concat(e),c=await fetch(n,{method:s,headers:"POST"===s?{"Content-Type":"application/json"}:{},body:"POST"===s?JSON.stringify(t):void 0}),l=c.headers.get("X-Skypilot-Request-ID")||c.headers.get("X-Request-ID"),o=await fetch("".concat(r).concat(a.f4,"/api/get?request_id=").concat(l)),i=await o.json();return i.return_value?JSON.parse(i.return_value):[]},post:async(e,t)=>{let s=window.location.origin,r="".concat(s).concat(a.f4).concat(e);return await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},stream:async(e,t,s)=>{let a=(await r.post(e,t)).body.getReader();try{for(;;){let{done:e,value:t}=await a.read();if(e)break;let r=new TextDecoder().decode(t);s(r)}}catch(e){throw console.error("Error in stream:",e),e}},get:async e=>{let t=window.location.origin,s="".concat(t).concat(a.f4).concat(e);return await fetch(s)}}},3266:function(e,t,s){"use strict";s.d(t,{QL:function(){return h},Sl:function(){return d},getClusters:function(){return o},uR:function(){return i}});var a=s(7294),r=s(5821),n=s(7145),c=s(6378);let l={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function o(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return(await n.x.fetch("/status",{cluster_names:e,all_users:!0})).map(e=>{let t="",s=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let s=Math.floor((t-3)/2),a=s+(t-3)%2;return 0===s?e.substring(0,a)+"...":e.substring(0,a)+"..."+e.substring(e.length-s)}(t,25)),{status:l[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:s?"".concat(e.cloud," (").concat(s,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,autostop:e.autostop,to_down:e.to_down,jobs:[],command:e.last_creation_command||e.last_use,task_yaml:e.last_creation_yaml||"{}",events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}})}catch(e){return console.error("Error fetching clusters:",e),[]}}async function i(){try{let e=await n.x.fetch("/cost_report",{days:30});console.log("Raw cluster history data:",e);let t=e.map(e=>{let t="Unknown";e.cloud?t=e.cloud:e.resources&&e.resources.cloud&&(t=e.resources.cloud);let s=e.user_name||"-";return{status:e.status?l[e.status]:"TERMINATED",cluster:e.name,user:s,user_hash:e.user_hash,cloud:t,region:"",infra:t,full_infra:t,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:e.launched_at?new Date(1e3*e.launched_at):null,num_nodes:e.num_nodes||1,duration:e.duration,total_cost:e.total_cost,workspace:e.workspace||"default",autostop:-1,to_down:!1,cluster_hash:e.cluster_hash,usage_intervals:e.usage_intervals,command:e.last_creation_command||"",task_yaml:e.last_creation_yaml||"{}",events:[{time:e.launched_at?new Date(1e3*e.launched_at):new Date,event:"Cluster created."}]}});return console.log("Processed cluster history data:",t),t}catch(e){return console.error("Error fetching cluster history:",e),[]}}async function d(e){let{clusterName:t,jobId:s,onNewLog:a,workspace:c}=e;try{await n.x.stream("/logs",{follow:!1,cluster_name:t,job_id:s,override_skypilot_config:{active_workspace:c||"default"}},a)}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,r.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function u(e){let{clusterName:t,workspace:s}=e;try{return(await n.x.fetch("/queue",{cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:s}})).map(e=>{let a=e.end_at?e.end_at:Date.now()/1e3,r=0,n=0;return e.submitted_at&&(r=a-e.submitted_at),e.start_at&&(n=a-e.start_at),{id:e.job_id,status:e.status,job:e.job_name,user:e.username,gpus:e.accelerators||{},submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,resources:e.resources,cluster:t,total_duration:r,job_duration:n,infra:"",logs:"",workspace:s||"default"}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function h(e){let{cluster:t,job:s=null}=e,[r,n]=(0,a.useState)(null),[l,i]=(0,a.useState)(null),[d,h]=(0,a.useState)(!0),[m,f]=(0,a.useState)(!0),x=(0,a.useCallback)(async()=>{if(t)try{h(!0);let e=await c.default.get(o,[{clusterNames:[t]}]);return n(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{h(!1)}return null},[t]),g=(0,a.useCallback)(async e=>{if(t)try{f(!0);let s=await c.default.get(u,[{clusterName:t,workspace:e||"default"}]);i(s)}catch(e){console.error("Error fetching cluster job data:",e)}finally{f(!1)}},[t]),b=(0,a.useCallback)(async()=>{c.default.invalidate(o,[{clusterNames:[t]}]);let e=await x();e&&(c.default.invalidate(u,[{clusterName:t,workspace:e.workspace||"default"}]),await g(e.workspace))},[x,g,t]),N=(0,a.useCallback)(async()=>{r&&(c.default.invalidate(u,[{clusterName:t,workspace:r.workspace||"default"}]),await g(r.workspace))},[g,r,t]);return(0,a.useEffect)(()=>{(async()=>{let e=await x();e&&g(e.workspace)})()},[t,s,x,g]),{clusterData:r,clusterJobData:l,loading:d,clusterDetailsLoading:d,clusterJobsLoading:m,refreshData:b,refreshClusterJobsOnly:N}}},5821:function(e,t,s){"use strict";function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,a=document.getElementById("toast-container");a||((a=document.createElement("div")).id="toast-container",a.className="fixed top-0 right-0 p-4 z-[9999] flex flex-col items-end space-y-2",document.body.appendChild(a));let r=document.createElement("div");switch(r.className="rounded-md border-l-4 p-4 shadow-md flex items-center justify-between max-w-md w-full mb-2 pointer-events-auto",t){case"success":r.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":r.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":r.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:r.className+=" bg-blue-100 border-blue-500 text-blue-800"}return r.innerHTML='\n <div class="flex-1 mr-2">\n <p class="text-sm font-medium">'.concat(e,'</p>\n </div>\n <button class="text-gray-500 hover:text-gray-700 focus:outline-none" aria-label="Close toast">\n <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>\n </button>\n '),a.appendChild(r),r.querySelector("button").addEventListener("click",()=>{a.removeChild(r)}),setTimeout(()=>{a.contains(r)&&a.removeChild(r)},s),r}s.d(t,{C:function(){return a}})},6378:function(e,t,s){"use strict";s.r(t),s.d(t,{DashboardCache:function(){return r},dashboardCache:function(){return n}});let a=s(1214).ej.DEFAULT_TTL;class r{async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=s.ttl||a,n=!1!==s.refreshOnAccess,c=this._generateKey(e,t),l=e.name||"anonymous",o=this.cache.get(c),i=Date.now();if(o&&i-o.lastUpdated<r){let s=Math.round((i-o.lastUpdated)/1e3);return this._debug("Cache HIT for ".concat(l," (age: ").concat(s,"s, TTL: ").concat(Math.round(r/1e3),"s)")),n&&(this.cache.set(c,{data:o.data,lastUpdated:i}),this._debug("Cache TTL refreshed for ".concat(l))),this.backgroundJobs.has(c)||this._refreshInBackground(e,t,c),o.data}try{let s=await e(...t);return this.cache.set(c,{data:s,lastUpdated:i}),s}catch(e){if(o)return console.warn("Failed to fetch fresh data for ".concat(c,", returning stale data:"),e),o.data;throw e}}invalidate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=this._generateKey(e,t);this.cache.delete(s),this.backgroundJobs.delete(s)}invalidateFunction(e){let t=e.name||"anonymous",s=[];for(let e of this.cache.keys())e.startsWith("".concat(t,"_"))&&s.push(e);s.forEach(e=>{this.cache.delete(e),this.backgroundJobs.delete(e)})}clear(){this.cache.clear(),this.backgroundJobs.clear()}getStats(){return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,keys:Array.from(this.cache.keys())}}getDetailedStats(){let e=Date.now(),t=[];for(let[s,a]of this.cache.entries()){let r=e-a.lastUpdated;t.push({key:s,age:Math.round(r/1e3),lastUpdated:new Date(a.lastUpdated).toISOString(),hasBackgroundJob:this.backgroundJobs.has(s)})}return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,entries:t.sort((e,t)=>e.age-t.age)}}setDebugMode(e){this.debugMode=e}_debug(e){for(var t=arguments.length,s=Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];this.debugMode&&console.log("[DashboardCache] ".concat(e),...s)}_refreshInBackground(e,t,s){this.backgroundJobs.set(s,!0),e(...t).then(e=>{this.cache.set(s,{data:e,lastUpdated:Date.now()})}).catch(e=>{console.warn("Background refresh failed for ".concat(s,":"),e)}).finally(()=>{this.backgroundJobs.delete(s)})}_generateKey(e,t){let s=e.name||"anonymous",a=t.length>0?JSON.stringify(t):"";return"".concat(s,"_").concat(a)}constructor(){this.cache=new Map,this.backgroundJobs=new Map,this.debugMode=!1}}let n=new r;t.default=n},2350:function(e,t,s){"use strict";s.d(t,{cn:function(){return n}});var a=s(512),r=s(8388);function n(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,r.m6)((0,a.W)(t))}},190:function(e,t,s){"use strict";s.r(t),s.d(t,{JobDetailPage:function(){return N}});var a=s(5893),r=s(7294);s(9470);var n=s(7673),c=s(1664),l=s.n(c),o=s(1163),i=s(3266),d=s(6989),u=s(3626),h=s(8799),m=s(9307),f=s(3001),x=s(9008),g=s.n(x);function b(e){let{cluster:t,job:s,jobData:r,onRefresh:n,isRefreshing:c,loading:o}=e,i=(0,f.X)();return(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)(l(),{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)(l(),{href:"/clusters/".concat(t),className:"text-sky-blue hover:underline",children:t}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsxs)(l(),{href:"/clusters/".concat(t,"/").concat(s),className:"text-sky-blue hover:underline",children:[s,r.job&&"-"!=r.job?" (".concat(r.job,")"):""]})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[(o||c)&&(0,a.jsxs)("div",{className:"flex items-center mr-2",children:[(0,a.jsx)(h.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"text-sm ml-2 text-gray-500",children:"Loading..."})]}),(0,a.jsx)(d.WH,{content:"Refresh",className:"text-muted-foreground",children:(0,a.jsxs)("button",{onClick:n,disabled:o||c,className:"text-sm text-sky-blue hover:text-sky-blue-bright font-medium mx-2 flex items-center",children:[(0,a.jsx)(u.Z,{className:"w-4 h-4 mr-1.5"}),!i&&(0,a.jsx)("span",{children:"Refresh"})]})})]})]})}function N(){let e=(0,o.useRouter)(),{cluster:t,job:s}=e.query,{clusterData:c,clusterJobData:f,loading:x,refreshData:N}=(0,i.QL)({cluster:t}),[y,p]=(0,r.useState)(!1),[w,j]=(0,r.useState)(!0),[_,v]=(0,r.useState)(!1),[E,k]=(0,r.useState)([]),[C,D]=(0,r.useState)(!1),T=(0,r.useMemo)(()=>["INIT","PENDING","SETTING_UP"],[]),S=(0,r.useMemo)(()=>{if(!f||!s)return!0;let e=f.find(e=>e.id==s);return e&&T.includes(e.status)},[f,s,T]);r.useEffect(()=>{!x&&w&&j(!1)},[x,w]),(0,r.useEffect)(()=>{let e=!0;return t&&s&&!S?(v(!0),(0,i.Sl)({clusterName:t,jobId:s,onNewLog:t=>{if(e){let e=(0,d.q8)(t);k(t=>[...t,e])}},workspace:null==c?void 0:c.workspace}).then(()=>{e&&v(!1)}).catch(t=>{e&&(console.error("Error streaming logs:",t),v(!1))})):v(!1),()=>{e=!1}},[t,s,C,S,c]);let I=async()=>{p(!0),D(e=>!e),k([]);try{N&&await N()}catch(e){console.error("Error refreshing data:",e)}finally{p(!1)}};if(!e.isReady)return(0,a.jsx)("div",{children:"Loading..."});let L={id:s};if(c&&f){let e=f.find(e=>e.id==s);e&&(L={...e,infra:c.infra,cluster:c.cluster,user:c.user})}let R=t&&s?"Job: ".concat(s," @ ").concat(t," | SkyPilot Dashboard"):"Job Details | SkyPilot Dashboard";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g(),{children:(0,a.jsx)("title",{children:R})}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b,{cluster:t,job:s,jobData:L,onRefresh:I,isRefreshing:y,loading:x}),x&&w?(0,a.jsxs)("div",{className:"flex items-center justify-center h-64",children:[(0,a.jsx)(h.Z,{size:24,className:"mr-2"}),(0,a.jsx)("span",{children:"Loading..."})]}):(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsx)("div",{id:"details",children:(0,a.jsxs)(n.Zb,{children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"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:"Job ID"}),(0,a.jsx)("div",{className:"text-base mt-1",children:L.id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job Name"}),(0,a.jsx)("div",{className:"text-base mt-1",children:L.job})]}),(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:"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:"Submitted"}),(0,a.jsx)("div",{className:"text-base mt-1",children:L.submitted_at?(0,d.xn)(L.submitted_at):"N/A"})]}),L.resources&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Requested Resources"}),(0,a.jsx)("div",{className:"text-base mt-1",children:L.resources||"N/A"})]}),L.cluster&&(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:(0,a.jsx)(l(),{href:"/clusters/".concat(L.cluster),className:"text-sky-blue hover:underline",children:L.cluster})})]})]})})]})}),(0,a.jsx)("div",{id:"logs",className:"mt-6",children:(0,a.jsxs)(n.Zb,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Logs"}),(0,a.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:"(Logs are not streaming; click refresh to fetch the latest logs.)"})]}),(0,a.jsx)(d.WH,{content:"Refresh logs",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:()=>{D(e=>!e),k([])},disabled:_,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,a.jsx)(u.Z,{className:"w-4 h-4 ".concat(_?"animate-spin":"")})})})]}),(0,a.jsx)("div",{className:"p-4",children:S?(0,a.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,a.jsx)("span",{children:"Waiting for the job to start; refresh in a few moments."})}):_?(0,a.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,a.jsx)(h.Z,{size:20,className:"mr-2"}),(0,a.jsx)("span",{children:"Loading..."})]}):(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto",children:(0,a.jsx)(d.$B,{logs:E.join("")})})})]})})]})]})]})}t.default=N},9008:function(e,t,s){e.exports=s(7219)},1163:function(e,t,s){e.exports=s(6036)}},function(e){e.O(0,[616,230,799,664,804,989,470,888,774,179],function(){return e(e.s=4966)}),_N_E=e.O()}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[722],{8706:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters/[cluster]",function(){return s(6996)}])},6639:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let a=(0,s(998).Z)("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()}]);
|
@@ -1 +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(
|
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()}]);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[315,544],{479:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs/[job]",function(){return s(8099)}])},6639:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let r=(0,s(998).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},8671:function(e,t,s){"use strict";s.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,s(998).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},3626:function(e,t,s){"use strict";s.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,s(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},9307:function(e,t,s){"use strict";s.d(t,{Cl:function(){return c},OE:function(){return d}});var r=s(5893);s(7294);var n=s(8799),a=s(6989),l=s(3850);let c=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"RUNNING":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"TERMINATED":default:return"bg-gray-100 text-gray-800";case"PENDING":case"CANCELLED":case"CANCELLING":return"bg-yellow-50 text-yellow-700";case"SUCCEEDED":return"bg-blue-50 text-blue-700";case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":return"bg-red-50 text-red-700";case"RECOVERING":return"bg-orange-50 text-orange-700";case"SUBMITTED":return"bg-indigo-50 text-indigo-700";case"STARTING":return"bg-cyan-50 text-cyan-700";case"FAILED_SETUP":return"bg-pink-50 text-pink-700"}},o=e=>{switch(e){case"LAUNCHING":case"STARTING":return(0,r.jsx)(n.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":default:return(0,r.jsx)(l.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,r.jsx)(l.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,r.jsx)(l.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,r.jsx)(l.Ye,{className:"w-3 h-3 mr-1"});case"PENDING":case"RECOVERING":case"SUBMITTED":case"CANCELLING":case"FAILED_SETUP":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":return(0,r.jsx)(l.J$,{className:"w-3 h-3 mr-1"})}},i=e=>{let t=c(e),s=o(e);return(0,r.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(t),children:[s,e]})},d=e=>{let{status:t}=e;return(0,r.jsx)(a.WH,{content:t,className:"text-muted-foreground text-sm",children:(0,r.jsx)("span",{children:i(t)})})}},7673:function(e,t,s){"use strict";s.d(t,{Ol:function(){return i},Zb:function(){return o},aY:function(){return m},eW:function(){return x},ll:function(){return d}});var r=s(5893),n=s(7294),a=s(5697),l=s.n(a),c=s(2350);let o=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",s),...a,children:n})});o.displayName="Card",o.propTypes={className:l().string,children:l().node};let i=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("flex flex-col space-y-1.5 p-6",s),...a,children:n})});i.displayName="CardHeader",i.propTypes={className:l().string,children:l().node};let d=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("h3",{ref:t,className:(0,c.cn)("text-2xl font-semibold leading-none tracking-tight",s),...a,children:n})});d.displayName="CardTitle",d.propTypes={className:l().string,children:l().node};let u=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("p",{ref:t,className:(0,c.cn)("text-sm text-muted-foreground",s),...a,children:n})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let m=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("p-6 pt-0",s),...a,children:n})});m.displayName="CardContent",m.propTypes={className:l().string,children:l().node};let x=n.forwardRef((e,t)=>{let{className:s,children:n,...a}=e;return(0,r.jsx)("div",{ref:t,className:(0,c.cn)("flex items-center p-6 pt-0",s),...a,children:n})});x.displayName="CardFooter",x.propTypes={className:l().string,children:l().node}},7145:function(e,t,s){"use strict";s.d(t,{x:function(){return n}});var r=s(3225);let n={fetch:async function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"POST",n=window.location.origin,a="".concat(n).concat(r.f4).concat(e),l=await fetch(a,{method:s,headers:"POST"===s?{"Content-Type":"application/json"}:{},body:"POST"===s?JSON.stringify(t):void 0}),c=l.headers.get("X-Skypilot-Request-ID")||l.headers.get("X-Request-ID"),o=await fetch("".concat(n).concat(r.f4,"/api/get?request_id=").concat(c)),i=await o.json();return i.return_value?JSON.parse(i.return_value):[]},post:async(e,t)=>{let s=window.location.origin,n="".concat(s).concat(r.f4).concat(e);return await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},stream:async(e,t,s)=>{let r=(await n.post(e,t)).body.getReader();try{for(;;){let{done:e,value:t}=await r.read();if(e)break;let n=new TextDecoder().decode(t);s(n)}}catch(e){throw console.error("Error in stream:",e),e}},get:async e=>{let t=window.location.origin,s="".concat(t).concat(r.f4).concat(e);return await fetch(s)}}},2350:function(e,t,s){"use strict";s.d(t,{cn:function(){return a}});var r=s(512),n=s(8388);function a(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,n.m6)((0,r.W)(t))}},4303:function(e,t,s){"use strict";s.d(t,{_q:function(){return n},pJ:function(){return c}});var r=s(1272);let n=e=>{if(!e)return"No YAML available";try{let t=r.ZP.load(e),s=r.ZP.dump(t,{lineWidth:-1,styles:{"!!str":"literal"},quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2}).split("\n"),n=[],a=-1;for(let e=0;e<s.length;e++){let t=s[e],r=t.search(/\S/);0===r&&a>=0&&e>0&&n.push(""),n.push(t),a=r}return n.join("\n").trim()}catch(t){return console.error("YAML formatting error:",t),e}},a=e=>"string"==typeof e?e.substring(0,50)+"...":e&&e.name?"name: ".concat(e.name):e&&e.resources?"Task configuration":"YAML document",l=(e,t)=>{try{let s=r.ZP.load(e),n=r.ZP.dump(s,{lineWidth:-1,styles:{"!!str":"literal"},quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2}).split("\n"),l=[],c=-1;for(let e=0;e<n.length;e++){let t=n[e],s=t.search(/\S/);0===s&&c>=0&&e>0&&l.push(""),l.push(t),c=s}return{index:t,content:l.join("\n").trim(),preview:a(s)}}catch(s){return console.error("YAML formatting error for document ".concat(t,":"),s),{index:t,content:e,preview:"Invalid YAML"}}},c=e=>{if(!e)return[];try{let t=[],s=e.split(/^---$/m);for(let e=0;e<s.length;e++){let r=s[e].trim();r&&""!==r&&t.push(r)}return(t.length>1?t.slice(1):t).map((e,t)=>l(e,t))}catch(t){return console.error("YAML formatting error:",t),[{index:0,content:e,preview:"Invalid YAML"}]}}},8099:function(e,t,s){"use strict";s.r(t);var r=s(5893),n=s(7294),a=s(8799),l=s(1163);s(9470);var c=s(7673),o=s(8969),i=s(1664),d=s.n(i),u=s(3626),m=s(282),x=s(8671),f=s(5895),g=s(6639),h=s(6989),j=s(9307),p=s(3001),N=s(9008),y=s.n(N),b=s(4303);function v(e){let{jobData:t,activeTab:s,setIsLoadingLogs:l,setIsLoadingControllerLogs:c,isLoadingLogs:i,isLoadingControllerLogs:u,refreshFlag:p}=e,[N,y]=(0,n.useState)(""),[v,w]=(0,n.useState)(""),[E,L]=(0,n.useState)(!1),[C,S]=(0,n.useState)({}),[T,R]=(0,n.useState)(!1),[I,k]=(0,n.useState)(!1),[A,D]=(0,n.useState)(0),[_,Z]=(0,n.useState)(0),[P,O]=(0,n.useState)(!1),[q,F]=(0,n.useState)(!1),[M,U]=(0,n.useState)(!1),[G,W]=(0,n.useState)(!1),H=(0,n.useRef)(null),J=(0,n.useRef)(null),Y=(0,n.useRef)(new WeakSet),B=(0,n.useRef)(null),z=(0,n.useRef)(null),$=(0,n.useRef)(""),V=(0,n.useRef)(""),X=(0,n.useRef)(null);(0,n.useRef)(0);let K=(0,n.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"request";if(e){if(Y.current.has(e)){console.log("".concat(t," controller already aborted previously, skipping"));return}try{if("function"!=typeof e.abort){console.warn("Controller for ".concat(t," does not have abort method"));return}if(e.signal&&e.signal.aborted){console.log("".concat(t," already aborted via signal, skipping")),Y.current.add(e);return}e.abort(),Y.current.add(e),console.log("Successfully aborted ".concat(t))}catch(s){console.log("Caught error while aborting ".concat(t,":"),s.name,s.message),Y.current.add(e),"AbortError"!==s.name&&"InvalidStateError"!==s.name&&console.warn("Unexpected error aborting ".concat(t,":"),s)}}},[]),Q=(0,n.useCallback)(e=>{let t="logs"===e?B:z;if(t.current)for(let s of[()=>t.current.querySelector(".logs-container"),()=>t.current.querySelector('[class*="logs-container"]'),()=>t.current.querySelector('div[style*="overflow"]'),()=>t.current]){let t=s();if(t&&t.scrollHeight>t.clientHeight){t.scrollTop=t.scrollHeight,console.log("Auto-scrolled ".concat(e," to bottom"));break}}},[]),ee=["PENDING","SUBMITTED","STARTING"].includes(t.status),et=["PENDING","SUBMITTED"].includes(t.status),es=["RECOVERING"].includes(t.status),er=e=>{S(t=>({...t,[e]:!t[e]}))},en=async()=>{try{let e=(0,b.pJ)(t.dag_yaml),s="";s=1===e.length?e[0].content:e.length>1?e.map(e=>e.content).join("\n---\n"):t.dag_yaml,await navigator.clipboard.writeText(s),R(!0),setTimeout(()=>R(!1),2e3)}catch(e){console.error("Failed to copy YAML to clipboard:",e)}},ea=async()=>{try{await navigator.clipboard.writeText(t.entrypoint),k(!0),setTimeout(()=>k(!1),2e3)}catch(e){console.error("Failed to copy command to clipboard:",e)}};(0,n.useEffect)(()=>{y(""),D(0),W(!1)},[s,t.id]),(0,n.useEffect)(()=>{w(""),Z(0),W(!1)},[s,t.id]);let el=(0,n.useCallback)((e,t)=>{("logs"===e?y:w)(e=>e+t),requestAnimationFrame(()=>{Q(e)})},[Q]),ec=(0,n.useCallback)(function(e,t,s,r){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a="logs"===e?H:J;if(a.current)return console.log("Request already active for ".concat(e,", skipping...")),()=>{};let l=!0,c=new AbortController;return"logs"===e&&(ee||es)?(r(!1),n&&O(!1),()=>{}):"controllerlogs"===e&&et?(r(!1),n&&F(!1),()=>{}):t?(a.current=c,r(!0),U(!0),n&&(s(""),"logs"===e?D(0):Z(0)),(0,o.NJ)({jobId:t,controller:"controllerlogs"===e,signal:c.signal,onNewLog:t=>{if(l){let s=(0,h.q8)(t);G||W(!0),el(e,s),"logs"===e?D(e=>e+s.length):Z(e=>e+s.length)}}}).then(()=>{l&&(r(!1),n&&("logs"===e?O(!1):F(!1)),requestAnimationFrame(()=>{Q(e)}))}).catch(t=>{l&&("AbortError"!==t.name&&(console.error("Error streaming ".concat(e,":"),t),t.message&&s(e=>e+"Error fetching logs: ".concat(t.message,"\n"))),r(!1),n&&("logs"===e?O(!1):F(!1)))}).finally(()=>{console.log("Cleaning up ".concat(e," request")),l=!1,a.current===c&&(K(c,e),a.current=null),"logs"===e?$.current="":V.current="",X.current&&(clearTimeout(X.current),X.current=null)}),()=>{console.log("Cleaning up ".concat(e," request")),l=!1,a.current===c&&(K(c,"".concat(e," cleanup")),a.current=null),"logs"===e?$.current="":V.current="",X.current&&(clearTimeout(X.current),X.current=null)}):()=>{l=!1}},[ee,et,es,G,K,Q,el]);return((0,n.useEffect)(()=>{if(H.current&&(K(H.current,"logs"),H.current=null),!ee&&!es)return ec("logs",t.id,y,l)},[t.id,ec,l,ee,es,K]),(0,n.useEffect)(()=>{if(J.current&&(K(J.current,"controller logs"),J.current=null),!et)return ec("controllerlogs",t.id,w,c)},[t.id,ec,c,et,K]),(0,n.useEffect)(()=>{if(p>0&&"logs"===s)return H.current&&(K(H.current,"logs refresh"),H.current=null),O(!0),ec("logs",t.id,y,l,!0)},[p,s,t.id,ec,l,K]),(0,n.useEffect)(()=>{if(p>0&&"controllerlogs"===s)return J.current&&(K(J.current,"controller logs refresh"),J.current=null),F(!0),ec("controllerlogs",t.id,w,c,!0)},[p,s,t.id,ec,c,K]),(0,n.useEffect)(()=>()=>{console.log("Cleaning up managed job log requests..."),H.current&&(K(H.current,"logs cleanup"),H.current=null),J.current&&(K(J.current,"controller logs cleanup"),J.current=null),X.current&&(clearTimeout(X.current),X.current=null),$.current="",V.current="",l(!1),c(!1),O(!1),F(!1)},[K,l,c]),(0,n.useEffect)(()=>{let e=()=>{document.hidden?(console.log("Page hidden - pausing log streaming for performance"),X.current&&(clearTimeout(X.current),X.current=null)):console.log("Page visible - resuming normal operation")};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[]),(0,n.useEffect)(()=>{let e=()=>{("logs"===s&&N||"controllerlogs"===s&&v)&&Q("logs"===s?"logs":"controllerlogs")};requestAnimationFrame(()=>{requestAnimationFrame(e)})},[s,N,v,Q]),"logs"===s)?(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",ref:B,children:ee?(0,r.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,r.jsx)("span",{children:"Waiting for the job to start; refresh in a few moments."})}):es?(0,r.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,r.jsx)("span",{children:"Waiting for the job to recover; refresh in a few moments."})}):G||N?(0,r.jsx)(h.$B,{logs:N}):i?(0,r.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,r.jsx)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading logs..."})]}):(0,r.jsx)(h.$B,{logs:N})}):"controllerlogs"===s?(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",ref:z,children:et?(0,r.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,r.jsx)("span",{children:"Waiting for the job controller process to start; refresh in a few moments."})}):G||v?(0,r.jsx)(h.$B,{logs:v,controller:!0}):u?(0,r.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,r.jsx)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading logs..."})]}):(0,r.jsx)(h.$B,{logs:v,controller:!0})}):(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job ID (Name)"}),(0,r.jsxs)("div",{className:"text-base mt-1",children:[t.id," ",t.name?"(".concat(t.name,")"):""]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsx)(j.OE,{status:t.status})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,r.jsx)("div",{className:"text-base mt-1",children:t.user})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Submitted"}),(0,r.jsx)("div",{className:"text-base mt-1",children:t.submitted_at?(0,h.xn)(t.submitted_at):"N/A"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Requested Resources"}),(0,r.jsx)("div",{className:"text-base mt-1",children:t.requested_resources||"N/A"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Infra"}),(0,r.jsx)("div",{className:"text-base mt-1",children:t.infra?(0,r.jsx)(h.Md,{content:t.full_infra||t.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(d(),{href:"/infra",className:"text-blue-600 hover:underline",children:t.cloud||t.infra.split("(")[0].trim()}),t.infra.includes("(")&&(0,r.jsx)("span",{children:" "+t.infra.substring(t.infra.indexOf("("))})]})}):"-"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Resources"}),(0,r.jsx)("div",{className:"text-base mt-1",children:t.resources_str_full||t.resources_str||"-"})]}),(t.entrypoint||t.dag_yaml)&&(0,r.jsxs)("div",{className:"col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Entrypoint"}),t.entrypoint&&(0,r.jsx)(h.WH,{content:I?"Copied!":"Copy command",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:ea,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:I?(0,r.jsx)(m.Z,{className:"w-4 h-4 text-green-600"}):(0,r.jsx)(x.Z,{className:"w-4 h-4"})})})]}),(0,r.jsxs)("div",{className:"space-y-4 mt-3",children:[t.entrypoint&&(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3",children:(0,r.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all",children:t.entrypoint})})}),t.dag_yaml&&"{}"!==t.dag_yaml&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center mb-2",children:[(0,r.jsxs)("button",{onClick:()=>{L(!E)},className:"flex items-center text-left focus:outline-none text-gray-700 hover:text-gray-900 transition-colors duration-200",children:[E?(0,r.jsx)(f.Z,{className:"w-4 h-4 mr-1"}):(0,r.jsx)(g.Z,{className:"w-4 h-4 mr-1"}),(0,r.jsx)("span",{className:"text-base",children:"Show SkyPilot YAML"})]}),(0,r.jsx)(h.WH,{content:T?"Copied!":"Copy YAML",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:en,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:T?(0,r.jsx)(m.Z,{className:"w-4 h-4 text-green-600"}):(0,r.jsx)(x.Z,{className:"w-4 h-4"})})})]}),E&&(0,r.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 max-h-96 overflow-y-auto",children:(()=>{let e=(0,b.pJ)(t.dag_yaml);return 0===e.length?(0,r.jsx)("div",{className:"text-gray-500",children:"No YAML available"}):1===e.length?(0,r.jsx)("pre",{className:"text-sm text-gray-800 font-mono whitespace-pre-wrap",children:e[0].content}):(0,r.jsx)("div",{className:"space-y-4",children:e.map((e,t)=>(0,r.jsxs)("div",{className:"border-b border-gray-200 pb-4 last:border-b-0",children:[(0,r.jsx)("button",{onClick:()=>er(t),className:"flex items-center justify-between w-full text-left focus:outline-none",children:(0,r.jsxs)("div",{className:"flex items-center",children:[C[t]?(0,r.jsx)(f.Z,{className:"w-4 h-4 mr-2"}):(0,r.jsx)(g.Z,{className:"w-4 h-4 mr-2"}),(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Task ",t+1,": ",e.preview]})]})}),C[t]&&(0,r.jsx)("div",{className:"mt-3 ml-6",children:(0,r.jsx)("pre",{className:"text-sm text-gray-800 font-mono whitespace-pre-wrap",children:e.content})})]},t))})})()})]})]})]})]})}t.default=function(){var e;let t=(0,l.useRouter)(),{job:s,tab:i}=t.query,[m,x]=(0,n.useState)(0),{jobData:f,loading:g}=(0,o.UA)(s,m),[j,N]=(0,n.useState)(!1),[b,w]=(0,n.useState)(!0),[E,L]=(0,n.useState)(!1),[C,S]=(0,n.useState)(!1),[T,R]=(0,n.useState)(!1),[I,k]=(0,n.useState)(!1),[A,D]=(0,n.useState)(!1),[_,Z]=(0,n.useState)(0),[P,O]=(0,n.useState)(0),q=(0,p.X)();n.useEffect(()=>{!g&&b&&w(!1)},[g,b]);let F=e=>{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:"smooth"})};(0,n.useEffect)(()=>{k(!0)},[]),(0,n.useEffect)(()=>{if(!A){let e=new MutationObserver(()=>{let t=document.getElementById("logs-section"),s=document.getElementById("controller-logs-section");("logs"===i&&t||"controllerlogs"===i&&s)&&(D(!0),e.disconnect())});return e.observe(document.body,{childList:!0,subtree:!0}),()=>e.disconnect()}},[A,i]),(0,n.useEffect)(()=>{if(t.isReady&&I&&A&&!T){let e=setTimeout(()=>{"logs"===i?(F("logs-section"),R(!0)):"controllerlogs"===i&&(F("controller-logs-section"),R(!0))},800);return()=>clearTimeout(e)}},[t.isReady,i,T,I,A]),(0,n.useEffect)(()=>{R(!1),D(!1)},[i]);let M=async()=>{N(!0);try{x(e=>e+1),Z(e=>e+1),O(e=>e+1)}catch(e){console.error("Error refreshing data:",e)}finally{N(!1)}};if(!t.isReady)return(0,r.jsx)("div",{children:"Loading..."});let U=null==f?void 0:null===(e=f.jobs)||void 0===e?void 0:e.find(e=>String(e.id)===String(s)),G=s?"Job: ".concat(s," | SkyPilot Dashboard"):"Job Details | SkyPilot Dashboard";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y(),{children:(0,r.jsx)("title",{children:G})}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)(d(),{href:"/jobs",className:"text-sky-blue hover:underline",children:"Managed Jobs"}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsxs)(d(),{href:"/jobs/".concat(s),className:"text-sky-blue hover:underline",children:[s," ",(null==U?void 0:U.name)?"(".concat(U.name,")"):""]})]}),(0,r.jsxs)("div",{className:"text-sm flex items-center",children:[(g||j||E||C)&&(0,r.jsxs)("div",{className:"flex items-center mr-4",children:[(0,r.jsx)(a.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,r.jsx)(h.WH,{content:"Refresh",className:"text-muted-foreground",children:(0,r.jsxs)("button",{onClick:M,disabled:g||j,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(u.Z,{className:"w-4 h-4 mr-1.5"}),!q&&(0,r.jsx)("span",{children:"Refresh"})]})})]})]}),g&&b?(0,r.jsxs)("div",{className:"flex items-center justify-center py-32",children:[(0,r.jsx)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):U?(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsx)("div",{id:"details-section",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Details"})}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(v,{jobData:U,activeTab:"info",setIsLoadingLogs:L,setIsLoadingControllerLogs:S,isLoadingLogs:E,isLoadingControllerLogs:C,refreshFlag:0})})]})}),(0,r.jsx)("div",{id:"logs-section",className:"mt-6",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Logs"}),(0,r.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:"(Logs are not streaming; click refresh to fetch the latest logs.)"})]}),(0,r.jsx)(h.WH,{content:"Refresh logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>{Z(e=>e+1)},disabled:E,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(u.Z,{className:"w-4 h-4 ".concat(E?"animate-spin":"")})})})]}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(v,{jobData:U,activeTab:"logs",setIsLoadingLogs:L,setIsLoadingControllerLogs:S,isLoadingLogs:E,isLoadingControllerLogs:C,refreshFlag:_})})]})}),(0,r.jsx)("div",{id:"controller-logs-section",className:"mt-6",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Controller Logs"}),(0,r.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:"(Logs are not streaming; click refresh to fetch the latest logs.)"})]}),(0,r.jsx)(h.WH,{content:"Refresh controller logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>{O(e=>e+1)},disabled:C,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(u.Z,{className:"w-4 h-4 ".concat(C?"animate-spin":"")})})})]}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(v,{jobData:U,activeTab:"controllerlogs",setIsLoadingLogs:L,setIsLoadingControllerLogs:S,isLoadingLogs:E,isLoadingControllerLogs:C,refreshFlag:P})})]})})]}):(0,r.jsx)("div",{className:"flex items-center justify-center py-32",children:(0,r.jsx)("span",{children:"Job not found"})})]})]})}},9008:function(e,t,s){e.exports=s(7219)},1163:function(e,t,s){e.exports=s(6036)}},function(e){e.O(0,[616,230,799,664,804,798,989,470,969,888,774,179],function(){return e(e.s=479)}),_N_E=e.O()}]);
|
@@ -0,0 +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(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()}]);
|
@@ -0,0 +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(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([[144],{3969:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/volumes",function(){return t(2567)}])},2567:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return l}});var r=t(5893);t(7294);var u=t(9008),s=t.n(u),i=t(5152);let o=t.n(i)()(()=>Promise.all([t.e(616),t.e(230),t.e(799),t.e(664),t.e(697),t.e(989),t.e(645)]).then(t.bind(t,7774)).then(e=>e.Volumes),{loadableGenerated:{webpack:()=>[7774]},ssr:!1});function l(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s(),{children:(0,r.jsx)("title",{children:"Volumes | SkyPilot Dashboard"})}),(0,r.jsx)(o,{})]})}},9008:function(e,n,t){e.exports=t(7219)}},function(e){e.O(0,[888,774,179],function(){return e(e.s=3969)}),_N_E=e.O()}]);
|
@@ -1 +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(
|
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()}]);
|
@@ -0,0 +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(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()}]);
|