(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[817],{6069:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/anvil",function(){return t(2693)}])},1939:function(e,n,t){"use strict";var r=t(5893),o=t(7357),i=t(7169);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l="Decorator",u={ok:"".concat(l,"-ok"),warning:"".concat(l,"-warning"),error:"".concat(l,"-error"),off:"".concat(l,"-off")};n.Z=function(e){var n,t=e.colour,l=e.sx,d=s(e,["colour","sx"]);return(0,r.jsx)(o.Z,c({},d,{className:u[t],sx:c((n={borderRadius:i.n_,height:"100%",width:"1.4em"},a(n,"&.".concat(u.ok),{backgroundColor:i.Ej}),a(n,"&.".concat(u.warning),{backgroundColor:i.Wd}),a(n,"&.".concat(u.error),{backgroundColor:i.hM}),a(n,"&.".concat(u.off),{backgroundColor:i.s7}),n),l)}))}},6632:function(e,n,t){"use strict";var r=t(7294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}n.Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.actionProceedText,t=void 0===n?"":n,o=e.content,c=void 0===o?"":o,s=e.titleText,l=void 0===s?"":s,u=a(e,["actionProceedText","content","titleText"]);return(0,r.useState)(i({actionProceedText:t,content:c,titleText:l},u))}},2693:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return nn}});var r=t(5893),o=t(1496),i=t(7357),a=t(9008),c=t(1163),s=t(7294),l=t(2029),u=t(7169),d={uuid:"",setAnvilUuid:function(){return null}},f=(0,s.createContext)(d),h=function(e){var n=e.children,t=(0,s.useState)(""),o=t[0],i=t[1];return(0,r.jsx)(f.Provider,{value:{uuid:o,setAnvilUuid:function(e){i(e)}},children:n})},x=t(3679),v=t(1905),m=t(2852),g=new Map([["optimal","Optimal"],["not_ready","Not Ready"],["degraded","Degraded"]]),p=t(1939),j=function(e,n){return fetch(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},b=t(7750);function y(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var w={anvilName:"".concat("SelectedAnvil","-anvilName")},Z=(0,o.ZP)(i.Z)((function(){return y({display:"flex",flexDirection:"row",width:"100%"},"& .".concat(w.anvilName),{paddingLeft:0})})),_=function(e){switch(e){case"optimal":return"ok";case"not_ready":return"warning";default:return"error"}},k=function(e){return!(-1===e.hosts.findIndex((function(e){return"offline"!==e.state})))},O=function(e){var n=e.list,t=(0,s.useContext)(f).uuid,o=n.findIndex((function(e){return e.anvil_uuid===t}));return(0,r.jsx)(Z,y({},"children",""!==t&&(0,r.jsxs)(r.Fragment,y({},"children",[(0,r.jsx)(i.Z,{p:1,children:(0,r.jsx)(p.Z,{colour:_(n[o].anvil_state)})}),(0,r.jsxs)(i.Z,{p:1,flexGrow:1,className:w.anvilName,children:[(0,r.jsx)(b.z,{text:n[o].anvil_name}),(0,r.jsx)(b.z,{text:g.get(n[o].anvil_state)||"State unavailable"})]}),(0,r.jsx)(i.Z,y({p:1},"children",(0,r.jsx)(m.Z,y({checked:k(n[o])},"onChange",(function(){var e=n[o],t=e.anvil_uuid;j("".concat(l.Z,"/command/").concat(k(e)?"stop-an":"start-an","/").concat(t),{})})))))]))))},P=t(8462),S=t(7720),A=t(7212),N=function(e){var n=e.anvil;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b.Ac,{text:n.anvil_name}),(0,r.jsx)(b.Ac,{text:g.get(n.anvil_state)||"State unavailable"})]})};function C(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);te.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},ae=t(2749);function ce(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);te.length)&&(n=e.length);for(var t=0,r=new Array(n);tu.li?(0,r.jsxs)(i.Z,{className:Ye.container,children:[(0,r.jsxs)(i.Z,{className:Ye.child,children:[(0,r.jsx)(F,{list:p}),(0,r.jsx)(te,{anvil:p.anvils})]}),(0,r.jsx)(i.Z,{className:Ye.server,children:(0,r.jsx)(Re,{anvil:p.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)(H,{}),(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:p.anvils}),(0,r.jsx)(F,{list:p}),(0,r.jsx)(te,{anvil:p.anvils})]}),(0,r.jsxs)(i.Z,{className:Ye.child,children:[(0,r.jsx)(xe,{}),(0,r.jsx)(Xe,{}),(0,r.jsx)(H,{}),(0,r.jsx)(oe,{})]})]})),e}),[p,n]),y=(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)(G.Z,{sx:{margin:"2em 2.4em"}})}):b}),[b,j]);return(0,s.useEffect)((function(){""===d&&m((null===t||void 0===t?void 0:t.toString())||"")}),[d,t,m]),(0,r.jsxs)(en,{children:[(0,r.jsx)(a.default,{children:(0,r.jsx)("title",{children:"Anvil"})}),(0,r.jsxs)(h,{children:[(0,r.jsx)($.Z,{}),y]})]})}}},function(e){e.O(0,[412,438,894,182,209,638,62,195,27,157,707,774,888,179],(function(){return n=6069,e(e.s=n);var n}));var n=e.O();_N_E=n}]);