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
33 KiB
1 lines
33 KiB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[817],{2852:function(e,t,n){"use strict";var r=n(3366),o=n(7462),i=n(7294),a=n(6010),c=n(7192),s=n(1796),l=n(8216),d=n(1964),u=n(3616),h=n(1496),f=n(9632),x=n(5893);const m=["className","color","edge","size","sx"],v=(0,h.ZP)("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.edge&&t[`edge${(0,l.Z)(n.edge)}`],t[`size${(0,l.Z)(n.size)}`]]}})((({ownerState:e})=>(0,o.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,[`& .${f.Z.thumb}`]:{width:16,height:16},[`& .${f.Z.switchBase}`]:{padding:4,[`&.${f.Z.checked}`]:{transform:"translateX(16px)"}}}))),p=(0,h.ZP)(d.Z,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.switchBase,{[`& .${f.Z.input}`]:t.input},"default"!==n.color&&t[`color${(0,l.Z)(n.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}),[`&.${f.Z.checked}`]:{transform:"translateX(20px)"},[`&.${f.Z.disabled}`]:{color:"light"===e.palette.mode?e.palette.grey[100]:e.palette.grey[600]},[`&.${f.Z.checked} + .${f.Z.track}`]:{opacity:.5},[`&.${f.Z.disabled} + .${f.Z.track}`]:{opacity:"light"===e.palette.mode?.12:.2},[`& .${f.Z.input}`]:{left:"-100%",width:"300%"}})),(({theme:e,ownerState:t})=>(0,o.Z)({"&:hover":{backgroundColor:(0,s.Fq)(e.palette.action.active,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"default"!==t.color&&{[`&.${f.Z.checked}`]:{color:e.palette[t.color].main,"&:hover":{backgroundColor:(0,s.Fq)(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${f.Z.disabled}`]:{color:"light"===e.palette.mode?(0,s.$n)(e.palette[t.color].main,.62):(0,s._j)(e.palette[t.color].main,.55)}},[`&.${f.Z.checked} + .${f.Z.track}`]:{backgroundColor:e.palette[t.color].main}}))),g=(0,h.ZP)("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(e,t)=>t.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}))),j=(0,h.ZP)("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(e,t)=>t.thumb})((({theme:e})=>({boxShadow:e.shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"}))),b=i.forwardRef((function(e,t){const n=(0,u.Z)({props:e,name:"MuiSwitch"}),{className:i,color:s="primary",edge:d=!1,size:h="medium",sx:b}=n,Z=(0,r.Z)(n,m),w=(0,o.Z)({},n,{color:s,edge:d,size:h}),y=(e=>{const{classes:t,edge:n,size:r,color:i,checked:a,disabled:s}=e,d={root:["root",n&&`edge${(0,l.Z)(n)}`,`size${(0,l.Z)(r)}`],switchBase:["switchBase",`color${(0,l.Z)(i)}`,a&&"checked",s&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},u=(0,c.Z)(d,f.H,t);return(0,o.Z)({},t,u)})(w),k=(0,x.jsx)(j,{className:y.thumb,ownerState:w});return(0,x.jsxs)(v,{className:(0,a.Z)(y.root,i),sx:b,ownerState:w,children:[(0,x.jsx)(p,(0,o.Z)({type:"checkbox",icon:k,checkedIcon:k,ref:t,ownerState:w},Z,{classes:(0,o.Z)({},y,{root:y.switchBase})})),(0,x.jsx)(g,{className:y.track,ownerState:w})]})}));t.Z=b},6069:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/anvil",function(){return n(7733)}])},1939:function(e,t,n){"use strict";var r=n(5893),o=n(7357),i=n(7169);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){a(e,t,n[t])}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l="Decorator",d={ok:"".concat(l,"-ok"),warning:"".concat(l,"-warning"),error:"".concat(l,"-error"),off:"".concat(l,"-off")};t.Z=function(e){var t,n=e.colour,l=e.sx,u=s(e,["colour","sx"]);return(0,r.jsx)(o.Z,c({},u,{className:d[n],sx:c((t={borderRadius:i.n_,height:"100%",width:"1.4em"},a(t,"&.".concat(d.ok),{backgroundColor:i.Ej}),a(t,"&.".concat(d.warning),{backgroundColor:i.Wd}),a(t,"&.".concat(d.error),{backgroundColor:i.hM}),a(t,"&.".concat(d.off),{backgroundColor:i.s7}),t),l)}))}},6632:function(e,t,n){"use strict";var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){o(e,t,n[t])}))}return e}function a(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}t.Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.actionProceedText,n=void 0===t?"":t,o=e.content,c=void 0===o?"":o,s=e.titleText,l=void 0===s?"":s,d=a(e,["actionProceedText","content","titleText"]);return(0,r.useState)(i({actionProceedText:n,content:c,titleText:l},d))}},7733:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return tt}});var r=n(5893),o=n(1496),i=n(7357),a=n(9008),c=n(1163),s=n(7294),l=n(2029),d=n(7169),u={uuid:"",setAnvilUuid:function(){return null}},h=(0,s.createContext)(u),f=function(e){var t=e.children,n=(0,s.useState)(""),o=n[0],i=n[1];return(0,r.jsx)(h.Provider,{value:{uuid:o,setAnvilUuid:function(e){i(e)}},children:t})},x=n(3679),m=n(1905),v=n(2852),p=new Map([["optimal","Optimal"],["not_ready","Not Ready"],["degraded","Degraded"]]),g=n(1939),j=function(e,t){return fetch(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},b=n(7750);function Z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w={anvilName:"".concat("SelectedAnvil","-anvilName")},y=(0,o.ZP)(i.Z)((function(){return Z({display:"flex",flexDirection:"row",width:"100%"},"& .".concat(w.anvilName),{paddingLeft:0})})),k=function(e){switch(e){case"optimal":return"ok";case"not_ready":return"warning";default:return"error"}},_=function(e){return!(-1===e.hosts.findIndex((function(e){return"offline"!==e.state})))},S=function(e){var t=e.list,n=(0,s.useContext)(h).uuid,o=t.findIndex((function(e){return e.anvil_uuid===n}));return(0,r.jsx)(y,Z({},"children",""!==n&&(0,r.jsxs)(r.Fragment,Z({},"children",[(0,r.jsx)(i.Z,{p:1,children:(0,r.jsx)(g.Z,{colour:k(t[o].anvil_state)})}),(0,r.jsxs)(i.Z,{p:1,flexGrow:1,className:w.anvilName,children:[(0,r.jsx)(b.z,{text:t[o].anvil_name}),(0,r.jsx)(b.z,{text:p.get(t[o].anvil_state)||"State unavailable"})]}),(0,r.jsx)(i.Z,Z({p:1},"children",(0,r.jsx)(v.Z,Z({checked:_(t[o])},"onChange",(function(){var e=t[o],n=e.anvil_uuid;j("".concat(l.Z,"/command/").concat(_(e)?"stop-an":"start-an","/").concat(n),{})})))))]))))},O=n(8462),P=n(7720),A=n(7212),N=function(e){var t=e.anvil;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b.Ac,{text:t.anvil_name}),(0,r.jsx)(b.Ac,{text:p.get(t.anvil_state)||"State unavailable"})]})};function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function T(e){return function(e){if(Array.isArray(e))return C(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"===typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C(e,t)}(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 I=function(e){var t=[],n=[],r=[];return e.forEach((function(e){"optimal"===e.anvil_state?t.push(e):"not_ready"===e.anvil_state?n.push(e):r.push(e)})),T(r).concat(T(n),T(t))};function B(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var M="AnvilList",U={root:"".concat(M,"-root"),divider:"".concat(M,"-divider"),button:"".concat(M,"-button"),anvil:"".concat(M,"-anvil")},D=(0,o.ZP)("div")((function(e){var t,n=e.theme;return B(t={},"& .".concat(U.root),B({width:"100%",overflow:"auto",height:"30vh",paddingRight:".3em"},n.breakpoints.down(d.li),{height:"100%",overflow:"hidden"})),B(t,"& .".concat(U.divider),{backgroundColor:d.d}),B(t,"& .".concat(U.button),{"&:hover":{backgroundColor:d.$T},paddingLeft:0}),B(t,"& .".concat(U.anvil),{paddingLeft:0}),t})),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 t=e.list,n=(0,s.useContext)(h),o=n.uuid,a=n.setAnvilUuid;return(0,s.useEffect)((function(){""===o&&a(I(t)[0].anvil_uuid)}),[o,t,a]),(0,r.jsx)(D,{children:(0,r.jsx)(O.Z,{component:"nav",className:U.root,"aria-label":"mailbox folders",children:I(t).map((function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(P.Z,{className:U.divider}),(0,r.jsx)(A.ZP,{button:!0,className:U.button,onClick:function(){return a(e.anvil_uuid)},children:(0,r.jsxs)(i.Z,{display:"flex",flexDirection:"row",width:"100%",children:[(0,r.jsx)(i.Z,{p:1,children:(0,r.jsx)(g.Z,{colour:L(e.anvil_state)})}),(0,r.jsx)(i.Z,{p:1,flexGrow:1,className:U.anvil,children:(0,r.jsx)(N,{anvil:e})})]})},e.anvil_uuid)]})}))})})};function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var z=function(e){var t=e.list,n=[];return null===t||void 0===t||t.anvils.forEach((function(e){var t=e.anvil_uuid,r=(0,m.Z)("".concat(l.Z,"/anvil/").concat(t)).data;n.push(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){R(e,t,n[t])}))}return e}({},e,r))})),(0,r.jsxs)(x.s_,{children:[(0,r.jsx)(S,{list:n}),(0,r.jsx)(E,{list:I(n)})]})},$=n(4690),F=n(2152),G=function(){var e=(0,s.useContext)(h).uuid,t=(0,m.Z)("".concat(l.Z,"/anvil/").concat(e,"/cpu")),n=t.data,o=void 0===n?{}:n,i=o.allocated,a=void 0===i?0:i,c=o.cores,d=void 0===c?0:c,u=o.threads,f=void 0===u?0:u,v=t.isLoading,p=(0,s.useMemo)((function(){return v?(0,r.jsx)(F.Z,{}):(0,r.jsxs)($.Z,{spacing:0,children:[(0,r.jsx)(b.Ac,{text:"Total Cores: ".concat(d)}),(0,r.jsx)(b.Ac,{text:"Total Threads: ".concat(f)}),(0,r.jsx)(b.Ac,{text:"Allocated Cores: ".concat(a)})]})}),[a,d,v,f]);return(0,r.jsxs)(x.s_,{children:[(0,r.jsx)(x.V9,{children:(0,r.jsx)(b.z,{text:"CPU"})}),p]})},H=n(5521),q=new Map([["message_0222","The subnode is in an unknown state."],["message_0223","The subnode is a full cluster member."],["message_0224","The subnode is coming online; the cluster resource manager is running (step 2/3)."],["message_0225","The subnode is coming online; the subnode is a consensus cluster member (step 1/3)."],["message_0226","The subnode has booted, but it is not (yet) joining the cluster."]]),V=n(5172);function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var X="AnvilHost",J={state:"".concat(X,"-state"),bar:"".concat(X,"-bar"),label:"".concat(X,"-label"),decoratorBox:"".concat(X,"-decoratorBox")},K=(0,o.ZP)(i.Z)((function(e){var t;return W(t={overflow:"auto",height:"28vh",paddingLeft:".3em",paddingRight:".3em"},e.theme.breakpoints.down(d.li),{height:"100%",overflow:"hidden"}),W(t,"& .".concat(J.state),{paddingLeft:".7em",paddingRight:".7em"}),W(t,"& .".concat(J.bar),{paddingLeft:".7em",paddingRight:".7em"}),W(t,"& .".concat(J.label),{paddingTop:".3em"}),W(t,"& .".concat(J.decoratorBox),{alignSelf:"stretch",paddingRight:".3em"}),t})),Q=function(e,t){var n=e.exec(t);return n?q.get(n[0])||"Error code not recognized":"Error code not found"},Y=function(e){switch(e){case"online":return"ok";case"offline":return"off";default:return"warning"}},ee=function(e){var t=e.hosts,n=/^[a-zA-Z]/,o=/^(message_[0-9]+)/;return(0,r.jsx)(K,{children:t&&t.map((function(e){var t;return e?(0,r.jsxs)(x.Lg,{children:[(0,r.jsxs)(x.CH,{children:[(0,r.jsx)(i.Z,{flexGrow:1,children:(0,r.jsx)(b.Ac,{text:e.host_name})}),(0,r.jsx)(i.Z,{className:J.decoratorBox,children:(0,r.jsx)(g.Z,{colour:Y(e.state)})}),(0,r.jsx)(i.Z,{children:(0,r.jsx)(b.Ac,{text:(null===e||void 0===e||null===(t=e.state)||void 0===t?void 0:t.replace(n,(function(e){return e.toUpperCase()})))||"Not Available"})})]}),(0,r.jsxs)(i.Z,{display:"flex",className:J.state,children:[(0,r.jsx)(i.Z,{className:J.label,children:(0,r.jsx)(b.Ac,{text:"Power: "})}),(0,r.jsx)(i.Z,{flexGrow:1,children:(0,r.jsx)(v.Z,{checked:"online"===e.state,onChange:function(){return j("".concat(l.Z,"/command/").concat("online"===e.state?"stop-subnode":"start-subnode","/").concat(e.host_uuid),{})}})}),(0,r.jsx)(i.Z,{className:J.label,children:(0,r.jsx)(b.Ac,{text:"Member: "})}),(0,r.jsx)(i.Z,{children:(0,r.jsx)(v.Z,{checked:"online"===e.state,disabled:!("online"===e.state),onChange:function(){return j("".concat(l.Z,"/command/").concat("online"===e.state?"leave-an":"join-an","/").concat(e.host_uuid),{})}})})]}),"online"!==e.state&&"offline"!==e.state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Z,{display:"flex",width:"100%",className:J.state,children:(0,r.jsx)(i.Z,{children:(0,r.jsx)(b.Ac,{text:Q(o,e.state_message)})})}),(0,r.jsx)(i.Z,{display:"flex",width:"100%",className:J.bar,children:(0,r.jsx)(i.Z,{flexGrow:1,children:(0,r.jsx)(V.ko,{progressPercentage:e.state_percent})})})]})]},e.host_uuid):(0,r.jsx)(r.Fragment,{})}))})},te=function(e){return null===e||void 0===e?void 0:e.filter((function(e){return e.host_uuid}))},ne=function(e){var t=e.anvil,n=(0,s.useContext)(h).uuid,o=(0,m.Z)("".concat(l.Z,"/anvil/").concat(n)),i=o.data,a=o.isLoading,c=t.findIndex((function(e){return e.anvil_uuid===n}));return(0,r.jsxs)(x.s_,{children:[(0,r.jsx)(b.z,{text:"Subnodes"}),a?(0,r.jsx)(F.Z,{}):(0,r.jsx)(r.Fragment,{children:-1!==c&&i&&(0,r.jsx)(ee,{hosts:te(t[c].hosts).reduce((function(e,t,n){var r=i.hosts[n];return r&&e.push(r),e}),[])})})]})},re=n(5737),oe=function(){var e=(0,s.useContext)(h).uuid,t=(0,m.Z)("".concat(l.Z,"/anvil/").concat(e,"/memory")),n=t.data,o=void 0===n?{}:n,a=o.allocated,c=void 0===a?"0":a,d=o.reserved,u=void 0===d?"0":d,f=o.total,v=void 0===f?"0":f,p=t.isLoading,g=(0,s.useMemo)((function(){return BigInt(c)}),[c]),j=(0,s.useMemo)((function(){return BigInt(u)}),[u]),Z=(0,s.useMemo)((function(){return BigInt(v)}),[v]);return(0,r.jsxs)(x.s_,{children:[(0,r.jsx)(x.V9,{children:(0,r.jsx)(b.z,{text:"Memory"})}),p?(0,r.jsx)(F.Z,{}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.Z,{display:"flex",width:"100%",children:[(0,r.jsx)(i.Z,{flexGrow:1,children:(0,r.jsx)(b.Ac,{text:"Allocated: ".concat((0,re.MU)(g))})}),(0,r.jsx)(i.Z,{children:(0,r.jsx)(b.Ac,{text:"Free: ".concat((0,re.MU)(Z-(j+g)))})})]}),(0,r.jsx)(i.Z,{display:"flex",width:"100%",children:(0,r.jsx)(i.Z,{flexGrow:1,children:(0,r.jsx)(V.CD,{allocated:Number((j+g)*BigInt(100)/Z)})})}),(0,r.jsx)(i.Z,{display:"flex",justifyContent:"center",width:"100%",children:(0,r.jsx)(b.Ac,{text:"Total: ".concat((0,re.MU)(Z)," | Reserved: ").concat((0,re.MU)(j))})})]})]})},ie=function(e){var t=[],n={bonds:[]};return e.hosts.forEach((function(e){e.bonds.forEach((function(r){var o=t.findIndex((function(e){return e===r.bond_name}));-1===o?(t.push(r.bond_name),n.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]}]})):n.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]})}))})),n.bonds.forEach((function(e){var t=e.hosts[0].link.link_speed>e.hosts[1].link.link_speed?1:0;e.bond_speed=e.hosts[t].link.link_speed,e.bond_state=e.hosts[t].link.link_state})),n},ae=n(2749);function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function le(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(s){c=!0,o=s}finally{try{a||null==n.return||n.return()}finally{if(c)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ce(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var de="Network",ue={container:"".concat(de,"-container"),root:"".concat(de,"-root"),noPaddingLeft:"".concat(de,"-noPaddingLeft"),divider:"".concat(de,"-divider"),verticalDivider:"".concat(de,"-verticalDivider")},he=(0,o.ZP)("div")((function(e){var t,n=e.theme;return se(t={},"& .".concat(ue.container),se({width:"100%",overflow:"auto",height:"32vh",paddingRight:".3em"},n.breakpoints.down(d.li),{height:"100%",overflow:"hidden"})),se(t,"& .".concat(ue.root),{paddingTop:".7em",paddingBottom:".7em"}),se(t,"& .".concat(ue.noPaddingLeft),{paddingLeft:0}),se(t,"& .".concat(ue.divider),{backgroundColor:d.d}),se(t,"& .".concat(ue.verticalDivider),{height:"3.5em"}),t})),fe=function(e){switch(e){case"optimal":return"ok";case"degraded":default:return"warning";case"down":return"error"}},xe=function(){var e=(0,s.useContext)(h).uuid,t=le((0,ae.Z)(void 0),2),n=t[0],o=t[1],a=(0,m.Z)("".concat(l.Z,"/anvil/").concat(e,"/network"),{onSuccess:function(e){o(ie(e))}}).isLoading;return(0,r.jsx)(x.s_,{children:(0,r.jsxs)(he,{children:[(0,r.jsx)(b.z,{text:"Network"}),a?(0,r.jsx)(F.Z,{}):(0,r.jsx)(i.Z,{className:ue.container,children:n&&n.bonds.map((function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.Z,{className:ue.root,display:"flex",flexDirection:"row",width:"100%",children:[(0,r.jsx)(i.Z,{p:1,className:ue.noPaddingLeft,children:(0,r.jsx)(g.Z,{colour:fe(e.bond_state)})}),(0,r.jsxs)(i.Z,{p:1,flexGrow:1,className:ue.noPaddingLeft,children:[(0,r.jsx)(b.Ac,{text:e.bond_name}),(0,r.jsx)(b.Ac,{text:"".concat(e.bond_speed,"Mbps")})]}),(0,r.jsx)(i.Z,{display:"flex",style:{paddingTop:".5em"},children:e.hosts.map((function(t,n){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Z,{p:1,style:{paddingTop:0,paddingBottom:0},children:(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(b.Ac,{text:t.host_name,selected:!1}),(0,r.jsx)(b.Ac,{text:t.link.link_name})]})},t.host_name),n!==e.hosts.length-1&&(0,r.jsx)(P.Z,{className:"".concat(ue.divider," ").concat(ue.verticalDivider),orientation:"vertical",flexItem:!0})]})}))})]}),(0,r.jsx)(P.Z,{className:ue.divider})]})}))})]})})},me=(0,n(7892).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"),ve=n(5861),pe=n(8333),ge=n(8128),je=new Map([["running","Running"],["idle","Idle"],["paused","Paused"],["in shutdown","Shutting Down"],["shut off","Off"],["crashed","Crashed"],["pmsuspended","PM Suspended"],["migrating","Migrating"]]),be=n(4390),Ze=n(157),we=n(4825),ye=n(1770),ke=n(1706),_e=n(4427),Se=n(4968),Oe=n(6632);function Pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ae(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ae(e,t,n[t])}))}return e}function Ce(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(s){c=!0,o=s}finally{try{a||null==n.return||n.return()}finally{if(c)throw o}}return i}}(e,t)||Ie(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Te(e){return function(e){if(Array.isArray(e))return Pe(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ie(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.")}()}function Ie(e,t){if(e){if("string"===typeof e)return Pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pe(e,t):void 0}}var Be,Me="Servers",Ue={root:"".concat(Me,"-root"),divider:"".concat(Me,"-divider"),verticalDivider:"".concat(Me,"-verticalDivider"),button:"".concat(Me,"-button"),headerPadding:"".concat(Me,"-headerPadding"),hostsBox:"".concat(Me,"-hostsBox"),hostBox:"".concat(Me,"-hostBox"),checkbox:"".concat(Me,"-checkbox"),editButtonBox:"".concat(Me,"-editButtonBox"),dropdown:"".concat(Me,"-dropdown"),on:"".concat(Me,"-on"),off:"".concat(Me,"-off"),all:"".concat(Me,"-all")},De=(0,o.ZP)("div")((function(e){var t,n=e.theme;return Ae(t={},"& .".concat(Ue.root),Ae({width:"100%",overflow:"auto",height:"78vh",paddingRight:".3em"},n.breakpoints.down(d.li),{height:"100%",overflow:"hidden"})),Ae(t,"& .".concat(Ue.divider),{backgroundColor:d.d}),Ae(t,"& .".concat(Ue.verticalDivider),{height:"75%",paddingTop:"1em"}),Ae(t,"& .".concat(Ue.button),{"&:hover":{backgroundColor:d.$T},paddingLeft:0}),Ae(t,"& .".concat(Ue.headerPadding),{paddingLeft:".3em"}),Ae(t,"& .".concat(Ue.hostsBox),{padding:"1em",paddingRight:0}),Ae(t,"& .".concat(Ue.hostBox),{paddingTop:0}),Ae(t,"& .".concat(Ue.checkbox),{paddingTop:".8em"}),Ae(t,"& .".concat(Ue.editButtonBox),{paddingTop:".3em"}),Ae(t,"& .".concat(Ue.dropdown),{paddingTop:".8em",paddingBottom:".8em"}),Ae(t,"& .".concat(Ue.all),{paddingTop:".5em",paddingLeft:".3em"}),t})),Le=function(e){switch(e){case"running":return"ok";case"shut off":return"off";case"crashed":return"error";default:return"warning"}},Ee=(0,o.ZP)(ve.Z)((Ae(Be={},"&.".concat(Ue.on),{color:d.Ej}),Ae(Be,"&.".concat(Ue.off),{color:d.hM}),Be)),Re=function(e){var t,n=e.anvil,o=(0,s.useState)(null),a=o[0],c=o[1],u=(0,s.useState)(!1),f=u[0],v=u[1],p=(0,s.useState)(!1),Z=p[0],w=p[1],y=(0,s.useState)([]),k=y[0],_=y[1],S=(0,s.useState)(!1),N=S[0],C=S[1],T=(0,s.useRef)({}),I=Ce((0,Oe.Z)(),2),B=I[0],M=I[1],U=(0,s.useContext)(h).uuid,D=(0,s.useRef)([]),L=(0,m.Z)("".concat(l.Z,"/server?anvilUUIDs=").concat(U)),E=L.data,R=void 0===E?[]:E,z=L.isLoading,$=function(e){D.current=[],e.filter((function(e){return"running"===e.serverState})).length&&D.current.push("off"),e.filter((function(e){return"shut off"===e.serverState})).length&&D.current.push("on")},G=n.findIndex((function(e){return e.anvil_uuid===U})),H=te(null===(t=n[G])||void 0===t?void 0:t.hosts),q=(0,s.useMemo)((function(){return!k.length}),[k.length]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.s_,{children:(0,r.jsxs)(De,{children:[(0,r.jsxs)(x.V9,{className:Ue.headerPadding,sx:{marginBottom:0},children:[(0,r.jsx)(b.z,{text:"Servers"}),f&&(0,r.jsx)(ke.Z,{disabled:q,mapPreset:"delete",onClick:function(){var e;M({actionProceedText:"Delete",content:"Are you sure you want to delete the selected server(s)? This action is not revertable.",onProceedAppend:function(){be.Z.request({data:{serverUuids:k},method:"delete",url:"/server"}).catch((function(e){(0,ye.Z)(e)}))},proceedColour:"red",titleText:"Delete ".concat(k.length," server(s)?")}),null===(e=T.current.setOpen)||void 0===e||e.call(null,!0)},variant:"redcontained"}),(0,r.jsx)(ke.Z,{mapPreset:"edit",onClick:function(){return v(!f)},state:String(f)}),(0,r.jsx)(ke.Z,{mapPreset:"add",onClick:function(){return C(!0)}})]}),f&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Z,{className:Ue.headerPadding,display:"flex",children:(0,r.jsxs)(i.Z,{flexGrow:1,className:Ue.dropdown,children:[(0,r.jsx)(we.Z,{disabled:q,onClick:function(e){c(e.currentTarget)},startIcon:(0,r.jsx)(me,{}),children:"Power"}),(0,r.jsx)(pe.Z,{anchorEl:a,keepMounted:!0,open:Boolean(a),onClose:function(){return c(null)},children:D.current.map((function(e){return(0,r.jsx)(_e.Z,{onClick:function(){return function(e){c(null),k.length&&k.forEach((function(t){j("".concat(l.Z,"/command/").concat("on"===e?"start-server":"stop-server","/").concat(t),{})}))}(e)},children:(0,r.jsx)(Ee,{className:Ue[e],variant:"subtitle1",children:e.replace(/^[a-z]/,(function(e){return e.toUpperCase()}))})},e)}))})]})}),(0,r.jsxs)(i.Z,{display:"flex",children:[(0,r.jsx)(i.Z,{children:(0,r.jsx)(ge.Z,{style:{color:d.lD},color:"secondary",checked:Z,onChange:function(){Z?($([]),_([])):($(R),_(R.map((function(e){return e.serverUUID})))),w(!Z)}})}),(0,r.jsx)(i.Z,{className:Ue.all,children:(0,r.jsx)(b.Ac,{text:"All"})})]})]}),z?(0,r.jsx)(F.Z,{}):(0,r.jsx)(i.Z,{className:Ue.root,children:(0,r.jsx)(O.Z,{component:"nav",children:R.map((function(e){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(A.ZP,{button:!0,className:Ue.button,component:f?"div":"a",href:"/server?uuid=".concat(e.serverUUID,"&server_name=").concat(e.serverName,"&server_state=").concat(e.serverState),onClick:function(){return function(e){var t=k.indexOf(e);-1===t?k.push(e):k.splice(t,1);var n=R.filter((function(e){return-1!==k.indexOf(e.serverUUID)}));$(n),_(Te(k))}(e.serverUUID)},children:(0,r.jsxs)(i.Z,{display:"flex",flexDirection:"row",width:"100%",children:[f&&(0,r.jsx)(i.Z,{className:Ue.checkbox,children:(0,r.jsx)(ge.Z,{style:{color:d.lD},color:"secondary",checked:void 0!==k.find((function(t){return t===e.serverUUID}))})}),(0,r.jsx)(i.Z,{p:1,children:(0,r.jsx)(g.Z,{colour:Le(e.serverState)})}),(0,r.jsxs)(i.Z,{p:1,flexGrow:1,children:[(0,r.jsx)(b.Ac,{text:e.serverName}),(0,r.jsx)(b.Ac,{text:je.get(e.serverState)||"Not Available"})]}),(0,r.jsx)(i.Z,{display:"flex",className:Ue.hostsBox,children:"shut off"!==e.serverState&&"crashed"!==e.serverState&&H.map((function(t,n){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Z,{p:1,className:Ue.hostBox,children:(0,r.jsx)(b.Ac,{text:t.host_name,selected:e.serverHostUUID===t.host_uuid})},t.host_uuid),n!==H.length-1&&(0,r.jsx)(P.Z,{className:"".concat(Ue.divider," ").concat(Ue.verticalDivider),orientation:"vertical"})]})}))})]})},e.serverUUID),(0,r.jsx)(P.Z,{className:Ue.divider})]})}))})})]})}),(0,r.jsx)(Se.Z,{dialogProps:{open:N},onClose:function(){C(!1)}}),(0,r.jsx)(Ze.Z,Ne({closeOnProceed:!0},B,{ref:T}))]})};function ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $e="SharedStorageHost",Fe={fs:"".concat($e,"-fs"),bar:"".concat($e,"-bar"),decoratorBox:"".concat($e,"-decoratorBox")},Ge=(0,o.ZP)("div")((function(){var e;return ze(e={},"& .".concat(Fe.fs),{paddingLeft:".7em",paddingRight:".7em"}),ze(e,"& .".concat(Fe.bar),{paddingLeft:".7em",paddingRight:".7em"}),ze(e,"& .".concat(Fe.decoratorBox),{paddingRight:".3em"}),e})),He=function(e){var t=e.group,n=t.storage_group_free,o=t.storage_group_total,a=(0,s.useMemo)((function(){return BigInt(n)}),[n]),c=(0,s.useMemo)((function(){return BigInt(o)}),[o]),l=(0,s.useMemo)((function(){return c-a}),[a,c]),d=(0,s.useMemo)((function(){return Number(l*BigInt(100)/c)}),[l,c]);return(0,r.jsxs)(Ge,{children:[(0,r.jsxs)(i.Z,{display:"flex",width:"100%",className:Fe.fs,children:[(0,r.jsx)(i.Z,{flexGrow:1,children:(0,r.jsx)(b.Ac,{text:"Used: ".concat((0,re.MU)(c-a))})}),(0,r.jsx)(i.Z,{children:(0,r.jsx)(b.Ac,{text:"Free: ".concat((0,re.MU)(a))})})]}),(0,r.jsx)(i.Z,{display:"flex",width:"100%",className:Fe.bar,children:(0,r.jsx)(i.Z,{flexGrow:1,children:(0,r.jsx)(V.CD,{allocated:d})})}),(0,r.jsx)(i.Z,{display:"flex",justifyContent:"center",width:"100%",children:(0,r.jsx)(b.Ac,{text:"Total Storage: ".concat((0,re.MU)(c))})})]})};function qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ve={root:"".concat("SharedStorage","-root")},We=(0,o.ZP)("div")((function(e){var t=e.theme;return qe({},"& .".concat(Ve.root),qe({overflow:"auto",height:"78vh",paddingLeft:".3em",paddingRight:".3em"},t.breakpoints.down(d.li),{height:"100%"}))})),Xe=function(){var e=(0,s.useContext)(h).uuid,t=(0,m.Z)("".concat(l.Z,"/anvil/").concat(e,"/store")),n=t.data,o=t.isLoading;return(0,r.jsx)(x.s_,{children:(0,r.jsxs)(We,{children:[(0,r.jsx)(b.z,{text:"Shared Storage"}),o?(0,r.jsx)(F.Z,{}):(0,r.jsx)(i.Z,{className:Ve.root,children:(null===n||void 0===n?void 0:n.storage_groups)&&n.storage_groups.map((function(e){return(0,r.jsxs)(x.Lg,{children:[(0,r.jsx)(x.CH,{children:(0,r.jsx)(b.Ac,{text:e.storage_group_name})}),(0,r.jsx)(He,{group:e},e.storage_group_uuid)]},e.storage_group_uuid)}))})]})})},Je=function(){var e=(0,s.useState)(void 0),t=e[0],n=e[1];return(0,s.useEffect)((function(){var e=function(){n(window.innerWidth)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),t};function Ke(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qe="Anvil",Ye={child:"".concat(Qe,"-child"),server:"".concat(Qe,"-server"),container:"".concat(Qe,"-container")},et=(0,o.ZP)("div")((function(e){var t,n,r=e.theme;return Ke(n={},"& .".concat(Ye.child),(Ke(t={width:"22%",height:"100%"},r.breakpoints.down(d.li),{width:"50%"}),Ke(t,r.breakpoints.down("md"),{width:"100%"}),t)),Ke(n,"& .".concat(Ye.server),Ke({width:"35%",height:"100%"},r.breakpoints.down("md"),{width:"100%"})),Ke(n,"& .".concat(Ye.container),Ke({display:"flex",flexDirection:"row",width:"100%",justifyContent:"space-between"},r.breakpoints.down("md"),{display:"block"})),n})),tt=function(){var e=(0,c.useRouter)(),t=Je(),n=e.query.anvil_uuid,o=(0,s.useContext)(h),u=o.uuid,v=o.setAnvilUuid,p=(0,m.Z)("".concat(l.Z,"/anvil/summary")),g=p.data,j=p.isLoading,b=(0,s.useMemo)((function(){var e;return g&&t&&(e=t>d.li?(0,r.jsxs)(i.Z,{className:Ye.container,children:[(0,r.jsxs)(i.Z,{className:Ye.child,children:[(0,r.jsx)(z,{list:g}),(0,r.jsx)(ne,{anvil:g.anvils})]}),(0,r.jsx)(i.Z,{className:Ye.server,children:(0,r.jsx)(Re,{anvil:g.anvils})}),(0,r.jsx)(i.Z,{className:Ye.child,children:(0,r.jsx)(Xe,{})}),(0,r.jsxs)(i.Z,{className:Ye.child,children:[(0,r.jsx)(xe,{}),(0,r.jsx)(G,{}),(0,r.jsx)(oe,{})]})]}):(0,r.jsxs)(i.Z,{className:Ye.container,children:[(0,r.jsxs)(i.Z,{className:Ye.child,children:[(0,r.jsx)(Re,{anvil:g.anvils}),(0,r.jsx)(z,{list:g}),(0,r.jsx)(ne,{anvil:g.anvils})]}),(0,r.jsxs)(i.Z,{className:Ye.child,children:[(0,r.jsx)(xe,{}),(0,r.jsx)(Xe,{}),(0,r.jsx)(G,{}),(0,r.jsx)(oe,{})]})]})),e}),[g,t]),Z=(0,s.useMemo)((function(){return j?(0,r.jsx)(x.s_,{sx:{marginLeft:{xs:"1em",sm:"auto"},marginRight:{xs:"1em",sm:"auto"},marginTop:"calc(50vh - 10em)",maxWidth:{xs:void 0,sm:"60%",md:"50%",lg:"40%"},minWidth:"fit-content"},children:(0,r.jsx)(F.Z,{sx:{margin:"2em 2.4em"}})}):b}),[b,j]);return(0,s.useEffect)((function(){""===u&&v((null===n||void 0===n?void 0:n.toString())||"")}),[u,n,v]),(0,r.jsxs)(et,{children:[(0,r.jsx)(a.default,{children:(0,r.jsx)("title",{children:"Anvil"})}),(0,r.jsxs)(f,{children:[(0,r.jsx)(H.Z,{}),Z]})]})}}},function(e){e.O(0,[412,438,894,182,900,485,62,195,987,157,825,774,888,179],(function(){return t=6069,e(e.s=t);var t}));var t=e.O();_N_E=t}]); |