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