(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[395],{75429:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/volumes/[volume]",function(){return t(8548)}])},6639:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});/**
 * @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 a=(0,t(60998).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},88507:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});/**
 * @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 a=(0,t(60998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},13626:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});/**
 * @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 a=(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"}]])},28586:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});/**
 * @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 a=(0,t(60998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},1125:function(e,s,t){"use strict";t.d(s,{C:function(){return i}});var a=t(85893),r=t(67294),n=t(34209),c=t(84283);let l=e=>{if(!e||"string"!=typeof e)return e;let s=e.split("\n"),t=[];for(let e=0;e<s.length;e++){let a=s[e];if(""===a.trim()){let r=!1,n=0;for(let t=e-1;t>=0;t--){let e=s[t],a=e.trim();if(a&&e.match(/:\s*[|>]\s*$/)){r=!0;for(let e=t+1;e<s.length;e++){let t=s[e];if(t.trim()){n=t.search(/\S/);break}}break}if(a&&0===e.search(/\S/))break}if(r)for(let r=e+1;r<s.length;r++){let e=s[r];if(e.trim()){e.search(/\S/)>=n?t.push("  #YAML_BLANK_LINE_MARKER#"):t.push(a);break}}else t.push(a)}else t.push(a)}return t.join("\n")};function i(e){let{children:s,className:t=""}=e,i=(0,r.useRef)(null),d=l(s);(0,r.useEffect)(()=>{if(i.current){let e=i.current;setTimeout(()=>{let s;let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);for(;s=t.nextNode();)s.textContent&&s.textContent.includes("#YAML_BLANK_LINE_MARKER#")&&(s.textContent=s.textContent.replace(/#YAML_BLANK_LINE_MARKER#/g,""))},0)}},[d]);let o={...c.mQ,'code[class*="language-"]':{...c.mQ['code[class*="language-"]'],whiteSpace:"pre !important"},'pre[class*="language-"]':{...c.mQ['pre[class*="language-"]'],whiteSpace:"pre !important"}};return(0,a.jsx)("div",{ref:i,className:t,children:(0,a.jsx)(n.Z,{language:"yaml",style:o,customStyle:{margin:0,padding:0,background:"transparent",fontSize:"0.875rem",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace'},wrapLines:!0,wrapLongLines:!0,showLineNumbers:!1,useInlineStyles:!0,children:d})})}},99307:function(e,s,t){"use strict";t.d(s,{Cl:function(){return l},OE:function(){return o}});var a=t(85893);t(67294);var r=t(55739),n=t(470),c=t(53850);let l=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,a.jsx)(r.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":case"IN_USE":default:return(0,a.jsx)(c.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":case"PREEMPTED":return(0,a.jsx)(c.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,a.jsx)(c.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,a.jsx)(c.Ye,{className:"w-3 h-3 mr-1"});case"PENDING":case"RECOVERING":case"SUBMITTED":case"CANCELLING":case"FAILED_SETUP":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"READY":case"NOT_READY":case"CONTROLLER_INIT":case"REPLICA_INIT":case"NO_REPLICA":return(0,a.jsx)(c.J$,{className:"w-3 h-3 mr-1"})}},d=e=>{let s=l(e),t=i(e);return(0,a.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(s),children:[t,e]})},o=e=>{let{status:s,statusTooltip:t}=e,r=t||s;return(0,a.jsx)(n.Md,{content:r,children:(0,a.jsx)("span",{children:d(s)})})}},20546:function(e,s,t){"use strict";t.d(s,{H:function(){return o}});var a=t(85893);t(67294);var r=t(41664),n=t.n(r),c=t(45697),l=t.n(c);function i(e){return!!e&&"string"==typeof e&&e.toLowerCase().startsWith("sa-")}let d=()=>(0,a.jsx)("span",{className:"px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded font-medium ml-1",children:"SA"}),o=e=>{let{username:s,userHash:t,className:r="flex items-center gap-1",linkClassName:c="text-gray-700 hover:text-blue-600 hover:underline",showBadge:l=!0}=e,o=i(t),u=i(t)?"/users?tab=service-accounts":"/users";return(0,a.jsxs)("div",{className:r,children:[(0,a.jsx)(n(),{href:u,className:c,children:s}),l&&o&&(0,a.jsx)(d,{})]})};o.propTypes={username:l().string.isRequired,userHash:l().string,className:l().string,linkClassName:l().string,showBadge:l().bool}},23001:function(e,s,t){"use strict";t.d(s,{X:function(){return r}});var a=t(67294);function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[s,t]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let s=()=>{t(window.innerWidth<e)};return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[e]),s}},84303:function(e,s,t){"use strict";t.d(s,{_q:function(){return n},pJ:function(){return i}});var a=t(1272);let r={lineWidth:-1,quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2},n=e=>{if(!e)return"No YAML available";try{let s=a.ZP.load(e),t=a.ZP.dump(s,r).split("\n"),n=[],c=-1;for(let e=0;e<t.length;e++){let s=t[e],a=s.search(/\S/);0===a&&c>=0&&e>0&&n.push(""),n.push(s),c=a}return n.join("\n").trim()}catch(s){return console.error("YAML formatting error:",s),e}},c=e=>"string"==typeof e?e.substring(0,50)+"...":e&&e.name?e.name:e&&e.resources?"Task configuration":"YAML document",l=(e,s)=>{try{let t=a.ZP.load(e),n=a.ZP.dump(t,r).split("\n"),l=[],i=-1;for(let e=0;e<n.length;e++){let s=n[e],t=s.search(/\S/);0===t&&i>=0&&e>0&&l.push(""),l.push(s),i=t}return{index:s,content:l.join("\n").trim(),preview:c(t)}}catch(t){return console.error("YAML formatting error for document ".concat(s,":"),t),{index:s,content:e,preview:"Invalid YAML"}}},i=e=>{if(!e)return[];try{let s=[],t=e.split(/^---$/m);for(let e=0;e<t.length;e++){let a=t[e].trim();a&&""!==a&&s.push(a)}return(s.length>1?s.slice(1):s).map((e,s)=>l(e,s))}catch(s){return console.error("YAML formatting error:",s),[{index:0,content:e,preview:"Invalid YAML"}]}}},8548:function(e,s,t){"use strict";t.r(s);var a=t(85893),r=t(67294),n=t(55739),c=t(11163),l=t(41664),i=t.n(l),d=t(99307),o=t(19238),u=t(6378),m=t(13626),x=t(70282),h=t(27325),N=t(45895),f=t(6639),g=t(470),j=t(23001),p=t(9008),v=t.n(p),y=t(84303),E=t(20546),b=t(1125);function L(e){let{clusters:s,pods:t}=e,r=Array.isArray(s)?s:[],n=Array.isArray(t)?t:[],c=r.length>0,l=c?r:n;return 0===l.length?(0,a.jsx)("span",{children:"N/A"}):(0,a.jsx)("div",{className:"space-y-1",children:(0,a.jsx)("div",{children:l.map((e,s)=>(0,a.jsxs)("span",{children:[c?(0,a.jsx)(i(),{href:"/clusters/".concat(encodeURIComponent(e)),className:"text-blue-600 hover:underline",children:e}):e,s<l.length-1?", ":""]},e))})})}function A(e){let{volumeData:s}=e,[t,n]=(0,r.useState)(!1),[c,l]=(0,r.useState)(!1),[o,u]=(0,r.useState)(!1),m=r.useMemo(()=>s.creation_yaml?(0,y._q)(s.creation_yaml):null,[s.creation_yaml]),j=async()=>{try{if(!m)return;await navigator.clipboard.writeText(m),l(!0),setTimeout(()=>l(!1),2e3)}catch(e){console.error("Failed to copy YAML to clipboard:",e)}},p=async()=>{try{let e=s.last_use;if(!e)return;await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch(e){console.error("Failed to copy command to clipboard:",e)}},v=!!m,A=v||s.last_use;return(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Details"})}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(d.OE,{status:s.status,statusTooltip:s.error_message||s.status})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Name"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Infra"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.infra?(0,a.jsx)(g.Md,{content:s.infra,className:"text-sm text-muted-foreground",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(i(),{href:"/infra",className:"text-blue-600 hover:underline",children:s.cloud||s.infra}),s.region&&(0,a.jsxs)("span",{className:"text-gray-600",children:[" ","(",s.region,s.zone?"/".concat(s.zone):"",")"]})]})}):"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Type"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.type||"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Size"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.size||"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(E.H,{username:s.user_name,userHash:s.user_hash})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Created"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.launched_at?(0,g.xn)(new Date(1e3*s.launched_at)):"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Last Use"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.last_attached_at?(0,g.xn)(new Date(1e3*s.last_attached_at)):"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Name on Cloud"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.name_on_cloud||"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Storage Class"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.storage_class||"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Access Mode"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.access_mode||"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Namespace"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.namespace||"N/A"})]}),(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Used By"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(L,{clusters:s.usedby_clusters,pods:s.usedby_pods})})]}),A&&(0,a.jsxs)("div",{className:"col-span-2",children:[s.last_use&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Entrypoint"}),(0,a.jsx)(g.WH,{content:o?"Copied!":"Copy command",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:p,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:o?(0,a.jsx)(x.Z,{className:"w-4 h-4 text-green-600"}):(0,a.jsx)(h.Z,{className:"w-4 h-4"})})})]}),(0,a.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 mt-2",children:(0,a.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all",children:s.last_use})})]}),v&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"flex items-center mb-2",children:[(0,a.jsxs)("button",{onClick:()=>{n(!t)},className:"flex items-center text-left focus:outline-none text-gray-700 hover:text-gray-900 transition-colors duration-200",children:[t?(0,a.jsx)(N.Z,{className:"w-4 h-4 mr-1"}):(0,a.jsx)(f.Z,{className:"w-4 h-4 mr-1"}),(0,a.jsx)("span",{className:"text-base",children:"Show Volume YAML"})]}),(0,a.jsx)(g.WH,{content:c?"Copied!":"Copy YAML",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:j,className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",children:c?(0,a.jsx)(x.Z,{className:"w-4 h-4 text-green-600"}):(0,a.jsx)(h.Z,{className:"w-4 h-4"})})})]}),t&&(0,a.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 max-h-96 overflow-y-auto",children:(0,a.jsx)(b.C,{className:"whitespace-pre-wrap",children:m})})]})]})]})})]})})})}s.default=function(){let e=(0,c.useRouter)(),{volume:s}=e.query,[t,l]=(0,r.useState)(!1),[d,x]=(0,r.useState)(!0),h=(0,j.X)(),{volumeData:N,loading:f,refreshData:p}=function(e){let{volumeName:s}=e,[t,a]=(0,r.useState)(null),[n,c]=(0,r.useState)(!0),l=(0,r.useCallback)(async()=>{if(s){c(!0);try{let e=(await u.ZP.get(o.C)).find(e=>e.name===s);a(e||null)}catch(e){console.error("Failed to fetch volume details:",e),a(null)}finally{c(!1)}}},[s]);return(0,r.useEffect)(()=>{l()},[l]),{volumeData:t,loading:n,refreshData:(0,r.useCallback)(async()=>{u.ZP.invalidate(o.C),await l()},[l])}}({volumeName:s});(0,r.useEffect)(()=>{!f&&d&&x(!1)},[f,d]);let y=async()=>{l(!0),await p(),l(!1)};if(!e.isReady)return(0,a.jsx)("div",{children:"Loading..."});let E=s?"Volume: ".concat(s," | SkyPilot Dashboard"):"Volume Details | SkyPilot Dashboard";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v(),{children:(0,a.jsx)("title",{children:E})}),(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)(i(),{href:"/volumes",className:"text-sky-blue hover:underline",children:"Volumes"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)(i(),{href:"/volumes/".concat(encodeURIComponent(s)),className:"text-sky-blue hover:underline",children:s})]}),(0,a.jsxs)("div",{className:"text-sm flex items-center",children:[(f||t)&&(0,a.jsxs)("div",{className:"flex items-center mr-4",children:[(0,a.jsx)(n.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),N&&(0,a.jsx)(g.WH,{content:"Refresh",className:"text-sm text-muted-foreground",children:(0,a.jsxs)("button",{onClick:y,disabled:f||t,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,a.jsx)(m.Z,{className:"w-4 h-4 mr-1.5"}),!h&&(0,a.jsx)("span",{children:"Refresh"})]})})]})]}),f&&d?(0,a.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,a.jsx)(n.Z,{size:24,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading volume details..."})]}):N?(0,a.jsx)(A,{volumeData:N}):(0,a.jsx)("div",{className:"flex justify-center items-center py-12",children:(0,a.jsx)("span",{className:"text-gray-500",children:"Volume not found."})})]})]})}},9008:function(e,s,t){e.exports=t(37219)}},function(e){e.O(0,[739,798,417,850,888,774,179],function(){return e(e.s=75429)}),_N_E=e.O()}]);