Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
22 KiB

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[817],{72315:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/anvil",function(){return n(96757)}])},39174:function(e,t,n){"use strict";var s=n(85893),o=n(5616),a=n(6010);let r="Decorator",c={ok:"".concat(r,"-ok"),warning:"".concat(r,"-warning"),error:"".concat(r,"-error"),off:"".concat(r,"-off")};t.Z=e=>{let{colour:t,sx:n,...r}=e;return(0,s.jsx)(o.Z,{...r,className:c[t],sx:{borderRadius:a.n_,height:"100%",width:"1.4em",["&.".concat(c.ok)]:{backgroundColor:a.Ej},["&.".concat(c.warning)]:{backgroundColor:a.Wd},["&.".concat(c.error)]:{backgroundColor:a.hM},["&.".concat(c.off)]:{backgroundColor:a.s7},...n}})}},58839:function(e,t,n){"use strict";var s=n(67294);t.Z=function(){let{actionProceedText:e="",content:t="",titleText:n="",...o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,s.useState)({actionProceedText:e,content:t,titleText:n,...o})}},96757:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return anvil}});var s=n(85893),o=n(90948),a=n(5616),r=n(9008),c=n.n(r),i=n(11163),l=n(67294),d=n(98436),h=n(6010);let x=(0,l.createContext)({uuid:"",setAnvilUuid:()=>null});var components_AnvilContext=e=>{let{children:t}=e,[n,o]=(0,l.useState)("");return(0,s.jsx)(x.Provider,{value:{uuid:n,setAnvilUuid:e=>{o(e)}},children:t})},u=n(37260),m=n(64666),v=n(72852);let p=new Map([["optimal","Optimal"],["not_ready","Not Ready"],["degraded","Degraded"]]);var g=n(39174),fetchers_putFetch=(e,t)=>fetch(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),j=n(84154);let f={anvilName:"".concat("SelectedAnvil","-anvilName")},_=(0,o.ZP)(a.Z)(()=>({display:"flex",flexDirection:"row",width:"100%",["& .".concat(f.anvilName)]:{paddingLeft:0}})),selectDecorator=e=>{switch(e){case"optimal":return"ok";case"not_ready":return"warning";default:return"error"}},isAnvilOn=e=>-1!==e.hosts.findIndex(e=>{let{state:t}=e;return"offline"!==t});var Anvils_SelectedAnvil=e=>{let{list:t}=e,{uuid:n}=(0,l.useContext)(x),o=t.findIndex(e=>e.anvil_uuid===n);return(0,s.jsx)(_,{children:""!==n&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{p:1,children:(0,s.jsx)(g.Z,{colour:selectDecorator(t[o].anvil_state)})}),(0,s.jsxs)(a.Z,{p:1,flexGrow:1,className:f.anvilName,children:[(0,s.jsx)(j.z,{text:t[o].anvil_name}),(0,s.jsx)(j.z,{text:p.get(t[o].anvil_state)||"State unavailable"})]}),(0,s.jsx)(a.Z,{p:1,children:(0,s.jsx)(v.Z,{checked:isAnvilOn(t[o]),onChange:()=>{let{[o]:e}=t,{anvil_uuid:n}=e;fetchers_putFetch("".concat(d.Z,"/command/").concat(isAnvilOn(e)?"stop-an":"start-an","/").concat(n),{})}})})]})})},Z=n(78462),w=n(67720),b=n(97212),Anvils_Anvil=e=>{let{anvil:t}=e;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(j.Ac,{text:t.anvil_name}),(0,s.jsx)(j.Ac,{text:p.get(t.anvil_state)||"State unavailable"})]})},Anvils_sortAnvils=e=>{let t=[],n=[],s=[];return e.forEach(e=>{"optimal"===e.anvil_state?t.push(e):"not_ready"===e.anvil_state?n.push(e):s.push(e)}),[...s,...n,...t]};let k="AnvilList",A={root:"".concat(k,"-root"),divider:"".concat(k,"-divider"),button:"".concat(k,"-button"),anvil:"".concat(k,"-anvil")},N=(0,o.ZP)("div")(e=>{let{theme:t}=e;return{["& .".concat(A.root)]:{width:"100%",overflow:"auto",height:"30vh",paddingRight:".3em",[t.breakpoints.down(h.li)]:{height:"100%",overflow:"hidden"}},["& .".concat(A.divider)]:{backgroundColor:h.d},["& .".concat(A.button)]:{"&:hover":{backgroundColor:h.$T},paddingLeft:0},["& .".concat(A.anvil)]:{paddingLeft:0}}}),AnvilList_selectDecorator=e=>{switch(e){case"optimal":return"ok";case"not_ready":return"warning";case"degraded":return"error";default:return"off"}};var Anvils_AnvilList=e=>{let{list:t}=e,{uuid:n,setAnvilUuid:o}=(0,l.useContext)(x);return(0,l.useEffect)(()=>{""===n&&o(Anvils_sortAnvils(t)[0].anvil_uuid)},[n,t,o]),(0,s.jsx)(N,{children:(0,s.jsx)(Z.Z,{component:"nav",className:A.root,"aria-label":"mailbox folders",children:Anvils_sortAnvils(t).map(e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(w.Z,{className:A.divider}),(0,s.jsx)(b.ZP,{button:!0,className:A.button,onClick:()=>o(e.anvil_uuid),children:(0,s.jsxs)(a.Z,{display:"flex",flexDirection:"row",width:"100%",children:[(0,s.jsx)(a.Z,{p:1,children:(0,s.jsx)(g.Z,{colour:AnvilList_selectDecorator(e.anvil_state)})}),(0,s.jsx)(a.Z,{p:1,flexGrow:1,className:A.anvil,children:(0,s.jsx)(Anvils_Anvil,{anvil:e})})]})},e.anvil_uuid)]}))})})},components_Anvils=e=>{let{list:t}=e,n=[];return null==t||t.anvils.forEach(e=>{let{anvil_uuid:t}=e,{data:s}=(0,m.Z)("".concat(d.Z,"/anvil/").concat(t));n.push({...e,...s})}),(0,s.jsxs)(u.s_,{children:[(0,s.jsx)(Anvils_SelectedAnvil,{list:n}),(0,s.jsx)(Anvils_AnvilList,{list:Anvils_sortAnvils(n)})]})},S=n(55238),C=n(81796),components_CPU=()=>{let{uuid:e}=(0,l.useContext)(x),{data:{allocated:t=0,cores:n=0,threads:o=0}={},isLoading:a}=(0,m.Z)("".concat(d.Z,"/anvil/").concat(e,"/cpu")),r=(0,l.useMemo)(()=>a?(0,s.jsx)(C.Z,{}):(0,s.jsxs)(S.Z,{spacing:0,children:[(0,s.jsx)(j.Ac,{text:"Total Cores: ".concat(n)}),(0,s.jsx)(j.Ac,{text:"Total Threads: ".concat(o)}),(0,s.jsx)(j.Ac,{text:"Allocated Cores: ".concat(t)})]}),[t,n,a,o]);return(0,s.jsxs)(u.s_,{children:[(0,s.jsx)(u.V9,{children:(0,s.jsx)(j.z,{text:"CPU"})}),r]})},y=n(21405);let P=new Map([["message_0222","The subnode is in an unknown state."],["message_0223","The subnode is a full cluster member."],["message_0224","The subnode is coming online; the cluster resource manager is running (step 2/3)."],["message_0225","The subnode is coming online; the subnode is a consensus cluster member (step 1/3)."],["message_0226","The subnode has booted, but it is not (yet) joining the cluster."]]);var D=n(27072);let B="AnvilHost",M={state:"".concat(B,"-state"),bar:"".concat(B,"-bar"),label:"".concat(B,"-label"),decoratorBox:"".concat(B,"-decoratorBox")},U=(0,o.ZP)(a.Z)(e=>{let{theme:t}=e;return{overflow:"auto",height:"28vh",paddingLeft:".3em",paddingRight:".3em",[t.breakpoints.down(h.li)]:{height:"100%",overflow:"hidden"},["& .".concat(M.state)]:{paddingLeft:".7em",paddingRight:".7em"},["& .".concat(M.bar)]:{paddingLeft:".7em",paddingRight:".7em"},["& .".concat(M.label)]:{paddingTop:".3em"},["& .".concat(M.decoratorBox)]:{alignSelf:"stretch"}}}),selectStateMessage=(e,t)=>{let n=e.exec(t);return n?P.get(n[0])||"Error code not recognized":"Error code not found"},AnvilHost_selectDecorator=e=>{switch(e){case"online":return"ok";case"offline":return"off";default:return"warning"}};var Hosts_AnvilHost=e=>{let{hosts:t}=e,n=/^[a-zA-Z]/,o=/^(message_[0-9]+)/;return(0,s.jsx)(U,{children:t&&t.map(e=>{var t;return e?(0,s.jsxs)(u.Lg,{children:[(0,s.jsxs)(u.CH,{children:[(0,s.jsx)(a.Z,{flexGrow:1,children:(0,s.jsx)(j.Ac,{text:e.host_name})}),(0,s.jsx)(a.Z,{className:M.decoratorBox,children:(0,s.jsx)(g.Z,{colour:AnvilHost_selectDecorator(e.state)})}),(0,s.jsx)(a.Z,{children:(0,s.jsx)(j.Ac,{text:(null==e?void 0:null===(t=e.state)||void 0===t?void 0:t.replace(n,e=>e.toUpperCase()))||"Not Available"})})]}),(0,s.jsxs)(a.Z,{display:"flex",className:M.state,children:[(0,s.jsx)(a.Z,{className:M.label,children:(0,s.jsx)(j.Ac,{text:"Power: "})}),(0,s.jsx)(a.Z,{flexGrow:1,children:(0,s.jsx)(v.Z,{checked:"online"===e.state,onChange:()=>fetchers_putFetch("".concat(d.Z,"/command/").concat("online"===e.state?"stop-subnode":"start-subnode","/").concat(e.host_uuid),{})})}),(0,s.jsx)(a.Z,{className:M.label,children:(0,s.jsx)(j.Ac,{text:"Member: "})}),(0,s.jsx)(a.Z,{children:(0,s.jsx)(v.Z,{checked:"online"===e.state,disabled:"online"!==e.state,onChange:()=>fetchers_putFetch("".concat(d.Z,"/command/").concat("online"===e.state?"leave-an":"join-an","/").concat(e.host_uuid),{})})})]}),"online"!==e.state&&"offline"!==e.state&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{display:"flex",width:"100%",className:M.state,children:(0,s.jsx)(a.Z,{children:(0,s.jsx)(j.Ac,{text:selectStateMessage(o,e.state_message)})})}),(0,s.jsx)(a.Z,{display:"flex",width:"100%",className:M.bar,children:(0,s.jsx)(a.Z,{flexGrow:1,children:(0,s.jsx)(D.ko,{progressPercentage:e.state_percent})})})]})]},e.host_uuid):(0,s.jsx)(s.Fragment,{})})})},sanitizers_hostsSanitizer=e=>null==e?void 0:e.filter(e=>e.host_uuid),components_Hosts=e=>{let{anvil:t}=e,{uuid:n}=(0,l.useContext)(x),{data:o,isLoading:a}=(0,m.Z)("".concat(d.Z,"/anvil/").concat(n)),r=t.findIndex(e=>e.anvil_uuid===n);return(0,s.jsxs)(u.s_,{children:[(0,s.jsx)(j.z,{text:"Subnodes"}),a?(0,s.jsx)(C.Z,{}):(0,s.jsx)(s.Fragment,{children:-1!==r&&o&&(0,s.jsx)(Hosts_AnvilHost,{hosts:sanitizers_hostsSanitizer(t[r].hosts).reduce((e,t,n)=>{let s=o.hosts[n];return s&&e.push(s),e},[])})})]})},T=n(56746),components_Memory=()=>{let{uuid:e}=(0,l.useContext)(x),{data:{allocated:t="0",reserved:n="0",total:o="0"}={},isLoading:r}=(0,m.Z)("".concat(d.Z,"/anvil/").concat(e,"/memory")),c=(0,l.useMemo)(()=>BigInt(t),[t]),i=(0,l.useMemo)(()=>BigInt(n),[n]),h=(0,l.useMemo)(()=>BigInt(o),[o]);return(0,s.jsxs)(u.s_,{children:[(0,s.jsx)(u.V9,{children:(0,s.jsx)(j.z,{text:"Memory"})}),r?(0,s.jsx)(C.Z,{}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(a.Z,{display:"flex",width:"100%",children:[(0,s.jsx)(a.Z,{flexGrow:1,children:(0,s.jsx)(j.Ac,{text:"Allocated: ".concat((0,T.MU)(c))})}),(0,s.jsx)(a.Z,{children:(0,s.jsx)(j.Ac,{text:"Free: ".concat((0,T.MU)(h-(i+c)))})})]}),(0,s.jsx)(a.Z,{display:"flex",width:"100%",children:(0,s.jsx)(a.Z,{flexGrow:1,children:(0,s.jsx)(D.CD,{allocated:Number((i+c)*BigInt(100)/h)})})}),(0,s.jsx)(a.Z,{display:"flex",justifyContent:"center",width:"100%",children:(0,s.jsx)(j.Ac,{text:"Total: ".concat((0,T.MU)(h)," | Reserved: ").concat((0,T.MU)(i))})})]})]})},processNetwork=e=>{let t=[],n={bonds:[]};return e.hosts.forEach(e=>{e.bonds.forEach(s=>{let o=t.findIndex(e=>e===s.bond_name);-1===o?(t.push(s.bond_name),n.bonds.push({bond_name:s.bond_name,bond_uuid:s.bond_uuid,bond_speed:0,bond_state:"degraded",hosts:[{host_name:e.host_name,host_uuid:e.host_uuid,link:s.links[0].is_active?s.links[0]:s.links[1]}]})):n.bonds[o].hosts.push({host_name:e.host_name,host_uuid:e.host_uuid,link:s.links[0].is_active?s.links[0]:s.links[1]})})}),n.bonds.forEach(e=>{let t=e.hosts[0].link.link_speed>e.hosts[1].link.link_speed?1:0;e.bond_speed=e.hosts[t].link.link_speed,e.bond_state=e.hosts[t].link.link_state}),n};let L="Network",z={container:"".concat(L,"-container"),root:"".concat(L,"-root"),noPaddingLeft:"".concat(L,"-noPaddingLeft"),divider:"".concat(L,"-divider"),verticalDivider:"".concat(L,"-verticalDivider")},I=(0,o.ZP)("div")(e=>{let{theme:t}=e;return{["& .".concat(z.container)]:{width:"100%",overflow:"auto",height:"32vh",paddingRight:".3em",[t.breakpoints.down(h.li)]:{height:"100%",overflow:"hidden"}},["& .".concat(z.root)]:{paddingTop:".7em",paddingBottom:".7em"},["& .".concat(z.noPaddingLeft)]:{paddingLeft:0},["& .".concat(z.divider)]:{backgroundColor:h.d},["& .".concat(z.verticalDivider)]:{height:"3.5em"}}}),Network_selectDecorator=e=>{switch(e){case"optimal":return"ok";case"degraded":default:return"warning";case"down":return"error"}};var components_Network=()=>{let{uuid:e}=(0,l.useContext)(x),[t,n]=(0,l.useState)(),{isLoading:o}=(0,m.Z)("".concat(d.Z,"/anvil/").concat(e,"/network"),{onSuccess:e=>{n(processNetwork(e))}});return(0,s.jsx)(u.s_,{children:(0,s.jsxs)(I,{children:[(0,s.jsx)(j.z,{text:"Network"}),o?(0,s.jsx)(C.Z,{}):(0,s.jsx)(a.Z,{className:z.container,children:t&&t.bonds.map(e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(a.Z,{className:z.root,display:"flex",flexDirection:"row",width:"100%",children:[(0,s.jsx)(a.Z,{p:1,className:z.noPaddingLeft,children:(0,s.jsx)(g.Z,{colour:Network_selectDecorator(e.bond_state)})}),(0,s.jsxs)(a.Z,{p:1,flexGrow:1,className:z.noPaddingLeft,children:[(0,s.jsx)(j.Ac,{text:e.bond_name}),(0,s.jsx)(j.Ac,{text:"".concat(e.bond_speed,"Mbps")})]}),(0,s.jsx)(a.Z,{display:"flex",style:{paddingTop:".5em"},children:e.hosts.map((t,n)=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{p:1,style:{paddingTop:0,paddingBottom:0},children:(0,s.jsxs)(a.Z,{children:[(0,s.jsx)(j.Ac,{text:t.host_name,selected:!1}),(0,s.jsx)(j.Ac,{text:t.link.link_name})]})},t.host_name),n!==e.hosts.length-1&&(0,s.jsx)(w.Z,{className:"".concat(z.divider," ").concat(z.verticalDivider),orientation:"vertical",flexItem:!0})]}))})]}),(0,s.jsx)(w.Z,{className:z.divider})]}))})]})})},R=n(57976),E=n(15861),F=n(87627),H=n(58128);let G=new Map([["running","Running"],["idle","Idle"],["paused","Paused"],["in shutdown","Shutting Down"],["shut off","Off"],["crashed","Crashed"],["pmsuspended","PM Suspended"],["migrating","Migrating"]]);var O=n(67645),W=n(56597),V=n(19467),q=n(41247),X=n(83221),$=n(65275),J=n(88750),K=n(58839);let Q="Servers",Y={root:"".concat(Q,"-root"),divider:"".concat(Q,"-divider"),verticalDivider:"".concat(Q,"-verticalDivider"),button:"".concat(Q,"-button"),headerPadding:"".concat(Q,"-headerPadding"),hostsBox:"".concat(Q,"-hostsBox"),hostBox:"".concat(Q,"-hostBox"),checkbox:"".concat(Q,"-checkbox"),editButtonBox:"".concat(Q,"-editButtonBox"),dropdown:"".concat(Q,"-dropdown"),on:"".concat(Q,"-on"),off:"".concat(Q,"-off"),all:"".concat(Q,"-all")},ee=(0,o.ZP)("div")(e=>{let{theme:t}=e;return{["& .".concat(Y.root)]:{width:"100%",overflow:"auto",height:"78vh",paddingRight:".3em",[t.breakpoints.down(h.li)]:{height:"100%",overflow:"hidden"}},["& .".concat(Y.divider)]:{backgroundColor:h.d},["& .".concat(Y.verticalDivider)]:{height:"75%",paddingTop:"1em"},["& .".concat(Y.button)]:{"&:hover":{backgroundColor:h.$T},paddingLeft:0},["& .".concat(Y.headerPadding)]:{paddingLeft:".3em"},["& .".concat(Y.hostsBox)]:{padding:"1em",paddingRight:0},["& .".concat(Y.hostBox)]:{paddingTop:0},["& .".concat(Y.checkbox)]:{paddingTop:".8em"},["& .".concat(Y.editButtonBox)]:{paddingTop:".3em"},["& .".concat(Y.dropdown)]:{paddingTop:".8em",paddingBottom:".8em"},["& .".concat(Y.all)]:{paddingTop:".5em",paddingLeft:".3em"}}}),Servers_selectDecorator=e=>{switch(e){case"running":return"ok";case"shut off":return"off";case"crashed":return"error";default:return"warning"}},et=(0,o.ZP)(E.Z)({["&.".concat(Y.on)]:{color:h.Ej},["&.".concat(Y.off)]:{color:h.hM}});var components_Servers=e=>{var t;let{anvil:n}=e,[o,r]=(0,l.useState)(null),[c,i]=(0,l.useState)(!1),[v,p]=(0,l.useState)(!1),[f,_]=(0,l.useState)([]),[k,A]=(0,l.useState)(!1),N=(0,l.useRef)({}),[S,y]=(0,K.Z)(),{uuid:P}=(0,l.useContext)(x),D=(0,l.useRef)([]),{data:B=[],isLoading:M}=(0,m.Z)("".concat(d.Z,"/server?anvilUUIDs=").concat(P)),setButtons=e=>{D.current=[],e.filter(e=>"running"===e.serverState).length&&D.current.push("off"),e.filter(e=>"shut off"===e.serverState).length&&D.current.push("on")},handlePower=e=>{r(null),f.length&&f.forEach(t=>{fetchers_putFetch("".concat(d.Z,"/command/").concat("on"===e?"start-server":"stop-server","/").concat(t),{})})},handleChange=e=>{let t=f.indexOf(e);-1===t?f.push(e):f.splice(t,1);let n=B.filter(e=>-1!==f.indexOf(e.serverUUID));setButtons(n),_([...f])},U=n.findIndex(e=>e.anvil_uuid===P),T=sanitizers_hostsSanitizer(null===(t=n[U])||void 0===t?void 0:t.hosts),L=(0,l.useMemo)(()=>!f.length,[f.length]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.s_,{children:(0,s.jsxs)(ee,{children:[(0,s.jsxs)(u.V9,{className:Y.headerPadding,sx:{marginBottom:0},children:[(0,s.jsx)(j.z,{text:"Servers"}),c&&(0,s.jsx)(X.Z,{disabled:L,mapPreset:"delete",onClick:()=>{var e;y({actionProceedText:"Delete",content:"Are you sure you want to delete the selected server(s)? This action is not revertable.",onProceedAppend:()=>{O.Z.request({data:{serverUuids:f},method:"delete",url:"/server"}).catch(e=>{(0,q.Z)(e)})},proceedColour:"red",titleText:"Delete ".concat(f.length," server(s)?")}),null===(e=N.current.setOpen)||void 0===e||e.call(null,!0)},variant:"redcontained"}),(0,s.jsx)(X.Z,{mapPreset:"edit",onClick:()=>i(!c),state:String(c)}),(0,s.jsx)(X.Z,{mapPreset:"add",onClick:()=>A(!0)})]}),c&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{className:Y.headerPadding,display:"flex",children:(0,s.jsxs)(a.Z,{flexGrow:1,className:Y.dropdown,children:[(0,s.jsx)(V.Z,{disabled:L,onClick:e=>{r(e.currentTarget)},startIcon:(0,s.jsx)(R.Z,{}),children:"Power"}),(0,s.jsx)(F.Z,{anchorEl:o,keepMounted:!0,open:!!o,onClose:()=>r(null),children:D.current.map(e=>(0,s.jsx)($.Z,{onClick:()=>handlePower(e),children:(0,s.jsx)(et,{className:Y[e],variant:"subtitle1",children:e.replace(/^[a-z]/,e=>e.toUpperCase())})},e))})]})}),(0,s.jsxs)(a.Z,{display:"flex",children:[(0,s.jsx)(a.Z,{children:(0,s.jsx)(H.Z,{style:{color:h.lD},color:"secondary",checked:v,onChange:()=>{v?(setButtons([]),_([])):(setButtons(B),_(B.map(e=>e.serverUUID))),p(!v)}})}),(0,s.jsx)(a.Z,{className:Y.all,children:(0,s.jsx)(j.Ac,{text:"All"})})]})]}),M?(0,s.jsx)(C.Z,{}):(0,s.jsx)(a.Z,{className:Y.root,children:(0,s.jsx)(Z.Z,{component:"nav",children:B.map(e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(b.ZP,{button:!0,className:Y.button,component:c?"div":"a",href:"/server?uuid=".concat(e.serverUUID,"&server_name=").concat(e.serverName,"&server_state=").concat(e.serverState),onClick:()=>handleChange(e.serverUUID),children:(0,s.jsxs)(a.Z,{display:"flex",flexDirection:"row",width:"100%",children:[c&&(0,s.jsx)(a.Z,{className:Y.checkbox,children:(0,s.jsx)(H.Z,{style:{color:h.lD},color:"secondary",checked:void 0!==f.find(t=>t===e.serverUUID)})}),(0,s.jsx)(a.Z,{p:1,children:(0,s.jsx)(g.Z,{colour:Servers_selectDecorator(e.serverState)})}),(0,s.jsxs)(a.Z,{p:1,flexGrow:1,children:[(0,s.jsx)(j.Ac,{text:e.serverName}),(0,s.jsx)(j.Ac,{text:G.get(e.serverState)||"Not Available"})]}),(0,s.jsx)(a.Z,{display:"flex",className:Y.hostsBox,children:"shut off"!==e.serverState&&"crashed"!==e.serverState&&T.map((t,n)=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.Z,{p:1,className:Y.hostBox,children:(0,s.jsx)(j.Ac,{text:t.host_name,selected:e.serverHostUUID===t.host_uuid})},t.host_uuid),n!==T.length-1&&(0,s.jsx)(w.Z,{className:"".concat(Y.divider," ").concat(Y.verticalDivider),orientation:"vertical"})]}))})]})},e.serverUUID),(0,s.jsx)(w.Z,{className:Y.divider})]}))})})]})}),(0,s.jsx)(J.Z,{dialogProps:{open:k},onClose:()=>{A(!1)}}),(0,s.jsx)(W.Z,{closeOnProceed:!0,...S,ref:N})]})};let en="SharedStorageHost",es={fs:"".concat(en,"-fs"),bar:"".concat(en,"-bar"),decoratorBox:"".concat(en,"-decoratorBox")},eo=(0,o.ZP)("div")(()=>({["& .".concat(es.fs)]:{paddingLeft:".7em",paddingRight:".7em"},["& .".concat(es.bar)]:{paddingLeft:".7em",paddingRight:".7em"},["& .".concat(es.decoratorBox)]:{paddingRight:".3em"}}));var SharedStorage_SharedStorageHost=e=>{let{group:t}=e,{storage_group_free:n,storage_group_total:o}=t,r=(0,l.useMemo)(()=>BigInt(n),[n]),c=(0,l.useMemo)(()=>BigInt(o),[o]),i=(0,l.useMemo)(()=>c-r,[r,c]),d=(0,l.useMemo)(()=>Number(i*BigInt(100)/c),[i,c]);return(0,s.jsxs)(eo,{children:[(0,s.jsxs)(a.Z,{display:"flex",width:"100%",className:es.fs,children:[(0,s.jsx)(a.Z,{flexGrow:1,children:(0,s.jsx)(j.Ac,{text:"Used: ".concat((0,T.MU)(c-r))})}),(0,s.jsx)(a.Z,{children:(0,s.jsx)(j.Ac,{text:"Free: ".concat((0,T.MU)(r))})})]}),(0,s.jsx)(a.Z,{display:"flex",width:"100%",className:es.bar,children:(0,s.jsx)(a.Z,{flexGrow:1,children:(0,s.jsx)(D.CD,{allocated:d})})}),(0,s.jsx)(a.Z,{display:"flex",justifyContent:"center",width:"100%",children:(0,s.jsx)(j.Ac,{text:"Total Storage: ".concat((0,T.MU)(c))})})]})};let ea={root:"".concat("SharedStorage","-root")},er=(0,o.ZP)("div")(e=>{let{theme:t}=e;return{["& .".concat(ea.root)]:{overflow:"auto",height:"78vh",paddingLeft:".3em",paddingRight:".3em",[t.breakpoints.down(h.li)]:{height:"100%"}}}});var components_SharedStorage=()=>{let{uuid:e}=(0,l.useContext)(x),{data:t,isLoading:n}=(0,m.Z)("".concat(d.Z,"/anvil/").concat(e,"/store"));return(0,s.jsx)(u.s_,{children:(0,s.jsxs)(er,{children:[(0,s.jsx)(j.z,{text:"Shared Storage"}),n?(0,s.jsx)(C.Z,{}):(0,s.jsx)(a.Z,{className:ea.root,children:(null==t?void 0:t.storage_groups)&&t.storage_groups.map(e=>(0,s.jsxs)(u.Lg,{children:[(0,s.jsx)(u.CH,{children:(0,s.jsx)(j.Ac,{text:e.storage_group_name})}),(0,s.jsx)(SharedStorage_SharedStorageHost,{group:e},e.storage_group_uuid)]},e.storage_group_uuid))})]})})},useWindowDimenions=()=>{let[e,t]=(0,l.useState)(void 0);return(0,l.useEffect)(()=>{let handleResize=()=>{t(window.innerWidth)};return handleResize(),window.addEventListener("resize",handleResize),()=>window.removeEventListener("resize",handleResize)},[]),e};let ec="Anvil",ei={child:"".concat(ec,"-child"),server:"".concat(ec,"-server"),container:"".concat(ec,"-container")},el=(0,o.ZP)("div")(e=>{let{theme:t}=e;return{["& .".concat(ei.child)]:{width:"22%",height:"100%",[t.breakpoints.down(h.li)]:{width:"50%"},[t.breakpoints.down("md")]:{width:"100%"}},["& .".concat(ei.server)]:{width:"35%",height:"100%",[t.breakpoints.down("md")]:{width:"100%"}},["& .".concat(ei.container)]:{display:"flex",flexDirection:"row",width:"100%",justifyContent:"space-between",[t.breakpoints.down("md")]:{display:"block"}}}});var anvil=()=>{let e=(0,i.useRouter)(),t=useWindowDimenions(),{anvil_uuid:n}=e.query,{uuid:o,setAnvilUuid:r}=(0,l.useContext)(x),{data:v,isLoading:p}=(0,m.Z)("".concat(d.Z,"/anvil/summary")),g=(0,l.useMemo)(()=>{let e;return v&&t&&(e=t>h.li?(0,s.jsxs)(a.Z,{className:ei.container,children:[(0,s.jsxs)(a.Z,{className:ei.child,children:[(0,s.jsx)(components_Anvils,{list:v}),(0,s.jsx)(components_Hosts,{anvil:v.anvils})]}),(0,s.jsx)(a.Z,{className:ei.server,children:(0,s.jsx)(components_Servers,{anvil:v.anvils})}),(0,s.jsx)(a.Z,{className:ei.child,children:(0,s.jsx)(components_SharedStorage,{})}),(0,s.jsxs)(a.Z,{className:ei.child,children:[(0,s.jsx)(components_Network,{}),(0,s.jsx)(components_CPU,{}),(0,s.jsx)(components_Memory,{})]})]}):(0,s.jsxs)(a.Z,{className:ei.container,children:[(0,s.jsxs)(a.Z,{className:ei.child,children:[(0,s.jsx)(components_Servers,{anvil:v.anvils}),(0,s.jsx)(components_Anvils,{list:v}),(0,s.jsx)(components_Hosts,{anvil:v.anvils})]}),(0,s.jsxs)(a.Z,{className:ei.child,children:[(0,s.jsx)(components_Network,{}),(0,s.jsx)(components_SharedStorage,{}),(0,s.jsx)(components_CPU,{}),(0,s.jsx)(components_Memory,{})]})]})),e},[v,t]),j=(0,l.useMemo)(()=>p?(0,s.jsx)(u.s_,{sx:{marginLeft:{xs:"1em",sm:"auto"},marginRight:{xs:"1em",sm:"auto"},marginTop:"calc(50vh - 10em)",maxWidth:{xs:void 0,sm:"60%",md:"50%",lg:"40%"},minWidth:"fit-content"},children:(0,s.jsx)(C.Z,{sx:{margin:"2em 2.4em"}})}):g,[g,p]);return(0,l.useEffect)(()=>{""===o&&r((null==n?void 0:n.toString())||"")},[o,n,r]),(0,s.jsxs)(el,{children:[(0,s.jsx)(c(),{children:(0,s.jsx)("title",{children:"Anvil"})}),(0,s.jsxs)(components_AnvilContext,{children:[(0,s.jsx)(y.Z,{}),j]})]})}}},function(e){e.O(0,[494,804,416,50,263,213,310,924,775,675,633,733,750,774,888,179],function(){return e(e.s=72315)}),_N_E=e.O()}]);