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

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{5301:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return r(1864)}])},8750:function(e,n,r){"use strict";r.d(n,{Z:function(){return N}});var t=r(5893),i=r(7294),o=r(5258),a=r(1120),s=r(253),c=r(282),d=[{text:"Files",image:"/pngs/files_on.png",uri:"/striker?files=true"},{text:"Tasks",image:"/pngs/tasks_no-jobs_icon.png",uri:"/striker?jobs=true"},{text:"Configure",image:"/pngs/configure_icon_on.png",uri:"/striker?configure=true"},{text:"Striker",image:"/pngs/striker_icon_on.png",uri:"/striker?striker=true"},{text:"Anvil",image:"/pngs/anvil_icon_on.png",uri:"/striker?anvil=true"},{text:"Email",image:"/pngs/email_on.png",uri:"/striker?email=true"},{text:"Logout",image:"/pngs/users_icon_on.png",uri:"/striker?logout=true"},{text:"Help",image:"/pngs/help_icon_on.png",uri:"https://alteeve.com/w/Support"}],l={width:"40em",height:"40em"},u=r(7169),h=r(8008),f=r(2822),x=r(998),g=r(5517),p=r(5154),m=r(442),j=r(3430);function v(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function b(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},t=Object.keys(r);"function"===typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),t.forEach((function(n){v(e,n,r[n])}))}return e}var _=(0,a.Z)((function(){return(0,p.Z)({list:{width:"200px"},divider:{background:u.d},text:{paddingTop:".5em",paddingLeft:"1.5em"},dashboardButton:{paddingLeft:".1em"},dashboardIcon:{fontSize:"2.3em",color:u.s7}})})),w=function(e){var n=e.open,r=e.setOpen,i=_();return(0,t.jsx)(h.ZP,{BackdropProps:{invisible:!0},anchor:"left",open:n,onClose:function(){return r(!n)},children:(0,t.jsx)("div",{role:"presentation",children:(0,t.jsxs)(f.Z,{className:i.list,children:[(0,t.jsx)(x.Z,{button:!0,children:(0,t.jsx)(j.z,{text:"Admin"})}),(0,t.jsx)(g.Z,{className:i.divider}),(0,t.jsx)(x.Z,{button:!0,component:"a",href:"/index.html",children:(0,t.jsxs)(s.Z,{display:"flex",flexDirection:"row",width:"100%",children:[(0,t.jsx)(s.Z,{className:i.dashboardButton,children:(0,t.jsx)(m.Z,{className:i.dashboardIcon})}),(0,t.jsx)(s.Z,{flexGrow:1,className:i.text,children:(0,t.jsx)(j.A,{text:"Dashboard"})})]})}),d.map((function(e){return(0,t.jsx)(x.Z,{button:!0,component:"a",href:-1!==e.uri.search(/^https?:/)?e.uri:"".concat("/cgi-bin").concat(e.uri),children:(0,t.jsxs)(s.Z,{display:"flex",flexDirection:"row",width:"100%",children:[(0,t.jsx)(s.Z,{children:(0,t.jsx)("img",b({alt:"",src:e.image},l),"icon")}),(0,t.jsx)(s.Z,{flexGrow:1,className:i.text,children:(0,t.jsx)(j.A,{text:e.text})})]})},e.image)}))]})})})};function Z(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function y(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},t=Object.keys(r);"function"===typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),t.forEach((function(n){Z(e,n,r[n])}))}return e}var k=(0,a.Z)((function(e){return{appBar:{paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),paddingLeft:e.spacing(3),paddingRight:e.spacing(3),borderBottom:"solid 1px",borderBottomColor:u.hM},input:{height:"2.8em",width:"30vw",backgroundColor:e.palette.secondary.main,borderRadius:u.n_},barElement:{padding:0},iconBox:Z({},e.breakpoints.down("sm"),{display:"none"}),searchBar:Z({},e.breakpoints.down("sm"),{flexGrow:1,paddingLeft:"15vw"}),icons:{paddingLeft:".1em",paddingRight:".1em"}}})),N=function(){var e=k(),n=(0,i.useState)(!1),r=n[0],a=n[1];return(0,t.jsxs)(o.Z,{position:"static",className:e.appBar,children:[(0,t.jsxs)(s.Z,{display:"flex",justifyContent:"space-between",flexDirection:"row",children:[(0,t.jsx)(s.Z,{className:e.barElement,children:(0,t.jsx)(c.Z,{onClick:function(){return a(!r)},children:(0,t.jsx)("img",{alt:"",src:"/pngs/logo.png",width:"160",height:"40"})})}),(0,t.jsx)(s.Z,{className:"".concat(e.barElement," ").concat(e.iconBox),children:d.map((function(n){return(0,t.jsx)("a",{href:-1!==n.uri.search(/^https?:/)?n.uri:"".concat("/cgi-bin").concat(n.uri),children:(0,t.jsx)("img",y({alt:"",src:n.image},l,{className:e.icons}),"icon")},n.uri)}))})]}),(0,t.jsx)(w,{open:r,setOpen:a})]})}},4365:function(e,n,r){"use strict";r.d(n,{Lg:function(){return l},s_:function(){return h},V9:function(){return c}});var t=r(5893),i=r(253),o=r(1120),a=r(7169),s=(0,o.Z)((function(){return{innerHeader:{position:"relative",padding:"0 .7em"},header:{top:"-.3em",left:"-.3em",padding:"1.4em 0",position:"absolute",content:'""',borderColor:a.d,borderWidth:"1px",borderRadius:a.n_,borderStyle:"solid",width:"100%"}}})),c=function(e){var n=e.children,r=s();return(0,t.jsxs)(i.Z,{className:r.innerHeader,whiteSpace:"pre-wrap",children:[(0,t.jsx)("div",{className:r.header}),n]})},d=(0,o.Z)((function(){return{innerBody:{borderWidth:"1px",borderRadius:a.n_,borderStyle:"solid",borderColor:a.d,marginTop:"1.4em",marginBottom:"1.4em",paddingBottom:0,position:"relative"}}})),l=function(e){var n=e.children,r=d();return(0,t.jsx)(i.Z,{className:r.innerBody,children:n})},u=(0,o.Z)((function(){return{paper:{padding:"2.1em",backgroundColor:a.v9,opacity:.8,zIndex:999},container:{margin:"1em",position:"relative"},square:{content:'""',position:"absolute",width:"2.1em",height:"2.1em",border:"1px",borderColor:a.lD,borderWidth:"1px",borderRadius:a.n_,borderStyle:"solid",padding:0,margin:0},topSquare:{top:"-.3em",left:"-.3em"},bottomSquare:{bottom:"-.3em",right:"-.3em"},"@global":{"*::-webkit-scrollbar":{width:".6em"},"*::-webkit-scrollbar-track":{backgroundColor:a.v9},"*::-webkit-scrollbar-thumb":{backgroundColor:a.lD,outline:"1px solid transparent",borderRadius:a.n_}}}})),h=function(e){var n=e.children,r=u();return(0,t.jsxs)("div",{className:r.container,children:[(0,t.jsx)("div",{className:"".concat(r.square," ").concat(r.topSquare)}),(0,t.jsx)("div",{className:"".concat(r.square," ").concat(r.bottomSquare)}),(0,t.jsx)("div",{className:r.paper,children:n})]})}},2152:function(e,n,r){"use strict";var t=r(5893),i=r(1120),o=r(5477),a=r(7169),s=(0,i.Z)((function(){return{root:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:"3em"},spinner:{color:a.lD,variant:"indeterminate",size:"50em"}}}));n.Z=function(){var e=s();return(0,t.jsx)("div",{className:e.root,children:(0,t.jsx)(o.Z,{className:e.spinner})})}},3430:function(e,n,r){"use strict";r.d(n,{A:function(){return u},z:function(){return c}});var t=r(5893),i=r(2318),o=r(1591),a=r(7169),s=(0,o.Z)({root:{color:a.lD}})(i.Z),c=function(e){var n=e.text;return(0,t.jsx)(s,{variant:"h4",children:n})},d=(0,r(1120).Z)((function(){return{selected:{color:a.lD},unselected:{color:a.UZ}}})),l=function(e){var n=e.text,r=e.selected,o=d();return(0,t.jsx)(i.Z,{variant:"subtitle1",className:r?o.selected:o.unselected,children:n})};l.defaultProps={selected:!0};var u=l},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)})}},1864:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return Le}});var t=r(5893),i=r(9008),o=r(253),a=r(1120),s=r(4365),c=r(2515);function d(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function l(e){return function(e){if(Array.isArray(e))return d(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 d(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 d(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 u=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return fetch.apply(void 0,l(n)).then((function(e){return e.json()}))},h=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,r=(0,c.ZP)(e,u,{refreshInterval:n}),t=r.data,i=r.error;return{data:t,isLoading:!i&&!t,isError:i}},f=r(7294),x=r(9570),g=r(3430),p=r(7169),m=new Map([["optimal","Optimal"],["not_ready","Not Ready"],["degraded","Degraded"]]),j={uuid:"",setAnvilUuid:function(){return null}},v=(0,f.createContext)(j),b=function(e){var n=e.children,r=(0,f.useState)(""),i=r[0],o=r[1];return(0,t.jsx)(v.Provider,{value:{uuid:i,setAnvilUuid:function(e){o(e)}},children:n})},_=(0,a.Z)((function(){return{decorator:{width:"1.4em",height:"100%",borderRadius:p.n_},ok:{backgroundColor:p.Ej},warning:{backgroundColor:p.Wd},error:{backgroundColor:p.hM},off:{backgroundColor:p.s7}}})),w=function(e){var n=e.colour,r=_();return(0,t.jsx)("div",{className:"".concat(r.decorator," ").concat(r[n])})},Z=r(8336),y=(0,a.Z)((function(){return{root:{width:"100%","&:hover $child":{backgroundColor:p.Gf}},anvilName:{paddingLeft:0}}})),k=function(e){switch(e){case"optimal":return"ok";case"not_ready":return"warning";default:return"error"}},N=function(e){return!(-1===e.hosts.findIndex((function(e){return"offline"!==e.state})))},C=function(e){var n=e.list,r=(0,f.useContext)(v).uuid,i=y(),a=n.findIndex((function(e){return e.anvil_uuid===r}));return(0,t.jsx)(o.Z,{display:"flex",flexDirection:"row",width:"100%",children:""!==r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Z,{p:1,children:(0,t.jsx)(w,{colour:k(n[a].anvil_state)})}),(0,t.jsxs)(o.Z,{p:1,flexGrow:1,className:i.anvilName,children:[(0,t.jsx)(g.z,{text:n[a].anvil_name}),(0,t.jsx)(g.z,{text:m.get(n[a].anvil_state)||"State unavailable"})]}),(0,t.jsx)(o.Z,{p:1,children:(0,t.jsx)(x.Z,{checked:N(n[a]),onChange:function(){return(0,Z.Z)("".concat("/cgi-bin","/set_power"),{anvil_uuid:n[a].anvil_uuid,is_on:!N(n[a])})}})})]})})},A=r(2822),O=r(5517),S=r(998),P=function(e){var n=e.anvil;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.A,{text:n.anvil_name}),(0,t.jsx)(g.A,{text:m.get(n.anvil_state)||"State unavailable"})]})};function T(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function L(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.")}()}var E=function(e){var n=[],r=[],t=[];return e.forEach((function(e){"optimal"===e.anvil_state?n.push(e):"not_ready"===e.anvil_state?r.push(e):t.push(e)})),L(t).concat(L(r),L(n))};var B=(0,a.Z)((function(e){return{root:(n={width:"100%",overflow:"auto",height:"30vh",paddingRight:".3em"},r=e.breakpoints.down(p.li),t={height:"100%",overflow:"hidden"},r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n),divider:{background:p.d},button:{"&:hover":{backgroundColor:p.$T},paddingLeft:0},anvil:{paddingLeft:0}};var n,r,t})),R=function(e){switch(e){case"optimal":return"ok";case"not_ready":return"warning";case"degraded":return"error";default:return"off"}},D=function(e){var n=e.list,r=(0,f.useContext)(v),i=r.uuid,a=r.setAnvilUuid,s=B();return(0,f.useEffect)((function(){""===i&&a(E(n)[0].anvil_uuid)}),[i,n,a]),(0,t.jsx)(A.Z,{component:"nav",className:s.root,"aria-label":"mailbox folders",children:E(n).map((function(e){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(O.Z,{className:s.divider}),(0,t.jsx)(S.Z,{button:!0,className:s.button,onClick:function(){return a(e.anvil_uuid)},children:(0,t.jsxs)(o.Z,{display:"flex",flexDirection:"row",width:"100%",children:[(0,t.jsx)(o.Z,{p:1,children:(0,t.jsx)(w,{colour:R(e.anvil_state)})}),(0,t.jsx)(o.Z,{p:1,flexGrow:1,className:s.anvil,children:(0,t.jsx)(P,{anvil:e})})]})},e.anvil_uuid)]})}))})};function I(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}var F=function(e){var n=e.list,r=[];return null===n||void 0===n||n.anvils.forEach((function(e){var n=h("".concat("/cgi-bin","/get_status?anvil_uuid=").concat(e.anvil_uuid)).data;r.push(function(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},t=Object.keys(r);"function"===typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),t.forEach((function(n){I(e,n,r[n])}))}return e}({},e,n))})),(0,t.jsxs)(s.s_,{children:[(0,t.jsx)(C,{list:r}),(0,t.jsx)(D,{list:E(r)})]})},z=r(1591),G=r(3681),M=(0,z.Z)({root:{height:"1em",borderRadius:p.n_},colorPrimary:{backgroundColor:p.v9},bar:{borderRadius:p.n_}})(G.Z),U=(0,a.Z)((function(){return{barOk:{backgroundColor:p.Ej},barWarning:{backgroundColor:p.Wd},barAlert:{backgroundColor:p.hM}}})),W=function(e){var n=e.allocated,r=U();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(M,{classes:{bar:n>70?n>90?r.barAlert:r.barWarning:r.barOk},variant:"determinate",value:n}),(0,t.jsx)(G.Z,{variant:"determinate",value:0})]})},q=(0,z.Z)({root:{height:"1em",borderRadius:p.n_},colorPrimary:{backgroundColor:p.v9},bar:{borderRadius:p.n_}})(G.Z),$=(0,a.Z)((function(){return{barOk:{backgroundColor:p.Ej},barInProgress:{backgroundColor:p.Wd}}})),H=function(e){var n=e.progressPercentage,r=$();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(q,{classes:{bar:n<100?r.barInProgress:r.barOk},variant:"determinate",value:n}),(0,t.jsx)(G.Z,{variant:"determinate",value:0})]})},V=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."]]);var X=(0,a.Z)((function(e){return{root:(n={overflow:"auto",height:"28vh",paddingLeft:".3em",paddingRight:".3em"},r=e.breakpoints.down(p.li),t={height:"100%",overflow:"hidden"},r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n),state:{paddingLeft:".7em",paddingRight:".7em",paddingTop:"1em"},bar:{paddingLeft:".7em",paddingRight:".7em"},header:{paddingTop:".3em",paddingRight:".7em"},label:{paddingTop:".3em"},decoratorBox:{paddingRight:".3em"}};var n,r,t})),J=function(e,n){var r=e.exec(n);return r?V.get(r[0])||"Error code not recognized":"Error code not found"},K=function(e){switch(e){case"online":return"ok";case"offline":return"off";default:return"warning"}},Q=function(e){var n=e.hosts,r=X(),i=/^[a-zA-Z]/,a=/^(message_[0-9]+)/;return(0,t.jsx)(o.Z,{className:r.root,children:n&&n.map((function(e){var n;return(0,t.jsxs)(s.Lg,{children:[(0,t.jsx)(s.V9,{children:(0,t.jsxs)(o.Z,{display:"flex",width:"100%",className:r.header,children:[(0,t.jsx)(o.Z,{flexGrow:1,children:(0,t.jsx)(g.A,{text:e.host_name})}),(0,t.jsx)(o.Z,{className:r.decoratorBox,children:(0,t.jsx)(w,{colour:K(e.state)})}),(0,t.jsx)(o.Z,{children:(0,t.jsx)(g.A,{text:(null===e||void 0===e||null===(n=e.state)||void 0===n?void 0:n.replace(i,(function(e){return e.toUpperCase()})))||"Not Available"})})]})}),(0,t.jsxs)(o.Z,{display:"flex",className:r.state,children:[(0,t.jsx)(o.Z,{className:r.label,children:(0,t.jsx)(g.A,{text:"Power: "})}),(0,t.jsx)(o.Z,{flexGrow:1,children:(0,t.jsx)(x.Z,{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,t.jsx)(o.Z,{className:r.label,children:(0,t.jsx)(g.A,{text:"Member: "})}),(0,t.jsx)(o.Z,{children:(0,t.jsx)(x.Z,{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,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Z,{display:"flex",width:"100%",className:r.state,children:(0,t.jsx)(o.Z,{children:(0,t.jsx)(g.A,{text:J(a,e.state_message)})})}),(0,t.jsx)(o.Z,{display:"flex",width:"100%",className:r.bar,children:(0,t.jsx)(o.Z,{flexGrow:1,children:(0,t.jsx)(H,{progressPercentage:e.state_percent})})})]})]},e.host_uuid)}))})},Y=r(2152),ee=function(e){return null===e||void 0===e?void 0:e.filter((function(e){return e.host_uuid}))},ne=function(e){var n=e.anvil,r=(0,f.useContext)(v).uuid,i=h("".concat("/cgi-bin","/get_status?anvil_uuid=").concat(r)),o=i.data,a=i.isLoading,c=n.findIndex((function(e){return e.anvil_uuid===r}));return(0,t.jsxs)(s.s_,{children:[(0,t.jsx)(g.z,{text:"Nodes"}),a?(0,t.jsx)(Y.Z,{}):(0,t.jsx)(t.Fragment,{children:-1!==c&&o&&(0,t.jsx)(Q,{hosts:ee(n[c].hosts).reduce((function(e,n,r){var t=o.hosts[r];return t&&e.push(t),e}),[])})})]})},re=function(){var e=(0,f.useContext)(v).uuid,n=h("".concat("/cgi-bin","/get_cpu?anvil_uuid=").concat(e)),r=n.data,i=n.isLoading,a=i||!r?{allocated:0,cores:0,threads:0}:r;return(0,t.jsxs)(s.s_,{children:[(0,t.jsx)(g.z,{text:"CPU"}),i?(0,t.jsx)(Y.Z,{}):(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.Z,{display:"flex",width:"100%",children:(0,t.jsxs)(o.Z,{flexGrow:1,style:{marginLeft:"1em",marginTop:"1em"},children:[(0,t.jsx)(g.A,{text:"Total Cores: ".concat(a.cores)}),(0,t.jsx)(g.A,{text:"Total Threads: ".concat(a.threads)}),(0,t.jsx)(g.A,{text:"Allocated Cores: ".concat(a.allocated)})]})})})]})},te=r(8600),ie=r.n(te),oe=(0,a.Z)((function(){return{fs:{paddingLeft:".7em",paddingRight:".7em",paddingTop:"1.2em"},bar:{paddingLeft:".7em",paddingRight:".7em"},decoratorBox:{paddingRight:".3em"}}})),ae=function(e){var n=e.group,r=oe();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{display:"flex",width:"100%",className:r.fs,children:[(0,t.jsx)(o.Z,{flexGrow:1,children:(0,t.jsx)(g.A,{text:"Used: ".concat(ie()(n.storage_group_total-n.storage_group_free,{binary:!0}))})}),(0,t.jsx)(o.Z,{children:(0,t.jsx)(g.A,{text:"Free: ".concat(ie()(n.storage_group_free,{binary:!0}))})})]}),(0,t.jsx)(o.Z,{display:"flex",width:"100%",className:r.bar,children:(0,t.jsx)(o.Z,{flexGrow:1,children:(0,t.jsx)(W,{allocated:(n.storage_group_total-n.storage_group_free)/n.storage_group_total*100})})}),(0,t.jsx)(o.Z,{display:"flex",justifyContent:"center",width:"100%",children:(0,t.jsx)(g.A,{text:"Total Storage: ".concat(ie()(n.storage_group_total,{binary:!0}))})})]})};var se=(0,a.Z)((function(e){return{header:{paddingTop:".1em",paddingRight:".7em"},root:(n={overflow:"auto",height:"78vh",paddingLeft:".3em",paddingRight:".3em"},r=e.breakpoints.down(p.li),t={height:"100%"},r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n)};var n,r,t})),ce=function(){var e=se(),n=(0,f.useContext)(v).uuid,r=h("".concat("/cgi-bin","/get_shared_storage?anvil_uuid=").concat(n)),i=r.data,a=r.isLoading;return(0,t.jsxs)(s.s_,{children:[(0,t.jsx)(g.z,{text:"Shared Storage"}),a?(0,t.jsx)(Y.Z,{}):(0,t.jsx)(o.Z,{className:e.root,children:(null===i||void 0===i?void 0:i.storage_groups)&&i.storage_groups.map((function(n){return(0,t.jsxs)(s.Lg,{children:[(0,t.jsx)(s.V9,{children:(0,t.jsx)(o.Z,{display:"flex",width:"100%",className:e.header,children:(0,t.jsx)(o.Z,{children:(0,t.jsx)(g.A,{text:n.storage_group_name})})})}),(0,t.jsx)(ae,{group:n},n.storage_group_uuid)]},n.storage_group_uuid)}))})]})},de=function(){var e=(0,f.useContext)(v).uuid,n=h("".concat("/cgi-bin","/get_memory?anvil_uuid=").concat(e)),r=n.data,i=n.isLoading,a=i||!r?{total:0,allocated:0,reserved:0}:r;return(0,t.jsxs)(s.s_,{children:[(0,t.jsx)(g.z,{text:"Memory"}),i?(0,t.jsx)(Y.Z,{}):(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsxs)(o.Z,{display:"flex",width:"100%",children:[(0,t.jsx)(o.Z,{flexGrow:1,children:(0,t.jsx)(g.A,{text:"Allocated: ".concat(ie()(a.allocated,{binary:!0}))})}),(0,t.jsx)(o.Z,{children:(0,t.jsx)(g.A,{text:"Free: ".concat(ie()(a.total-a.allocated,{binary:!0}))})})]}),(0,t.jsx)(o.Z,{display:"flex",width:"100%",children:(0,t.jsx)(o.Z,{flexGrow:1,children:(0,t.jsx)(W,{allocated:a.allocated/a.total*100})})}),(0,t.jsx)(o.Z,{display:"flex",justifyContent:"center",width:"100%",children:(0,t.jsx)(g.A,{text:"Total: ".concat(ie()(a.total,{binary:!0})," | Reserved: ").concat(ie()(a.reserved,{binary:!0}))})})]})]})},le=function(e){var n=[],r={bonds:[]};return null===e||void 0===e||e.hosts.forEach((function(e){e.bonds.forEach((function(t){var i=n.findIndex((function(e){return e===t.bond_name}));-1===i?(n.push(t.bond_name),r.bonds.push({bond_name:t.bond_name,bond_uuid:t.bond_uuid,bond_speed:0,bond_state:"degraded",hosts:[{host_name:e.host_name,host_uuid:e.host_uuid,link:t.links[0].is_active?t.links[0]:t.links[1]}]})):r.bonds[i].hosts.push({host_name:e.host_name,host_uuid:e.host_uuid,link:t.links[0].is_active?t.links[0]:t.links[1]})}))})),r.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})),r};var ue=(0,a.Z)((function(e){return{container:(n={width:"100%",overflow:"auto",height:"32vh",paddingRight:".3em"},r=e.breakpoints.down(p.li),t={height:"100%",overflow:"hidden"},r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n),root:{paddingTop:".7em",paddingBottom:".7em"},noPaddingLeft:{paddingLeft:0},divider:{background:p.d},verticalDivider:{height:"3.5em"}};var n,r,t})),he=function(e){switch(e){case"optimal":return"ok";case"degraded":default:return"warning";case"down":return"error"}},fe=function(){var e=(0,f.useContext)(v).uuid,n=ue(),r=h("".concat("/cgi-bin","/get_networks?anvil_uuid=").concat(e)),i=r.data,a=r.isLoading,c=le(i);return(0,t.jsxs)(s.s_,{children:[(0,t.jsx)(g.z,{text:"Network"}),a?(0,t.jsx)(Y.Z,{}):(0,t.jsx)(o.Z,{className:n.container,children:i&&c.bonds.map((function(e){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.Z,{display:"flex",flexDirection:"row",width:"100%",className:n.root,children:[(0,t.jsx)(o.Z,{p:1,className:n.noPaddingLeft,children:(0,t.jsx)(w,{colour:he(e.bond_state)})}),(0,t.jsxs)(o.Z,{p:1,flexGrow:1,className:n.noPaddingLeft,children:[(0,t.jsx)(g.A,{text:e.bond_name}),(0,t.jsx)(g.A,{text:"".concat(e.bond_speed,"Mbps")})]}),(0,t.jsx)(o.Z,{display:"flex",style:{paddingTop:".5em"},children:e.hosts.map((function(r,i){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Z,{p:1,style:{paddingTop:0,paddingBottom:0},children:(0,t.jsxs)(o.Z,{children:[(0,t.jsx)(g.A,{text:r.host_name,selected:!1}),(0,t.jsx)(g.A,{text:r.link.link_name})]})},r.host_name),i!==e.hosts.length-1&&(0,t.jsx)(O.Z,{className:"".concat(n.divider," ").concat(n.verticalDivider),orientation:"vertical",flexItem:!0})]})}))})]}),(0,t.jsx)(O.Z,{className:n.divider})]})}))})]})},xe=r(7812),ge=r(282),pe=r(2318),me=r(5681),je=r(5639),ve=r(797),be=r(9067),_e=r(8513),we=r(1959),Ze=new Map([["running","Running"],["idle","Idle"],["paused","Paused"],["in shutdown","Shutting Down"],["shut off","Off"],["crashed","Crashed"],["pmsuspended","PM Suspended"],["migrating","Migrating"]]);function ye(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function ke(e){return function(e){if(Array.isArray(e))return ye(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 ye(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 ye(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 Ne=(0,a.Z)((function(e){return{root:(n={width:"100%",overflow:"auto",height:"78vh",paddingRight:".3em"},r=e.breakpoints.down(p.li),t={height:"100%",overflow:"hidden"},r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n),divider:{background:p.d},verticalDivider:{height:"75%",paddingTop:"1em"},button:{"&:hover":{backgroundColor:p.$T},paddingLeft:0},headerPadding:{paddingLeft:".3em"},hostsBox:{padding:"1em",paddingRight:0},hostBox:{paddingTop:0},checkbox:{paddingTop:".8em"},menuItem:{backgroundColor:p.s7,paddingRight:"3em","&:hover":{backgroundColor:p.s7}},editButton:{borderRadius:8,backgroundColor:p.s7,"&:hover":{backgroundColor:p.s7}},editButtonBox:{paddingTop:".3em"},dropdown:{paddingTop:".8em",paddingBottom:".8em"},power:{color:p.E5},on:{color:p.Ej},off:{color:p.hM},all:{paddingTop:".5em",paddingLeft:".3em"}};var n,r,t})),Ce=function(e){switch(e){case"running":return"ok";case"shut off":return"off";case"crashed":return"error";default:return"warning"}},Ae=function(e){var n,r=e.anvil,i=(0,f.useState)(null),a=i[0],c=i[1],d=(0,f.useState)(!1),l=d[0],u=d[1],x=(0,f.useState)(!1),m=x[0],j=x[1],b=(0,f.useState)([]),_=b[0],y=b[1],k=(0,f.useRef)([]),N=(0,f.useContext)(v).uuid,C=Ne(),P=h("".concat("/cgi-bin","/get_servers?anvil_uuid=").concat(N)),T=P.data,L=P.isLoading,E=function(e){k.current=[],e.filter((function(e){return"running"===e.server_state})).length&&k.current.push("off"),e.filter((function(e){return"shut off"===e.server_state})).length&&k.current.push("on")},B=r.findIndex((function(e){return e.anvil_uuid===N})),R=ee(null===(n=r[B])||void 0===n?void 0:n.hosts);return(0,t.jsxs)(s.s_,{children:[(0,t.jsxs)(o.Z,{className:C.headerPadding,display:"flex",children:[(0,t.jsx)(o.Z,{flexGrow:1,children:(0,t.jsx)(g.z,{text:"Servers"})}),(0,t.jsx)(o.Z,{className:C.editButtonBox,children:(0,t.jsx)(xe.Z,{className:C.editButton,style:{color:p.E5},onClick:function(){return u(!l)},children:l?(0,t.jsx)(we.Z,{}):(0,t.jsx)(be.Z,{})})})]}),l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Z,{className:C.headerPadding,display:"flex",children:(0,t.jsxs)(o.Z,{flexGrow:1,className:C.dropdown,children:[(0,t.jsx)(ge.Z,{variant:"contained",startIcon:(0,t.jsx)(_e.Z,{}),onClick:function(e){c(e.currentTarget)},style:{textTransform:"none"},children:(0,t.jsx)(pe.Z,{className:C.power,variant:"subtitle1",children:"Power"})}),(0,t.jsx)(me.Z,{anchorEl:a,keepMounted:!0,open:Boolean(a),onClose:function(){return c(null)},children:k.current.map((function(e){return(0,t.jsx)(je.Z,{onClick:function(){return function(e){c(null),_.length&&(0,Z.Z)("".concat("/cgi-bin","/set_power"),{server_uuid_list:_,is_on:"on"===e})}(e)},className:C.menuItem,children:(0,t.jsx)(pe.Z,{className:C[e],variant:"subtitle1",children:e.replace(/^[a-z]/,(function(e){return e.toUpperCase()}))})},e)}))})]})}),(0,t.jsxs)(o.Z,{display:"flex",children:[(0,t.jsx)(o.Z,{children:(0,t.jsx)(ve.Z,{style:{color:p.lD},color:"secondary",checked:m,onChange:function(){m?(E([]),y([])):(E(T.servers),y(T.servers.map((function(e){return e.server_uuid})))),j(!m)}})}),(0,t.jsx)(o.Z,{className:C.all,children:(0,t.jsx)(g.A,{text:"All"})})]})]}),L?(0,t.jsx)(Y.Z,{}):(0,t.jsx)(o.Z,{className:C.root,children:(0,t.jsx)(A.Z,{component:"nav",children:null===T||void 0===T?void 0:T.servers.map((function(e){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S.Z,{button:!0,className:C.button,component:l?"div":"a",href:"/server?uuid=".concat(e.server_uuid,"&server_name=").concat(e.server_name),onClick:function(){return function(e){var n=_.indexOf(e);-1===n?_.push(e):_.splice(n,1);var r=T.servers.filter((function(e){return-1!==_.indexOf(e.server_uuid)}));E(r),y(ke(_))}(e.server_uuid)},children:(0,t.jsxs)(o.Z,{display:"flex",flexDirection:"row",width:"100%",children:[l&&(0,t.jsx)(o.Z,{className:C.checkbox,children:(0,t.jsx)(ve.Z,{style:{color:p.lD},color:"secondary",checked:void 0!==_.find((function(n){return n===e.server_uuid}))})}),(0,t.jsx)(o.Z,{p:1,children:(0,t.jsx)(w,{colour:Ce(e.server_state)})}),(0,t.jsxs)(o.Z,{p:1,flexGrow:1,children:[(0,t.jsx)(g.A,{text:e.server_name}),(0,t.jsx)(g.A,{text:Ze.get(e.server_state)||"Not Available"})]}),(0,t.jsx)(o.Z,{display:"flex",className:C.hostsBox,children:"shut off"!==e.server_state&&"crashed"!==e.server_state&&R.map((function(n,r){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Z,{p:1,className:C.hostBox,children:(0,t.jsx)(g.A,{text:n.host_name,selected:e.server_host_uuid===n.host_uuid})},n.host_uuid),r!==R.length-1&&(0,t.jsx)(O.Z,{className:"".concat(C.divider," ").concat(C.verticalDivider),orientation:"vertical"})]})}))})]})},e.server_uuid),(0,t.jsx)(O.Z,{className:C.divider})]})}))})})]})},Oe=r(8750),Se=function(){var e=(0,f.useState)(void 0),n=e[0],r=e[1];return(0,f.useEffect)((function(){var e=function(){r(window.innerWidth)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),n};function Pe(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}var Te=(0,a.Z)((function(e){var n;return{child:(n={width:"22%",height:"100%"},Pe(n,e.breakpoints.down(p.li),{width:"50%"}),Pe(n,e.breakpoints.down("md"),{width:"100%"}),n),server:Pe({width:"35%",height:"100%"},e.breakpoints.down("md"),{width:"100%"}),container:Pe({display:"flex",flexDirection:"row",width:"100%",justifyContent:"space-between"},e.breakpoints.down("md"),{display:"block"})}})),Le=function(){var e=Te(),n=Se(),r=h("".concat("/cgi-bin","/get_anvils")).data;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.default,{children:(0,t.jsx)("title",{children:"Dashboard"})}),(0,t.jsxs)(b,{children:[(0,t.jsx)(Oe.Z,{}),(null===r||void 0===r?void 0:r.anvils)&&n&&(n>p.li?(0,t.jsxs)(o.Z,{className:e.container,children:[(0,t.jsxs)(o.Z,{className:e.child,children:[(0,t.jsx)(F,{list:r}),(0,t.jsx)(ne,{anvil:r.anvils})]}),(0,t.jsx)(o.Z,{className:e.server,children:(0,t.jsx)(Ae,{anvil:r.anvils})}),(0,t.jsx)(o.Z,{className:e.child,children:(0,t.jsx)(ce,{})}),(0,t.jsxs)(o.Z,{className:e.child,children:[(0,t.jsx)(fe,{}),(0,t.jsx)(re,{}),(0,t.jsx)(de,{})]})]}):(0,t.jsxs)(o.Z,{className:e.container,children:[(0,t.jsxs)(o.Z,{className:e.child,children:[(0,t.jsx)(Ae,{anvil:r.anvils}),(0,t.jsx)(F,{list:r}),(0,t.jsx)(ne,{anvil:r.anvils})]}),(0,t.jsxs)(o.Z,{className:e.child,children:[(0,t.jsx)(fe,{}),(0,t.jsx)(ce,{}),(0,t.jsx)(re,{}),(0,t.jsx)(de,{})]})]}))]})]})}}},function(e){e.O(0,[321,291,774,888,179],(function(){return n=5301,e(e.s=n);var n}));var n=e.O();_N_E=n}]);