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
34 KiB
1 lines
34 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(6028)}])},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 s(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 u(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=u(e,["children","sx"]);return(0,r.jsx)(i.Z,s({underline:"hover",variant:"subtitle1"},a,{sx:s({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"}})]})}))}},3106:function(e,n){"use strict";n.Z={bcn:"Back-Channel Network",ifn:"Internet-Facing Network",mn:"Migration Network",sn:"Storage Network"}},6028:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Qe}});var r=t(5893),o=t(6886),i=t(9008),c=t(7294),l=t(2029),a=t(157),s=t(5521),u=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 Z(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,Z({},o,{control:(0,r.jsx)(j.Z,Z({},n,{checked:t,onChange:l})),label:a}))},O=t(4690),S=t(7504),k=t(1770),I=t(1706),T=t(4069),C=t(7869),E=t(6284),F=t(7987),M=t(3144),U=t(2749);function D(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 N(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 D(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 D(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"},B="DB port",_="IP address",L="Password",H="Ping",G="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)({}),s=(0,c.useRef)({}),u=(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),Z=P[0],D=P[1],$=N((0,U.Z)(!1,i),2),q=$[0],W=$[1],z=(0,c.useCallback)((function(e){return function(n){var t=n.isValid;j((0,g.ZP)(e,t))}}),[]),K=(0,c.useCallback)((function(e){return function(n){j((0,g.ZP)(e,n))}}),[]),X=(0,c.useCallback)((function(e){var n;null===(n=m.current.setMessage)||void 0===n||n.call(null,"api",e)}),[]),J=(0,c.useMemo)((function(){return Object.values(x).some((function(e){return!e}))}),[x]),Y=(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)(O.Z,{row:!0,spacing:".3em",children:[(0,r.jsx)(T.Z,{input:(0,r.jsx)(E.Z,{formControlProps:{sx:{minWidth:"4.6em",width:"25%"}},id:"add-peer-user-input",inputProps:{placeholder:"admin"},label:V}),inputTestBatch:(0,F.Gn)(V,(function(){Y.user()}),{onFinishBatch:K(R.user)},(function(e){Y.user({children:e})})),onFirstRender:z(R.user),ref:h}),(0,r.jsx)(w.Ac,{children:"@"}),(0,r.jsx)(T.Z,{input:(0,r.jsx)(E.Z,{id:"add-peer-ip-address-input",label:_}),inputTestBatch:(0,F._)(_,(function(){Y.ipAddress()}),{onFinishBatch:K(R.ipAddress)},(function(e){Y.ipAddress({children:e})})),onFirstRender:z(R.ipAddress),ref:s,required:!0})]})},"add-peer-password":{children:(0,r.jsx)(T.Z,{input:(0,r.jsx)(E.Z,{fillRow:!0,id:"add-peer-password-input",label:L,type:f.Z.password}),inputTestBatch:(0,F.Gn)(L,(function(){Y.password()}),{onFinishBatch:K(R.password)},(function(e){Y.password({children:e})})),onFirstRender:z(R.password),ref:u,required:!0})},"add-peer-db-and-ssh-port":{children:(0,r.jsxs)(O.Z,{row:!0,children:[(0,r.jsx)(T.Z,{input:(0,r.jsx)(E.Z,{id:"add-peer-db-port-input",inputProps:{placeholder:"5432"},label:B}),inputTestBatch:(0,v.Z)(B,(function(){Y.dbPort()}),{onFinishBatch:K(R.dbPort)},(function(e){Y.dbPort({children:e})})),onFirstRender:z(R.dbPort),ref:l}),(0,r.jsx)(T.Z,{input:(0,r.jsx)(E.Z,{id:"add-peer-ssh-port-input",inputProps:{placeholder:"22"},label:G}),inputTestBatch:(0,v.Z)(G,(function(){Y.sshPort()}),{onFinishBatch:K(R.sshPort)},(function(e){Y.sshPort({children:e})})),onFirstRender:z(R.sshPort),ref:d})]})},"add-peer-is-ping":{children:(0,r.jsx)(A,{checked:Z,label:H,onChange:function(e,n){D(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:q,onActionAppend:function(){X()},onProceedAppend:function(){var e,n,t,r,o;W(!0),p.Z.post("/host/connection",{ipAddress:null===(e=s.current.getValue)||void 0===e?void 0:e.call(null),isPing:Z,password:null===(n=u.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(){X({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),X(n)})).finally((function(){W(!1)}))},proceedButtonProps:{disabled:J},ref:n,titleText:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.z,{children:"Add a peer"}),(0,r.jsx)(I.Z,{mapPreset:"close",onClick:function(){var e;n&&"current"in n&&(null===(e=n.current.setOpen)||void 0===e||e.call(null,!1))},variant:"redcontained"})]})})}));$.displayName="AddPeerDialog";var q=$,W=t(6125),z=t(8187),K=t(3679),X=t(5537),J=t(2026),Y=t(7169),Q={small:w.KI,medium:w.Ac},ee={size:"small",stateMap:new Map([[!1,(0,r.jsx)(X.Z,{sx:{color:Y.Wd}},"state-false")],[!0,(0,r.jsx)(J.Z,{sx:{color:Y.Ej}},"state-true")]])},ne=function(e){var n=e.label,t=e.size,o=void 0===t?ee.size:t,i=e.state,l=e.stateMap,a=(void 0===l?ee.stateMap:l).get(i);return(0,r.jsxs)(O.Z,{row:!0,spacing:".3em",children:[a&&(0,c.cloneElement)(a,{fontSize:o}),(0,c.createElement)(Q[o],{},n)]})};ne.defaultProps=ee;var te=ne;function re(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 oe(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ie(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){oe(e,n,t[n])}))}return e}function ce(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 re(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 re(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 le=function(e){var n=e.refreshInterval,t=void 0===n?6e4:n,i=(0,M.Z)().protect,s=(0,c.useRef)({}),f=(0,c.useRef)({}),h=ce((0,U.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=ce((0,U.Z)({},i),2),j=x[0],P=x[1],Z=(0,c.useState)(!1),A=Z[0],S=Z[1],I=ce((0,U.Z)({},i),2),T=I[0],C=I[1],E=(0,c.useMemo)((function(){return m&&(0,r.jsx)(o.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(z.Z,ie({},m))})}),[m]),F=(0,u.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=ce(t,2),c=r[0],l=r[1],a=l.networkLinkNumber,s=l.networkNumber,u=l.networkType;return n[c]=ie({},e[c],{dbPort:o,dbUser:i,ipAddress:c,networkLinkNumber:a,networkNumber:s,networkType:u}),n}),{})})),C((function(e){return Object.entries(c).reduce((function(n,t){var r=ce(t,2),o=r[0],i=r[1],c=i.hostUUID,l=i.isPing,a=i.port,s=i.user,u="".concat(s,"@").concat(o,":").concat(a);return n[u]=ie({},e[u],{dbPort:a,dbUser:s,hostUUID:c,ipAddress:o,isPingTest:l}),n}),{})}))}}).isLoading;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.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)(O.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:T,onAdd:function(){var e;null===(e=s.current.setOpen)||void 0===e||e.call(null,!0)},onDelete:function(){var e,n=Object.entries(T).reduce((function(e,n){var t=ce(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){T[e].isChecked=t,C((function(e){return ie({},e)}))},renderListItem:function(e,n){var t=n.isPingTest,o=void 0!==t&&t;return(0,r.jsx)(O.Z,{row:!0,spacing:0,children:(0,r.jsxs)(O.Z,{spacing:0,children:[(0,r.jsx)(w.$_,{children:e}),(0,r.jsx)(te,{label:"Ping",state:o})]})})}})}),E]})}),(0,r.jsx)(q,{ref:s}),(0,r.jsx)(a.Z,ie({closeOnProceed:!0},v,{ref:f}))]})},ae=t(582),se=t(5741),ue=t(3906);function de(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 fe(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function pe(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){fe(e,n,t[n])}))}return e}function he(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 de(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 de(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 me=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,s=(0,c.useRef)({}),d=he((0,U.Z)(void 0),2),f=d[0],h=d[1],m=he((0,U.Z)({}),2),y=m[0],b=m[1],v=he((0,U.Z)({actionProceedText:"",content:"",titleText:""}),2),g=v[0],x=v[1],j=(0,ue.Z)({list:y}),P=j.checks,Z=j.getCheck,A=j.hasAllChecks,S=j.hasChecks,I=j.setAllChecks,T=j.setCheck,C=(0,c.useMemo)((function(){return f&&(0,r.jsx)(z.Z,pe({},f))}),[f]),E=(0,c.useMemo)((function(){return Object.keys(y).length>1}),[y]),F=(0,u.Z)("".concat(l.Z,"/ssh-key/conflict"),{onError:function(e){h({children:"Failed to fetch SSH key conflicts. Error: ".concat(e),type:"error"})},onSuccess:function(e){b((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]=pe({},n[c],{hostName:r,hostUUID:o,ipAddress:i})})),e}),{})}))},refreshInterval:i}).isLoading;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(K.TZ,{header:"Manage changed SSH keys",loading:F,children:[(0,r.jsxs)(O.Z,{spacing:".2em",children:[(0,r.jsx)(w.Ac,{children:"The identity of the following targets have unexpectedly changed."}),(0,r.jsxs)(z.Z,{type:"warning",isAllowClose:!0,children:["If you haven't rebuilt the listed targets, then you could be experiencing a"," ",(0,r.jsx)(se.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)(O.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)(O.Z,{row:!0,spacing:".3em",sx:{flexBasis:"calc(50% + 1em)"},children:[(0,r.jsx)(w.Ac,{children:"Host name"}),(0,r.jsx)(ae.Z,{sx:{flexGrow:1}})]}),(0,r.jsxs)(O.Z,{row:!0,spacing:".3em",sx:{flexGrow:1},children:[(0,r.jsx)(w.Ac,{children:"IP address"}),(0,r.jsx)(ae.Z,{sx:{flexGrow:1}})]}),(0,r.jsx)(ae.Z,{sx:{flexGrow:1}})]}),allowCheckAll:E,allowCheckItem:!0,allowDelete:!0,allowEdit:!1,disableDelete:!S,edit:!0,getListCheckboxProps:function(){return{checked:A}},listEmpty:(0,r.jsx)(w.Ac,{align:"center",children:"No conflicting keys found."}),listItems:y,onAllCheckboxChange:function(e,n){I(n)},onDelete:function(){var e,n=P.reduce((function(e,n){if(!Z(n))return e;var t=y[n].hostUUID;return e[t]||(e[t]=[]),e[t].push(n),e}),{});x({actionProceedText:"Delete",content:"Resolve ".concat(P.length," 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:n}).catch((function(e){var n=(0,k.Z)(e);n.children="Failed to delete selected SSH key conflicts. ".concat(n.children),h(n)}))},proceedColour:"red",titleText:"Delete ".concat(P.length," conflicting SSH keys?")}),null===(e=s.current.setOpen)||void 0===e||e.call(null,!0)},onItemCheckboxChange:function(e,n,t){T(e,t)},renderListItem:function(e,n){var t=n.hostName,o=n.ipAddress;return(0,r.jsxs)(O.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){return Z(e)}})]}),C]}),(0,r.jsx)(a.Z,pe({closeOnProceed:!0},g,{ref:s}))]})};function ye(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function be(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){ye(e,n,t[n])}))}return e}var ve="common-user-input-confirm-password",ge="common-user-input-name",xe="common-user-input-password",je="Username",we="Password",Pe=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,o=n.buildInputFirstRenderFunction,i=n.setMessage,l=n.setValidity,a=e.previous,s=(void 0===a?{}:a).name,u=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)(T.Z,{input:(0,r.jsx)(E.Z,{id:xe,label:we,type:f.Z.password}),inputTestBatch:(0,F.Gn)(we,(function(){i(xe)}),{onFinishBatch:t(xe)},(function(e){i(xe,{children:e})})),onBlurAppend:function(e){var n,t=e.target.value;g(t.length>0),l(ve,t===(null===(n=y.current.getValue)||void 0===n?void 0:n.call(null)))},onFirstRender:o(xe),ref:m,required:p})},"common-user-input-cell-confirm-password":{children:(0,r.jsx)(T.Z,{input:(0,r.jsx)(E.Z,{id:ve,inputProps:{readOnly:!v},label:"Confirm password",type:f.Z.password}),inputTestBatch:{defaults:{onSuccess:function(){i(ve)}},onFinishBatch:t(ve),tests:[{test:F.HJ},{onFailure:function(){i(ve,{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(ve),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:be({"common-user-input-cell-name":{children:(0,r.jsx)(T.Z,{input:(0,r.jsx)(E.Z,{id:ge,inputProps:{readOnly:u},label:je,value:s}),inputTestBatch:(0,F.Gn)(je,(function(){i(ge)}),{onFinishBatch:t(ge)},(function(e){i(ge,{children:e})})),onFirstRender:o(ge),required:!0}),md:1,sm:2}},x),spacing:"1em"})},Ze=t(2545),Ae=t(8610),Oe=t(6632),Se=t(8859);function ke(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 Ie(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Te(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){Ie(e,n,t[n])}))}return e}function Ce(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)||Fe(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 Ee(e){return function(e){if(Array.isArray(e))return ke(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Fe(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 Fe(e,n){if(e){if("string"===typeof e)return ke(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)?ke(e,n):void 0}}var Me=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=Ce(n,1),o=r[0].target,i=o.elements,c=i.namedItem(ge),l=c.value,a=i.namedItem(xe),s="";a&&(s=a.value);return{password:s,userName:l}},Ue=function(){var e=(0,c.useRef)({}),n=(0,c.useRef)({}),t=(0,c.useRef)({}),o=(0,c.useRef)({}),i=Ce((0,Oe.Z)(),2),s=i[0],d=i[1],f=(0,c.useState)(!1),p=f[0],h=f[1],m=Ce((0,U.Z)({children:"No users found."}),2),y=m[0],b=m[1],v=Ce((0,U.Z)(void 0),2),g=v[0],x=v[1],j=(0,u.Z)("".concat(l.Z,"/user"),{onError:function(e){b((0,k.Z)(e))}}),P=j.data,Z=j.isLoading,A=(0,Se.Z)([ve,ge,xe],o),O=A.isFormInvalid,S=A.isFormSubmitting,I=A.submitForm,T=(0,ue.Z)({list:P}),E=T.buildDeleteDialogProps,F=T.checks,M=T.getCheck,D=T.hasChecks,N=T.setCheck,R=(0,c.useMemo)((function(){return null!==g&&void 0!==g?g:{}}),[g]),B=R.userName,_=R.userUUID,L=(0,c.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(Pe,{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=Me.apply(void 0,Ee(t));d({actionProceedText:"Add",content:(0,r.jsx)(Ae.Z,{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)(Pe,{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=Me.apply(void 0,Ee(t));d({actionProceedText:"Update",content:(0,r.jsx)(Ae.Z,{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(_)})},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,_]),G=(0,c.useMemo)((function(){return(0,r.jsx)(C.Z,{count:1,defaultMessageType:"warning",ref:o})}),[]),V=(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)(K.TZ,{header:"Manage users",loading:Z,children:(0,r.jsx)(W.Z,{allowAddItem:V,allowDelete:V,allowEdit:!0,allowItemButton:p,disableDelete:!D,edit:p,getListItemCheckboxProps:function(e,n){return{disabled:"admin"===n.userName}},header:!0,listEmpty:(0,r.jsx)(z.Z,Te({},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:F},getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Delete user(s) failed. ",e]})},method:"delete",url:"/user"})}},formSummaryProps:{renderEntry:function(e){var n=e.key;return(0,r.jsx)(w.Ac,{children:null===P||void 0===P?void 0:P[n].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,t){return N(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 M(e)},renderListItem:function(e,n){var t=n.userName;return(0,r.jsx)(w.Ac,{children:t})}})}),(0,r.jsx)(Ze.Z,Te({},L,{disableProceed:O,loadingAction:S,preActionArea:G,ref:e})),(0,r.jsx)(Ze.Z,Te({},H,{disableProceed:O,loadingAction:S,preActionArea:G,ref:t})),(0,r.jsx)(a.Z,Te({closeOnProceed:!0},s,{ref:n}))]})},De=function(){return(0,r.jsxs)(K.s_,{children:[(0,r.jsx)(le,{}),(0,r.jsx)(me,{}),(0,r.jsx)(Ue,{})]})},Ne=t(2852),Re=t(4825),Be=t(2152);function _e(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 Le(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function He(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){Le(e,n,t[n])}))}return e}function Ge(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 _e(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 _e(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 Ve=function(e){return(0,r.jsx)(Re.Z,He({},e,{sx:{width:"100%"}}))},$e=function(e){var n=e.installTarget,t=void 0===n?"disabled":n,i=e.onSubmit,l=e.title,a=(0,M.Z)().protect,s=Ge((0,U.Z)(void 0,a),2),u=s[0],d=s[1],f=(0,c.useMemo)((function(){return l?(0,r.jsx)(w.z,{sx:{textAlign:"center"},children:l}):(0,r.jsx)(Be.Z,{mt:0})}),[l]),h=(0,c.useMemo)((function(){return u&&(0,r.jsx)(o.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(z.Z,He({},u,{onClose:function(){d(void 0)}}))})}),[u,d]);return(0,r.jsxs)(K.s_,{children:[(0,r.jsx)(K.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)(O.Z,{row:!0,children:[(0,r.jsx)(w.Ac,{sx:{flexGrow:1},children:"Install target"}),(0,r.jsx)(Ne.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)(Ve,{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)(Ve,{href:"/init?re=1",children:"Reconfigure striker"})}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(Ve,{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)(Ve,{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 qe(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 We(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ze(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){We(e,n,t[n])}))}return e}function Ke(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 Xe(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)||Ye(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 Je(e){return function(e){if(Array.isArray(e))return qe(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ye(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 Ye(e,n){if(e){if("string"===typeof e)return qe(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)?qe(e,n):void 0}}var Qe=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=Xe((0,U.Z)(void 0,d),2),g=v[0],x=v[1],j=Xe((0,U.Z)("",d),2),w=j[0],P=j[1],Z=(0,u.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=Z.data,O=Z.isLoading;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.default,{children:(0,r.jsx)("title",{children:O?"Loading...":"".concat(null===A||void 0===A?void 0:A.shortHostName," Config")})}),(0,r.jsx)(s.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)($e,{installTarget:g,onSubmit:function(e){var n=e.onProceedAppend,t=Ke(e,["onProceedAppend"]);b((function(e){return ze({},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(Je(t))),h(!1)}})})),h(!0)},title:w})}),(0,r.jsx)(o.ZP,{item:!0,md:2,xs:1,children:(0,r.jsx)(De,{})})]}),(0,r.jsx)(a.Z,ze({},y,{dialogProps:{open:p}}))]})}}},function(e){e.O(0,[382,438,894,644,586,62,195,987,157,248,336,560,774,888,179],(function(){return n=329,e(e.s=n);var n}));var n=e.O();_N_E=n}]); |