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
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[443,211],{1812:function(e,s,r){r.d(s,{X:function(){return a}});var t=r(5893),n=r(7294);let l=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:r="Error",onDismiss:a}=e,[i,c]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{s&&c(!1)},[s]),!s||i)return null;let o="string"==typeof s?s:l(s);return(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsxs)("div",{className:"text-sm text-red-800",children:[(0,t.jsxs)("strong",{children:[r,":"]})," ",o]})})]}),(0,t.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,t.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},803:function(e,s,r){r.d(s,{z:function(){return o}});var t=r(5893),n=r(7294),l=r(8426),a=r(2003),i=r(2350);let c=(0,a.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"}}),o=n.forwardRef((e,s)=>{let{className:r,variant:n,size:a,asChild:o=!1,...d}=e,u=o?l.g7:"button";return(0,t.jsx)(u,{className:(0,i.cn)(c({variant:n,size:a,className:r})),ref:s,...d})});o.displayName="Button"},7673:function(e,s,r){r.d(s,{Ol:function(){return o},Zb:function(){return c},aY:function(){return m},eW:function(){return x},ll:function(){return d}});var t=r(5893),n=r(7294),l=r(5697),a=r.n(l),i=r(2350);let c=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...l,children:n})});c.displayName="Card",c.propTypes={className:a().string,children:a().node};let o=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",r),...l,children:n})});o.displayName="CardHeader",o.propTypes={className:a().string,children:a().node};let d=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("h3",{ref:s,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",r),...l,children:n})});d.displayName="CardTitle",d.propTypes={className:a().string,children:a().node};let u=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("p",{ref:s,className:(0,i.cn)("text-sm text-muted-foreground",r),...l,children:n})});u.displayName="CardDescription",u.propTypes={className:a().string,children:a().node};let m=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("p-6 pt-0",r),...l,children:n})});m.displayName="CardContent",m.propTypes={className:a().string,children:a().node};let x=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("flex items-center p-6 pt-0",r),...l,children:n})});x.displayName="CardFooter",x.propTypes={className:a().string,children:a().node}},5443:function(e,s,r){r.r(s),r.d(s,{Workspaces:function(){return D}});var t=r(5893),n=r(7294),l=r(1163),a=r(3266),i=r(8969),c=r(7324),o=r(7673),d=r(803),u=r(8799),m=r(1272),x=r(326),h=r(3850),f=r(1812),p=r(3626),g=r(3001),j=r(938),v=r(6378),N=r(1214),b=r(6856),y=r(7145);let w=e=>{let{isPrivate:s}=e;return s?(0,t.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,t.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"})},k=e=>{let{workspace:s,onDelete:r,onEdit:n,router:l,rawWorkspacesData:a,checkPermissionAndAct:i,roleLoading:c}=e,m=!0===((null==a?void 0:a[s.name])||{}).private;return(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.Ol,{children:(0,t.jsx)(o.ll,{className:"text-base font-normal",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-semibold",children:"Workspace:"})," ",s.name]}),(0,t.jsx)(w,{isPrivate:m})]})})}),(0,t.jsxs)(o.aY,{className:"text-sm pb-2",children:[(0,t.jsxs)("div",{className:"py-2 flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,t.jsx)(h.QT,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,t.jsx)("span",{children:"Clusters (Running / Total)"})]}),(0,t.jsxs)("button",{onClick:()=>{l.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,t.jsxs)("div",{className:"py-2 flex items-center justify-between border-t border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,t.jsx)(h.Vp,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,t.jsx)("span",{children:"Managed Jobs"})]}),(0,t.jsx)("button",{onClick:()=>{l.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,t.jsxs)("div",{className:"px-6 pb-3 text-sm pt-3",children:[(0,t.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Enabled Infra"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:s.clouds.map(e=>(0,t.jsxs)("div",{className:"flex items-center text-gray-700",children:[(0,t.jsx)(h.Ye,{className:"w-3.5 h-3.5 mr-1.5 text-green-500"}),(0,t.jsx)("span",{children:e})]},e))})]}),(0,t.jsxs)(o.eW,{className:"flex justify-end pt-3 gap-2",children:[(0,t.jsx)(d.z,{variant:"outline",size:"sm",onClick:()=>r(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,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(u.Z,{size:12,className:"mr-1"}),(0,t.jsx)("span",{children:"Delete"})]}):"Delete"}),(0,t.jsx)(d.z,{variant:"outline",size:"sm",onClick:()=>{i("cannot edit workspace",()=>{n(s.name)})},disabled:c,children:c?(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(u.Z,{size:12,className:"mr-1"}),(0,t.jsx)("span",{children:"Edit"})]}):"Edit"})]})]},s.name)},C=e=>{let{onClick:s,checkPermissionAndAct:r,roleLoading:n}=e;return(0,t.jsx)(o.Zb,{className:"border-2 border-dashed border-sky-300 hover:border-sky-400 cursor-pointer transition-colors flex flex-col",onClick:()=>{r("cannot create workspace",s)},children:(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center p-6",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"w-16 h-16 rounded-full bg-sky-100 flex items-center justify-center mb-4 mx-auto",children:(0,t.jsx)("span",{className:"text-3xl text-sky-600",children:"+"})}),(0,t.jsx)("h3",{className:"text-lg font-medium text-sky-700 mb-2",children:"Create New Workspace"}),(0,t.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:r,totalClusters:n,managedJobs:l,router:a}=e;return(0,t.jsx)("div",{className:"bg-sky-50 p-4 rounded-lg shadow mb-6",children:(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-around items-center",children:[(0,t.jsx)("div",{className:"p-2",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(h.E9,{className:"w-5 h-5 mr-2 text-sky-600"}),(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Workspaces:"}),(0,t.jsx)("span",{className:"ml-1 text-xl font-semibold text-sky-700",children:s})]})}),(0,t.jsx)("div",{className:"p-2",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(h.QT,{className:"w-5 h-5 mr-2 text-sky-600"}),(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Clusters (Running / Total):"}),(0,t.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:[r," / ",n]})]})}),(0,t.jsx)("div",{className:"p-2",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(h.Vp,{className:"w-5 h-5 mr-2 text-sky-600"}),(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Managed Jobs:"}),(0,t.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:l})]})})]})})},z=N.nb.REFRESH_INTERVAL;function D(){let[e,s]=(0,n.useState)([]),[r,o]=(0,n.useState)({runningClusters:0,totalClusters:0,managedJobs:0}),[h,N]=(0,n.useState)(!0),[w,D]=(0,n.useState)(null),[R,T]=(0,n.useState)(!1),[O,S]=(0,n.useState)({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),[A,Z]=(0,n.useState)({open:!1,message:"",userName:""}),[L,J]=(0,n.useState)(null),[P,W]=(0,n.useState)(!1),F=(0,l.useRouter)(),V=(0,g.X)(),M=async()=>{if(L&&Date.now()-L.timestamp<3e5)return L;W(!0);try{let e=await y.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(),r={role:s.role,name:s.name,timestamp:Date.now()};return J(r),W(!1),r}catch(e){throw W(!1),e}},X=async(e,s)=>{try{let r=await M();if("admin"!==r.role)return Z({open:!0,message:e,userName:r.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&&N(!0);try{let[e,r,t]=await Promise.all([v.default.get(c.fX),v.default.get(a.getClusters),v.default.get(i.getManagedJobs,[{allUsers:!0}])]);D(e);let n=Object.keys(e),l=await Promise.all(n.map(e=>v.default.get(c.yz,[e]))),d=Object.fromEntries(n.map((e,s)=>[e,l[s]])),u=Object.fromEntries(r.map(e=>[e.cluster,e.workspace||"default"])),m={};n.forEach(e=>{m[e]={name:e,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}});let x=0;r.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=t.jobs||[],f=new Set(j.statusGroups.active),p=0;h.forEach(e=>{let s=e.cluster_name||e.resources&&e.resources.cluster_name;if(s){let r=u[s];r&&m[r]&&f.has(e.status)&&m[r].managedJobsCount++}f.has(e.status)&&p++});let g=Object.values(m).filter(e=>n.includes(e.name)).map(e=>({...e,clouds:Array.isArray(d[e.name])?d[e.name]:[]})).sort((e,s)=>e.name.localeCompare(s.name));s(g),o({runningClusters:x,totalClusters:r.length,managedJobs:p})}catch(e){console.error("Error fetching workspace data:",e),s([]),o({runningClusters:0,totalClusters:0,managedJobs:0})}e&&N(!1)};(0,n.useEffect)(()=>{(async()=>{await b.ZP.preloadForPage("workspaces"),_(!0)})();let e=setInterval(()=>{_(!1)},z);return()=>clearInterval(e)},[]);let B=e=>{X("cannot delete workspace",()=>{S({confirmOpen:!0,workspaceToDelete:e,deleting:!1,error:null})})},I=async()=>{if(O.workspaceToDelete){S(e=>({...e,deleting:!0,error:null}));try{await (0,c.zl)(O.workspaceToDelete),S({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),v.default.invalidate(c.fX),await _(!0)}catch(e){console.error("Error deleting workspace:",e),S(s=>({...s,deleting:!1,error:e}))}}},q=()=>{S({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null})};return h&&0===e.length?(0,t.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,t.jsx)(u.Z,{}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading workspaces..."})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,t.jsxs)("div",{className:"text-base flex items-center",children:[(0,t.jsx)("span",{className:"text-sky-blue leading-none",children:"Workspaces"}),(0,t.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||!w||0===Object.keys(w).length,children:P?(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(u.Z,{size:12,className:"mr-1"}),(0,t.jsx)("span",{children:"Edit All Configs"})]}):"Edit All Configs"})]}),(0,t.jsxs)("div",{className:"flex items-center",children:[h&&(0,t.jsxs)("div",{className:"flex items-center mr-2",children:[(0,t.jsx)(u.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500 text-xs",children:"Refreshing..."})]}),(0,t.jsxs)("button",{onClick:()=>{v.default.invalidate(c.fX),v.default.invalidate(a.getClusters),v.default.invalidate(i.getManagedJobs,[{allUsers:!0}]),v.default.invalidateFunction(c.yz),_(!0)},disabled:h,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,t.jsx)(p.Z,{className:"h-4 w-4 mr-1.5"}),!V&&(0,t.jsx)("span",{children:"Refresh"})]})]})]}),(0,t.jsx)(E,{workspaceCount:e.length,runningClusters:r.runningClusters,totalClusters:r.totalClusters,managedJobs:r.managedJobs,router:F}),0!==e.length||h?(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[e.map(e=>(0,t.jsx)(k,{workspace:e,onDelete:B,onEdit:e=>F.push("/workspaces/".concat(e)),router:F,rawWorkspacesData:w,checkPermissionAndAct:X,roleLoading:P},e.name)),(0,t.jsx)(C,{onClick:()=>F.push("/workspace/new"),checkPermissionAndAct:X,roleLoading:P})]}):(0,t.jsxs)("div",{className:"text-center py-10",children:[(0,t.jsx)("p",{className:"text-lg text-gray-600",children:"No workspaces found."}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Create a cluster to see its workspace here."})]}),w&&(0,t.jsx)(x.Vq,{open:R,onOpenChange:T,children:(0,t.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,t.jsx)(x.fK,{children:(0,t.jsx)(x.$N,{className:"pr-10",children:"All Workspaces Configuration"})}),(0,t.jsx)("div",{className:"flex-grow overflow-y-auto py-4",children:(0,t.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",overflowX:"auto",whiteSpace:"pre",wordBreak:"normal"},children:m.ZP.dump(w,{indent:2})})})]})}),(0,t.jsx)(x.Vq,{open:A.open,onOpenChange:e=>Z(s=>({...s,open:e})),children:(0,t.jsxs)(x.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,t.jsxs)(x.fK,{children:[(0,t.jsx)(x.$N,{children:"Permission Denied"}),(0,t.jsx)(x.Be,{children:P?(0,t.jsxs)("div",{className:"flex items-center py-2",children:[(0,t.jsx)(u.Z,{size:16,className:"mr-2"}),(0,t.jsx)("span",{children:"Checking permissions..."})]}):(0,t.jsx)(t.Fragment,{children:A.userName?(0,t.jsxs)(t.Fragment,{children:[A.userName," is logged in as non-admin and ",A.message,"."]}):A.message})})]}),(0,t.jsx)(x.cN,{children:(0,t.jsx)(d.z,{variant:"outline",onClick:()=>Z(e=>({...e,open:!1})),disabled:P,children:"OK"})})]})}),(0,t.jsx)(x.Vq,{open:O.confirmOpen,onOpenChange:q,children:(0,t.jsxs)(x.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(x.fK,{children:[(0,t.jsx)(x.$N,{children:"Delete Workspace"}),(0,t.jsxs)(x.Be,{children:['Are you sure you want to delete workspace "',O.workspaceToDelete,'"? This action cannot be undone.']})]}),(0,t.jsx)(f.X,{error:O.error,title:"Deletion Failed",onDismiss:()=>S(e=>({...e,error:null}))}),(0,t.jsxs)(x.cN,{children:[(0,t.jsx)(d.z,{variant:"outline",onClick:q,disabled:O.deleting,children:"Cancel"}),(0,t.jsx)(d.z,{variant:"destructive",onClick:I,disabled:O.deleting,children:O.deleting?"Deleting...":"Delete"})]})]})})]})}},2003:function(e,s,r){r.d(s,{j:function(){return a}});var t=r(512);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=t.W,a=(e,s)=>r=>{var t;if((null==s?void 0:s.variants)==null)return l(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:a,defaultVariants:i}=s,c=Object.keys(a).map(e=>{let s=null==r?void 0:r[e],t=null==i?void 0:i[e];if(null===s)return null;let l=n(s)||n(t);return a[e][l]}),o=r&&Object.entries(r).reduce((e,s)=>{let[r,t]=s;return void 0===t||(e[r]=t),e},{});return l(e,c,null==s?void 0:null===(t=s.compoundVariants)||void 0===t?void 0:t.reduce((e,s)=>{let{class:r,className:t,...n}=s;return Object.entries(n).every(e=>{let[s,r]=e;return Array.isArray(r)?r.includes({...i,...o}[s]):({...i,...o})[s]===r})?[...e,r,t]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[470],{3850:function(e,t,r){r.d(t,{E9:function(){return j},J$:function(){return l},PC:function(){return d},Ps:function(){return i},QT:function(){return x},Vp:function(){return u},W2:function(){return c},Ye:function(){return a},aD:function(){return g},fp:function(){return h},fy:function(){return m},h0:function(){return f},mU:function(){return p},oy:function(){return v},r7:function(){return w}});var n=r(5893);r(7294);var s=r(8507),o=r(8586);function i(e){return(0,n.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})})}function c(e){return(0,n.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function l(e){return(0,n.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function a(e){return(0,n.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M6 12l4 4 8-8"})})}function h(e){return(0,n.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1"}),(0,n.jsx)("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1"})]})}function x(e){return(0,n.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,n.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,n.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,n.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}function u(e){return(0,n.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"}),(0,n.jsx)("rect",{width:"20",height:"14",x:"2",y:"6",rx:"2"})]})}function d(e){return(0,n.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",ry:"2"}),(0,n.jsx)("rect",{x:"9",y:"9",width:"6",height:"6"}),(0,n.jsx)("line",{x1:"9",y1:"1",x2:"9",y2:"4"}),(0,n.jsx)("line",{x1:"15",y1:"1",x2:"15",y2:"4"}),(0,n.jsx)("line",{x1:"9",y1:"20",x2:"9",y2:"23"}),(0,n.jsx)("line",{x1:"15",y1:"20",x2:"15",y2:"23"}),(0,n.jsx)("line",{x1:"20",y1:"9",x2:"23",y2:"9"}),(0,n.jsx)("line",{x1:"20",y1:"14",x2:"23",y2:"14"}),(0,n.jsx)("line",{x1:"1",y1:"9",x2:"4",y2:"9"}),(0,n.jsx)("line",{x1:"1",y1:"14",x2:"4",y2:"14"})]})}function f(e){return(0,n.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),(0,n.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,n.jsx)("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function m(e){return(0,n.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,n.jsx)("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}function w(e){return(0,n.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}function p(e){return(0,n.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,n.jsx)("path",{transform:"scale(0.85) translate(1.8, 1.8)",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})})}function j(e){return(0,n.jsx)("svg",{...e,stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsxs)("g",{children:[(0,n.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,n.jsx)("path",{d:"M3 18.5V5a3 3 0 0 1 3-3h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5A3.5 3.5 0 0 1 3 18.5zM19 20v-3H6.5a1.5 1.5 0 0 0 0 3H19zM10 4H6a1 1 0 0 0-1 1v10.337A3.486 3.486 0 0 1 6.5 15H19V4h-2v8l-3.5-2-3.5 2V4z"})]})})}let g=s.Z,v=o.Z},9470:function(e,t,r){r.r(t),r.d(t,{Layout:function(){return v}});var n=r(5893),s=r(7294),o=r(5675),i=r.n(o),c=r(1163),l=r(1664),a=r.n(l),h=r(3850),x=r(355),u=r(6021),d=r(3225),f=r(6989),m=r(3001);let w=(0,s.createContext)(null);function p(e){let{children:t}=e,[r,o]=(0,s.useState)(!0),[i,c]=(0,s.useState)(null),[l,a]=(0,s.useState)(null),h=window.location.origin,x="".concat(h).concat(d.f4);return(0,s.useEffect)(()=>{fetch("".concat(x,"/api/health")).then(e=>e.json()).then(e=>{e.user&&e.user.name&&(c(e.user.name),(async()=>{try{let e=await fetch("".concat(x,"/users/role"));if(e.ok){let t=await e.json();t.role&&a(t.role)}}catch(e){console.log("Could not fetch user role:",e)}})())}).catch(e=>{console.error("Error fetching user data:",e)})},[x]),(0,n.jsx)(w.Provider,{value:{isSidebarOpen:r,toggleSidebar:()=>{o(e=>!e)},userEmail:i,userRole:l},children:t})}function j(){let e,t;let r=(0,c.useRouter)(),o=(0,m.X)(),{userEmail:l,userRole:p}=function(){let e=(0,s.useContext)(w);if(!e)throw Error("useSidebar must be used within a SidebarProvider");return e}(),[j,g]=(0,s.useState)(!1),v=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){v.current&&!v.current.contains(e.target)&&g(!1)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[v]);let y=e=>"/workspaces"===e?r.pathname.startsWith("/workspaces")||r.pathname.startsWith("/workspace"):r.pathname.startsWith(e),k=e=>{let t=y(e);return"inline-flex items-center border-b-2 ".concat(t?"border-transparent text-blue-600":"border-transparent hover:text-blue-600"," ").concat(o?"px-2 py-1":"px-1 pt-1 space-x-2")};return(0,n.jsx)("div",{className:"fixed top-0 left-0 right-0 bg-white z-30 h-14 px-4 border-b border-gray-200 shadow-sm",children:(0,n.jsxs)("div",{className:"flex items-center h-full",children:[(0,n.jsx)("div",{className:"flex items-center ".concat(o?"space-x-2 mr-2":"space-x-4 mr-6"),children:(0,n.jsx)(a(),{href:"/",className:"flex items-center px-1 pt-1 h-full",prefetch:!1,children:(0,n.jsx)("div",{className:"h-20 w-20 flex items-center justify-center",children:(0,n.jsx)(i(),{src:"".concat(d.GW,"/skypilot.svg"),alt:"SkyPilot Logo",width:80,height:80,priority:!0,className:"w-full h-full object-contain"})})})}),(0,n.jsxs)("div",{className:"flex items-center ".concat(o?"space-x-1":"space-x-2 md:space-x-4"," ").concat(o?"mr-2":"mr-6"),children:[(0,n.jsxs)(a(),{href:"/clusters",className:k("/clusters"),prefetch:!1,children:[(0,n.jsx)(h.QT,{className:"w-4 h-4"}),!o&&(0,n.jsx)("span",{children:"Clusters"})]}),(0,n.jsxs)(a(),{href:"/jobs",className:k("/jobs"),prefetch:!1,children:[(0,n.jsx)(h.Vp,{className:"w-4 h-4"}),!o&&(0,n.jsx)("span",{children:"Jobs"})]}),(0,n.jsx)("div",{className:"border-l border-gray-200 h-6 mx-1"}),(0,n.jsxs)(a(),{href:"/infra",className:k("/infra"),prefetch:!1,children:[(0,n.jsx)(h.PC,{className:"w-4 h-4"}),!o&&(0,n.jsx)("span",{children:"Infra"})]}),(0,n.jsxs)(a(),{href:"/workspaces",className:k("/workspaces"),prefetch:!1,children:[(0,n.jsx)(h.E9,{className:"w-4 h-4"}),!o&&(0,n.jsx)("span",{children:"Workspaces"})]}),(0,n.jsxs)(a(),{href:"/users",className:k("/users"),prefetch:!1,children:[(0,n.jsx)(h.oy,{className:"w-4 h-4"}),!o&&(0,n.jsx)("span",{children:"Users"})]})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-1 ".concat(o?"ml-0":"ml-auto"),children:[(0,n.jsx)(f.WH,{content:"Documentation",className:"text-sm text-muted-foreground",children:(0,n.jsxs)("a",{href:"https://skypilot.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-2 py-1 text-gray-600 hover:text-blue-600 transition-colors duration-150 cursor-pointer",title:"Docs",children:[!o&&(0,n.jsx)("span",{className:"mr-1",children:"Docs"}),(0,n.jsx)(h.h0,{className:"".concat(o?"w-4 h-4":"w-3.5 h-3.5")})]})}),(0,n.jsx)(f.WH,{content:"GitHub Repository",className:"text-sm text-muted-foreground",children:(0,n.jsx)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"GitHub",children:(0,n.jsx)(h.fy,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,n.jsx)(f.WH,{content:"Join Slack",className:"text-sm text-muted-foreground",children:(0,n.jsx)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Slack",children:(0,n.jsx)(h.mU,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,n.jsx)(f.WH,{content:"Leave Feedback",className:"text-sm text-muted-foreground",children:(0,n.jsx)("a",{href:"https://github.com/skypilot-org/skypilot/issues/new",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Leave Feedback",children:(0,n.jsx)(h.aD,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,n.jsx)("div",{className:"border-l border-gray-200 h-6"}),(0,n.jsx)(f.WH,{content:"Configuration",className:"text-sm text-muted-foreground",children:(0,n.jsx)(a(),{href:"/config",className:"inline-flex items-center justify-center p-2 rounded-full transition-colors duration-150 cursor-pointer ".concat(y("/config")?"text-blue-600 hover:bg-gray-100":"text-gray-600 hover:bg-gray-100"),title:"Configuration",prefetch:!1,children:(0,n.jsx)(x.Z,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),l&&(0,n.jsxs)("div",{className:"relative",ref:v,children:[(0,n.jsx)("button",{onClick:()=>g(!j),className:"inline-flex items-center justify-center rounded-full transition-colors duration-150 cursor-pointer hover:ring-2 hover:ring-blue-200",title:"User Profile",children:(0,n.jsx)("div",{className:"".concat(o?"w-6 h-6":"w-7 h-7"," bg-blue-600 text-white rounded-full flex items-center justify-center font-medium ").concat(o?"text-xs":"text-sm"," hover:bg-blue-700 transition-colors"),children:l?l.includes("@")?l.split("@")[0].charAt(0).toUpperCase():l.charAt(0).toUpperCase():"?"})}),j&&(0,n.jsxs)("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg z-50 border border-gray-200",children:[(e=l,t=null,l&&l.includes("@")&&(e=l.split("@")[0],t=l),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"px-4 pt-2 pb-1 text-sm font-medium text-gray-900",children:e}),t&&(0,n.jsx)("div",{className:"px-4 pt-0 pb-1 text-xs text-gray-500",children:t}),p&&(0,n.jsx)("div",{className:"px-4 pt-0 pb-2 text-xs",children:"admin"===p?(0,n.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,n.jsx)(h.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,n.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,n.jsx)(u.Z,{className:"w-3 h-3 mr-1"}),"User"]})})]})),(0,n.jsx)("div",{className:"border-t border-gray-200 mx-1 my-1"}),(0,n.jsx)(a(),{href:"/users",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-blue-600",onClick:()=>g(!1),prefetch:!1,children:"See all users"})]})]})]})]})})}function g(e){let{children:t,highlighted:r}=e;return(0,m.X)(),(0,n.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,n.jsx)("div",{className:"fixed top-0 left-0 right-0 z-50 shadow-sm",children:(0,n.jsx)(j,{})}),(0,n.jsx)("div",{className:"transition-all duration-200 ease-in-out min-h-screen",style:{paddingTop:"56px"},children:(0,n.jsx)("main",{className:"p-6",children:t})})]})}function v(e){return(0,n.jsx)(p,{children:(0,n.jsx)(g,{...e})})}},3001:function(e,t,r){r.d(t,{X:function(){return s}});var n=r(7294);function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,r]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let t=()=>{r(window.innerWidth<e)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e]),t}}}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[513,211],{803:function(e,r,t){t.d(r,{z:function(){return d}});var s=t(5893),n=t(7294),a=t(8426),l=t(2003),o=t(2350);let i=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=n.forwardRef((e,r)=>{let{className:t,variant:n,size:l,asChild:d=!1,...c}=e,u=d?a.g7:"button";return(0,s.jsx)(u,{className:(0,o.cn)(i({variant:n,size:l,className:t})),ref:r,...c})});d.displayName="Button"},7673:function(e,r,t){t.d(r,{Ol:function(){return d},Zb:function(){return i},aY:function(){return f},eW:function(){return m},ll:function(){return c}});var s=t(5893),n=t(7294),a=t(5697),l=t.n(a),o=t(2350);let i=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...a,children:n})});i.displayName="Card",i.propTypes={className:l().string,children:l().node};let d=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("flex flex-col space-y-1.5 p-6",t),...a,children:n})});d.displayName="CardHeader",d.propTypes={className:l().string,children:l().node};let c=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("h3",{ref:r,className:(0,o.cn)("text-2xl font-semibold leading-none tracking-tight",t),...a,children:n})});c.displayName="CardTitle",c.propTypes={className:l().string,children:l().node};let u=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("p",{ref:r,className:(0,o.cn)("text-sm text-muted-foreground",t),...a,children:n})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let f=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("p-6 pt-0",t),...a,children:n})});f.displayName="CardContent",f.propTypes={className:l().string,children:l().node};let m=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("flex items-center p-6 pt-0",t),...a,children:n})});m.displayName="CardFooter",m.propTypes={className:l().string,children:l().node}},4513:function(e,r,t){t.r(r),t.d(r,{NewWorkspace:function(){return y}});var s=t(5893),n=t(7294),a=t(1163),l=t(1664),o=t.n(l),i=t(5152),d=t.n(i),c=t(7324),u=t(803),f=t(2350);let m=n.forwardRef((e,r)=>{let{className:t,type:n,...a}=e;return(0,s.jsx)("input",{type:n,className:(0,f.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...a})});m.displayName="Input";var p=t(5320),x=n.forwardRef((e,r)=>(0,s.jsx)(p.WV.label,{...e,ref:r,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));x.displayName="Label";let b=(0,t(2003).j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),h=n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)(x,{ref:r,className:(0,f.cn)(b(),t),...n})});h.displayName=x.displayName;var g=t(7673);let v=d()(()=>Promise.all([t.e(616),t.e(799),t.e(804),t.e(798),t.e(947),t.e(989),t.e(470),t.e(969),t.e(856),t.e(973),t.e(938),t.e(843)]).then(t.bind(t,5843)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[5843]},ssr:!1});function y(){(0,a.useRouter)();let[e,r]=(0,n.useState)(""),[t,l]=(0,n.useState)(!1),[i,d]=(0,n.useState)({}),[f,p]=(0,n.useState)(!0);(0,n.useEffect)(()=>{x()},[]);let x=async()=>{try{let e=await (0,c.fX)();d(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{p(!1)}},b=()=>{e.trim()&&!y&&l(!0)},y=e.trim()&&i.hasOwnProperty(e.trim()),N=e.trim()&&!y;return t?(0,s.jsx)(v,{workspaceName:e,isNewWorkspace:!0}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex items-center justify-between mb-4 h-5",children:(0,s.jsxs)("div",{className:"text-base flex items-center",children:[(0,s.jsx)(o(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,s.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,s.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,s.jsxs)(g.Zb,{className:"max-w-md",children:[(0,s.jsx)(g.Ol,{children:(0,s.jsx)(g.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,s.jsxs)(g.aY,{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(h,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,s.jsx)(m,{id:"workspace-name",value:e,onChange:e=>r(e.target.value),placeholder:"Enter workspace name",autoFocus:!0,onKeyPress:e=>{"Enter"===e.key&&N&&b()}}),y?(0,s.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,s.jsx)(o(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,s.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,s.jsx)(u.z,{onClick:b,disabled:!N||f,className:"w-full bg-blue-600 hover:bg-blue-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:f?"Loading...":"Next: Configure Workspace"})]})]})]})}},2003:function(e,r,t){t.d(r,{j:function(){return l}});var s=t(512);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=s.W,l=(e,r)=>t=>{var s;if((null==r?void 0:r.variants)==null)return a(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:l,defaultVariants:o}=r,i=Object.keys(l).map(e=>{let r=null==t?void 0:t[e],s=null==o?void 0:o[e];if(null===r)return null;let a=n(r)||n(s);return l[e][a]}),d=t&&Object.entries(t).reduce((e,r)=>{let[t,s]=r;return void 0===s||(e[t]=s),e},{});return a(e,i,null==r?void 0:null===(s=r.compoundVariants)||void 0===s?void 0:s.reduce((e,r)=>{let{class:t,className:s,...n}=r;return Object.entries(n).every(e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...o,...d}[r]):({...o,...d})[r]===t})?[...e,t,s]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[641],{1812:function(e,s,r){r.d(s,{X:function(){return l}});var t=r(5893),a=r(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},l=e=>{let{error:s,title:r="Error",onDismiss:l}=e,[i,o]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{s&&o(!1)},[s]),!s||i)return null;let c="string"==typeof s?s:n(s);return(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsxs)("div",{className:"text-sm text-red-800",children:[(0,t.jsxs)("strong",{children:[r,":"]})," ",c]})})]}),(0,t.jsx)("button",{onClick:()=>{o(!0),l&&l()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,t.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},803:function(e,s,r){r.d(s,{z:function(){return c}});var t=r(5893),a=r(7294),n=r(8426),l=r(2003),i=r(2350);let o=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=a.forwardRef((e,s)=>{let{className:r,variant:a,size:l,asChild:c=!1,...d}=e,u=c?n.g7:"button";return(0,t.jsx)(u,{className:(0,i.cn)(o({variant:a,size:l,className:r})),ref:s,...d})});c.displayName="Button"},7673:function(e,s,r){r.d(s,{Ol:function(){return c},Zb:function(){return o},aY:function(){return m},eW:function(){return x},ll:function(){return d}});var t=r(5893),a=r(7294),n=r(5697),l=r.n(n),i=r(2350);let o=a.forwardRef((e,s)=>{let{className:r,children:a,...n}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...n,children:a})});o.displayName="Card",o.propTypes={className:l().string,children:l().node};let c=a.forwardRef((e,s)=>{let{className:r,children:a,...n}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",r),...n,children:a})});c.displayName="CardHeader",c.propTypes={className:l().string,children:l().node};let d=a.forwardRef((e,s)=>{let{className:r,children:a,...n}=e;return(0,t.jsx)("h3",{ref:s,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",r),...n,children:a})});d.displayName="CardTitle",d.propTypes={className:l().string,children:l().node};let u=a.forwardRef((e,s)=>{let{className:r,children:a,...n}=e;return(0,t.jsx)("p",{ref:s,className:(0,i.cn)("text-sm text-muted-foreground",r),...n,children:a})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let m=a.forwardRef((e,s)=>{let{className:r,children:a,...n}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("p-6 pt-0",r),...n,children:a})});m.displayName="CardContent",m.propTypes={className:l().string,children:l().node};let x=a.forwardRef((e,s)=>{let{className:r,children:a,...n}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("flex items-center p-6 pt-0",r),...n,children:a})});x.displayName="CardFooter",x.propTypes={className:l().string,children:l().node}},326:function(e,s,r){r.d(s,{$N:function(){return f},Be:function(){return h},Vq:function(){return o},cN:function(){return x},cZ:function(){return u},fK:function(){return m}});var t=r(5893),a=r(7294),n=r(6327),l=r(2350),i=r(3767);let o=n.fC;n.xz;let c=n.h_;n.x8;let d=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)(n.aV,{ref:s,className:(0,l.cn)("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...a})});d.displayName=n.aV.displayName;let u=a.forwardRef((e,s)=>{let{className:r,children:a,...o}=e;return(0,t.jsxs)(c,{children:[(0,t.jsx)(d,{}),(0,t.jsxs)(n.VY,{ref:s,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...o,children:[a,(0,t.jsxs)(n.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-500",children:[(0,t.jsx)(i.Z,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});u.displayName=n.VY.displayName;let m=e=>{let{className:s,...r}=e;return(0,t.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left",s),...r})};m.displayName="DialogHeader";let x=e=>{let{className:s,...r}=e;return(0,t.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...r})};x.displayName="DialogFooter";let f=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)(n.Dx,{ref:s,className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight",r),...a})});f.displayName=n.Dx.displayName;let h=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)(n.dk,{ref:s,className:(0,l.cn)("text-sm text-gray-500",r),...a})});h.displayName=n.dk.displayName},8764:function(e,s,r){r.d(s,{RM:function(){return o},SC:function(){return c},iA:function(){return l},pj:function(){return u},ss:function(){return d},xD:function(){return i}});var t=r(5893),a=r(7294),n=r(2350);let l=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)("div",{className:"relative w-full overflow-auto",children:(0,t.jsx)("table",{ref:s,className:(0,n.cn)("w-full caption-bottom text-base",r),...a})})});l.displayName="Table";let i=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)("thead",{ref:s,className:(0,n.cn)("[&_tr]:border-b",r),...a})});i.displayName="TableHeader";let o=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)("tbody",{ref:s,className:(0,n.cn)("[&_tr:last-child]:border-0",r),...a})});o.displayName="TableBody",a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)("tfoot",{ref:s,className:(0,n.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",r),...a})}).displayName="TableFooter";let c=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)("tr",{ref:s,className:(0,n.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...a})});c.displayName="TableRow";let d=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)("th",{ref:s,className:(0,n.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",r),...a})});d.displayName="TableHead";let u=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)("td",{ref:s,className:(0,n.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",r),...a})});u.displayName="TableCell",a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)("caption",{ref:s,className:(0,n.cn)("mt-4 text-base text-muted-foreground",r),...a})}).displayName="TableCaption"},2641:function(e,s,r){r.r(s),r.d(s,{Users:function(){return V}});var t=r(5893),a=r(7294),n=r(5697),l=r.n(n),i=r(8799),o=r(1664),c=r.n(o),d=r(803),u=r(8764),m=r(3081),x=r(3266),f=r(8969),h=r(6378),p=r(6856),g=r(1214),b=r(4545),j=r(1109),y=r(3626),v=r(3685),N=r(6741),w=r(6826),k=r(282),C=r(3767),R=r(5274),D=r(3936),S=r(7603);r(9470);var E=r(3001),I=r(7673),U=r(7145),F=r(326),_=r(1812);let L=(e,s)=>e&&e.includes("@")?e.split("@")[0]:e||"N/A",Z=(e,s)=>e&&e.includes("@")?e:s||"-",z=g.nb.REFRESH_INTERVAL,T=e=>{let{message:s,onDismiss:r}=e;return s?(0,t.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-6",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsx)("p",{className:"text-sm font-medium text-green-800",children:s})})]}),r&&(0,t.jsx)("div",{className:"ml-auto pl-3",children:(0,t.jsx)("div",{className:"-mx-1.5 -my-1.5",children:(0,t.jsxs)("button",{type:"button",onClick:r,className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2 focus:ring-offset-green-50",children:[(0,t.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,t.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}):null};function V(){let[e,s]=(0,a.useState)(!1),r=(0,a.useRef)(null),n=(0,E.X)(),[l,o]=(0,a.useState)(!1),[u,p]=(0,a.useState)({username:"",password:"",role:"user"}),[g,b]=(0,a.useState)(!1),[k,C]=(0,a.useState)({open:!1,message:"",userName:""}),[R,D]=(0,a.useState)(null),[S,I]=(0,a.useState)(!1),[L,Z]=(0,a.useState)(!1),[V,A]=(0,a.useState)(!1),[q,M]=(0,a.useState)(null),[B,O]=(0,a.useState)(!1),[K,H]=(0,a.useState)(null),[Y,$]=(0,a.useState)("import"),[X,J]=(0,a.useState)(!1),[W,G]=(0,a.useState)(null),[Q,ee]=(0,a.useState)(""),[es,er]=(0,a.useState)(!1),[et,ea]=(0,a.useState)(null),[en,el]=(0,a.useState)(!1),[ei,eo]=(0,a.useState)(null),[ec,ed]=(0,a.useState)(null),[eu,em]=(0,a.useState)(!1),[ex,ef]=(0,a.useState)(null),[eh,ep]=(0,a.useState)(null),[eg,eb]=(0,a.useState)(void 0);(0,a.useEffect)(()=>{(async function(){try{let e=await U.x.get("/api/health");if(e.ok){let s=await e.json();eb(!!s.basic_auth_enabled)}else eb(!1)}catch(e){eb(!1)}})()},[]),(0,a.useEffect)(()=>{ej().catch(()=>{console.error("Failed to get user role")})},[]);let ej=async()=>{if(R&&Date.now()-R.timestamp<3e5)return R;I(!0);try{let e=await U.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(),r={role:s.role,name:s.name,id:s.id,timestamp:Date.now()};return D(r),I(!1),r}catch(e){throw I(!1),e}},ey=async(e,s)=>{try{let r=await ej();if("admin"!==r.role)return C({open:!0,message:e,userName:r.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),C({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},ev=()=>{h.default.invalidate(m.R),h.default.invalidate(x.getClusters),h.default.invalidate(f.getManagedJobs,[{allUsers:!0}]),r.current&&r.current()},eN=async()=>{if(!u.username||!u.password){ep(Error("Username and password are required.")),o(!1);return}b(!0),ep(null),ef(null);try{let e=await U.x.post("/users/create",u);if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to create user")}ef('User "'.concat(u.username,'" created successfully!')),o(!1),p({username:"",password:"",role:"user"}),ev()}catch(e){ep(e),o(!1),p({username:"",password:"",role:"user"})}finally{b(!1)}},ew=async e=>{let s=e.target.files[0];s&&(M(s),H(null))},ek=async()=>{if(!q){alert("Please select a CSV file first.");return}O(!0);try{let e=new FileReader;e.onload=async e=>{try{let s=e.target.result,r=await U.x.post("/users/import",{csv_content:s});if(!r.ok){let e=await r.json();throw Error(e.detail||"Failed to import users")}let t=await r.json(),a="Import completed. ".concat(t.success_count," users created successfully.");t.error_count>0&&(a+="\n".concat(t.error_count," failed."),t.creation_errors.length>0&&(a+="\nErrors: ".concat(t.creation_errors.slice(0,3).join(", ")),t.creation_errors.length>3&&(a+=" and ".concat(t.creation_errors.length-3," more...")))),H({message:a}),t.success_count>0&&ev()}catch(e){alert("Error importing users: ".concat(e.message))}finally{O(!1)}},e.readAsText(q)}catch(e){alert("Error reading file: ".concat(e.message)),O(!1)}},eC=async e=>{G(e),ee(""),J(!0)},eR=async()=>{if(!Q){ea(Error("Please enter a new password."));return}er(!0),ea(null);try{let e=await U.x.post("/users/update",{user_id:W.userId,password:Q});if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to reset password")}ef('Password reset successfully for user "'.concat(W.usernameDisplay,'"!')),J(!1),G(null),ee("")}catch(e){ea(e)}finally{er(!1)}},eD=async()=>{if(ei){em(!0),ed(null);try{let e=await U.x.post("/users/delete",{user_id:ei.userId});if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to delete user")}ef('User "'.concat(ei.usernameDisplay,'" deleted successfully!')),el(!1),eo(null),ev()}catch(e){ed(e)}finally{em(!1)}}},eS=()=>{el(!1),eo(null),ed(null)},eE=()=>{J(!1),G(null),ee(""),ea(null)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,t.jsx)("div",{className:"text-base",children:(0,t.jsx)(c(),{href:"/users",className:"text-sky-blue hover:underline leading-none",children:"Users"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[e&&(0,t.jsxs)("div",{className:"flex items-center mr-2",children:[(0,t.jsx)(i.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),eg&&(null==R?void 0:R.role)==="admin"&&(0,t.jsx)("button",{onClick:async()=>{await ey("cannot create users",()=>{o(!0)})},className:"text-sky-blue hover:text-sky-blue-bright flex items-center border-sky-blue rounded px-2 py-1 mr-2",title:"Create New User",children:"+ New User"}),eg&&(null==R?void 0:R.role)==="admin"&&(0,t.jsxs)("button",{onClick:async()=>{await ey("cannot import users",()=>{A(!0)})},className:"text-sky-blue hover:text-sky-blue-bright flex items-center rounded px-2 py-1 mr-2",title:"Import/Export Users",children:[(0,t.jsx)(j.Z,{className:"h-4 w-4 mr-1"}),"Import/Export"]}),(0,t.jsxs)("button",{onClick:ev,disabled:e,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,t.jsx)(y.Z,{className:"h-4 w-4 mr-1.5"}),!n&&(0,t.jsx)("span",{children:"Refresh"})]})]})]}),(0,t.jsx)(T,{message:ex,onDismiss:()=>ef(null)}),(0,t.jsx)(_.X,{error:eh,title:"Error",onDismiss:()=>ep(null)}),(0,t.jsx)(P,{refreshInterval:z,setLoading:s,refreshDataRef:r,checkPermissionAndAct:ey,roleLoading:S,onResetPassword:eC,onDeleteUser:e=>{ey("cannot delete users",()=>{eo(e),el(!0)})},basicAuthEnabled:eg,currentUserRole:null==R?void 0:R.role,currentUserId:null==R?void 0:R.id}),(0,t.jsx)(F.Vq,{open:l,onOpenChange:o,children:(0,t.jsxs)(F.cZ,{className:"sm:max-w-md",children:[(0,t.jsx)(F.fK,{children:(0,t.jsx)(F.$N,{children:"Create User"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 py-4",children:[(0,t.jsxs)("div",{className:"grid gap-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Username"}),(0,t.jsx)("input",{className:"border rounded px-3 py-2 w-full",placeholder:"Username",value:u.username,onChange:e=>p({...u,username:e.target.value})})]}),(0,t.jsxs)("div",{className:"grid gap-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{className:"border rounded px-3 py-2 w-full pr-10",placeholder:"Password",type:L?"text":"password",value:u.password,onChange:e=>p({...u,password:e.target.value})}),(0,t.jsx)("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600",onClick:()=>Z(!L),children:L?(0,t.jsx)(v.Z,{className:"h-4 w-4"}):(0,t.jsx)(N.Z,{className:"h-4 w-4"})})]})]}),(0,t.jsxs)("div",{className:"grid gap-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Role"}),(0,t.jsxs)("select",{className:"border rounded px-3 py-2 w-full",value:u.role,onChange:e=>p({...u,role:e.target.value}),children:[(0,t.jsx)("option",{value:"user",children:"User"}),(0,t.jsx)("option",{value:"admin",children:"Admin"})]})]})]}),(0,t.jsxs)(F.cN,{children:[(0,t.jsx)("button",{className:"inline-flex items-center justify-center 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 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",onClick:()=>o(!1),disabled:g,children:"Cancel"}),(0,t.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:eN,disabled:g,children:g?"Creating...":"Create"})]})]})}),(0,t.jsx)(F.Vq,{open:k.open,onOpenChange:e=>C(s=>({...s,open:e})),children:(0,t.jsxs)(F.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,t.jsxs)(F.fK,{children:[(0,t.jsx)(F.$N,{children:"Permission Denied"}),(0,t.jsx)(F.Be,{children:S?(0,t.jsxs)("div",{className:"flex items-center py-2",children:[(0,t.jsx)(i.Z,{size:16,className:"mr-2"}),(0,t.jsx)("span",{children:"Checking permissions..."})]}):(0,t.jsx)(t.Fragment,{children:k.userName?(0,t.jsxs)(t.Fragment,{children:[k.userName," is logged in as non-admin and ",k.message,"."]}):k.message})})]}),(0,t.jsx)(F.cN,{children:(0,t.jsx)(d.z,{variant:"outline",onClick:()=>C(e=>({...e,open:!1})),disabled:S,children:"OK"})})]})}),(0,t.jsx)(F.Vq,{open:V,onOpenChange:A,children:(0,t.jsxs)(F.cZ,{className:"sm:max-w-lg",children:[(0,t.jsx)(F.fK,{children:(0,t.jsx)(F.$N,{children:"Import/Export Users"})}),(0,t.jsxs)("div",{className:"flex border-b border-gray-200 mb-4",children:[(0,t.jsx)("button",{className:"px-4 py-2 text-sm font-medium ".concat("import"===Y?"border-b-2 border-sky-500 text-sky-600":"text-gray-500 hover:text-gray-700"),onClick:()=>$("import"),children:"Import"}),(0,t.jsx)("button",{className:"px-4 py-2 text-sm font-medium ".concat("export"===Y?"border-b-2 border-sky-500 text-sky-600":"text-gray-500 hover:text-gray-700"),onClick:()=>$("export"),children:"Export"})]}),(0,t.jsx)("div",{className:"flex flex-col gap-4 py-4",children:"import"===Y?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"grid gap-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"CSV File"}),(0,t.jsx)("input",{type:"file",accept:".csv",onChange:ew,className:"border rounded px-3 py-2 w-full"}),(0,t.jsxs)("p",{className:"text-xs text-gray-500",children:["CSV should have columns: username, password, role",(0,t.jsx)("br",{}),"Supports both plain text passwords and exported password hashes."]})]}),K&&(0,t.jsx)("div",{className:"p-3 bg-green-50 border border-green-200 rounded text-green-700 text-sm",children:K.message})]}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"grid gap-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Export Users to CSV"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"Download all users as a CSV file with password hashes."}),(0,t.jsxs)("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded",children:[(0,t.jsx)("p",{className:"text-sm text-amber-700",children:"⚠️ This will export all users with columns: username, password (hashed), role"}),(0,t.jsx)("p",{className:"text-xs text-amber-600 mt-1",children:"Password hashes can be imported directly for system backups."})]})]})})}),(0,t.jsxs)(F.cN,{children:[(0,t.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",onClick:()=>A(!1),disabled:B,children:"Cancel"}),"import"===Y?(0,t.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:ek,disabled:B||!q,children:B?"Importing...":"Import"}):(0,t.jsxs)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:async()=>{try{let e=await U.x.get("/users/export");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to export users")}let s=await e.json(),r=s.csv_content,t=new Blob([r],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(t),n=document.createElement("a");n.href=a;let l=new Date,i=e=>String(e).padStart(2,"0"),o=l.getFullYear(),c=i(l.getMonth()+1),d=i(l.getDate()),u=i(l.getHours()),m=i(l.getMinutes()),x=i(l.getSeconds());n.download="users_export_".concat(o,"-").concat(c,"-").concat(d,"-").concat(u,"-").concat(m,"-").concat(x,".csv"),n.click(),URL.revokeObjectURL(a),alert("Successfully exported ".concat(s.user_count," users to CSV file."))}catch(e){alert("Error exporting users: ".concat(e.message))}},children:[(0,t.jsx)(w.Z,{className:"h-4 w-4 mr-1"}),"Export"]})]})]})}),(0,t.jsx)(F.Vq,{open:X,onOpenChange:eE,children:(0,t.jsxs)(F.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(F.fK,{children:[(0,t.jsx)(F.$N,{children:"Reset Password"}),(0,t.jsxs)(F.Be,{children:["Enter a new password for"," ",(null==W?void 0:W.usernameDisplay)||"this user","."]})]}),(0,t.jsx)("div",{className:"flex flex-col gap-4 py-4",children:(0,t.jsxs)("div",{className:"grid gap-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"New Password"}),(0,t.jsx)("input",{type:"password",className:"border rounded px-3 py-2 w-full",placeholder:"Enter new password",value:Q,onChange:e=>ee(e.target.value),autoFocus:!0})]})}),(0,t.jsx)(_.X,{error:et,title:"Reset Failed",onDismiss:()=>ea(null)}),(0,t.jsxs)(F.cN,{children:[(0,t.jsx)(d.z,{variant:"outline",onClick:eE,disabled:es,children:"Cancel"}),(0,t.jsx)(d.z,{variant:"default",onClick:eR,disabled:es||!Q,className:"bg-sky-600 text-white hover:bg-sky-700",children:es?"Resetting...":"Reset Password"})]})]})}),(0,t.jsx)(F.Vq,{open:en,onOpenChange:eS,children:(0,t.jsxs)(F.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(F.fK,{children:[(0,t.jsx)(F.$N,{children:"Delete User"}),(0,t.jsxs)(F.Be,{children:['Are you sure you want to delete user "',(null==ei?void 0:ei.usernameDisplay)||"this user",'"? This action cannot be undone.']})]}),(0,t.jsx)(_.X,{error:ec,title:"Deletion Failed",onDismiss:()=>ed(null)}),(0,t.jsxs)(F.cN,{children:[(0,t.jsx)(d.z,{variant:"outline",onClick:eS,disabled:eu,children:"Cancel"}),(0,t.jsx)(d.z,{variant:"destructive",onClick:eD,disabled:eu,children:eu?"Deleting...":"Delete"})]})]})})]})}function P(e){let{refreshInterval:s,setLoading:r,refreshDataRef:n,checkPermissionAndAct:l,roleLoading:o,onResetPassword:d,onDeleteUser:g,basicAuthEnabled:j,currentUserRole:y,currentUserId:v}=e,[N,w]=(0,a.useState)([]),[E,F]=(0,a.useState)(!0),[_,z]=(0,a.useState)(!1),[T,V]=(0,a.useState)({key:"username",direction:"ascending"}),[P,A]=(0,a.useState)(null),[q,M]=(0,a.useState)(""),B=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r&&e&&r(!0),e&&F(!0);try{let s=await h.default.get(m.R),t=(s||[]).map(e=>({...e,usernameDisplay:L(e.username,e.userId),fullEmailID:Z(e.username,e.userId),clusterCount:-1,jobCount:-1}));w(t),z(!0),r&&e&&r(!1),e&&F(!1);let[a,n]=await Promise.all([h.default.get(x.getClusters),h.default.get(f.getManagedJobs,[{allUsers:!0}])]),l=n.jobs||[],i=(s||[]).map(e=>{let s=(a||[]).filter(s=>s.user_hash===e.userId),r=(l||[]).filter(s=>s.user_hash===e.userId);return{...e,usernameDisplay:L(e.username,e.userId),fullEmailID:Z(e.username,e.userId),clusterCount:s.length,jobCount:r.length}});w(i)}catch(s){console.error("Failed to fetch or process user data:",s),w([]),z(!0),r&&e&&r(!1),e&&F(!1)}},[r]);(0,a.useEffect)(()=>{n&&(n.current=()=>B(!0))},[n,B]),(0,a.useEffect)(()=>{(async()=>{z(!1),F(!0),await p.ZP.preloadForPage("users"),B(!0)})();let e=setInterval(()=>{B(!1)},s);return()=>clearInterval(e)},[B,s]);let O=(0,a.useMemo)(()=>(0,b.R0)(N,T.key,T.direction),[N,T]),K=e=>{let s="ascending";T.key===e&&"ascending"===T.direction&&(s="descending"),V({key:e,direction:s})},H=e=>T.key===e?"ascending"===T.direction?" ↑":" ↓":"",Y=async(e,s)=>{await l("cannot edit user role",()=>{A(e),M(s)})},$=()=>{A(null),M("")},X=async e=>{if(!e||!q){console.error("User ID or role is missing."),alert("Error: User ID or role is missing.");return}F(!0);try{let s=await U.x.post("/users/update",{user_id:e,role:q});if(!s.ok){let e=await s.json();throw Error(e.detail||"Failed to update role")}h.default.invalidate(m.R),await B(!0),$()}catch(e){console.error("Failed to update user role:",e),alert("Error updating role: ".concat(e.message))}finally{F(!1)}};return E&&0===N.length&&!_?(0,t.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,t.jsx)(i.Z,{})}):_?O&&0!==O.length?(0,t.jsx)(I.Zb,{children:(0,t.jsxs)(u.iA,{children:[(0,t.jsx)(u.xD,{children:(0,t.jsxs)(u.SC,{children:[(0,t.jsxs)(u.ss,{onClick:()=>K("usernameDisplay"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Name",H("usernameDisplay")]}),(0,t.jsxs)(u.ss,{onClick:()=>K("fullEmailID"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["User ID",H("fullEmailID")]}),(0,t.jsxs)(u.ss,{onClick:()=>K("role"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Role",H("role")]}),(0,t.jsxs)(u.ss,{onClick:()=>K("clusterCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Clusters",H("clusterCount")]}),(0,t.jsxs)(u.ss,{onClick:()=>K("jobCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Jobs",H("jobCount")]}),j&&(0,t.jsx)(u.ss,{className:"whitespace-nowrap w-1/6",children:"Actions"})]})}),(0,t.jsx)(u.RM,{children:O.map(e=>(0,t.jsxs)(u.SC,{children:[(0,t.jsx)(u.pj,{className:"truncate",title:e.username,children:e.usernameDisplay}),(0,t.jsx)(u.pj,{className:"truncate",title:e.fullEmailID,children:e.fullEmailID}),(0,t.jsx)(u.pj,{className:"truncate",title:e.role,children:(0,t.jsx)("div",{className:"flex items-center gap-2",children:P===e.userId?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("select",{value:q,onChange:e=>M(e.target.value),className:"block w-auto p-1 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-sky-blue focus:border-sky-blue sm:text-sm",children:[(0,t.jsx)("option",{value:"admin",children:"Admin"}),(0,t.jsx)("option",{value:"user",children:"User"})]}),(0,t.jsx)("button",{onClick:()=>X(e.userId),className:"text-green-600 hover:text-green-800 p-1",title:"Save",children:(0,t.jsx)(k.Z,{className:"h-4 w-4"})}),(0,t.jsx)("button",{onClick:$,className:"text-gray-500 hover:text-gray-700 p-1",title:"Cancel",children:(0,t.jsx)(C.Z,{className:"h-4 w-4"})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"capitalize",children:e.role}),"admin"===y&&(0,t.jsx)("button",{onClick:()=>Y(e.userId,e.role),className:"text-sky-blue hover:text-sky-blue-bright p-1",title:"Edit role",children:(0,t.jsx)(R.Z,{className:"h-3 w-3"})})]})})}),(0,t.jsx)(u.pj,{children:-1===e.clusterCount?(0,t.jsxs)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-400 rounded text-xs font-medium flex items-center",children:[(0,t.jsx)(i.Z,{size:10,className:"mr-1"}),"Loading..."]}):(0,t.jsx)(c(),{href:"/clusters?user=".concat(encodeURIComponent(e.userId)),className:"px-2 py-0.5 rounded text-xs font-medium transition-colors duration-200 cursor-pointer inline-block ".concat(e.clusterCount>0?"bg-blue-100 text-blue-800 hover:bg-blue-200 hover:text-blue-900":"bg-gray-100 text-gray-500 hover:bg-gray-200 hover:text-gray-700"),title:"View ".concat(e.clusterCount," cluster").concat(1!==e.clusterCount?"s":""," for ").concat(e.usernameDisplay),children:e.clusterCount})}),(0,t.jsx)(u.pj,{children:-1===e.jobCount?(0,t.jsxs)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-400 rounded text-xs font-medium flex items-center",children:[(0,t.jsx)(i.Z,{size:10,className:"mr-1"}),"Loading..."]}):(0,t.jsx)(c(),{href:"/jobs?user=".concat(encodeURIComponent(e.userId)),className:"px-2 py-0.5 rounded text-xs font-medium transition-colors duration-200 cursor-pointer inline-block ".concat(e.jobCount>0?"bg-green-100 text-green-800 hover:bg-green-200 hover:text-green-900":"bg-gray-100 text-gray-500 hover:bg-gray-200 hover:text-gray-700"),title:"View ".concat(e.jobCount," job").concat(1!==e.jobCount?"s":""," for ").concat(e.usernameDisplay),children:e.jobCount})}),j&&(0,t.jsx)(u.pj,{className:"relative",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{onClick:"admin"===y||e.userId===v?async()=>{d(e)}:void 0,className:"admin"===y||e.userId===v?"text-sky-blue hover:text-sky-blue-bright p-1":"text-gray-300 cursor-not-allowed p-1",title:"admin"===y||e.userId===v?"Reset Password":"You can only reset your own password",disabled:"admin"!==y&&e.userId!==v,children:(0,t.jsx)(D.Z,{className:"h-4 w-4"})}),"admin"===y&&(0,t.jsx)("button",{onClick:()=>g(e),className:"text-sky-blue hover:text-red-500 p-1",title:"Delete User",children:(0,t.jsx)(S.Z,{className:"h-4 w-4"})})]})})]},e.userId))})]})}):(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)("p",{className:"text-lg font-semibold text-gray-500",children:"No users found."}),(0,t.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:"There are currently no users to display."})]}):(0,t.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,t.jsx)(i.Z,{}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading users..."})]})}P.propTypes={refreshInterval:l().number.isRequired,setLoading:l().func.isRequired,refreshDataRef:l().shape({current:l().func}).isRequired,checkPermissionAndAct:l().func.isRequired,roleLoading:l().bool.isRequired,onResetPassword:l().func.isRequired,onDeleteUser:l().func.isRequired,basicAuthEnabled:l().bool,currentUserRole:l().string,currentUserId:l().string}},4545:function(e,s,r){function t(e){return e.startsWith("sky-jobs-controller-")}function a(e,s,r){return null===s?e:[...e].sort((e,t)=>e[s]<t[s]?"ascending"===r?-1:1:e[s]>t[s]?"ascending"===r?1:-1:0)}r.d(s,{R0:function(){return a},Ym:function(){return t}})}}]);
|
@@ -1,6 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[682],{3626:function(e,s,t){t.d(s,{Z:function(){return a}});/**
|
2
|
-
* @license lucide-react v0.407.0 - ISC
|
3
|
-
*
|
4
|
-
* This source code is licensed under the ISC license.
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
6
|
-
*/let a=(0,t(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"}]])},8682:function(e,s,t){t.r(s),t.d(s,{ContextDetails:function(){return y},GPUs:function(){return w},InfrastructureSection:function(){return b}});var a=t(5893),l=t(7294),r=t(8799);t(9470);var n=t(3626),d=t(3001),c=t(2045),i=t(3266),o=t(8969),x=t(6378),m=t(6856),u=t(1214),h=t(1163),g=t(1664),f=t.n(g),p=t(6989);let j=u.nb.REFRESH_INTERVAL,N=u.MO.NAME_TRUNCATE_LENGTH;function b(e){let{title:s,isLoading:t,isDataLoaded:l,contexts:n,gpus:d,groupedPerContextGPUs:c,groupedPerNodeGPUs:i,handleContextClick:o,contextStats:x={},isSSH:m=!1}=e,u=n||[];return t||!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:s}),(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 ",s,"..."]})]})]})}):l&&0===u.length?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:s}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["No ",s," found or ",s," is not configured."]})]})}):l&&u.length>0?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:s}),(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:[u.length," ",1===u.length?m?"pool":"context":m?"pools":"contexts"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:m?"Node Pool":"Context"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Jobs"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Nodes"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"GPU Types"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"#GPUs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(u.length>5?"max-h-[250px] overflow-y-auto block":""),children:u.map(e=>{let s=c[e]||[],t=i[e]||[],l=s.reduce((e,s)=>e+(s.gpu_total||0),0),r=x[m?"ssh/".concat(e.replace(/^ssh-/,"")):"kubernetes/".concat(e)]||{clusters:0,jobs:0},n=Object.keys(s.reduce((e,s)=>(e[s.gpu_name]=(e[s.gpu_name]||0)+(s.gpu_total||0),e),{})).join(", "),d=m?e.replace(/^ssh-/,""):e;return(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3",children:(0,a.jsx)(p.Md,{content:d,className:"text-sm text-muted-foreground",children:(0,a.jsx)("span",{className:"text-blue-600 hover:underline cursor-pointer",onClick:()=>o(e),children:d.length>N?"".concat(d.substring(0,Math.floor((N-3)/2)),"...").concat(d.substring(d.length-Math.ceil((N-3)/2))):d})})}),(0,a.jsx)("td",{className:"p-3",children:r.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:r.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:r.jobs>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:r.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:(t||[]).length}),(0,a.jsx)("td",{className:"p-3",children:n||"-"}),(0,a.jsx)("td",{className:"p-3",children:l})]},e)})})]})})}),d&&d.length>0&&(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4 whitespace-nowrap",children:["GPU",(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-green-100 text-green-800 rounded-full text-xs font-medium whitespace-nowrap",children:[d.reduce((e,s)=>e+s.gpu_free,0)," ","of"," ",d.reduce((e,s)=>e+s.gpu_total,0)," ","free"]})]}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"Requestable"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/2",children:(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsx)("span",{children:"Utilization"})})})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(d.length>5?"max-h-[250px] overflow-y-auto block":""),children:d.map(e=>{let s=e.gpu_total-e.gpu_free,t=e.gpu_total>0?e.gpu_free/e.gpu_total*100:0,l=e.gpu_total>0?s/e.gpu_total*100:0,r=c?Object.values(c).flat().filter(s=>s.gpu_name===e.gpu_name&&(m?s.context.startsWith("ssh-"):!s.context.startsWith("ssh-"))).map(e=>e.gpu_requestable_qty_per_node).filter((e,s,t)=>t.indexOf(e)===s).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(s," used")}),t>0&&(0,a.jsx)("div",{style:{width:"".concat(t,"%")},className:"bg-green-700 h-full flex items-center justify-center text-white text-xs font-medium",children:t>15&&"".concat(e.gpu_free," free")})]})})})]},e.gpu_name)})})]})})})]})]})}):null}function y(e){let{contextName:s,gpusInContext:t,nodesInContext:l}=e;return s.startsWith("ssh-"),(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm h-full",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4",children:"Available GPUs"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:t.map(e=>{let s=e.gpu_total-e.gpu_free,t=e.gpu_total>0?e.gpu_free/e.gpu_total*100:0,l=e.gpu_total>0?s/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(s," used")}),t>0&&(0,a.jsx)("div",{style:{width:"".concat(t,"%")},className:"bg-green-700 h-full flex items-center justify-center text-white text-xs",children:t>15&&"".concat(e.gpu_free," free")})]})]},e.gpu_name)})}),l&&l.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4",children:"Nodes"}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-100",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"Node"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"GPU"}),(0,a.jsx)("th",{className:"p-3 text-right font-medium text-gray-600",children:"Availability"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:l.map((e,s)=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.node_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.gpu_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-right text-gray-700",children:"".concat(e.gpu_free," of ").concat(e.gpu_total," free")})]},"".concat(e.node_name,"-").concat(s)))})]})})]})]})})})}function w(){let[e,s]=(0,l.useState)(!0),[t,u]=(0,l.useState)(!0),[g,p]=(0,l.useState)(!0),N=l.useRef(null),w=(0,d.X)(),[v,_]=(0,l.useState)(!1),[C,S]=(0,l.useState)(!1),P=(0,h.useRouter)(),[k,L]=(0,l.useState)([]),[U,E]=(0,l.useState)([]),[I,G]=(0,l.useState)([]),[M,R]=(0,l.useState)([]),[q,A]=(0,l.useState)([]),[Z,W]=(0,l.useState)(0),[z,D]=(0,l.useState)(0),[F,H]=(0,l.useState)({}),[T,O]=(0,l.useState)(null),J=l.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showLoadingIndicators:!0};e.showLoadingIndicators&&(s(!0),u(!0));try{let e=await x.default.get(c.l4),{gpuData:s,cloudData:t}=e||{};if(s){let{allContextNames:e,allGPUs:t,perContextGPUs:a,perNodeGPUs:l,contextStats:r}=s;L(e||[]),E(t||[]),G(a||[]),R(l||[]),H(r||{}),_(!0)}else e&&null===e.gpuData?(L([]),E([]),G([]),R([]),H({}),_(!0)):e||console.log("No infra data received from cache");t?(A(t.clouds||[]),W(t.totalClouds||0),D(t.enabledClouds||0),S(!0)):e&&null===e.cloudData?(A([]),W(0),D(0),S(!0)):e||console.log("No cloud data received from cache")}catch(e){console.error("Error in fetchData:",e),L([]),E([]),G([]),R([]),H({}),A([]),W(0),D(0),_(!0),S(!0)}finally{e.showLoadingIndicators&&(s(!1),u(!1)),g&&e.showLoadingIndicators&&p(!1)}},[g]);(0,l.useEffect)(()=>{N.current=J},[J]),(0,l.useEffect)(()=>{(async()=>{await m.ZP.preloadForPage("infra"),J({showLoadingIndicators:!0})})()},[J]),(0,l.useEffect)(()=>{let e=!0,s=setInterval(()=>{e&&N.current&&N.current({showLoadingIndicators:!1})},j);return()=>{e=!1,clearInterval(s)}},[]),(0,l.useEffect)(()=>()=>{_(!1),S(!1),p(!0)},[]),(U||[]).length,(U||[]).reduce((e,s)=>e+s.gpu_total,0),(U||[]).reduce((e,s)=>e+s.gpu_free,0);let K=l.useMemo(()=>I?I.reduce((e,s)=>{let{context:t}=s;return e[t]||(e[t]=[]),e[t].push(s),e},{}):{},[I]),V=l.useMemo(()=>k&&Array.isArray(k)?k.filter(e=>e.startsWith("ssh-")):[],[k]),X=l.useMemo(()=>k&&Array.isArray(k)?k.filter(e=>!e.startsWith("ssh-")):[],[k]),B=l.useMemo(()=>{if(!I||!U)return[];let e=new Set;return I.forEach(s=>{s.context.startsWith("ssh-")&&e.add(s.gpu_name)}),U.filter(s=>e.has(s.gpu_name))},[U,I]),Q=l.useMemo(()=>{if(!I||!U)return[];let e=new Set;return I.forEach(s=>{s.context.startsWith("ssh-")||e.add(s.gpu_name)}),U.filter(s=>e.has(s.gpu_name))},[U,I]),Y=l.useMemo(()=>M?M.reduce((e,s)=>{let{context:t}=s;return e[t]||(e[t]=[]),e[t].push(s),e},{}):{},[M]);(0,l.useEffect)(()=>{P.isReady&&P.query.context&&O(decodeURIComponent(Array.isArray(P.query.context)?P.query.context[0]:P.query.context))},[P.isReady,P.query.context]);let $=e=>{O(e),P.push("/infra/".concat(encodeURIComponent(e)))},ee=e||t,es=v&&C&&!g;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)(f(),{href:"/infra",className:"text-sky-blue hover:underline ".concat(T?"":"cursor-default"),children:"Infrastructure"}),T&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),T.startsWith("ssh-")?(0,a.jsx)(f(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"SSH Node Pool"}):(0,a.jsx)(f(),{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:T.startsWith("ssh-")?T.replace(/^ssh-/,""):T})]})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[ee&&(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:()=>{x.default.invalidate(i.getClusters),x.default.invalidate(o.getManagedJobs,[{allUsers:!0}]),x.default.invalidate(c.l4),N.current&&N.current({showLoadingIndicators:!0})},disabled:ee,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 mr-1.5"}),!w&&"Refresh"]})]})]}),es?T?e&&!v?(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..."})]}):(s=>{let t=K[s]||[],l=Y[s]||[];return e&&!v?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]}):(0,a.jsx)(y,{contextName:s,gpusInContext:t,nodesInContext:l})})(T):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b,{title:"SSH Node Pool",isLoading:e,isDataLoaded:v,contexts:V,gpus:B,groupedPerContextGPUs:K,groupedPerNodeGPUs:Y,handleContextClick:$,contextStats:F,isSSH:!0}),(0,a.jsx)(b,{title:"Kubernetes",isLoading:e,isDataLoaded:v,contexts:X,gpus:Q,groupedPerContextGPUs:K,groupedPerNodeGPUs:Y,handleContextClick:$,contextStats:F,isSSH:!1}),t||!C?(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:[z," of ",Z," enabled"]})]}),q&&0!==q.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:q.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..."})]})]})}}}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[760],{1163:function(e,r,t){e.exports=t(6036)},8771:function(e,r,t){"use strict";t.d(r,{F:function(){return l},e:function(){return i}});var o=t(7294);function n(e,r){if("function"==typeof e)return e(r);null!=e&&(e.current=r)}function l(...e){return r=>{let t=!1,o=e.map(e=>{let o=n(e,r);return t||"function"!=typeof o||(t=!0),o});if(t)return()=>{for(let r=0;r<o.length;r++){let t=o[r];"function"==typeof t?t():n(e[r],null)}}}}function i(...e){return o.useCallback(l(...e),e)}},5320:function(e,r,t){"use strict";t.d(r,{WV:function(){return s},jH:function(){return a}});var o=t(7294),n=t(3935),l=t(8426),i=t(5893),s=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{let t=(0,l.Z8)(`Primitive.${r}`),n=o.forwardRef((e,o)=>{let{asChild:n,...l}=e,s=n?t:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,i.jsx)(s,{...l,ref:o})});return n.displayName=`Primitive.${r}`,{...e,[r]:n}},{});function a(e,r){e&&n.flushSync(()=>e.dispatchEvent(r))}},8426:function(e,r,t){"use strict";t.d(r,{Z8:function(){return i},g7:function(){return s}});var o=t(7294),n=t(8771),l=t(5893);function i(e){let r=function(e){let r=o.forwardRef((e,r)=>{let{children:t,...l}=e;if(o.isValidElement(t)){let e,i;let s=(e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?t.props.ref:t.props.ref||t.ref,a=function(e,r){let t={...r};for(let o in r){let n=e[o],l=r[o];/^on[A-Z]/.test(o)?n&&l?t[o]=(...e)=>{let r=l(...e);return n(...e),r}:n&&(t[o]=n):"style"===o?t[o]={...n,...l}:"className"===o&&(t[o]=[n,l].filter(Boolean).join(" "))}return{...e,...t}}(l,t.props);return t.type!==o.Fragment&&(a.ref=r?(0,n.F)(r,s):s),o.cloneElement(t,a)}return o.Children.count(t)>1?o.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}(e),t=o.forwardRef((e,t)=>{let{children:n,...i}=e,s=o.Children.toArray(n),a=s.find(d);if(a){let e=a.props.children,n=s.map(r=>r!==a?r:o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null);return(0,l.jsx)(r,{...i,ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null})}return(0,l.jsx)(r,{...i,ref:t,children:n})});return t.displayName=`${e}.Slot`,t}var s=i("Slot"),a=Symbol("radix.slottable");function d(e){return o.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===a}},512:function(e,r,t){"use strict";function o(){for(var e,r,t=0,o="",n=arguments.length;t<n;t++)(e=arguments[t])&&(r=function e(r){var t,o,n="";if("string"==typeof r||"number"==typeof r)n+=r;else if("object"==typeof r){if(Array.isArray(r)){var l=r.length;for(t=0;t<l;t++)r[t]&&(o=e(r[t]))&&(n&&(n+=" "),n+=o)}else for(o in r)r[o]&&(n&&(n+=" "),n+=o)}return n}(e))&&(o&&(o+=" "),o+=r);return o}t.d(r,{W:function(){return o}}),r.Z=o},8388:function(e,r,t){"use strict";t.d(r,{m6:function(){return L}});let o=e=>{let r=s(e),{conflictingClassGroups:t,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{let t=e.split("-");return""===t[0]&&1!==t.length&&t.shift(),n(t,r)||i(e)},getConflictingClassGroupIds:(e,r)=>{let n=t[e]||[];return r&&o[e]?[...n,...o[e]]:n}}},n=(e,r)=>{if(0===e.length)return r.classGroupId;let t=e[0],o=r.nextPart.get(t),l=o?n(e.slice(1),o):void 0;if(l)return l;if(0===r.validators.length)return;let i=e.join("-");return r.validators.find(({validator:e})=>e(i))?.classGroupId},l=/^\[(.+)\]$/,i=e=>{if(l.test(e)){let r=l.exec(e)[1],t=r?.substring(0,r.indexOf(":"));if(t)return"arbitrary.."+t}},s=e=>{let{theme:r,prefix:t}=e,o={nextPart:new Map,validators:[]};return u(Object.entries(e.classGroups),t).forEach(([e,t])=>{a(t,o,e,r)}),o},a=(e,r,t,o)=>{e.forEach(e=>{if("string"==typeof e){(""===e?r:d(r,e)).classGroupId=t;return}if("function"==typeof e){if(c(e)){a(e(o),r,t,o);return}r.validators.push({validator:e,classGroupId:t});return}Object.entries(e).forEach(([e,n])=>{a(n,d(r,e),t,o)})})},d=(e,r)=>{let t=e;return r.split("-").forEach(e=>{t.nextPart.has(e)||t.nextPart.set(e,{nextPart:new Map,validators:[]}),t=t.nextPart.get(e)}),t},c=e=>e.isThemeGetter,u=(e,r)=>r?e.map(([e,t])=>[e,t.map(e=>"string"==typeof e?r+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,t])=>[r+e,t])):e)]):e,p=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let r=0,t=new Map,o=new Map,n=(n,l)=>{t.set(n,l),++r>e&&(r=0,o=t,t=new Map)};return{get(e){let r=t.get(e);return void 0!==r?r:void 0!==(r=o.get(e))?(n(e,r),r):void 0},set(e,r){t.has(e)?t.set(e,r):n(e,r)}}},b=e=>{let{separator:r,experimentalParseClassName:t}=e,o=1===r.length,n=r[0],l=r.length,i=e=>{let t;let i=[],s=0,a=0;for(let d=0;d<e.length;d++){let c=e[d];if(0===s){if(c===n&&(o||e.slice(d,d+l)===r)){i.push(e.slice(a,d)),a=d+l;continue}if("/"===c){t=d;continue}}"["===c?s++:"]"===c&&s--}let d=0===i.length?e:e.substring(a),c=d.startsWith("!"),u=c?d.substring(1):d;return{modifiers:i,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:t&&t>a?t-a:void 0}};return t?e=>t({className:e,parseClassName:i}):i},f=e=>{if(e.length<=1)return e;let r=[],t=[];return e.forEach(e=>{"["===e[0]?(r.push(...t.sort(),e),t=[]):t.push(e)}),r.push(...t.sort()),r},m=e=>({cache:p(e.cacheSize),parseClassName:b(e),...o(e)}),g=/\s+/,h=(e,r)=>{let{parseClassName:t,getClassGroupId:o,getConflictingClassGroupIds:n}=r,l=[],i=e.trim().split(g),s="";for(let e=i.length-1;e>=0;e-=1){let r=i[e],{modifiers:a,hasImportantModifier:d,baseClassName:c,maybePostfixModifierPosition:u}=t(r),p=!!u,b=o(p?c.substring(0,u):c);if(!b){if(!p||!(b=o(c))){s=r+(s.length>0?" "+s:s);continue}p=!1}let m=f(a).join(":"),g=d?m+"!":m,h=g+b;if(l.includes(h))continue;l.push(h);let y=n(b,p);for(let e=0;e<y.length;++e){let r=y[e];l.push(g+r)}s=r+(s.length>0?" "+s:s)}return s};function y(){let e,r,t=0,o="";for(;t<arguments.length;)(e=arguments[t++])&&(r=x(e))&&(o&&(o+=" "),o+=r);return o}let x=e=>{let r;if("string"==typeof e)return e;let t="";for(let o=0;o<e.length;o++)e[o]&&(r=x(e[o]))&&(t&&(t+=" "),t+=r);return t},v=e=>{let r=r=>r[e]||[];return r.isThemeGetter=!0,r},w=/^\[(?:([a-z-]+):)?(.+)\]$/i,k=/^\d+\/\d+$/,z=new Set(["px","full","screen"]),j=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,C=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,S=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,E=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,P=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,N=e=>R(e)||z.has(e)||k.test(e),G=e=>T(e,"length",B),R=e=>!!e&&!Number.isNaN(Number(e)),$=e=>T(e,"number",R),W=e=>!!e&&Number.isInteger(Number(e)),_=e=>e.endsWith("%")&&R(e.slice(0,-1)),O=e=>w.test(e),I=e=>j.test(e),M=new Set(["length","size","percentage"]),V=e=>T(e,M,H),A=e=>T(e,"position",H),Z=new Set(["image","url"]),F=e=>T(e,Z,K),q=e=>T(e,"",J),D=()=>!0,T=(e,r,t)=>{let o=w.exec(e);return!!o&&(o[1]?"string"==typeof r?o[1]===r:r.has(o[1]):t(o[2]))},B=e=>C.test(e)&&!S.test(e),H=()=>!1,J=e=>E.test(e),K=e=>P.test(e),L=function(e,...r){let t,o,n;let l=function(s){return o=(t=m(r.reduce((e,r)=>r(e),e()))).cache.get,n=t.cache.set,l=i,i(s)};function i(e){let r=o(e);if(r)return r;let l=h(e,t);return n(e,l),l}return function(){return l(y.apply(null,arguments))}}(()=>{let e=v("colors"),r=v("spacing"),t=v("blur"),o=v("brightness"),n=v("borderColor"),l=v("borderRadius"),i=v("borderSpacing"),s=v("borderWidth"),a=v("contrast"),d=v("grayscale"),c=v("hueRotate"),u=v("invert"),p=v("gap"),b=v("gradientColorStops"),f=v("gradientColorStopPositions"),m=v("inset"),g=v("margin"),h=v("opacity"),y=v("padding"),x=v("saturate"),w=v("scale"),k=v("sepia"),z=v("skew"),j=v("space"),C=v("translate"),S=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",O,r],M=()=>[O,r],Z=()=>["",N,G],T=()=>["auto",R,O],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",O],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[R,O];return{cacheSize:500,separator:":",theme:{colors:[D],spacing:[N,G],blur:["none","",I,O],brightness:U(),borderColor:[e],borderRadius:["none","","full",I,O],borderSpacing:M(),borderWidth:Z(),contrast:U(),grayscale:L(),hueRotate:U(),invert:L(),gap:M(),gradientColorStops:[e],gradientColorStopPositions:[_,G],inset:P(),margin:P(),opacity:U(),padding:M(),saturate:U(),scale:U(),sepia:L(),skew:U(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",O]}],container:["container"],columns:[{columns:[I]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...B(),O]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",W,O]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",O]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",W,O]}],"grid-cols":[{"grid-cols":[D]}],"col-start-end":[{col:["auto",{span:["full",W,O]},O]}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":[D]}],"row-start-end":[{row:["auto",{span:[W,O]},O]}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",O]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",O]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",O,r]}],"min-w":[{"min-w":[O,r,"min","max","fit"]}],"max-w":[{"max-w":[O,r,"none","full","min","max","fit","prose",{screen:[I]},I]}],h:[{h:[O,r,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[O,r,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[O,r,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[O,r,"auto","min","max","fit"]}],"font-size":[{text:["base",I,G]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",$]}],"font-family":[{font:[D]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",O]}],"line-clamp":[{"line-clamp":["none",R,$]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",N,O]}],"list-image":[{"list-image":["none",O]}],"list-style-type":[{list:["none","disc","decimal",O]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[h]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",N,G]}],"underline-offset":[{"underline-offset":["auto",N,O]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",O]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",O]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[h]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),A]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",V]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},F]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[f]}],"gradient-via-pos":[{via:[f]}],"gradient-to-pos":[{to:[f]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[h]}],"border-style":[{border:[...H(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[h]}],"divide-style":[{divide:H()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...H()]}],"outline-offset":[{"outline-offset":[N,O]}],"outline-w":[{outline:[N,G]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[h]}],"ring-offset-w":[{"ring-offset":[N,G]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",I,q]}],"shadow-color":[{shadow:[D]}],opacity:[{opacity:[h]}],"mix-blend":[{"mix-blend":[...J(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":J()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[o]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",I,O]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[u]}],saturate:[{saturate:[x]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[h]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",O]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",O]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",O]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[W,O]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[z]}],"skew-y":[{"skew-y":[z]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",O]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",O]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",O]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[N,G,$]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}})}}]);
|
@@ -1,11 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[843],{9333:function(e,s,a){a.d(s,{Z:function(){return l}});/**
|
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 l=(0,a(998).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},1812:function(e,s,a){a.d(s,{X:function(){return n}});var l=a(5893),r=a(7294);let t=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},n=e=>{let{error:s,title:a="Error",onDismiss:n}=e,[c,i]=(0,r.useState)(!1);if((0,r.useEffect)(()=>{s&&i(!1)},[s]),!s||c)return null;let o="string"==typeof s?s:t(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:[a,":"]})," ",o]})})]}),(0,l.jsx)("button",{onClick:()=>{i(!0),n&&n()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,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"})})})]})})}},5843:function(e,s,a){a.r(s),a.d(s,{WorkspaceEditor:function(){return _}});var l=a(5893),r=a(7294),t=a(1163),n=a(7324),c=a(3266),i=a(8969);a(9470);var o=a(1664),d=a.n(o),u=a(9008),x=a.n(u),m=a(7673),h=a(803),f=a(2350);let g=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,l.jsx)("textarea",{className:(0,f.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",a),ref:s,...r})});g.displayName="Textarea";var p=a(8799),b=a(282),j=a(6021),y=a(3626);/**
|
7
|
-
* @license lucide-react v0.407.0 - ISC
|
8
|
-
*
|
9
|
-
* This source code is licensed under the ISC license.
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
11
|
-
*/let N=(0,a(998).Z)("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);var v=a(9333),w=a(326);let k=e=>{let{className:s="",variant:a="default",children:r,...t}=e;return(0,l.jsx)("div",{role:"alert",className:"".concat("relative w-full rounded-lg border p-4 flex items-start space-x-2"," ").concat({default:"bg-blue-50 border-blue-200 text-blue-800",destructive:"bg-red-50 border-red-200 text-red-800"}[a]," ").concat(s),...t,children:r})},C=e=>{let{className:s="",children:a,...r}=e;return(0,l.jsx)("div",{className:"text-sm leading-relaxed ".concat(s),...r,children:a})};var L=a(3850),S=a(1812),E=a(938),M=a(1272),D=a(3225),A=a(3081);let W=e=>{let{message:s}=e;return s?(0,l.jsxs)(k,{className:"border-green-200 bg-green-50",children:[(0,l.jsx)(b.Z,{className:"h-4 w-4 text-green-600"}),(0,l.jsx)(C,{className:"text-green-800",children:s})]}):null},Z=e=>{let{workspaceName:s,config:a,enabledClouds:r=[]}=e;if(!a)return null;let t="default"===s,n=0===Object.keys(a).length;if(t&&n)return(0,l.jsx)("div",{className:"text-sm text-gray-500 mb-3 italic p-3 bg-sky-50 rounded border border-sky-200",children:"Workspace 'default' can use all accessible infrastructure."});let c=[],i=[],o=[],d=new Set(r.map(e=>e.toLowerCase()));Object.entries(a).forEach(e=>{let[s,a]=e;if("private"===s||"allowed_users"===s)return;let r=D.MN[s.toLowerCase()]||s.toUpperCase(),t=d.has(null==r?void 0:r.toLowerCase());if((null==a?void 0:a.disabled)===!0)i.push(r);else if(a&&Object.keys(a).length>0){let e="";"gcp"===s.toLowerCase()&&a.project_id?e=" (Project ID: ".concat(a.project_id,")"):"aws"===s.toLowerCase()&&a.region&&(e=" (Region: ".concat(a.region,")")),t?c.push((0,l.jsxs)("span",{className:"block",children:[r,e," is enabled."]},"".concat(s,"-enabled"))):o.push((0,l.jsxs)("span",{className:"block text-amber-700",children:[r,e," is configured but not currently available."]},"".concat(s,"-configured-not-enabled")))}else t?c.push((0,l.jsxs)("span",{className:"block",children:[r," is enabled (using default settings)."]},"".concat(s,"-default-enabled"))):o.push((0,l.jsxs)("span",{className:"block text-amber-700",children:[r," is configured but not currently available."]},"".concat(s,"-default-not-enabled")))});let u=[];if(i.length>0){let e=i.join(" and ");u.push((0,l.jsxs)("span",{className:"block",children:[e," ",1===i.length?"is":"are"," explicitly disabled."]},"disabled-clouds"))}return(u.push(...c),u.push(...o),u.length>0)?(0,l.jsx)("div",{className:"text-sm text-gray-700 mb-3 p-3 bg-sky-50 rounded border border-sky-200",children:u}):!t&&n?(0,l.jsx)("div",{className:"text-sm text-gray-500 mb-3 italic p-3 bg-sky-50 rounded border border-sky-200",children:"This workspace has no specific cloud resource configurations and can use all accessible infrastructure."}):null},P=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"})},R=e=>{let{workspaceConfig:s,allUsers:a}=e;if(!s.private)return null;let r=s.allowed_users||[],t=(a||[]).filter(e=>"admin"===e.role).map(e=>e.username),n=[...new Set([...r,...t])];return 0===n.length?(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Allowed Users (0)"}),(0,l.jsx)("div",{className:"text-amber-600 text-xs italic p-2 bg-amber-50 rounded border border-amber-200",children:"No users configured (workspace may be inaccessible)"})]}):(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsxs)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:["Allowed Users (",n.length,")"]}),(0,l.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto border border-gray-200 rounded",children:n.map(e=>{let s=t.includes(e);return(0,l.jsxs)("div",{className:"flex items-center justify-between text-xs p-2 bg-gray-50 hover:bg-gray-100 border-b border-gray-100 last:border-b-0",children:[(0,l.jsx)("span",{className:"font-medium text-gray-700",children:e}),s?(0,l.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,l.jsx)(L.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,l.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,l.jsx)(j.Z,{className:"w-3 h-3 mr-1"}),"User"]})]},e)})})]})};function _(e){let{workspaceName:s,isNewWorkspace:a=!1}=e,o=(0,t.useRouter)(),[u,f]=(0,r.useState)({}),[b,j]=(0,r.useState)({}),[k,C]=(0,r.useState)(""),[D,_]=(0,r.useState)(!0),[z,O]=(0,r.useState)(!1),[T,U]=(0,r.useState)(!1),[Y,J]=(0,r.useState)(null),[I,V]=(0,r.useState)(null),[F,H]=(0,r.useState)(null),[X,B]=(0,r.useState)([]),[G,q]=(0,r.useState)({showDialog:!1,deleting:!1,error:null}),[K,Q]=(0,r.useState)({totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:[]}),[$,ee]=(0,r.useState)(!1),es=(0,r.useCallback)(async()=>{_(!0),J(null);try{let e;let[a,l]=await Promise.all([(0,n.fX)(),(0,A.R)()]),r=a[s]||{};f(r),j(r),B(l||[]),e=0===Object.keys(r).length?"".concat(s,":\n # Empty workspace configuration - uses all accessible infrastructure\n"):M.ZP.dump({[s]:r},{indent:2,lineWidth:-1,noRefs:!0,skipInvalid:!0,flowLevel:-1}),C(e)}catch(e){console.error("Error fetching workspace config:",e),J(e)}finally{_(!1)}},[s]),ea=(0,r.useCallback)(async()=>{if(!a){ee(!0);try{let[e,a,l]=await Promise.all([(0,c.getClusters)(),(0,i.getManagedJobs)(),(0,n.yz)(s,!0)]),r=e.filter(e=>(e.workspace||"default")===s),t=r.filter(e=>"RUNNING"===e.status||"LAUNCHING"===e.status),o={};e.forEach(e=>{o[e.cluster]=e.workspace||"default"});let d=a.jobs||[],u=new Set(E.statusGroups.active),x=0;d.forEach(e=>{let a=e.cluster_name||e.resources&&e.resources.cluster_name;a&&o[a]===s&&u.has(e.status)&&x++}),Q({totalClusterCount:r.length,runningClusterCount:t.length,managedJobsCount:x,clouds:Array.isArray(l)?l:[]})}catch(e){console.error("Failed to fetch workspace stats:",e)}finally{ee(!1)}}},[s,a]);(0,r.useEffect)(()=>{a?(_(!1),C("".concat(s,":\n # New workspace configuration\n # Leave empty to use all accessible infrastructure\n"))):(es(),ea())},[s,a,es,ea]),(0,r.useEffect)(()=>{U(JSON.stringify(u)!==JSON.stringify(b))},[u,b]);let el=e=>{C(e),H(null);try{let a=M.ZP.load(e)||{},l=Object.keys(a);if(0===l.length)f({});else if(1===l.length){let e=l[0];if(e!==s){H('Workspace name cannot be changed. Expected "'.concat(s,'" but found "').concat(e,'".'));return}let r=a[s]||{};f(r)}else H("Configuration must contain only one workspace. Found: ".concat(l.join(", ")))}catch(e){H("Invalid YAML: ".concat(e.message))}},er=async()=>{O(!0),J(null),V(null);try{if(F)throw Error("Please fix YAML errors before saving");let e=M.ZP.load(k)||{},l=Object.keys(e);if(l.length>0&&l[0]!==s)throw Error('Workspace name cannot be changed. Expected "'.concat(s,'".'));a?(await (0,n.MB)(s,u),V("Workspace created successfully!"),setTimeout(()=>{o.push("/workspaces/".concat(s))},1500)):(await (0,n.eA)(s,u),V("Workspace updated successfully!"),j(u),ea())}catch(e){console.error("Error saving workspace:",e),J(e)}finally{O(!1)}},et=async()=>{q(e=>({...e,deleting:!0,error:null}));try{await (0,n.zl)(s),V("Workspace deleted successfully!"),setTimeout(()=>{o.push("/workspaces")},1500)}catch(e){console.error("Error deleting workspace:",e),q(s=>({...s,deleting:!1,error:e}))}},en=()=>{q({showDialog:!1,deleting:!1,error:null})},ec=async()=>{await Promise.all([es(),ea()])};if(!o.isReady)return(0,l.jsx)("div",{children:"Loading..."});let ei=a?"Create New Workspace | SkyPilot Dashboard":"Workspace: ".concat(s," | SkyPilot Dashboard");return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(x(),{children:(0,l.jsx)("title",{children:ei})}),(0,l.jsxs)(l.Fragment,{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)(d(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,l.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,l.jsx)(d(),{href:a?"/workspace/new":"/workspaces/".concat(s),className:"text-sky-blue hover:underline",children:a?"New Workspace":s}),T&&(0,l.jsx)("span",{className:"ml-3 px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded",children:"Unsaved changes"})]}),(0,l.jsxs)("div",{className:"text-sm flex items-center",children:[(D||z||$)&&(0,l.jsxs)("div",{className:"flex items-center mr-4",children:[(0,l.jsx)(p.Z,{size:15,className:"mt-0"}),(0,l.jsx)("span",{className:"ml-2 text-gray-500",children:z?"Saving...":"Loading..."})]}),(0,l.jsxs)("div",{className:"flex items-center space-x-4",children:[!a&&(0,l.jsxs)("button",{onClick:ec,disabled:D||z||$,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,l.jsx)(y.Z,{className:"w-4 h-4 mr-1.5"}),"Refresh"]}),!a&&"default"!==s&&(0,l.jsxs)("button",{onClick:()=>q({...G,showDialog:!0}),disabled:G.deleting||z,className:"text-red-600 hover:text-red-700 font-medium inline-flex items-center",children:[(0,l.jsx)(N,{className:"w-4 h-4 mr-1.5"}),"Delete"]})]})]})]}),D?(0,l.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,l.jsx)(p.Z,{size:24,className:"mr-2"}),(0,l.jsx)("span",{className:"text-gray-500",children:"Loading workspace configuration..."})]}):(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)(S.X,{error:Y,title:"Error",onDismiss:()=>J(null)}),(0,l.jsx)(W,{message:I}),(0,l.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[!a&&(0,l.jsx)("div",{className:"lg:col-span-1",children:(0,l.jsxs)(m.Zb,{className:"h-full",children:[(0,l.jsx)(m.Ol,{children:(0,l.jsx)(m.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]}),(0,l.jsx)(P,{isPrivate:!0===b.private})]})})}),(0,l.jsxs)(m.aY,{className:"text-sm pb-2 flex-1",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)(L.QT,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,l.jsx)("span",{children:"Clusters (Running / Total)"})]}),(0,l.jsx)("span",{className:"font-normal text-gray-800",children:$?"...":"".concat(K.runningClusterCount," / ").concat(K.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)(L.Vp,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,l.jsx)("span",{children:"Managed Jobs"})]}),(0,l.jsx)("span",{className:"font-normal text-gray-800",children:$?"...":K.managedJobsCount})]})]}),(0,l.jsxs)("div",{className:"px-6 pb-6 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:$?(0,l.jsx)("span",{className:"text-gray-500",children:"Loading..."}):K.clouds.length>0?K.clouds.map(e=>(0,l.jsxs)("div",{className:"flex items-center text-gray-700",children:[(0,l.jsx)(L.Ye,{className:"w-3.5 h-3.5 mr-1.5 text-green-500"}),(0,l.jsx)("span",{children:e})]},e)):(0,l.jsx)("span",{className:"text-gray-500 italic",children:"No enabled infrastructure"})}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(Z,{workspaceName:s,config:b,enabledClouds:K.clouds})}),(0,l.jsx)(R,{workspaceConfig:b,allUsers:X})]})]})}),(0,l.jsx)("div",{className:a?"lg:col-span-3":"lg:col-span-2",children:(0,l.jsxs)(m.Zb,{className:"h-full flex flex-col",children:[(0,l.jsx)(m.Ol,{children:(0,l.jsx)(m.ll,{className:"text-base font-normal",children:a?"New Workspace YAML":"Edit Workspace YAML"})}),(0,l.jsx)(m.aY,{className:"flex-1 flex flex-col",children:(0,l.jsxs)("div",{className:"space-y-4 flex-1 flex flex-col",children:[F&&(0,l.jsx)(S.X,{error:F,onDismiss:()=>H(null)}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,l.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Configure infra-specific settings for this workspace. Leave empty to use all accessible infrastructure. Refer to"," ",(0,l.jsx)("a",{href:"https://docs.skypilot.co/en/latest/admin/workspaces.html#configuration",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600",children:"SkyPilot Docs"})," ","for more details."]}),(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Example configuration:"}),(0,l.jsx)("div",{className:"p-3 bg-gray-50 border rounded-lg",children:(0,l.jsx)("pre",{className:"text-xs font-mono text-gray-600 whitespace-pre-wrap",children:"".concat(s||"my-workspace",":\n private: true\n allowed_users:\n - user1@mydomain.com\n - user2@mydomain.com\n gcp:\n project_id: xxx\n disabled: false\n kubernetes:\n allowed_contexts:\n - context-1")})})]}),(0,l.jsx)(g,{value:k,onChange:e=>el(e.target.value),className:"font-mono text-sm flex-1 resize-none",style:{minHeight:"350px"},spellCheck:!1,placeholder:"# Enter workspace configuration in YAML format"}),(0,l.jsx)("div",{className:"flex justify-end space-x-3 pt-3 border-gray-200",children:(0,l.jsxs)(h.z,{onClick:er,disabled:z||F||D,className:"inline-flex items-center bg-blue-600 hover:bg-blue-700 text-white",children:[(0,l.jsx)(v.Z,{className:"w-4 h-4 mr-1.5"}),z?"Applying...":"Apply"]})})]})]})})]})})]})]}),(0,l.jsx)(w.Vq,{open:G.showDialog,onOpenChange:en,children:(0,l.jsxs)(w.cZ,{className:"sm:max-w-md",children:[(0,l.jsxs)(w.fK,{className:"",children:[(0,l.jsx)(w.$N,{children:"Delete Workspace"}),(0,l.jsxs)(w.Be,{children:['Are you sure you want to delete workspace "',s,'"? This action cannot be undone.']})]}),G.error&&(0,l.jsx)(S.X,{error:G.error,title:"Deletion Failed",onDismiss:()=>q(e=>({...e,error:null}))}),(0,l.jsxs)(w.cN,{className:"",children:[(0,l.jsx)(h.z,{variant:"outline",onClick:en,disabled:G.deleting,children:"Cancel"}),(0,l.jsx)(h.z,{variant:"destructive",onClick:et,disabled:G.deleting,children:G.deleting?"Deleting...":"Delete"})]})]})})]})]})}}}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[856],{3266:function(e,t,r){r.d(t,{QL:function(){return g},Sl:function(){return i},getClusters:function(){return c},uR:function(){return u}});var a=r(7294),s=r(5821),o=r(7145),l=r(6378);let n={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function c(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return(await o.x.fetch("/status",{cluster_names:e,all_users:!0})).map(e=>{let t="",r=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let r=Math.floor((t-3)/2),a=r+(t-3)%2;return 0===r?e.substring(0,a)+"...":e.substring(0,a)+"..."+e.substring(e.length-r)}(t,25)),{status:n[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:r?"".concat(e.cloud," (").concat(r,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,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 u(){try{let e=await o.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 r=e.user_name||"-";return{status:e.status?n[e.status]:"TERMINATED",cluster:e.name,user:r,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 i(e){let{clusterName:t,jobId:r,onNewLog:a,workspace:l}=e;try{await o.x.stream("/logs",{follow:!1,cluster_name:t,job_id:r,override_skypilot_config:{active_workspace:l||"default"}},a)}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,s.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function d(e){let{clusterName:t,workspace:r}=e;try{return(await o.x.fetch("/queue",{cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:r}})).map(e=>{let a=e.end_at?e.end_at:Date.now()/1e3,s=0,o=0;return e.submitted_at&&(s=a-e.submitted_at),e.start_at&&(o=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:s,job_duration:o,infra:"",logs:"",workspace:r||"default"}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function g(e){let{cluster:t,job:r=null}=e,[s,o]=(0,a.useState)(null),[n,u]=(0,a.useState)(null),[i,g]=(0,a.useState)(!0),[f,_]=(0,a.useState)(!0),h=(0,a.useCallback)(async()=>{if(t)try{g(!0);let e=await l.default.get(c,[{clusterNames:[t]}]);return o(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{g(!1)}return null},[t]),p=(0,a.useCallback)(async e=>{if(t)try{_(!0);let r=await l.default.get(d,[{clusterName:t,workspace:e||"default"}]);u(r)}catch(e){console.error("Error fetching cluster job data:",e)}finally{_(!1)}},[t]),m=(0,a.useCallback)(async()=>{l.default.invalidate(c,[{clusterNames:[t]}]);let e=await h();e&&(l.default.invalidate(d,[{clusterName:t,workspace:e.workspace||"default"}]),await p(e.workspace))},[h,p,t]),b=(0,a.useCallback)(async()=>{s&&(l.default.invalidate(d,[{clusterName:t,workspace:s.workspace||"default"}]),await p(s.workspace))},[p,s,t]);return(0,a.useEffect)(()=>{(async()=>{let e=await h();e&&p(e.workspace)})()},[t,r,h,p]),{clusterData:s,clusterJobData:n,loading:i,clusterDetailsLoading:i,clusterJobsLoading:f,refreshData:m,refreshClusterJobsOnly:b}}},2045:function(e,t,r){r.d(t,{l4:function(){return l}});var a=r(3225),s=r(7145);async function o(e,t){try{let r=[];try{let e=await s.x.get("/enabled_clouds"),t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),a=await s.x.get("/api/get?request_id=".concat(t)),o=await a.json();r=o.return_value?JSON.parse(o.return_value):[],console.log("Enabled clouds:",r)}catch(e){console.error("Error fetching enabled clouds:",e),r=[]}let o={};a.$m.forEach(e=>{let t=r.includes(e.toLowerCase());o[e]={name:e,clusters:0,jobs:0,enabled:t}}),e.forEach(e=>{if(e.cloud){let t=e.cloud;o[t]&&(o[t].clusters+=1,o[t].enabled=!0)}}),t.forEach(e=>{if(e.cloud){let t=e.cloud;o[t]&&(o[t].jobs+=1,o[t].enabled=!0)}});let l=a.$m.length,n=Object.values(o).filter(e=>e.enabled).length;return{clouds:Object.values(o).filter(e=>e.enabled).sort((e,t)=>t.clusters-e.clusters||t.jobs-e.jobs),totalClouds:l,enabledClouds:n}}catch(e){return console.error("Error fetching cloud infrastructure:",e),{clouds:[],totalClouds:a.$m.length,enabledClouds:0}}}async function l(){let{getClusters:e}=await Promise.resolve().then(r.bind(r,3266)),{getManagedJobs:t}=await Promise.resolve().then(r.bind(r,8969)),a=(await Promise.resolve().then(r.bind(r,6378))).default,[s,l]=await Promise.all([a.get(e),a.get(t,[{allUsers:!0}])]),c=s||[],u=(null==l?void 0:l.jobs)||[],[i,d]=await Promise.all([n(c,u),o(c,u)]);return{gpuData:i,cloudData:d}}async function n(e,t){return await g({clusters:e||[],jobs:t||[]})}async function c(){try{let e=await s.x.post("/realtime_kubernetes_gpu_availability",{context:null,name_filter:null,quantity_filter:null});if(!e.ok)return console.error("Error fetching Kubernetes context GPUs (in getKubernetesContextGPUs): ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for Kubernetes GPU availability (in getKubernetesContextGPUs)"),[];let r=await s.x.get("/api/get?request_id=".concat(t)),a=await r.text();if(500===r.status){try{let e=JSON.parse(a);if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("[infra.jsx] getKubernetesContextGPUs: Server error detail:",t.message)}catch(t){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing server error JSON:",t,"Original error text:",e.detail.error)}}catch(e){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing 500 error response JSON:",e,"Raw text was:",a)}return[]}let o=JSON.parse(a);return o.return_value?JSON.parse(o.return_value):[]}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesContextGPUs:",e),[]}}async function u(){try{let e=await s.x.get("/all_contexts");if(!e.ok)return console.error("Error fetching all contexts: ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for /all_contexts"),[];let r=await s.x.get("/api/get?request_id=".concat(t)),a=await r.json();return a.return_value?JSON.parse(a.return_value):[]}catch(e){return console.error("[infra.jsx] Error in getAllContexts:",e),[]}}async function i(e){try{let t=await s.x.post("/kubernetes_node_info",{context:e}),r=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("x-request-id"),a=await s.x.get("/api/get?request_id=".concat(r));if(500===a.status){try{let e=await a.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Kubernetes per node GPUs:",t.message)}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{}}let o=await a.json();return(o.return_value?JSON.parse(o.return_value):{}).node_info_dict||{}}catch(t){return console.error("[infra.jsx] Error in getKubernetesPerNodeGPUs for context",e,":",t),{}}}async function d(e){try{let t=e.clusters,r=e.jobs,a={};return t.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(a[t]||(a[t]={clusters:0,jobs:0}),a[t].clusters+=1)}),r.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(a[t]||(a[t]={clusters:0,jobs:0}),a[t].jobs+=1)}),a}catch(e){return console.error("=== Error in getContextClustersAndJobs ===",e),{}}}async function g(e){try{let o=await u();if(!o||0===o.length)return console.log("No contexts found from /all_contexts endpoint."),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}};let l=await d(e),n=await c(),g=new Map;n&&n.forEach(e=>{g.set(e[0],e[1])});let f={},_={},h={};for(let e of o){_[e]||(_[e]=[]);let o=g.get(e);if(o&&o.length>0)for(let t of o){let r=t[0],a=t[1].join(", "),s=t[2],o=t[3];r in f?(f[r].gpu_total+=s,f[r].gpu_free+=o):f[r]={gpu_total:s,gpu_free:o,gpu_name:r},_[e].push({gpu_name:r,gpu_requestable_qty_per_node:a,gpu_total:s,gpu_free:o,context:e})}let l=await i(e);if(l&&Object.keys(l).length>0)for(let o in l){var t,r,a,s;let n=l[o],c=n.accelerator_type||"-",u=null!==(a=null===(t=n.total)||void 0===t?void 0:t.accelerator_count)&&void 0!==a?a:0,i=null!==(s=null===(r=n.free)||void 0===r?void 0:r.accelerators_available)&&void 0!==s?s:0;h["".concat(e,"/").concat(o)]={node_name:n.name,gpu_name:c,gpu_total:u,gpu_free:i,context:e},"-"===c||_[e].some(e=>e.gpu_name===c)||(c in f||(f[c]={gpu_total:0,gpu_free:0,gpu_name:c}),_[e].find(e=>e.gpu_name===c)||_[e].push({gpu_name:c,gpu_requestable_qty_per_node:"-",gpu_total:0,gpu_free:0,context:e}))}0===_[e].length&&l&&Object.keys(l).length}return{allContextNames:o.sort(),allGPUs:Object.values(f).sort((e,t)=>e.gpu_name.localeCompare(t.gpu_name)),perContextGPUs:Object.values(_).flat().sort((e,t)=>e.context.localeCompare(t.context)||e.gpu_name.localeCompare(t.gpu_name)),perNodeGPUs:Object.values(h).sort((e,t)=>e.context.localeCompare(t.context)||e.node_name.localeCompare(t.node_name)||e.gpu_name.localeCompare(t.gpu_name)),contextStats:l}}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesGPUs:",e),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}}}}},3081:function(e,t,r){r.d(t,{R:function(){return s}}),r(3266),r(8969);var a=r(7145);async function s(){try{let e=await a.x.get("/users");if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return(await e.json()).map(e=>({userId:e.id,username:e.name,role:e.role}))||[]}catch(e){return console.error("Failed to fetch users:",e),[]}}},6856:function(e,t,r){var a=r(6378),s=r(3266),o=r(8969),l=r(7324),n=r(3081),c=r(2045);let u={base:{getClusters:{fn:s.getClusters,args:[]},getClusterHistory:{fn:s.uR,args:[]},getManagedJobs:{fn:o.getManagedJobs,args:[{allUsers:!0}]},getWorkspaces:{fn:l.fX,args:[]},getUsers:{fn:n.R,args:[]},getInfraData:{fn:c.l4,args:[]}},dynamic:{getEnabledClouds:{fn:l.yz,requiresWorkspaces:!0}},pages:{clusters:["getClusters","getClusterHistory","getWorkspaces","getUsers"],jobs:["getManagedJobs","getClusters","getWorkspaces","getUsers"],infra:["getInfraData","getClusters","getManagedJobs"],workspaces:["getWorkspaces","getClusters","getManagedJobs","getEnabledClouds"],users:["getUsers","getClusters","getManagedJobs"]}};class i{async preloadForPage(e,t){let{backgroundPreload:r=!0,force:a=!1}=t||{};if(!u.pages[e]){console.warn("Unknown page: ".concat(e));return}console.log("[CachePreloader] Preloading cache for page: ".concat(e));try{await this._loadPageData(e,a),r&&this._backgroundPreloadOtherPages(e)}catch(t){console.error("[CachePreloader] Error preloading for page ".concat(e,":"),t)}}async _loadPageData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=u.pages[e],s=[];for(let e of r)if(u.base[e]){let{fn:r,args:o}=u.base[e];t&&a.default.invalidate(r,o),s.push(a.default.get(r,o))}else"getEnabledClouds"===e&&s.push(this._loadEnabledCloudsForAllWorkspaces(t));await Promise.allSettled(s),console.log("[CachePreloader] Loaded data for page: ".concat(e))}async _loadEnabledCloudsForAllWorkspaces(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&a.default.invalidate(l.fX);let t=await a.default.get(l.fX),r=Object.keys(t||{}).map(t=>(e&&a.default.invalidate(l.yz,[t]),a.default.get(l.yz,[t])));await Promise.allSettled(r)}catch(e){console.error("[CachePreloader] Error loading enabled clouds:",e)}}_backgroundPreloadOtherPages(e){if(this.isPreloading)return;this.isPreloading=!0;let t=Object.keys(u.pages).filter(t=>t!==e);console.log("[CachePreloader] Background preloading pages: ".concat(t.join(", "))),Promise.allSettled(t.map(async e=>{try{await this._loadPageData(e,!1),console.log("[CachePreloader] Background loaded: ".concat(e))}catch(t){console.error("[CachePreloader] Background load failed for ".concat(e,":"),t)}})).then(()=>{this.isPreloading=!1,console.log("[CachePreloader] Background preloading complete")})}async preloadBaseFunctions(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];console.log("[CachePreloader] Preloading all base functions");let t=Object.entries(u.base).map(t=>{let[r,{fn:s,args:o}]=t;return e&&a.default.invalidate(s,o),a.default.get(s,o).catch(e=>{console.error("[CachePreloader] Failed to preload ".concat(r,":"),e)})});await Promise.allSettled(t),console.log("[CachePreloader] Base functions preloaded")}getCacheStats(){return{...a.default.getStats(),isPreloading:this.isPreloading}}clearCache(){a.default.clear(),this.isPreloading=!1,this.preloadPromises.clear(),console.log("[CachePreloader] Cache cleared")}constructor(){this.isPreloading=!1,this.preloadPromises=new Map}}let d=new i;t.ZP=d}}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[901,350],{7145:function(e,r,t){t.d(r,{x:function(){return a}});var o=t(3225);let a={fetch:async(e,r)=>{let t=window.location.origin,a="".concat(t).concat(o.f4).concat(e),s=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n=s.headers.get("X-Skypilot-Request-ID")||s.headers.get("X-Request-ID"),c=await fetch("".concat(t).concat(o.f4,"/api/get?request_id=").concat(n)),l=await c.json();return l.return_value?JSON.parse(l.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 s},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 s={};if("SUCCEEDED"===a.status&&a.return_value)try{s=JSON.parse(a.return_value),console.log("Successfully parsed workspace data from return_value:",s)}catch(e){throw console.error("Failed to parse workspace data from return_value:",e,"Raw return_value:",a.return_value),Error("Failed to parse workspace data for request ID ".concat(r,": ").concat(e.message))}else a.result&&(console.warn("Using resultData.result as fallback for status ".concat(a.status)),s=a.result);return console.log("Effectively fetched workspace data (to be returned):",s),s||{}}catch(e){throw console.error("Failed to fetch workspaces (in getWorkspaces function):",e.message,e.stack),e}}async function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{let t="/enabled_clouds",a=new URLSearchParams;e&&a.append("workspace",e),r&&a.append("expand","true"),a.toString()&&(t+="?".concat(a.toString()));let s=await o.x.get(t);if(!s.ok)throw Error("Error scheduling getEnabledClouds: ".concat(s.statusText," (status ").concat(s.status,")"));let n=s.headers.get("X-Skypilot-Request-ID");if(!n){console.warn("X-Skypilot-Request-ID header not found in /enabled_clouds response. Attempting to find request_id in response body as a fallback.");try{let e=await s.json();if(e&&e.request_id)n=e.request_id,console.log("Found request_id in /enabled_clouds response body (fallback):",n);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /enabled_clouds.")}catch(r){let e=r.message||"Error processing fallback for request_id from /enabled_clouds response body.";throw console.error("Error in /enabled_clouds request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!n)throw Error("Failed to obtain X-Skypilot-Request-ID from /enabled_clouds response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching enabled_clouds data with request_id: ".concat(n));let c=await o.x.get("/api/get?request_id=".concat(n));if(!c.ok){let e="Error fetching enabled_clouds data for request ID ".concat(n,": ").concat(c.statusText," (status ").concat(c.status,")");try{let r=await c.json();if(r&&r.detail){let t=r.detail;try{let e=JSON.parse(t);e&&e.error?t=e.error:e&&e.result&&e.result.error&&(t=e.result.error)}catch(e){}e="Error fetching enabled_clouds data for request ID ".concat(n,": ").concat(t)}}catch(e){}throw Error(e)}let l=await c.json();if(console.log("[Connector Debug] Full resultData from /api/get for enabled_clouds:",l),"FAILED"===l.status){let e=l.error||l.result&&l.result.error||"Unknown error during task execution for enabled_clouds";throw Error("Fetching enabled_clouds data failed for request ID ".concat(n,": ").concat(e))}let i=[];if("SUCCEEDED"===l.status&&l.return_value)try{i=JSON.parse(l.return_value),console.log("Successfully parsed enabled_clouds data from return_value:",i)}catch(e){throw console.error("Failed to parse enabled_clouds data from return_value:",e,"Raw return_value:",l.return_value),Error("Failed to parse enabled_clouds data for request ID ".concat(n,": ").concat(e.message))}else l.result&&(console.warn("Using resultData.result as fallback for enabled_clouds status ".concat(l.status)),i=l.result);return Array.isArray(i)?i:[]}catch(e){throw console.error("Failed to fetch enabled_clouds (in getEnabledClouds function):",e.message,e.stack),e}}async function n(e,r){console.log("Polling for ".concat(r," task completion with request_id: ").concat(e));let t=await 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 s={};if("SUCCEEDED"===a.status&&a.return_value)try{s=JSON.parse(a.return_value),console.log("Successfully parsed ".concat(r," data:"),s)}catch(t){throw console.error("Failed to parse ".concat(r," data from return_value:"),t,"Raw return_value:",a.return_value),Error("Failed to parse ".concat(r," data for request ID ").concat(e,": ").concat(t.message))}else a.result&&(console.warn("Using resultData.result as fallback for ".concat(r," status ").concat(a.status)),s=a.result);return s}async function c(e,r){try{console.log("Updating workspace ".concat(e," with config:"),r);let t=await 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 n(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 n(a,"createWorkspace")}catch(e){throw console.error("Failed to create workspace:",e),e}};async function i(e){try{console.log("Deleting workspace ".concat(e));let r=await 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 n(t,"deleteWorkspace");return console.log("[Delete Debug] deleteWorkspace completed successfully:",e),e}catch(e){throw console.error("[Delete Debug] deleteWorkspace failed with error:",e),console.error("[Delete Debug] Error message:",e.message),e}}catch(e){throw console.error("Failed to delete workspace:",e),e}}async function u(){try{console.log("Getting entire SkyPilot configuration");let e=await 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 n(r,"getConfig")}catch(e){throw console.error("Failed to get config:",e),e}}async function d(e){try{console.log("Updating entire SkyPilot configuration with config:",e);let r=await 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 n(t,"updateConfig")}catch(e){throw console.error("Failed to update config:",e),e}}},2350:function(e,r,t){t.d(r,{cn:function(){return s}});var o=t(512),a=t(8388);function s(){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))}}}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[973],{9307:function(e,t,s){s.d(t,{Cl:function(){return c},OE:function(){return d}});var a=s(5893);s(7294);var n=s(8799),r=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,a.jsx)(n.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":default:return(0,a.jsx)(l.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,a.jsx)(l.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,a.jsx)(l.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,a.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,a.jsx)(l.J$,{className:"w-3 h-3 mr-1"})}},i=e=>{let t=c(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)(r.WH,{content:t,className:"text-muted-foreground text-sm",children:(0,a.jsx)("span",{children:i(t)})})}},9284:function(e,t,s){s.d(t,{Oh:function(){return u},_R:function(){return x},cV:function(){return f}});var a=s(5893),n=s(7294),r=s(326),l=s(803),c=s(7673),o=s(8671),i=s(6989),d=s(3225),m=s(3001);function u(e){let{isOpen:t,onClose:s,cluster:d}=e,[m,u]=n.useState(!1),x=e=>{navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)},f=["sky status ".concat(d),"ssh ".concat(d)],h=f.join("\n");return(0,a.jsx)(r.Vq,{open:t,onOpenChange:s,children:(0,a.jsxs)(r.cZ,{className:"sm:max-w-md",children:[(0,a.jsxs)(r.fK,{children:[(0,a.jsxs)(r.$N,{children:["Connect to: ",(0,a.jsx)("span",{className:"font-light",children:d})]}),(0,a.jsx)(r.Be,{children:"Use these instructions to connect to your cluster via SSH."})]}),(0,a.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium mb-2",children:"SSH Command"}),(0,a.jsx)(c.Zb,{className:"p-3 bg-gray-50",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("pre",{className:"text-sm w-full whitespace-pre-wrap",children:f.map((e,t)=>(0,a.jsx)("code",{className:"block",children:e},t))}),(0,a.jsx)(i.WH,{content:m?"Copied!":"Copy command",children:(0,a.jsx)(l.z,{variant:"ghost",size:"icon",onClick:()=>x(h),className:"h-8 w-8 rounded-full",children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium mb-2",children:"Additional Information"}),(0,a.jsxs)("p",{className:"text-sm text-secondary-foreground",children:["Make sure to run"," ",(0,a.jsxs)("code",{className:"text-sm",children:["sky status ",d]})," first to have SkyPilot set up the SSH access."]})]})]})]})})}function x(e){let{isOpen:t,onClose:s,cluster:n}=e,u=(0,m.X)();return(0,a.jsx)(r.Vq,{open:t,onOpenChange:s,children:(0,a.jsx)(r.cZ,{className:"sm:max-w-3xl",children:(0,a.jsxs)(r.fK,{children:[(0,a.jsxs)(r.$N,{children:["Connect to: ",(0,a.jsx)("span",{className:"font-light",children:n})]}),(0,a.jsx)(r.Be,{children:(0,a.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium mb-2 my-2",children:"Setup SSH access"}),(0,a.jsx)(c.Zb,{className:"p-3 bg-gray-50",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("pre",{className:"text-sm",children:(0,a.jsxs)("code",{children:["sky status ",n]})}),(0,a.jsx)(i.WH,{content:"Copy command",children:(0,a.jsx)(l.z,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText("sky status ".concat(n)),className:"h-8 w-8 rounded-full",children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium mb-2 my-2",children:"Connect with VSCode/Cursor"}),(0,a.jsx)(c.Zb,{className:"p-3 bg-gray-50",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("pre",{className:"text-sm",children:(0,a.jsxs)("code",{children:["code --remote ssh-remote+",n]})}),(0,a.jsx)(i.WH,{content:"Copy command",children:(0,a.jsx)(l.z,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText("code --remote ssh-remote+".concat(n)),className:"h-8 w-8 rounded-full",children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium",children:"Or use the GUI to connect"}),(0,a.jsx)("div",{className:"relative ".concat(u?"-mt-5":"-mt-10"),style:{paddingBottom:"70%"},children:(0,a.jsxs)("video",{className:"absolute top-0 left-0 w-full h-full rounded-lg",controls:!0,autoPlay:!0,muted:!0,preload:"metadata",children:[(0,a.jsx)("source",{src:"".concat(d.GW,"/videos/cursor-small.mp4"),type:"video/mp4"}),"Your browser does not support the video tag."]})})]})]})})]})})})}function f(e){let{isOpen:t,onClose:s,onConfirm:n,title:c,message:o,confirmText:i="Confirm",confirmVariant:d="destructive",confirmClassName:m=null}=e;return(0,a.jsx)(r.Vq,{open:t,onOpenChange:s,children:(0,a.jsxs)(r.cZ,{className:"sm:max-w-md",children:[(0,a.jsxs)(r.fK,{children:[(0,a.jsx)(r.$N,{children:c}),(0,a.jsx)(r.Be,{children:o})]}),(0,a.jsxs)(r.cN,{className:"flex justify-end gap-2 pt-4",children:[(0,a.jsx)(l.z,{variant:"outline",onClick:s,children:"Cancel"}),(0,a.jsx)(l.z,{variant:m?void 0:d,className:m,onClick:()=>{n(),s()},children:i})]})]})})}},326:function(e,t,s){s.d(t,{$N:function(){return f},Be:function(){return h},Vq:function(){return o},cN:function(){return x},cZ:function(){return m},fK:function(){return u}});var a=s(5893),n=s(7294),r=s(6327),l=s(2350),c=s(3767);let o=r.fC;r.xz;let i=r.h_;r.x8;let d=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(r.aV,{ref:t,className:(0,l.cn)("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...n})});d.displayName=r.aV.displayName;let m=n.forwardRef((e,t)=>{let{className:s,children:n,...o}=e;return(0,a.jsxs)(i,{children:[(0,a.jsx)(d,{}),(0,a.jsxs)(r.VY,{ref:t,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...o,children:[n,(0,a.jsxs)(r.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-500",children:[(0,a.jsx)(c.Z,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});m.displayName=r.VY.displayName;let u=e=>{let{className:t,...s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...s})};u.displayName="DialogHeader";let x=e=>{let{className:t,...s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s})};x.displayName="DialogFooter";let f=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(r.Dx,{ref:t,className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight",s),...n})});f.displayName=r.Dx.displayName;let h=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(r.dk,{ref:t,className:(0,l.cn)("text-sm text-gray-500",s),...n})});h.displayName=r.dk.displayName},8764:function(e,t,s){s.d(t,{RM:function(){return o},SC:function(){return i},iA:function(){return l},pj:function(){return m},ss:function(){return d},xD:function(){return c}});var a=s(5893),n=s(7294),r=s(2350);let l=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("div",{className:"relative w-full overflow-auto",children:(0,a.jsx)("table",{ref:t,className:(0,r.cn)("w-full caption-bottom text-base",s),...n})})});l.displayName="Table";let c=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("thead",{ref:t,className:(0,r.cn)("[&_tr]:border-b",s),...n})});c.displayName="TableHeader";let o=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("tbody",{ref:t,className:(0,r.cn)("[&_tr:last-child]:border-0",s),...n})});o.displayName="TableBody",n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("tfoot",{ref:t,className:(0,r.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...n})}).displayName="TableFooter";let i=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("tr",{ref:t,className:(0,r.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...n})});i.displayName="TableRow";let d=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("th",{ref:t,className:(0,r.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",s),...n})});d.displayName="TableHead";let m=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("td",{ref:t,className:(0,r.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...n})});m.displayName="TableCell",n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)("caption",{ref:t,className:(0,r.cn)("mt-4 text-base text-muted-foreground",s),...n})}).displayName="TableCaption"},4545:function(e,t,s){function a(e){return e.startsWith("sky-jobs-controller-")}function n(e,t,s){return null===t?e:[...e].sort((e,a)=>e[t]<a[t]?"ascending"===s?-1:1:e[t]>a[t]?"ascending"===s?1:-1:0)}s.d(t,{R0:function(){return n},Ym:function(){return a}})}}]);
|