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