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

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