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
31 KiB

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{5301:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return t(4990)}])},9297:function(e,n,t){"use strict";t.d(n,{C:function(){return h},k:function(){return m}});var r=t(5893),o=t(1458),a=t(1496),i=t(7169),c=(0,a.ZP)(o.Z)({height:"1em",borderRadius:i.n_,backgroundColor:i.v9});function s(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var d="AllocationBar",l={barOk:"".concat(d,"-barOk"),barWarning:"".concat(d,"-barWarning"),barAlert:"".concat(d,"-barAlert"),underline:"".concat(d,"-underline")},u=(0,a.ZP)("div")((function(){var e;return s(e={},"& .".concat(l.barOk),{backgroundColor:i.Ej}),s(e,"& .".concat(l.barWarning),{backgroundColor:i.Wd}),s(e,"& .".concat(l.barAlert),{backgroundColor:i.hM}),s(e,"& .".concat(l.underline),{borderRadius:i.n_}),e})),h=function(e){var n=e.allocated;return(0,r.jsxs)(u,{children:[(0,r.jsx)(c,{classes:{bar:n>70?n>90?l.barAlert:l.barWarning:l.barOk},variant:"determinate",value:n}),(0,r.jsx)(o.Z,{className:l.underline,variant:"determinate",value:0})]})};function f(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var x="ProgressBar",g={barOk:"".concat(x,"-barOk"),barInProgress:"".concat(x,"-barInProgress"),underline:"".concat(x,"-underline")},v=(0,a.ZP)("div")((function(){var e;return f(e={},"& .".concat(g.barOk),{backgroundColor:i.Ej}),f(e,"& .".concat(g.barInProgress),{backgroundColor:i.Wd}),f(e,"& .".concat(g.underline),{borderRadius:i.n_}),e})),m=function(e){var n=e.progressPercentage;return(0,r.jsxs)(v,{children:[(0,r.jsx)(c,{classes:{bar:n<100?g.barInProgress:g.barOk},variant:"determinate",value:n}),(0,r.jsx)(o.Z,{className:g.underline,variant:"determinate",value:0})]})}},1706:function(e,n,t){"use strict";t.d(n,{Z:function(){return i}});var r=t(1496),o=t(3946),a=t(7169),i=(0,r.ZP)(o.Z)({borderRadius:a.n_,backgroundColor:a.s7,"&:hover":{backgroundColor:a.lD},color:a.E5})},1200:function(e,n){"use strict";function t(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function r(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"===typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}n.Z=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return fetch.apply(void 0,r(n)).then((function(e){return e.json()}))}},1905:function(e,n,t){"use strict";var r=t(2515),o=t(1200);n.Z=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.refreshInterval,a=void 0===t?5e3:t,i=n.onSuccess,c=(0,r.ZP)(e,o.Z,{refreshInterval:a,onSuccess:i}),s=c.data,d=c.error;return{data:s,isLoading:!d&&!s,isError:d}}},8336:function(e,n){"use strict";n.Z=function(e,n){return fetch(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}},4990:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return hn}});var r=t(5893),o=t(9008),a=t(7357),i=t(1496),c=t(9203),s=t(1905),d=t(7294),l=t(3366),u=t(7462),h=t(6010),f=t(7192),x=t(1796),g=t(8216),v=t(1964),m=t(7623),p=t(9632);const b=["className","color","edge","size","sx"],j=(0,i.ZP)("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:t}=e;return[n.root,t.edge&&n[`edge${(0,g.Z)(t.edge)}`],n[`size${(0,g.Z)(t.size)}`]]}})((({ownerState:e})=>(0,u.Z)({display:"inline-flex",width:58,height:38,overflow:"hidden",padding:12,boxSizing:"border-box",position:"relative",flexShrink:0,zIndex:0,verticalAlign:"middle","@media print":{colorAdjust:"exact"}},"start"===e.edge&&{marginLeft:-8},"end"===e.edge&&{marginRight:-8},"small"===e.size&&{width:40,height:24,padding:7,[`& .${p.Z.thumb}`]:{width:16,height:16},[`& .${p.Z.switchBase}`]:{padding:4,[`&.${p.Z.checked}`]:{transform:"translateX(16px)"}}}))),Z=(0,i.ZP)(v.Z,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(e,n)=>{const{ownerState:t}=e;return[n.switchBase,{[`& .${p.Z.input}`]:n.input},"default"!==t.color&&n[`color${(0,g.Z)(t.color)}`]]}})((({theme:e})=>({position:"absolute",top:0,left:0,zIndex:1,color:"light"===e.palette.mode?e.palette.common.white:e.palette.grey[300],transition:e.transitions.create(["left","transform"],{duration:e.transitions.duration.shortest}),[`&.${p.Z.checked}`]:{transform:"translateX(20px)"},[`&.${p.Z.disabled}`]:{color:"light"===e.palette.mode?e.palette.grey[100]:e.palette.grey[600]},[`&.${p.Z.checked} + .${p.Z.track}`]:{opacity:.5},[`&.${p.Z.disabled} + .${p.Z.track}`]:{opacity:"light"===e.palette.mode?.12:.2},[`& .${p.Z.input}`]:{left:"-100%",width:"300%"}})),(({theme:e,ownerState:n})=>(0,u.Z)({"&:hover":{backgroundColor:(0,x.Fq)(e.palette.action.active,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"default"!==n.color&&{[`&.${p.Z.checked}`]:{color:e.palette[n.color].main,"&:hover":{backgroundColor:(0,x.Fq)(e.palette[n.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${p.Z.disabled}`]:{color:"light"===e.palette.mode?(0,x.$n)(e.palette[n.color].main,.62):(0,x._j)(e.palette[n.color].main,.55)}},[`&.${p.Z.checked} + .${p.Z.track}`]:{backgroundColor:e.palette[n.color].main}}))),w=(0,i.ZP)("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(e,n)=>n.track})((({theme:e})=>({height:"100%",width:"100%",borderRadius:7,zIndex:-1,transition:e.transitions.create(["opacity","background-color"],{duration:e.transitions.duration.shortest}),backgroundColor:"light"===e.palette.mode?e.palette.common.black:e.palette.common.white,opacity:"light"===e.palette.mode?.38:.3}))),_=(0,i.ZP)("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(e,n)=>n.thumb})((({theme:e})=>({boxShadow:e.shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"}))),y=d.forwardRef((function(e,n){const t=(0,m.Z)({props:e,name:"MuiSwitch"}),{className:o,color:a="primary",edge:i=!1,size:c="medium",sx:s}=t,d=(0,l.Z)(t,b),x=(0,u.Z)({},t,{color:a,edge:i,size:c}),v=(e=>{const{classes:n,edge:t,size:r,color:o,checked:a,disabled:i}=e,c={root:["root",t&&`edge${(0,g.Z)(t)}`,`size${(0,g.Z)(r)}`],switchBase:["switchBase",`color${(0,g.Z)(o)}`,a&&"checked",i&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},s=(0,f.Z)(c,p.H,n);return(0,u.Z)({},n,s)})(x),y=(0,r.jsx)(_,{className:v.thumb,ownerState:x});return(0,r.jsxs)(j,{className:(0,h.Z)(v.root,o),sx:s,ownerState:x,children:[(0,r.jsx)(Z,(0,u.Z)({type:"checkbox",icon:y,checkedIcon:y,ref:n,ownerState:x},d,{classes:(0,u.Z)({},v,{root:v.switchBase})})),(0,r.jsx)(w,{className:v.track,ownerState:x})]})}));var k=y,A=t(3430),C=new Map([["optimal","Optimal"],["not_ready","Not Ready"],["degraded","Degraded"]]),N={uuid:"",setAnvilUuid:function(){return null}},P=(0,d.createContext)(N),S=function(e){var n=e.children,t=(0,d.useState)(""),o=t[0],a=t[1];return(0,r.jsx)(P.Provider,{value:{uuid:o,setAnvilUuid:function(e){a(e)}},children:n})},O=t(7169);function B(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var T="Decorator",R={ok:"".concat(T,"-ok"),warning:"".concat(T,"-warning"),error:"".concat(T,"-error"),off:"".concat(T,"-off")},L=(0,i.ZP)("div")((function(){var e;return B(e={width:"1.4em",height:"100%",borderRadius:O.n_},"&.".concat(R.ok),{backgroundColor:O.Ej}),B(e,"&.".concat(R.warning),{backgroundColor:O.Wd}),B(e,"&.".concat(R.error),{backgroundColor:O.hM}),B(e,"&.".concat(R.off),{backgroundColor:O.s7}),e})),E=function(e){var n=e.colour;return(0,r.jsx)(L,{className:R[n]})},z=t(8336);var I={anvilName:"".concat("SelectedAnvil","-anvilName")},$=(0,i.ZP)(a.Z)((function(){return e={display:"flex",flexDirection:"row",width:"100%"},n="& .".concat(I.anvilName),t={paddingLeft:0},n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e;var e,n,t})),D=function(e){switch(e){case"optimal":return"ok";case"not_ready":return"warning";default:return"error"}},M=function(e){return!(-1===e.hosts.findIndex((function(e){return"offline"!==e.state})))},F=function(e){var n=e.list,t=(0,d.useContext)(P).uuid,o=n.findIndex((function(e){return e.anvil_uuid===t}));return(0,r.jsx)($,{children:""!==t&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Z,{p:1,children:(0,r.jsx)(E,{colour:D(n[o].anvil_state)})}),(0,r.jsxs)(a.Z,{p:1,flexGrow:1,className:I.anvilName,children:[(0,r.jsx)(A.z,{text:n[o].anvil_name}),(0,r.jsx)(A.z,{text:C.get(n[o].anvil_state)||"State unavailable"})]}),(0,r.jsx)(a.Z,{p:1,children:(0,r.jsx)(k,{checked:M(n[o]),onChange:function(){return(0,z.Z)("".concat("/cgi-bin","/set_power"),{anvil_uuid:n[o].anvil_uuid,is_on:!M(n[o])})}})})]})})},G=t(8462),U=t(7720),W=t(891),H=function(e){var n=e.anvil;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(A.A,{text:n.anvil_name}),(0,r.jsx)(A.A,{text:C.get(n.anvil_state)||"State unavailable"})]})};function X(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function q(e){return function(e){if(Array.isArray(e))return X(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"===typeof e)return X(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return X(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var V=function(e){var n=[],t=[],r=[];return e.forEach((function(e){"optimal"===e.anvil_state?n.push(e):"not_ready"===e.anvil_state?t.push(e):r.push(e)})),q(r).concat(q(t),q(n))};function J(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var K="AnvilList",Q={root:"".concat(K,"-root"),divider:"".concat(K,"-divider"),button:"".concat(K,"-button"),anvil:"".concat(K,"-anvil")},Y=(0,i.ZP)("div")((function(e){var n,t=e.theme;return J(n={},"& .".concat(Q.root),J({width:"100%",overflow:"auto",height:"30vh",paddingRight:".3em"},t.breakpoints.down(O.li),{height:"100%",overflow:"hidden"})),J(n,"& .".concat(Q.divider),{backgroundColor:O.d}),J(n,"& .".concat(Q.button),{"&:hover":{backgroundColor:O.$T},paddingLeft:0}),J(n,"& .".concat(Q.anvil),{paddingLeft:0}),n})),ee=function(e){switch(e){case"optimal":return"ok";case"not_ready":return"warning";case"degraded":return"error";default:return"off"}},ne=function(e){var n=e.list,t=(0,d.useContext)(P),o=t.uuid,i=t.setAnvilUuid;return(0,d.useEffect)((function(){""===o&&i(V(n)[0].anvil_uuid)}),[o,n,i]),(0,r.jsx)(Y,{children:(0,r.jsx)(G.Z,{component:"nav",className:Q.root,"aria-label":"mailbox folders",children:V(n).map((function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(U.Z,{className:Q.divider}),(0,r.jsx)(W.ZP,{button:!0,className:Q.button,onClick:function(){return i(e.anvil_uuid)},children:(0,r.jsxs)(a.Z,{display:"flex",flexDirection:"row",width:"100%",children:[(0,r.jsx)(a.Z,{p:1,children:(0,r.jsx)(E,{colour:ee(e.anvil_state)})}),(0,r.jsx)(a.Z,{p:1,flexGrow:1,className:Q.anvil,children:(0,r.jsx)(H,{anvil:e})})]})},e.anvil_uuid)]})}))})})};function te(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var re=function(e){var n=e.list,t=[];return null===n||void 0===n||n.anvils.forEach((function(e){var n=(0,s.Z)("".concat("/cgi-bin","/get_status?anvil_uuid=").concat(e.anvil_uuid)).data;t.push(function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){te(e,n,t[n])}))}return e}({},e,n))})),(0,r.jsxs)(c.s_,{children:[(0,r.jsx)(F,{list:t}),(0,r.jsx)(ne,{list:V(t)})]})},oe=t(9297),ae=new Map([["message_0222","The node is in an unknown state."],["message_0223","The node is a full cluster member."],["message_0224","The node is coming online; the cluster resource manager is running (step 2/3)."],["message_0225","The node is coming online; the node is a consensus cluster member (step 1/3)."],["message_0226","The node has booted, but it is not (yet) joining the cluster."]]);function ie(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var ce="AnvilHost",se={state:"".concat(ce,"-state"),bar:"".concat(ce,"-bar"),header:"".concat(ce,"-header"),label:"".concat(ce,"-label"),decoratorBox:"".concat(ce,"-decoratorBox")},de=(0,i.ZP)(a.Z)((function(e){var n;return ie(n={overflow:"auto",height:"28vh",paddingLeft:".3em",paddingRight:".3em"},e.theme.breakpoints.down(O.li),{height:"100%",overflow:"hidden"}),ie(n,"& .".concat(se.state),{paddingLeft:".7em",paddingRight:".7em",paddingTop:"1em"}),ie(n,"& .".concat(se.bar),{paddingLeft:".7em",paddingRight:".7em"}),ie(n,"& .".concat(se.header),{paddingTop:".3em",paddingRight:".7em"}),ie(n,"& .".concat(se.label),{paddingTop:".3em"}),ie(n,"& .".concat(se.decoratorBox),{paddingRight:".3em"}),n})),le=function(e,n){var t=e.exec(n);return t?ae.get(t[0])||"Error code not recognized":"Error code not found"},ue=function(e){switch(e){case"online":return"ok";case"offline":return"off";default:return"warning"}},he=function(e){var n=e.hosts,t=/^[a-zA-Z]/,o=/^(message_[0-9]+)/;return(0,r.jsx)(de,{children:n&&n.map((function(e){var n;return e?(0,r.jsxs)(c.Lg,{children:[(0,r.jsx)(c.CH,{children:(0,r.jsxs)(a.Z,{display:"flex",width:"100%",className:se.header,children:[(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(A.A,{text:e.host_name})}),(0,r.jsx)(a.Z,{className:se.decoratorBox,children:(0,r.jsx)(E,{colour:ue(e.state)})}),(0,r.jsx)(a.Z,{children:(0,r.jsx)(A.A,{text:(null===e||void 0===e||null===(n=e.state)||void 0===n?void 0:n.replace(t,(function(e){return e.toUpperCase()})))||"Not Available"})})]})}),(0,r.jsxs)(a.Z,{display:"flex",className:se.state,children:[(0,r.jsx)(a.Z,{className:se.label,children:(0,r.jsx)(A.A,{text:"Power: "})}),(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(k,{checked:"online"===e.state,onChange:function(){return(0,z.Z)("".concat("/cgi-bin","/set_power"),{host_uuid:e.host_uuid,is_on:!("online"===e.state)})}})}),(0,r.jsx)(a.Z,{className:se.label,children:(0,r.jsx)(A.A,{text:"Member: "})}),(0,r.jsx)(a.Z,{children:(0,r.jsx)(k,{checked:"online"===e.state,disabled:!("online"===e.state),onChange:function(){return(0,z.Z)("".concat("/cgi-bin","/set_membership"),{host_uuid:e.host_uuid,is_member:!("online"===e.state)})}})})]}),"online"!==e.state&&"offline"!==e.state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Z,{display:"flex",width:"100%",className:se.state,children:(0,r.jsx)(a.Z,{children:(0,r.jsx)(A.A,{text:le(o,e.state_message)})})}),(0,r.jsx)(a.Z,{display:"flex",width:"100%",className:se.bar,children:(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(oe.k,{progressPercentage:e.state_percent})})})]})]},e.host_uuid):(0,r.jsx)(r.Fragment,{})}))})},fe=t(2152),xe=function(e){return null===e||void 0===e?void 0:e.filter((function(e){return e.host_uuid}))},ge=function(e){var n=e.anvil,t=(0,d.useContext)(P).uuid,o=(0,s.Z)("".concat("/cgi-bin","/get_status?anvil_uuid=").concat(t)),a=o.data,i=o.isLoading,l=n.findIndex((function(e){return e.anvil_uuid===t}));return(0,r.jsxs)(c.s_,{children:[(0,r.jsx)(A.z,{text:"Nodes"}),i?(0,r.jsx)(fe.Z,{}):(0,r.jsx)(r.Fragment,{children:-1!==l&&a&&(0,r.jsx)(he,{hosts:xe(n[l].hosts).reduce((function(e,n,t){var r=a.hosts[t];return r&&e.push(r),e}),[])})})]})},ve=function(){var e=(0,d.useContext)(P).uuid,n=(0,s.Z)("".concat("/cgi-bin","/get_cpu?anvil_uuid=").concat(e)),t=n.data,o=n.isLoading,i=o||!t?{allocated:0,cores:0,threads:0}:t;return(0,r.jsxs)(c.s_,{children:[(0,r.jsx)(A.z,{text:"CPU"}),o?(0,r.jsx)(fe.Z,{}):(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(a.Z,{display:"flex",width:"100%",children:(0,r.jsxs)(a.Z,{flexGrow:1,style:{marginLeft:"1em",marginTop:"1em"},children:[(0,r.jsx)(A.A,{text:"Total Cores: ".concat(i.cores)}),(0,r.jsx)(A.A,{text:"Total Threads: ".concat(i.threads)}),(0,r.jsx)(A.A,{text:"Allocated Cores: ".concat(i.allocated)})]})})})]})},me=t(8600),pe=t.n(me);function be(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var je="SharedStorageHost",Ze={fs:"".concat(je,"-fs"),bar:"".concat(je,"-bar"),decoratorBox:"".concat(je,"-decoratorBox")},we=(0,i.ZP)("div")((function(){var e;return be(e={},"& .".concat(Ze.fs),{paddingLeft:".7em",paddingRight:".7em",paddingTop:"1.2em"}),be(e,"& .".concat(Ze.bar),{paddingLeft:".7em",paddingRight:".7em"}),be(e,"& .".concat(Ze.decoratorBox),{paddingRight:".3em"}),e})),_e=function(e){var n=e.group;return(0,r.jsxs)(we,{children:[(0,r.jsxs)(a.Z,{display:"flex",width:"100%",className:Ze.fs,children:[(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(A.A,{text:"Used: ".concat(pe()(n.storage_group_total-n.storage_group_free,{binary:!0}))})}),(0,r.jsx)(a.Z,{children:(0,r.jsx)(A.A,{text:"Free: ".concat(pe()(n.storage_group_free,{binary:!0}))})})]}),(0,r.jsx)(a.Z,{display:"flex",width:"100%",className:Ze.bar,children:(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(oe.C,{allocated:(n.storage_group_total-n.storage_group_free)/n.storage_group_total*100})})}),(0,r.jsx)(a.Z,{display:"flex",justifyContent:"center",width:"100%",children:(0,r.jsx)(A.A,{text:"Total Storage: ".concat(pe()(n.storage_group_total,{binary:!0}))})})]})};function ye(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var ke="SharedStorage",Ae={header:"".concat(ke,"-header"),root:"".concat(ke,"-root")},Ce=(0,i.ZP)("div")((function(e){var n,t=e.theme;return ye(n={},"& .".concat(Ae.header),{paddingTop:".1em",paddingRight:".7em"}),ye(n,"& .".concat(Ae.root),ye({overflow:"auto",height:"78vh",paddingLeft:".3em",paddingRight:".3em"},t.breakpoints.down(O.li),{height:"100%"})),n})),Ne=function(){var e=(0,d.useContext)(P).uuid,n=(0,s.Z)("".concat("/cgi-bin","/get_shared_storage?anvil_uuid=").concat(e)),t=n.data,o=n.isLoading;return(0,r.jsx)(c.s_,{children:(0,r.jsxs)(Ce,{children:[(0,r.jsx)(A.z,{text:"Shared Storage"}),o?(0,r.jsx)(fe.Z,{}):(0,r.jsx)(a.Z,{className:Ae.root,children:(null===t||void 0===t?void 0:t.storage_groups)&&t.storage_groups.map((function(e){return(0,r.jsxs)(c.Lg,{children:[(0,r.jsx)(c.CH,{children:(0,r.jsx)(a.Z,{display:"flex",width:"100%",className:Ae.header,children:(0,r.jsx)(a.Z,{children:(0,r.jsx)(A.A,{text:e.storage_group_name})})})}),(0,r.jsx)(_e,{group:e},e.storage_group_uuid)]},e.storage_group_uuid)}))})]})})},Pe=function(){var e=(0,d.useContext)(P).uuid,n=(0,s.Z)("".concat("/cgi-bin","/get_memory?anvil_uuid=").concat(e)),t=n.data,o=n.isLoading,i=o||!t?{total:0,allocated:0,reserved:0}:t;return(0,r.jsxs)(c.s_,{children:[(0,r.jsx)(A.z,{text:"Memory"}),o?(0,r.jsx)(fe.Z,{}):(0,r.jsxs)(r.Fragment,{children:[" ",(0,r.jsxs)(a.Z,{display:"flex",width:"100%",children:[(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(A.A,{text:"Allocated: ".concat(pe()(i.allocated,{binary:!0}))})}),(0,r.jsx)(a.Z,{children:(0,r.jsx)(A.A,{text:"Free: ".concat(pe()(i.total-i.allocated,{binary:!0}))})})]}),(0,r.jsx)(a.Z,{display:"flex",width:"100%",children:(0,r.jsx)(a.Z,{flexGrow:1,children:(0,r.jsx)(oe.C,{allocated:i.allocated/i.total*100})})}),(0,r.jsx)(a.Z,{display:"flex",justifyContent:"center",width:"100%",children:(0,r.jsx)(A.A,{text:"Total: ".concat(pe()(i.total,{binary:!0})," | Reserved: ").concat(pe()(i.reserved,{binary:!0}))})})]})]})},Se=function(e){var n=[],t={bonds:[]};return null===e||void 0===e||e.hosts.forEach((function(e){e.bonds.forEach((function(r){var o=n.findIndex((function(e){return e===r.bond_name}));-1===o?(n.push(r.bond_name),t.bonds.push({bond_name:r.bond_name,bond_uuid:r.bond_uuid,bond_speed:0,bond_state:"degraded",hosts:[{host_name:e.host_name,host_uuid:e.host_uuid,link:r.links[0].is_active?r.links[0]:r.links[1]}]})):t.bonds[o].hosts.push({host_name:e.host_name,host_uuid:e.host_uuid,link:r.links[0].is_active?r.links[0]:r.links[1]})}))})),t.bonds.forEach((function(e){var n=e.hosts[0].link.link_speed>e.hosts[1].link.link_speed?1:0;e.bond_speed=e.hosts[n].link.link_speed,e.bond_state=e.hosts[n].link.link_state})),t};function Oe(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var Be="Network",Te={container:"".concat(Be,"-container"),root:"".concat(Be,"-root"),noPaddingLeft:"".concat(Be,"-noPaddingLeft"),divider:"".concat(Be,"-divider"),verticalDivider:"".concat(Be,"-verticalDivider")},Re=(0,i.ZP)("div")((function(e){var n,t=e.theme;return Oe(n={},"& .".concat(Te.container),Oe({width:"100%",overflow:"auto",height:"32vh",paddingRight:".3em"},t.breakpoints.down(O.li),{height:"100%",overflow:"hidden"})),Oe(n,"& .".concat(Te.root),{paddingTop:".7em",paddingBottom:".7em"}),Oe(n,"& .".concat(Te.noPaddingLeft),{paddingLeft:0}),Oe(n,"& .".concat(Te.divider),{backgroundColor:O.d}),Oe(n,"& .".concat(Te.verticalDivider),{height:"3.5em"}),n})),Le=function(e){switch(e){case"optimal":return"ok";case"degraded":default:return"warning";case"down":return"error"}},Ee=function(){var e=(0,d.useContext)(P).uuid,n=(0,s.Z)("".concat("/cgi-bin","/get_networks?anvil_uuid=").concat(e)),t=n.data,o=n.isLoading,i=Se(t);return(0,r.jsx)(c.s_,{children:(0,r.jsxs)(Re,{children:[(0,r.jsx)(A.z,{text:"Network"}),o?(0,r.jsx)(fe.Z,{}):(0,r.jsx)(a.Z,{className:Te.container,children:t&&i.bonds.map((function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(a.Z,{display:"flex",flexDirection:"row",width:"100%",className:Te.root,children:[(0,r.jsx)(a.Z,{p:1,className:Te.noPaddingLeft,children:(0,r.jsx)(E,{colour:Le(e.bond_state)})}),(0,r.jsxs)(a.Z,{p:1,flexGrow:1,className:Te.noPaddingLeft,children:[(0,r.jsx)(A.A,{text:e.bond_name}),(0,r.jsx)(A.A,{text:"".concat(e.bond_speed,"Mbps")})]}),(0,r.jsx)(a.Z,{display:"flex",style:{paddingTop:".5em"},children:e.hosts.map((function(n,t){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Z,{p:1,style:{paddingTop:0,paddingBottom:0},children:(0,r.jsxs)(a.Z,{children:[(0,r.jsx)(A.A,{text:n.host_name,selected:!1}),(0,r.jsx)(A.A,{text:n.link.link_name})]})},n.host_name),t!==e.hosts.length-1&&(0,r.jsx)(U.Z,{className:"".concat(Te.divider," ").concat(Te.verticalDivider),orientation:"vertical",flexItem:!0})]})}))})]}),(0,r.jsx)(U.Z,{className:Te.divider})]})}))})]})})},ze=t(40),Ie=t(5861),$e=t(3321),De=t(7850),Me=t(8128),Fe=t(2428),Ge=t(2026),Ue=t(1797),We=(0,t(8169).Z)((0,r.jsx)("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreVert"),He=new Map([["running","Running"],["idle","Idle"],["paused","Paused"],["in shutdown","Shutting Down"],["shut off","Off"],["crashed","Crashed"],["pmsuspended","PM Suspended"],["migrating","Migrating"]]),Xe=t(1706);function qe(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Ve(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Je(e){return function(e){if(Array.isArray(e))return qe(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"===typeof e)return qe(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return qe(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Ke,Qe="Servers",Ye={root:"".concat(Qe,"-root"),divider:"".concat(Qe,"-divider"),verticalDivider:"".concat(Qe,"-verticalDivider"),button:"".concat(Qe,"-button"),headerPadding:"".concat(Qe,"-headerPadding"),hostsBox:"".concat(Qe,"-hostsBox"),hostBox:"".concat(Qe,"-hostBox"),checkbox:"".concat(Qe,"-checkbox"),serverActionButton:"".concat(Qe,"-serverActionButton"),editButtonBox:"".concat(Qe,"-editButtonBox"),dropdown:"".concat(Qe,"-dropdown"),power:"".concat(Qe,"-power"),on:"".concat(Qe,"-on"),off:"".concat(Qe,"-off"),all:"".concat(Qe,"-all")},en=(0,i.ZP)("div")((function(e){var n,t=e.theme;return Ve(n={},"& .".concat(Ye.root),Ve({width:"100%",overflow:"auto",height:"78vh",paddingRight:".3em"},t.breakpoints.down(O.li),{height:"100%",overflow:"hidden"})),Ve(n,"& .".concat(Ye.divider),{backgroundColor:O.d}),Ve(n,"& .".concat(Ye.verticalDivider),{height:"75%",paddingTop:"1em"}),Ve(n,"& .".concat(Ye.button),{"&:hover":{backgroundColor:O.$T},paddingLeft:0}),Ve(n,"& .".concat(Ye.headerPadding),{paddingLeft:".3em"}),Ve(n,"& .".concat(Ye.hostsBox),{padding:"1em",paddingRight:0}),Ve(n,"& .".concat(Ye.hostBox),{paddingTop:0}),Ve(n,"& .".concat(Ye.checkbox),{paddingTop:".8em"}),Ve(n,"& .".concat(Ye.serverActionButton),{backgroundColor:O.lD,color:O.E5,textTransform:"none","&:hover":{backgroundColor:O.s7}}),Ve(n,"& .".concat(Ye.editButtonBox),{paddingTop:".3em"}),Ve(n,"& .".concat(Ye.dropdown),{paddingTop:".8em",paddingBottom:".8em"}),Ve(n,"& .".concat(Ye.power),{color:O.E5}),Ve(n,"& .".concat(Ye.all),{paddingTop:".5em",paddingLeft:".3em"}),n})),nn=function(e){switch(e){case"running":return"ok";case"shut off":return"off";case"crashed":return"error";default:return"warning"}},tn=(0,i.ZP)(ze.Z)({backgroundColor:O.s7,paddingRight:"3em","&:hover":{backgroundColor:O.s7}}),rn=(0,i.ZP)(Ie.Z)((Ve(Ke={},"&.".concat(Ye.on),{color:O.Ej}),Ve(Ke,"&.".concat(Ye.off),{color:O.hM}),Ke)),on=function(e){var n,t=e.anvil,o=(0,d.useState)(null),i=o[0],l=o[1],u=(0,d.useState)(!1),h=u[0],f=u[1],x=(0,d.useState)(!1),g=x[0],v=x[1],m=(0,d.useState)([]),p=m[0],b=m[1],j=(0,d.useContext)(P).uuid,Z=(0,d.useRef)([]),w=(0,s.Z)("".concat("/cgi-bin","/get_servers?anvil_uuid=").concat(j)),_=w.data,y=w.isLoading,k=function(e){Z.current=[],e.filter((function(e){return"running"===e.server_state})).length&&Z.current.push("off"),e.filter((function(e){return"shut off"===e.server_state})).length&&Z.current.push("on")},C=t.findIndex((function(e){return e.anvil_uuid===j})),N=xe(null===(n=t[C])||void 0===n?void 0:n.hosts);return(0,r.jsx)(c.s_,{children:(0,r.jsxs)(en,{children:[(0,r.jsxs)(c.V9,{className:Ye.headerPadding,sx:{marginBottom:0},children:[(0,r.jsx)(A.z,{text:"Servers"}),(0,r.jsx)(Xe.Z,{children:(0,r.jsx)(Fe.Z,{})}),(0,r.jsx)(Xe.Z,{onClick:function(){return f(!h)},children:h?(0,r.jsx)(Ge.Z,{sx:{color:O.Ej}}):(0,r.jsx)(Ue.Z,{})})]}),h&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Z,{className:Ye.headerPadding,display:"flex",children:(0,r.jsxs)(a.Z,{flexGrow:1,className:Ye.dropdown,children:[(0,r.jsx)($e.Z,{variant:"contained",startIcon:(0,r.jsx)(We,{}),onClick:function(e){l(e.currentTarget)},className:Ye.serverActionButton,children:(0,r.jsx)(Ie.Z,{className:Ye.power,variant:"subtitle1",children:"Power"})}),(0,r.jsx)(De.Z,{anchorEl:i,keepMounted:!0,open:Boolean(i),onClose:function(){return l(null)},children:Z.current.map((function(e){return(0,r.jsx)(tn,{onClick:function(){return function(e){l(null),p.length&&(0,z.Z)("".concat("/cgi-bin","/set_power"),{server_uuid_list:p,is_on:"on"===e})}(e)},children:(0,r.jsx)(rn,{className:Ye[e],variant:"subtitle1",children:e.replace(/^[a-z]/,(function(e){return e.toUpperCase()}))})},e)}))})]})}),(0,r.jsxs)(a.Z,{display:"flex",children:[(0,r.jsx)(a.Z,{children:(0,r.jsx)(Me.Z,{style:{color:O.lD},color:"secondary",checked:g,onChange:function(){g?(k([]),b([])):(k(_.servers),b(_.servers.map((function(e){return e.server_uuid})))),v(!g)}})}),(0,r.jsx)(a.Z,{className:Ye.all,children:(0,r.jsx)(A.A,{text:"All"})})]})]}),y?(0,r.jsx)(fe.Z,{}):(0,r.jsx)(a.Z,{className:Ye.root,children:(0,r.jsx)(G.Z,{component:"nav",children:null===_||void 0===_?void 0:_.servers.map((function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(W.ZP,{button:!0,className:Ye.button,component:h?"div":"a",href:"/server?uuid=".concat(e.server_uuid,"&server_name=").concat(e.server_name),onClick:function(){return function(e){var n=p.indexOf(e);-1===n?p.push(e):p.splice(n,1);var t=_.servers.filter((function(e){return-1!==p.indexOf(e.server_uuid)}));k(t),b(Je(p))}(e.server_uuid)},children:(0,r.jsxs)(a.Z,{display:"flex",flexDirection:"row",width:"100%",children:[h&&(0,r.jsx)(a.Z,{className:Ye.checkbox,children:(0,r.jsx)(Me.Z,{style:{color:O.lD},color:"secondary",checked:void 0!==p.find((function(n){return n===e.server_uuid}))})}),(0,r.jsx)(a.Z,{p:1,children:(0,r.jsx)(E,{colour:nn(e.server_state)})}),(0,r.jsxs)(a.Z,{p:1,flexGrow:1,children:[(0,r.jsx)(A.A,{text:e.server_name}),(0,r.jsx)(A.A,{text:He.get(e.server_state)||"Not Available"})]}),(0,r.jsx)(a.Z,{display:"flex",className:Ye.hostsBox,children:"shut off"!==e.server_state&&"crashed"!==e.server_state&&N.map((function(n,t){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Z,{p:1,className:Ye.hostBox,children:(0,r.jsx)(A.A,{text:n.host_name,selected:e.server_host_uuid===n.host_uuid})},n.host_uuid),t!==N.length-1&&(0,r.jsx)(U.Z,{className:"".concat(Ye.divider," ").concat(Ye.verticalDivider),orientation:"vertical"})]})}))})]})},e.server_uuid),(0,r.jsx)(U.Z,{className:Ye.divider})]})}))})})]})})},an=t(8750),cn=function(){var e=(0,d.useState)(void 0),n=e[0],t=e[1];return(0,d.useEffect)((function(){var e=function(){t(window.innerWidth)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),n};function sn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var dn="Dashboard",ln={child:"".concat(dn,"-child"),server:"".concat(dn,"-server"),container:"".concat(dn,"-container")},un=(0,i.ZP)("div")((function(e){var n,t,r=e.theme;return sn(t={},"& .".concat(ln.child),(sn(n={width:"22%",height:"100%"},r.breakpoints.down(O.li),{width:"50%"}),sn(n,r.breakpoints.down("md"),{width:"100%"}),n)),sn(t,"& .".concat(ln.server),sn({width:"35%",height:"100%"},r.breakpoints.down("md"),{width:"100%"})),sn(t,"& .".concat(ln.container),sn({display:"flex",flexDirection:"row",width:"100%",justifyContent:"space-between"},r.breakpoints.down("md"),{display:"block"})),t})),hn=function(){var e=cn(),n=(0,s.Z)("".concat("/cgi-bin","/get_anvils")).data;return(0,r.jsxs)(un,{children:[(0,r.jsx)(o.default,{children:(0,r.jsx)("title",{children:"Dashboard"})}),(0,r.jsxs)(S,{children:[(0,r.jsx)(an.Z,{}),(null===n||void 0===n?void 0:n.anvils)&&e&&(e>O.li?(0,r.jsxs)(a.Z,{className:ln.container,children:[(0,r.jsxs)(a.Z,{className:ln.child,children:[(0,r.jsx)(re,{list:n}),(0,r.jsx)(ge,{anvil:n.anvils})]}),(0,r.jsx)(a.Z,{className:ln.server,children:(0,r.jsx)(on,{anvil:n.anvils})}),(0,r.jsx)(a.Z,{className:ln.child,children:(0,r.jsx)(Ne,{})}),(0,r.jsxs)(a.Z,{className:ln.child,children:[(0,r.jsx)(Ee,{}),(0,r.jsx)(ve,{}),(0,r.jsx)(Pe,{})]})]}):(0,r.jsxs)(a.Z,{className:ln.container,children:[(0,r.jsxs)(a.Z,{className:ln.child,children:[(0,r.jsx)(on,{anvil:n.anvils}),(0,r.jsx)(re,{list:n}),(0,r.jsx)(ge,{anvil:n.anvils})]}),(0,r.jsxs)(a.Z,{className:ln.child,children:[(0,r.jsx)(Ee,{}),(0,r.jsx)(Ne,{}),(0,r.jsx)(ve,{}),(0,r.jsx)(Pe,{})]})]}))]})]})}}},function(e){e.O(0,[806,100,478,774,888,179],(function(){return n=5301,e(e.s=n);var n}));var n=e.O();_N_E=n}]);