"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[725],{13626:function(e,s,r){r.d(s,{Z:function(){return t}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let t=(0,r(60998).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"}]])},47603:function(e,s,r){r.d(s,{Z:function(){return t}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let t=(0,r(60998).Z)("Trash2",[["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"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},1812:function(e,s,r){r.d(s,{X:function(){return l}});var t=r(85893),n=r(67294);let a=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,[c,i]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{s&&i(!1)},[s]),!s||c)return null;let o="string"==typeof s?s:a(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:()=>{i(!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"})})})]})})}},99307:function(e,s,r){r.d(s,{Cl:function(){return c},OE:function(){return d}});var t=r(85893);r(67294);var n=r(55739),a=r(470),l=r(53850);let c=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"RUNNING":case"IN_USE":case"READY":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"AUTOSTOPPING":return"bg-purple-100 text-purple-800";case"TERMINATED":case"PENDING":case"UNKNOWN":default:return"bg-gray-100 text-gray-800";case"SUCCEEDED":case"PROVISIONING":case"CONTROLLER_INIT":case"REPLICA_INIT":return"bg-blue-50 text-blue-700";case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":return"bg-red-50 text-red-700";case"CANCELLED":case"CANCELLING":case"NOT_READY":return"bg-yellow-50 text-yellow-700";case"RECOVERING":case"SHUTTING_DOWN":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";case"PREEMPTED":case"NO_REPLICA":return"bg-purple-50 text-purple-700"}},i=e=>{switch(e){case"LAUNCHING":case"STARTING":case"AUTOSTOPPING":case"PROVISIONING":case"SHUTTING_DOWN":return(0,t.jsx)(n.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":case"IN_USE":default:return(0,t.jsx)(l.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":case"PREEMPTED":return(0,t.jsx)(l.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":case"UNKNOWN":return(0,t.jsx)(l.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,t.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":case"READY":case"NOT_READY":case"CONTROLLER_INIT":case"REPLICA_INIT":case"NO_REPLICA":return(0,t.jsx)(l.J$,{className:"w-3 h-3 mr-1"})}},o=e=>{let s=c(e),r=i(e);return(0,t.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(s),children:[r,e]})},d=e=>{let{status:s,statusTooltip:r}=e,n=r||s;return(0,t.jsx)(a.Md,{content:n,children:(0,t.jsx)("span",{children:o(s)})})}},54725:function(e,s,r){r.r(s),r.d(s,{Volumes:function(){return C}});var t=r(85893),n=r(67294),a=r(45697),l=r.n(a),c=r(55739),i=r(65168),o=r(30803),d=r(68764),u=r(19238),h=r(51214),x=r(94545),m=r(13626),p=r(47603),N=r(23001),j=r(37673),g=r(91360),f=r(1812),v=r(41664),E=r.n(v),y=r(470),I=r(99307),w=r(6378),b=r(36856);let L=h.nb.REFRESH_INTERVAL;function C(){let[e,s]=(0,n.useState)(!1),r=(0,n.useRef)(null),a=(0,N.X)(),[l,i]=(0,n.useState)(!1),[d,h]=(0,n.useState)(null),[x,p]=(0,n.useState)(null),[j,v]=(0,n.useState)(!1),[I,C]=(0,n.useState)(!1),[A,D]=(0,n.useState)(null),k=()=>{w.ZP.invalidate(u.C),C(!1),b.ZP.preloadForPage("volumes",{force:!0}).then(()=>{C(!0),D(new Date),r.current&&r.current()})},_=async()=>{if(d){v(!0),p(null);try{let e=await (0,u.w)(d.name);if(!e.success)throw Error(e.msg);i(!1),h(null),k()}catch(e){p(e)}finally{v(!1)}}},S=()=>{i(!1),h(null),p(null)};return(0,n.useEffect)(()=>{(async()=>{try{await b.ZP.preloadForPage("volumes")}catch(e){console.error("Error preloading volumes data:",e)}finally{C(!0),D(new Date)}})()},[]),(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)(E(),{href:"/volumes",className:"text-sky-blue hover:underline leading-none",children:"Volumes"})}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[e&&(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(c.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),!e&&A&&(0,t.jsx)(y.$3,{timestamp:A}),(0,t.jsxs)("button",{onClick:k,disabled:e,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,t.jsx)(m.Z,{className:"h-4 w-4 mr-1.5"}),!a&&(0,t.jsx)("span",{children:"Refresh"})]})]})]}),(0,t.jsx)(R,{refreshInterval:L,setLoading:s,refreshDataRef:r,onDeleteVolume:e=>{h(e),i(!0),p(null)},preloadingComplete:I},"volumes"),(0,t.jsx)(g.Vq,{open:l,onOpenChange:S,children:(0,t.jsxs)(g.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(g.fK,{children:[(0,t.jsx)(g.$N,{children:"Delete Volume"}),(0,t.jsxs)(g.Be,{children:['Are you sure you want to delete volume "',(null==d?void 0:d.name)||"this volume",'"? This action cannot be undone.']})]}),(0,t.jsx)(f.X,{error:x,title:"Deletion Failed",onDismiss:()=>p(null)}),(0,t.jsxs)(g.cN,{children:[(0,t.jsx)(o.z,{variant:"outline",onClick:S,disabled:j,children:"Cancel"}),(0,t.jsx)(o.z,{variant:"destructive",onClick:_,disabled:j,children:j?"Deleting...":"Delete"})]})]})})]})}function R(e){let{refreshInterval:s,setLoading:r,refreshDataRef:a,onDeleteVolume:l,preloadingComplete:i}=e,[h,m]=(0,n.useState)([]),[N,g]=(0,n.useState)({key:null,direction:"ascending"}),[f,v]=(0,n.useState)(!1),[E,b]=(0,n.useState)(!0),[L,C]=(0,n.useState)(1),[R,D]=(0,n.useState)(10),k=(0,n.useCallback)(async()=>{r(!0),v(!0);try{let e=await w.ZP.get(u.C);m(e)}catch(e){console.error("Failed to fetch volumes:",e),m([])}finally{r(!1),v(!1),b(!1)}},[r]),_=(0,n.useMemo)(()=>(0,x.R0)(h,N.key,N.direction),[h,N]);(0,n.useEffect)(()=>{a&&(a.current=k)},[a,k]),(0,n.useEffect)(()=>{m([]);let e=!0;if(i){k();let r=setInterval(()=>{e&&"visible"===window.document.visibilityState&&k()},s);return()=>{e=!1,clearInterval(r)}}return()=>{e=!1}},[s,k,i]),(0,n.useEffect)(()=>{C(1)},[h.length]);let S=e=>{let s="ascending";N.key===e&&"ascending"===N.direction&&(s="descending"),g({key:e,direction:s})},O=e=>N.key===e?"ascending"===N.direction?" ↑":" ↓":"",T=Math.ceil(_.length/R),P=(L-1)*R,F=P+R,U=_.slice(P,F),M=e=>e||"-",z=e=>{if(!e)return"N/A";try{let s=new Date(1e3*e);return(0,t.jsx)(y.Zg,{date:s})}catch(e){return"Invalid Date"}};return(0,t.jsxs)("div",{children:[(0,t.jsx)(j.Zb,{children:(0,t.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,t.jsxs)(d.iA,{className:"min-w-full",children:[(0,t.jsx)(d.xD,{children:(0,t.jsxs)(d.SC,{children:[(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>S("name"),children:["Name",O("name")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>S("infra"),children:["Infra",O("infra")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>S("status"),children:["Status",O("status")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>S("size"),children:["Size",O("size")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>S("user_name"),children:["User",O("user_name")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>S("last_attached_at"),children:["Last Use",O("last_attached_at")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>S("type"),children:["Type",O("type")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>S("usedby_clusters"),children:["Used By",O("usedby_clusters")]}),(0,t.jsx)(d.ss,{children:"Actions"})]})}),(0,t.jsx)(d.RM,{children:f||!i?(0,t.jsx)(d.SC,{children:(0,t.jsx)(d.pj,{colSpan:11,className:"text-center py-6 text-gray-500",children:(0,t.jsxs)("div",{className:"flex justify-center items-center",children:[(0,t.jsx)(c.Z,{size:20,className:"mr-2"}),(0,t.jsx)("span",{children:"Loading..."})]})})}):U.length>0?U.map(e=>(0,t.jsxs)(d.SC,{children:[(0,t.jsx)(d.pj,{className:"font-medium",children:e.name}),(0,t.jsx)(d.pj,{children:e.infra||"N/A"}),(0,t.jsx)(d.pj,{children:(0,t.jsx)(I.OE,{status:e.status,statusTooltip:e.error_message||e.status})}),(0,t.jsx)(d.pj,{children:M(e.size)}),(0,t.jsx)(d.pj,{children:e.user_name||"N/A"}),(0,t.jsx)(d.pj,{children:z(e.last_attached_at)}),(0,t.jsx)(d.pj,{children:e.type||"N/A"}),(0,t.jsx)(d.pj,{children:(0,t.jsx)(A,{clusters:e.usedby_clusters,pods:e.usedby_pods})}),(0,t.jsx)(d.pj,{children:(0,t.jsx)(o.z,{variant:"ghost",size:"sm",onClick:()=>l(e),className:"text-red-600 hover:text-red-700 hover:bg-red-50",title:"Delete volume",children:(0,t.jsx)(p.Z,{className:"w-4 h-4"})})})]},e.name)):(0,t.jsx)(d.SC,{children:(0,t.jsx)(d.pj,{colSpan:11,className:"text-center py-6 text-gray-500",children:"No volumes found"})})})]})})}),h.length>0&&(0,t.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,t.jsxs)("div",{className:"relative inline-block",children:[(0,t.jsxs)("select",{value:R,onChange:e=>{D(parseInt(e.target.value,10)),C(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,t.jsx)("option",{value:10,children:"10"}),(0,t.jsx)("option",{value:30,children:"30"}),(0,t.jsx)("option",{value:50,children:"50"}),(0,t.jsx)("option",{value:100,children:"100"}),(0,t.jsx)("option",{value:200,children:"200"})]}),(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,t.jsxs)("div",{children:[P+1," – ",Math.min(F,h.length)," of"," ",h.length]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{C(e=>Math.max(e-1,1))},disabled:1===L,className:"text-gray-500 h-8 w-8 p-0",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,t.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,t.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{C(e=>Math.min(e+1,T))},disabled:L===T||0===T,className:"text-gray-500 h-8 w-8 p-0",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,t.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function A(e){let{clusters:s,pods:r}=e,[a,l]=(0,n.useState)(null),c=Array.isArray(s)&&s.length>0?s:Array.isArray(r)&&r.length>0?r:[],o=Array.isArray(s)&&s.length>0;if(!c||0===c.length)return"N/A";let d=c.slice(0,2),u=c.slice(2);return(0,t.jsxs)(t.Fragment,{children:[d.map((e,s)=>(0,t.jsxs)("span",{children:[o?(0,t.jsx)(E(),{href:"/clusters/".concat(encodeURIComponent(e)),className:"text-sky-blue hover:underline",children:e}):(0,t.jsx)("span",{children:e}),s<d.length-1?", ":""]},e)),u.length>0&&(0,t.jsxs)(t.Fragment,{children:[","," ",(0,t.jsxs)("span",{className:"text-sky-blue cursor-pointer underline",onClick:e=>{l(e.currentTarget)},style:{userSelect:"none"},children:["+",u.length," more"]}),(0,t.jsx)(i.ZP,{open:!!a,anchorEl:a,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:(0,t.jsx)("div",{style:{padding:12,maxWidth:300},children:u.map(e=>(0,t.jsx)("div",{style:{marginBottom:4},children:o?(0,t.jsx)(E(),{href:"/clusters/".concat(encodeURIComponent(e)),className:"text-sky-blue hover:underline",children:e}):(0,t.jsx)("span",{children:e})},e))})})]})]})}R.propTypes={refreshInterval:l().number.isRequired,setLoading:l().func.isRequired,refreshDataRef:l().shape({current:l().func}).isRequired,onDeleteVolume:l().func.isRequired,preloadingComplete:l().bool.isRequired}},23001:function(e,s,r){r.d(s,{X:function(){return n}});var t=r(67294);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[s,r]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{let s=()=>{r(window.innerWidth<e)};return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[e]),s}}}]);