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
45 KiB
1 lines
45 KiB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[490],{329:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/config",function(){return t(6256)}])},157:function(e,n,t){"use strict";var r=t(5893),o=t(7357),i=t(8262),c=t(7294),l=t(7169),a=t(4825),u=t(4690),s=t(3679),d=t(2152),f=t(7750);function p(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function h(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function m(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){h(e,n,t[n])}))}return e}function y(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function b(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"===typeof e)return p(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var v={blue:l.Ej,red:l.hM},g=(0,c.forwardRef)((function(e,n){var t=e.actionCancelText,p=void 0===t?"Cancel":t,h=e.actionProceedText,g=e.contentContainerProps,x=void 0===g?{}:g,j=e.closeOnProceed,w=void 0!==j&&j,P=e.content,O=e.dialogProps,A=void 0===O?{}:O,Z=A.open,S=void 0!==Z&&Z,k=A.PaperProps,I=void 0===k?{}:k,C=e.disableProceed,T=e.formContent,E=e.loading,M=void 0!==E&&E,D=e.loadingAction,F=void 0!==D&&D,U=e.onActionAppend,R=e.onCancelAppend,N=e.onProceedAppend,B=e.onSubmitAppend,L=e.openInitially,_=void 0!==L&&L,H=e.preActionArea,V=e.proceedButtonProps,$=void 0===V?{}:V,G=e.proceedColour,W=void 0===G?"blue":G,q=e.scrollContent,z=void 0!==q&&q,K=e.scrollBoxProps,X=(void 0===K?{}:K).sx,J=e.titleText,Y=y(e.dialogProps,["open","PaperProps"]),Q=y(e.scrollBoxProps,["sx"]),ee=I.sx,ne=y(I,["sx"]),te=$.disabled,re=void 0===te?C:te,oe=$.sx,ie=y($,["disabled","sx"]),ce=(0,c.useState)(_),le=ce[0],ae=ce[1],ue=(0,c.useMemo)((function(){return n?le:S}),[S,le,n]),se=(0,c.useMemo)((function(){return v[W]}),[W]),de=(0,c.useMemo)((function(){var e,n,t,r=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r,o;w&&ae(!1),null===U||void 0===U||(r=U).call.apply(r,[null].concat(b(n))),null===N||void 0===N||(o=N).call.apply(o,[null].concat(b(n)))};return T&&(e="form",n=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o;e.preventDefault(),w&&ae(!1),null===B||void 0===B||(o=B).call.apply(o,[null,e].concat(b(t)))},r=void 0,t="submit"),{contentContainerComponent:e,contentContainerSubmitEventHandler:n,proceedButtonClickEventHandler:r,proceedButtonType:t}}),[w,T,U,N,B]),fe=de.contentContainerComponent,pe=de.contentContainerSubmitEventHandler,he=de.proceedButtonClickEventHandler,me=de.proceedButtonType,ye=(0,c.useMemo)((function(){return(0,r.jsx)(a.Z,{onClick:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r,o;ae(!1),null===U||void 0===U||(r=U).call.apply(r,[null].concat(b(n))),null===R||void 0===R||(o=R).call.apply(o,[null].concat(b(n)))},children:p})}),[p,U,R]),be=(0,c.useMemo)((function(){return(0,r.jsx)(a.Z,m({disabled:re,onClick:he,type:me},ie,{sx:m({backgroundColor:se,color:l.lD,"&:hover":{backgroundColor:"".concat(se,"F0")}},oe),children:h}))}),[h,he,re,oe,me,se,ie]),ve=(0,c.useMemo)((function(){return F?(0,r.jsx)(d.Z,{mt:0}):(0,r.jsxs)(u.Z,{row:!0,spacing:".5em",sx:{justifyContent:"flex-end",width:"100%"},children:[ye,be]})}),[ye,F,be]),ge=(0,c.useMemo)((function(){return"string"===typeof P?(0,r.jsx)(f.Ac,{text:P}):P}),[P]),xe=(0,c.useMemo)((function(){return"string"===typeof J?(0,r.jsx)(f.z,{children:J}):J}),[J]),je=(0,c.useMemo)((function(){var e,n,t;z&&(T&&(n="hidden",t=".6em"),e=m({maxHeight:"60vh",overflowX:n,overflowY:"scroll",paddingRight:".4em",paddingTop:t},X));return e}),[T,z,X]),we=(0,c.useMemo)((function(){return M?(0,r.jsx)(d.Z,{}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,m({},Q,{sx:je,children:ge})),H,ve]})}),[ve,je,ge,M,H,Q]);return(0,c.useImperativeHandle)(n,(function(){return{setOpen:function(e){return ae(e)}}}),[]),(0,r.jsxs)(i.Z,m({open:ue,PaperComponent:s.s_,PaperProps:m({},ne,{sx:m({overflow:"visible"},ee)})},Y,{children:[(0,r.jsx)(s.V9,{children:xe}),(0,r.jsx)(u.Z,m({component:fe,onSubmit:pe},x,{children:we}))]}))}));g.displayName="ConfirmDialog",n.Z=g},2545:function(e,n,t){"use strict";var r=t(5893),o=t(7294),i=t(157);function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var l=(0,o.forwardRef)((function(e,n){var t=e.scrollContent,l=(0,o.useMemo)((function(){return t?".5em":void 0}),[t]);return(0,r.jsx)(i.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){c(e,n,t[n])}))}return e}({dialogProps:{PaperProps:{sx:{minWidth:{xs:"90%",md:"50em"}}}},formContent:!0,scrollBoxProps:{paddingRight:l,paddingTop:".3em"}},e,{ref:n}))}));l.displayName="FormDialog",n.Z=l},5741:function(e,n,t){"use strict";var r=t(5893),o=t(1714),i=t(122),c=t(7169),l=t(4690);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 u(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){a(e,n,t[n])}))}return e}function s(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}n.Z=function(e){var n=e.children,t=e.sx,a=s(e,["children","sx"]);return(0,r.jsx)(i.Z,u({underline:"hover",variant:"subtitle1"},a,{sx:u({color:c.lD,textDecorationColor:c.s7},t),children:(0,r.jsxs)(l.Z,{row:!0,children:[n,(0,r.jsx)(o.Z,{sx:{marginLeft:".3em"}})]})}))}},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<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){o(e,n,t[n])}))}return e}function c(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=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,l=void 0===o?"":o,a=e.titleText,u=void 0===a?"":a,s=c(e,["actionProceedText","content","titleText"]);return(0,r.useState)(i({actionProceedText:t,content:l,titleText:u},s))}},3106:function(e,n){"use strict";n.Z={bcn:"Back-Channel Network",ifn:"Internet-Facing Network",mn:"Migration Network",sn:"Storage Network"}},6256:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return sn}});var r=t(5893),o=t(6886),i=t(9008),c=t(7294),l=t(2029),a=t(157),u=t(5521),s=t(1905),d=t(3106),f=t(4188),p=t(4390);function h(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function m(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],c=!0,l=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);c=!0);}catch(a){l=!0,o=a}finally{try{c||null==t.return||t.return()}finally{if(l)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,n)}(e,n)||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 y=function(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,o=function(t){var r;null===(r=n.current.setMessage)||void 0===r||r.call(null,e,t)};return t&&(t[r]=o),o},b=function(e,n){var t,r,o={};return t=e,o=(null!=(r=Array)&&"undefined"!==typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](t):t instanceof r)?e.reduce((function(e,t){return y(t,n,e),e}),o):Object.entries(e).reduce((function(e,t){var r=m(t,2),o=r[0],i=r[1];return y(i,n,e,o),e}),o)},v=t(4894),g=t(6607),x=t(480),j=t(2349),w=t(7750);function P(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function O(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){P(e,n,t[n])}))}return e}var A=function(e){var n=e.checkboxProps,t=e.checked,o=e.formControlLabelProps,i=e.label,l=e.onChange,a=(0,c.useMemo)((function(){return"string"===typeof i?(0,r.jsx)(w.Ac,{children:i}):i}),[i]);return(0,r.jsx)(x.Z,O({},o,{control:(0,r.jsx)(j.Z,O({},n,{checked:t,onChange:l})),label:a}))},Z=t(4690),S=t(7504),k=t(1770),I=t(9099),C=t(7869),T=t(6284),E=t(7987),M=t(3144),D=t(2749);function F(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function U(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],c=!0,l=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);c=!0);}catch(a){l=!0,o=a}finally{try{c||null==t.return||t.return()}finally{if(l)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return F(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return F(e,n)}(e,n)||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 R={dbPort:"dbPort",ipAddress:"ipAddress",password:"password",sshPort:"sshPort",user:"user"},N="DB port",B="IP address",L="Password",_="Ping",H="SSH port",V="User",$=(0,c.forwardRef)((function(e,n){var t=e.formGridColumns,o=void 0===t?2:t,i=(0,M.Z)().protect,l=(0,c.useRef)({}),u=(0,c.useRef)({}),s=(0,c.useRef)({}),d=(0,c.useRef)({}),h=(0,c.useRef)({}),m=(0,c.useRef)({}),y=(0,c.useState)({}),x=y[0],j=y[1],P=(0,c.useState)(!1),O=P[0],F=P[1],$=U((0,D.Z)(!1,i),2),G=$[0],W=$[1],q=(0,c.useCallback)((function(e){return function(n){var t=n.isValid;j((0,g.ZP)(e,t))}}),[]),z=(0,c.useCallback)((function(e){return function(n){j((0,g.ZP)(e,n))}}),[]),K=(0,c.useCallback)((function(e){var n;null===(n=m.current.setMessage)||void 0===n||n.call(null,"api",e)}),[]),X=(0,c.useMemo)((function(){return Object.values(x).some((function(e){return!e}))}),[x]),J=(0,c.useMemo)((function(){return b(R,m)}),[]);return(0,r.jsx)(a.Z,{actionProceedText:"Add",content:(0,r.jsx)(S.Z,{columns:{xs:1,sm:o},layout:{"add-peer-user-and-ip-address":{children:(0,r.jsxs)(Z.Z,{row:!0,spacing:".3em",children:[(0,r.jsx)(I.Z,{input:(0,r.jsx)(T.Z,{formControlProps:{sx:{minWidth:"4.6em",width:"25%"}},id:"add-peer-user-input",inputProps:{placeholder:"admin"},label:V}),inputTestBatch:(0,E.Gn)(V,(function(){J.user()}),{onFinishBatch:z(R.user)},(function(e){J.user({children:e})})),onFirstRender:q(R.user),ref:h}),(0,r.jsx)(w.Ac,{children:"@"}),(0,r.jsx)(I.Z,{input:(0,r.jsx)(T.Z,{id:"add-peer-ip-address-input",label:B}),inputTestBatch:(0,E._)(B,(function(){J.ipAddress()}),{onFinishBatch:z(R.ipAddress)},(function(e){J.ipAddress({children:e})})),onFirstRender:q(R.ipAddress),ref:u,required:!0})]})},"add-peer-password":{children:(0,r.jsx)(I.Z,{input:(0,r.jsx)(T.Z,{fillRow:!0,id:"add-peer-password-input",label:L,type:f.Z.password}),inputTestBatch:(0,E.Gn)(L,(function(){J.password()}),{onFinishBatch:z(R.password)},(function(e){J.password({children:e})})),onFirstRender:q(R.password),ref:s,required:!0})},"add-peer-db-and-ssh-port":{children:(0,r.jsxs)(Z.Z,{row:!0,children:[(0,r.jsx)(I.Z,{input:(0,r.jsx)(T.Z,{id:"add-peer-db-port-input",inputProps:{placeholder:"5432"},label:N}),inputTestBatch:(0,v.Z)(N,(function(){J.dbPort()}),{onFinishBatch:z(R.dbPort)},(function(e){J.dbPort({children:e})})),onFirstRender:q(R.dbPort),ref:l}),(0,r.jsx)(I.Z,{input:(0,r.jsx)(T.Z,{id:"add-peer-ssh-port-input",inputProps:{placeholder:"22"},label:H}),inputTestBatch:(0,v.Z)(H,(function(){J.sshPort()}),{onFinishBatch:z(R.sshPort)},(function(e){J.sshPort({children:e})})),onFirstRender:q(R.sshPort),ref:d})]})},"add-peer-is-ping":{children:(0,r.jsx)(A,{checked:O,label:_,onChange:function(e,n){F(n)}}),sx:{display:"flex"}},"add-peer-message-group":{children:(0,r.jsx)(C.Z,{count:1,defaultMessageType:"warning",ref:m}),sm:o}},spacing:"1em"}),dialogProps:{PaperProps:{sx:{minWidth:"16em"}}},loadingAction:G,onActionAppend:function(){K()},onProceedAppend:function(){var e,n,t,r,o;W(!0),p.Z.post("/host/connection",{ipAddress:null===(e=u.current.getValue)||void 0===e?void 0:e.call(null),isPing:O,password:null===(n=s.current.getValue)||void 0===n?void 0:n.call(null),port:null===(t=l.current.getValue)||void 0===t?void 0:t.call(null),sshPort:null===(r=d.current.getValue)||void 0===r?void 0:r.call(null),user:null===(o=h.current.getValue)||void 0===o?void 0:o.call(null)}).then((function(){K({children:"Successfully initiated the peer addition. You can continue to edit the field(s) to add another peer.",type:"info"})})).catch((function(e){var n=(0,k.Z)(e);n.children="Failed to add the given peer. ".concat(n.children),K(n)})).finally((function(){W(!1)}))},proceedButtonProps:{disabled:X},ref:n,titleText:"Add a peer"})}));$.displayName="AddPeerDialog";var G=$,W=t(6125),q=t(8187),z=t(3679),K=t(5537),X=t(2026),J=t(7169),Y={small:w.KI,medium:w.Ac},Q={size:"small",stateMap:new Map([[!1,(0,r.jsx)(K.Z,{sx:{color:J.Wd}},"state-false")],[!0,(0,r.jsx)(X.Z,{sx:{color:J.Ej}},"state-true")]])},ee=function(e){var n=e.label,t=e.size,o=void 0===t?Q.size:t,i=e.state,l=e.stateMap,a=(void 0===l?Q.stateMap:l).get(i);return(0,r.jsxs)(Z.Z,{row:!0,spacing:".3em",children:[a&&(0,c.cloneElement)(a,{fontSize:o}),(0,c.createElement)(Y[o],{},n)]})};ee.defaultProps=Q;var ne=ee;function te(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function re(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function oe(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){re(e,n,t[n])}))}return e}function ie(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],c=!0,l=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);c=!0);}catch(a){l=!0,o=a}finally{try{c||null==t.return||t.return()}finally{if(l)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return te(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return te(e,n)}(e,n)||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 ce=function(e){var n=e.refreshInterval,t=void 0===n?6e4:n,i=(0,M.Z)().protect,u=(0,c.useRef)({}),f=(0,c.useRef)({}),h=ie((0,D.Z)(void 0,i),2),m=h[0],y=h[1],b=(0,c.useState)({actionProceedText:"",content:"",titleText:""}),v=b[0],g=b[1],x=ie((0,D.Z)({},i),2),j=x[0],P=x[1],O=(0,c.useState)(!1),A=O[0],S=O[1],I=ie((0,D.Z)({},i),2),C=I[0],T=I[1],E=(0,c.useMemo)((function(){return m&&(0,r.jsx)(o.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(q.Z,oe({},m))})}),[m]),F=(0,s.Z)("".concat(l.Z,"/host/connection"),{refreshInterval:t,onError:function(e){y({children:"Failed to get connection data. Error: ".concat(e),type:"error"})},onSuccess:function(e){var n=e.local,t=n.inbound,r=t.ipAddress,o=t.port,i=t.user,c=n.peer;P((function(e){return Object.entries(r).reduce((function(n,t){var r=ie(t,2),c=r[0],l=r[1],a=l.networkLinkNumber,u=l.networkNumber,s=l.networkType;return n[c]=oe({},e[c],{dbPort:o,dbUser:i,ipAddress:c,networkLinkNumber:a,networkNumber:u,networkType:s}),n}),{})})),T((function(e){return Object.entries(c).reduce((function(n,t){var r=ie(t,2),o=r[0],i=r[1],c=i.hostUUID,l=i.isPing,a=i.port,u=i.user,s="".concat(u,"@").concat(o,":").concat(a);return n[s]=oe({},e[s],{dbPort:a,dbUser:u,hostUUID:c,ipAddress:o,isPingTest:l}),n}),{})}))}}).isLoading;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z.TZ,{header:"Configure striker peers",loading:F,children:(0,r.jsxs)(o.ZP,{columns:{xs:1,sm:2},container:!0,spacing:"1em",children:[(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(W.Z,{header:"Inbound connections",listEmpty:(0,r.jsx)(w.Ac,{align:"center",children:"No inbound connections found."}),listItemKeyPrefix:"config-peers-inbound-connection",listItems:j,renderListItem:function(e,n){var t=n.dbPort,o=n.dbUser,i=n.networkNumber,c=n.networkType;return(0,r.jsxs)(Z.Z,{spacing:0,sx:{width:"100%"},children:[(0,r.jsx)(w.$_,{children:"".concat(o,"@").concat(e,":").concat(t)}),(0,r.jsx)(w.KI,{children:"".concat(d.Z[c]," ").concat(i)})]})}})}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(W.Z,{header:"Peer connections",allowEdit:!0,edit:A,listEmpty:(0,r.jsx)(w.Ac,{align:"center",children:"No peer connections found."}),listItemKeyPrefix:"config-peers-peer-connection",listItems:C,onAdd:function(){var e;null===(e=u.current.setOpen)||void 0===e||e.call(null,!0)},onDelete:function(){var e,n=Object.entries(C).reduce((function(e,n){var t=ie(n,2)[1],r=t.hostUUID;return t.isChecked&&e.local.push(r),e}),{local:[]}),t=n.local.length;t>0&&(g({actionProceedText:"Delete",content:"The peer relationship between this striker and the selected ".concat(t," host(s) will terminate. The removed peer(s) can be re-added later."),onProceedAppend:function(){p.Z.delete("/host/connection",{data:n}).catch((function(e){var n=(0,k.Z)(e);n.children="Failed to delete peer connection(s). ".concat(n.children),y(n)}))},proceedColour:"red",titleText:"Delete ".concat(t," peer(s) from this striker?")}),null===(e=f.current.setOpen)||void 0===e||e.call(null,!0))},onEdit:function(){S((function(e){return!e}))},onItemCheckboxChange:function(e,n,t){C[e].isChecked=t,T((function(e){return oe({},e)}))},renderListItem:function(e,n){var t=n.isPingTest,o=void 0!==t&&t;return(0,r.jsx)(Z.Z,{row:!0,spacing:0,children:(0,r.jsxs)(Z.Z,{spacing:0,children:[(0,r.jsx)(w.$_,{children:e}),(0,r.jsx)(ne,{label:"Ping",state:o})]})})}})}),E]})}),(0,r.jsx)(G,{ref:u}),(0,r.jsx)(a.Z,oe({closeOnProceed:!0},v,{ref:f}))]})},le=t(582),ae=t(5741);function ue(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function se(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function de(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){se(e,n,t[n])}))}return e}function fe(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],c=!0,l=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);c=!0);}catch(a){l=!0,o=a}finally{try{c||null==t.return||t.return()}finally{if(l)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return ue(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ue(e,n)}(e,n)||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 pe=function(e){var n=e.mitmExternalHref,t=void 0===n?"https://en.wikipedia.org/wiki/Man-in-the-middle_attack":n,o=e.refreshInterval,i=void 0===o?6e4:o,u=(0,M.Z)().protect,d=(0,c.useRef)({}),f=(0,c.useRef)({}),h=fe((0,D.Z)(void 0,u),2),m=h[0],y=h[1],b=fe((0,D.Z)({},u),2),v=b[0],g=b[1],x=fe((0,D.Z)({actionProceedText:"",content:"",titleText:""},u),2),j=x[0],P=x[1],O=(0,c.useMemo)((function(){return m&&(0,r.jsx)(q.Z,de({},m))}),[m]),A=(0,c.useMemo)((function(){return Object.keys(v).length>1}),[v]),S=(0,s.Z)("".concat(l.Z,"/ssh-key/conflict"),{onError:function(e){y({children:"Failed to fetch SSH key conflicts. Error: ".concat(e),type:"error"})},onSuccess:function(e){g((function(n){return Object.values(e).reduce((function(e,t){return Object.values(t).forEach((function(t){var r=t.hostName,o=t.hostUUID,i=t.ipAddress,c=t.stateUUID;e[c]=de({},n[c],{hostName:r,hostUUID:o,ipAddress:i})})),e}),{})}))},refreshInterval:i}).isLoading;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(z.TZ,{header:"Manage changed SSH keys",loading:S,children:[(0,r.jsxs)(Z.Z,{spacing:".2em",children:[(0,r.jsx)(w.Ac,{children:"The identity of the following targets have unexpectedly changed."}),(0,r.jsxs)(q.Z,{type:"warning",isAllowClose:!0,children:["If you haven't rebuilt the listed targets, then you could be experiencing a"," ",(0,r.jsx)(ae.Z,{href:t,sx:{display:"inline-flex"},target:"_blank",children:'"Man In The Middle"'})," ","attack. Please verify the targets have changed for a known reason before proceeding to remove the broken keys."]}),(0,r.jsx)(W.Z,{header:(0,r.jsxs)(Z.Z,{row:!0,spacing:".3em",sx:{width:"100%","& > :not(:last-child)":{display:{xs:"none",sm:"flex"}},"& > :last-child":{display:{xs:"initial",sm:"none"},marginLeft:0}},children:[(0,r.jsxs)(Z.Z,{row:!0,spacing:".3em",sx:{flexBasis:"calc(50% + 1em)"},children:[(0,r.jsx)(w.Ac,{children:"Host name"}),(0,r.jsx)(le.Z,{sx:{flexGrow:1}})]}),(0,r.jsxs)(Z.Z,{row:!0,spacing:".3em",sx:{flexGrow:1},children:[(0,r.jsx)(w.Ac,{children:"IP address"}),(0,r.jsx)(le.Z,{sx:{flexGrow:1}})]}),(0,r.jsx)(le.Z,{sx:{flexGrow:1}})]}),allowCheckAll:A,allowCheckItem:!0,allowDelete:!0,allowEdit:!1,edit:!0,listEmpty:(0,r.jsx)(w.Ac,{align:"center",children:"No conflicting keys found."}),listItems:v,onAllCheckboxChange:function(e,n){Object.keys(v).forEach((function(e){v[e].isChecked=n})),g((function(e){return de({},e)}))},onDelete:function(){var e,n=0,t=Object.entries(v).reduce((function(e,t){var r=fe(t,2),o=r[0],i=r[1],c=i.hostUUID;return i.isChecked&&(e[c]||(e[c]=[]),e[c].push(o),n+=1),e}),{});P({actionProceedText:"Delete",content:"Resolve ".concat(n," SSH key conflicts. Please make sure the identity change(s) are expected to avoid MITM attacks."),onProceedAppend:function(){p.Z.delete("/ssh-key/conflict",{data:t}).catch((function(e){var n=(0,k.Z)(e);n.children="Failed to delete selected SSH key conflicts. ".concat(n.children),y(n)}))},proceedColour:"red",titleText:"Delete ".concat(n," conflicting SSH keys?")}),null===(e=d.current.setOpen)||void 0===e||e.call(null,!0)},onItemCheckboxChange:function(e,n,t){var r;v[e].isChecked=t,null===(r=f.current.setCheckAll)||void 0===r||r.call(null,Object.values(v).every((function(e){return e.isChecked}))),g((function(e){return de({},e)}))},renderListItem:function(e,n){var t=n.hostName,o=n.ipAddress;return(0,r.jsxs)(Z.Z,{spacing:0,sm:"row",sx:{width:"100%","& > *":{flexBasis:"50%"}},xs:"column",children:[(0,r.jsx)(w.Ac,{children:t}),(0,r.jsx)(w.Ac,{children:o})]})},renderListItemCheckboxState:function(e,n){return!0===n.isChecked},ref:f})]}),O]}),(0,r.jsx)(a.Z,de({closeOnProceed:!0},j,{ref:d}))]})};function he(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function me(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){he(e,n,t[n])}))}return e}var ye="common-user-input-confirm-password",be="common-user-input-name",ve="common-user-input-password",ge="Username",xe="Password",je=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,o=n.buildInputFirstRenderFunction,i=n.setMessage,l=n.setValidity,a=e.previous,u=(void 0===a?{}:a).name,s=e.readOnlyUserName,d=e.requirePassword,p=void 0!==d&&d,h=e.showPasswordField,m=(0,c.useRef)({}),y=(0,c.useRef)({}),b=(0,c.useState)(p),v=b[0],g=b[1],x=(0,c.useMemo)((function(){return h?{"common-user-input-cell-password":{children:(0,r.jsx)(I.Z,{input:(0,r.jsx)(T.Z,{id:ve,label:xe,type:f.Z.password}),inputTestBatch:(0,E.Gn)(xe,(function(){i(ve)}),{onFinishBatch:t(ve)},(function(e){i(ve,{children:e})})),onBlurAppend:function(e){var n,t=e.target.value;g(t.length>0),l(ye,t===(null===(n=y.current.getValue)||void 0===n?void 0:n.call(null)))},onFirstRender:o(ve),ref:m,required:p})},"common-user-input-cell-confirm-password":{children:(0,r.jsx)(I.Z,{input:(0,r.jsx)(T.Z,{id:ye,inputProps:{readOnly:!v},label:"Confirm password",type:f.Z.password}),inputTestBatch:{defaults:{onSuccess:function(){i(ye)}},onFinishBatch:t(ye),tests:[{test:E.HJ},{onFailure:function(){i(ye,{children:"The passwords do not match."})},test:function(e){var n;return e.value===(null===(n=m.current.getValue)||void 0===n?void 0:n.call(null))}}]},onFirstRender:o(ye),ref:y,required:v})}}:void 0}),[t,o,v,p,i,l,h]);return(0,r.jsx)(S.Z,{columns:{xs:1,sm:2,md:3},layout:me({"common-user-input-cell-name":{children:(0,r.jsx)(I.Z,{input:(0,r.jsx)(T.Z,{id:be,inputProps:{readOnly:s},label:ge,value:u}),inputTestBatch:(0,E.Gn)(ge,(function(){i(be)}),{onFinishBatch:t(be)},(function(e){i(be,{children:e})})),onFirstRender:o(be),required:!0}),md:1,sm:2}},x),spacing:"1em"})},we=t(2545),Pe=t(7212),Oe=t(8462),Ae=t(8216);function Ze(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Se(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ke(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Se(e,n,t[n])}))}return e}function Ie(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],c=!0,l=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);c=!0);}catch(a){l=!0,o=a}finally{try{c||null==t.return||t.return()}finally{if(l)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Ze(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ze(e,n)}(e,n)||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 Ce=function(e,n){var t=/passw/i.test(e)?w.PJ:w.$_;return(0,c.createElement)(t,{monospaced:!0},String(n))},Te=function(e){var n=e.depth,t=void 0===n?0:n,o=e.entries,i=e.getEntryLabel,c=e.getListProps,l=e.getListItemProps,a=e.listKey,u=e.maxDepth,s=e.renderEntry,d=e.renderEntryValue,f=[];Object.entries(o).forEach((function(e){var n=Ie(e,2),o=n[0],c=n[1],a="form-summary-entry-".concat(o),p=null!==c&&"object"===typeof c,h=p?null:c;f.push((0,r.jsx)(Pe.ZP,ke({sx:{paddingLeft:".".concat(2*t,"em")}},null===l||void 0===l?void 0:l.call(null,o,h,t),{children:s(o,h,i,d)}),a)),p&&t<u&&f.push(Te({depth:t+1,entries:c,getEntryLabel:i,listKey:o,maxDepth:u,renderEntry:s,renderEntryValue:d}))}));var p="form-summary-list-".concat(null!==a&&void 0!==a?a:"root");return(0,r.jsx)(Oe.Z,ke({dense:!0},null===c||void 0===c?void 0:c.call(null,a,o,t),{children:f}),p)},Ee=function(e){var n=e.entries,t=e.getEntryLabel,o=void 0===t?function(e){var n=e.replace(/([a-z\d])([A-Z])/g,"$1 $2").toLowerCase();return(0,Ae.Z)(n)}:t,i=e.getListProps,c=e.getListItemProps,l=e.hasPassword,a=e.maxDepth,u=void 0===a?3:a,s=e.renderEntry,d=void 0===s?function(e,n,t,o){return(0,r.jsxs)(Z.Z,{fullWidth:!0,growFirst:!0,row:!0,children:[(0,r.jsx)(w.Ac,{children:t(e,n)}),o(e,n)]})}:s,f=e.renderEntryValue;return Te({entries:n,getEntryLabel:o,getListProps:i,getListItemProps:c,maxDepth:u,renderEntry:d,renderEntryValue:void 0===f?l?Ce:function(e,n){return(0,r.jsx)(w.$_,{children:String(n)})}:f})};function Me(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function De(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Me(e,n,t[n])}))}return e}var Fe=function(){var e=(0,c.useState)({}),n=e[0],t=e[1],o=(0,c.useMemo)((function(){return Object.keys(n)}),[n]),i=(0,c.useMemo)((function(){return o.length>0}),[o.length]),l=(0,c.useCallback)((function(e){var t=e.confirmDialogProps,i=void 0===t?{}:t,c=e.formSummaryProps,l=void 0===c?{}:c,a=e.getConfirmDialogTitle;return De({actionProceedText:"Delete",content:(0,r.jsx)(Ee,De({entries:n,maxDepth:0},l)),proceedColour:"red",titleText:a(o.length)},i)}),[n,o.length]),a=(0,c.useCallback)((function(e){return n[e]}),[n]),u=(0,c.useCallback)((function(e,n){return t((0,g.ZP)(e,n||void 0))}),[]);return{buildDeleteDialogProps:l,checklist:n,checks:o,getCheck:a,hasChecks:i,setCheck:u}},Ue=t(6632),Re=t(8859);function Ne(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Be(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Le(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Be(e,n,t[n])}))}return e}function _e(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],c=!0,l=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);c=!0);}catch(a){l=!0,o=a}finally{try{c||null==t.return||t.return()}finally{if(l)throw o}}return i}}(e,n)||Ve(e,n)||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 He(e){return function(e){if(Array.isArray(e))return Ne(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ve(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 Ve(e,n){if(e){if("string"===typeof e)return Ne(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ne(e,n):void 0}}var $e=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=_e(n,1),o=r[0].target,i=o.elements,c=i.namedItem(be),l=c.value,a=i.namedItem(ve),u="";a&&(u=a.value);return{password:u,userName:l}},Ge=function(){var e=(0,c.useRef)({}),n=(0,c.useRef)({}),t=(0,c.useRef)({}),o=(0,c.useRef)({}),i=_e((0,Ue.Z)(),2),u=i[0],d=i[1],f=(0,c.useState)(!1),p=f[0],h=f[1],m=_e((0,D.Z)({children:"No users found."}),2),y=m[0],b=m[1],v=_e((0,D.Z)(void 0),2),g=v[0],x=v[1],j=(0,s.Z)("".concat(l.Z,"/user"),{onError:function(e){b((0,k.Z)(e))}}),P=j.data,O=j.isLoading,A=(0,Re.Z)([ye,be,ve],o),Z=A.isFormInvalid,S=A.isFormSubmitting,I=A.submitForm,T=Fe(),E=T.buildDeleteDialogProps,M=T.checks,F=T.getCheck,U=T.hasChecks,R=T.setCheck,N=(0,c.useMemo)((function(){return null!==g&&void 0!==g?g:{}}),[g]),B=N.userName,L=N.userUUID,_=(0,c.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(je,{formUtils:A,requirePassword:!0,showPasswordField:!0}),onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,c=$e.apply(void 0,He(t));d({actionProceedText:"Add",content:(0,r.jsx)(Ee,{entries:c,hasPassword:!0}),onProceedAppend:function(){I({body:c,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Add user failed. ",e]})},method:"post",successMsg:"Created user ".concat(c.userName,"."),url:"/user"})},titleText:"Add the following new user?"}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},titleText:"Add a web interface user"}}),[A,d,I]),H=(0,c.useMemo)((function(){return{actionProceedText:"Edit",content:(0,r.jsx)(je,{formUtils:A,previous:{name:B},readOnlyUserName:"admin"===B,showPasswordField:!0}),onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,c=$e.apply(void 0,He(t));d({actionProceedText:"Update",content:(0,r.jsx)(Ee,{entries:c,hasPassword:!0}),onProceedAppend:function(){I({body:c,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Update user failed. ",e]})},method:"put",successMsg:"Updated user ".concat(B),url:"/user/".concat(L)})},titleText:"Update user ".concat(B," with the following?")}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},titleText:"Edit user ".concat(B)}}),[A,d,I,B,L]),V=(0,c.useMemo)((function(){return(0,r.jsx)(C.Z,{count:1,defaultMessageType:"warning",ref:o})}),[]),$=(0,c.useMemo)((function(){var e;return"admin"===(null===P||void 0===P||null===(e=P.current)||void 0===e?void 0:e.userName)}),[P]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z.TZ,{header:"Manage users",loading:O,children:(0,r.jsx)(W.Z,{allowAddItem:$,allowDelete:$,allowEdit:!0,allowItemButton:p,disableDelete:!U,edit:p,getListItemCheckboxProps:function(e,n){return{disabled:"admin"===n.userName}},header:!0,listEmpty:(0,r.jsx)(q.Z,Le({},y)),listItems:P,onAdd:function(){var n;null===(n=e.current.setOpen)||void 0===n||n.call(null,!0)},onDelete:function(){var e;d(E({confirmDialogProps:{onProceedAppend:function(){I({body:{uuids:M},getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Delete user(s) failed. ",e]})},method:"delete",url:"/user"})}},formSummaryProps:{renderEntry:function(e){return(0,r.jsx)(w.Ac,{children:null===P||void 0===P?void 0:P[e].userName})}},getConfirmDialogTitle:function(e){return"Delete the following ".concat(e," users?")}})),null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){return h((function(e){return!e}))},onItemCheckboxChange:function(e,n){var t=n.target.checked;return R(e,t)},onItemClick:function(e){var n;p&&(x(e),null===(n=t.current.setOpen)||void 0===n||n.call(null,!0))},renderListItemCheckboxState:function(e){return F(e)},renderListItem:function(e,n){var t=n.userName;return(0,r.jsx)(w.Ac,{children:t})}})}),(0,r.jsx)(we.Z,Le({},_,{disableProceed:Z,loadingAction:S,preActionArea:V,ref:e})),(0,r.jsx)(we.Z,Le({},H,{disableProceed:Z,loadingAction:S,preActionArea:V,ref:t})),(0,r.jsx)(a.Z,Le({closeOnProceed:!0},u,{ref:n}))]})},We=function(){return(0,r.jsxs)(z.s_,{children:[(0,r.jsx)(ce,{}),(0,r.jsx)(pe,{}),(0,r.jsx)(Ge,{})]})},qe=t(2852),ze=t(4825),Ke=t(2152);function Xe(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Je(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ye(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Je(e,n,t[n])}))}return e}function Qe(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],c=!0,l=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);c=!0);}catch(a){l=!0,o=a}finally{try{c||null==t.return||t.return()}finally{if(l)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Xe(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Xe(e,n)}(e,n)||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 en=function(e){return(0,r.jsx)(ze.Z,Ye({},e,{sx:{width:"100%"}}))},nn=function(e){var n=e.installTarget,t=void 0===n?"disabled":n,i=e.onSubmit,l=e.title,a=(0,M.Z)().protect,u=Qe((0,D.Z)(void 0,a),2),s=u[0],d=u[1],f=(0,c.useMemo)((function(){return l?(0,r.jsx)(w.z,{sx:{textAlign:"center"},children:l}):(0,r.jsx)(Ke.Z,{mt:0})}),[l]),h=(0,c.useMemo)((function(){return s&&(0,r.jsx)(o.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(q.Z,Ye({},s,{onClose:function(){d(void 0)}}))})}),[s,d]);return(0,r.jsxs)(z.s_,{children:[(0,r.jsx)(z.V9,{children:f}),(0,r.jsxs)(o.ZP,{columns:{xs:1,sm:2},container:!0,spacing:"1em",children:[(0,r.jsx)(o.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsxs)(Z.Z,{row:!0,children:[(0,r.jsx)(w.Ac,{sx:{flexGrow:1},children:"Install target"}),(0,r.jsx)(qe.Z,{checked:"enabled"===t,edge:"end",onChange:function(e,n){var t="disable",o="Disable";n&&(t="enable",o="Enable"),null===i||void 0===i||i.call(null,{actionProceedText:o,content:(0,r.jsxs)(w.Ac,{children:["Would you like to ",t,' "Install target" on this striker? It\'ll take a few moments to complete.']}),onProceedAppend:function(){p.Z.put("/host/local",{isEnableInstallTarget:n},{params:{handler:"install-target"}}).catch((function(e){var n=(0,k.Z)(e);n.children="Failed to ".concat(t,' "Install target". ').concat(n.children),d(n)}))},titleText:"".concat(o,' "Install target" on ').concat(l,"?")})}})]})}),(0,r.jsx)(o.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(en,{onClick:function(){null===i||void 0===i||i.call(null,{actionProceedText:"Update",content:(0,r.jsx)(w.Ac,{children:"Would you like to update the operating system on this striker? It'll be placed into maintenance mode until the update completes."}),onProceedAppend:function(){p.Z.put("/command/update-system").catch((function(e){var n=(0,k.Z)(e);n.children="Failed to initiate system update. ".concat(n.children),d(n)}))},titleText:"Update operating system on ".concat(l,"?")})},children:"Update system"})}),(0,r.jsx)(o.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(en,{children:"Reconfigure striker"})}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(en,{onClick:function(){null===i||void 0===i||i.call(null,{actionProceedText:"Reboot",content:(0,r.jsx)(w.Ac,{children:"Would you like to reboot this striker?"}),onProceedAppend:function(){p.Z.put("/command/reboot-host").catch((function(e){var n=(0,k.Z)(e);n.children="Failed to initiate system reboot. ".concat(n.children),d(n)}))},titleText:"Reboot ".concat(l,"?")})},children:"Reboot"})}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(en,{onClick:function(){null===i||void 0===i||i.call(null,{actionProceedText:"Shutdown",content:(0,r.jsx)(w.Ac,{children:"Would you like to shutdown this striker?"}),onProceedAppend:function(){p.Z.put("/command/poweroff-host").catch((function(e){var n=(0,k.Z)(e);n.children="Failed to initiate system shutdown. ".concat(n.children),d(n)}))},titleText:"Shutdown ".concat(l,"?")})},children:"Shutdown"})}),h]})]})};function tn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function rn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function on(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){rn(e,n,t[n])}))}return e}function cn(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function ln(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],c=!0,l=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);c=!0);}catch(a){l=!0,o=a}finally{try{c||null==t.return||t.return()}finally{if(l)throw o}}return i}}(e,n)||un(e,n)||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 an(e){return function(e){if(Array.isArray(e))return tn(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||un(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 un(e,n){if(e){if("string"===typeof e)return tn(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?tn(e,n):void 0}}var sn=function(e){var n=e.refreshInterval,t=void 0===n?6e4:n,d=(0,M.Z)().protect,f=(0,c.useState)(!1),p=f[0],h=f[1],m=(0,c.useState)({actionProceedText:"",closeOnProceed:!0,content:"",dialogProps:{open:p},onCancelAppend:function(){h(!1)},onProceedAppend:function(){h(!1)},titleText:""}),y=m[0],b=m[1],v=ln((0,D.Z)(void 0,d),2),g=v[0],x=v[1],j=ln((0,D.Z)("",d),2),w=j[0],P=j[1],O=(0,s.Z)("".concat(l.Z,"/host/local"),{onError:function(){P("Unknown")},onSuccess:function(e){var n=e.installTarget,t=e.shortHostName;x(n),P(t)},refreshInterval:t}),A=O.data,Z=O.isLoading;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.default,{children:(0,r.jsx)("title",{children:Z?"Loading...":"".concat(null===A||void 0===A?void 0:A.shortHostName," Config")})}),(0,r.jsx)(u.Z,{}),(0,r.jsxs)(o.ZP,{container:!0,columns:{xs:1,md:3,lg:4},children:[(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(nn,{installTarget:g,onSubmit:function(e){var n=e.onProceedAppend,t=cn(e,["onProceedAppend"]);b((function(e){return on({},e,t,{onProceedAppend:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o;null===n||void 0===n||(o=n).call.apply(o,[null].concat(an(t))),h(!1)}})})),h(!0)},title:w})}),(0,r.jsx)(o.ZP,{item:!0,md:2,xs:1,children:(0,r.jsx)(We,{})})]}),(0,r.jsx)(a.Z,on({},y,{dialogProps:{open:p}}))]})}}},function(e){e.O(0,[382,923,894,644,498,746,203,899,903,774,888,179],(function(){return n=329,e(e.s=n);var n}));var n=e.O();_N_E=n}]); |