Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
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 Ke}});var r=t(5893),o=t(8263),i=t(9008),c=t(7294),l=t(2029),a=t(157),s=t(8750),u=t(1905),d=t(3106),f=t(4188),h=t(4390);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 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 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,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(6607),g=t(480),x=t(2349),j=t(7750);function w(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function P(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){w(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)(j.Ac,{children:i}):i}),[i]);return(0,r.jsx)(g.Z,P({},o,{control:(0,r.jsx)(x.Z,P({},n,{checked:t,onChange:l})),label:a}))},Z=t(4690),O=t(7504),S=t(1770),k=t(1706),I=t(4069),T=t(7869),C=t(6284),E=t(2027),M=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 D={dbPort:"dbPort",ipAddress:"ipAddress",password:"password",sshPort:"sshPort",user:"user"},N="IP address",R="Password",_="Ping",L=(0,c.forwardRef)((function(e,n){var t=e.formGridColumns,o=void 0===t?2:t,i=(0,c.useRef)({}),l=(0,c.useRef)({}),s=(0,c.useRef)({}),u=(0,c.useRef)({}),d=(0,c.useRef)({}),p=(0,c.useRef)({}),m=(0,c.useState)({}),y=m[0],g=m[1],x=(0,c.useState)(!1),w=x[0],P=x[1],F=U((0,M.Z)(!1),2),L=F[0],B=F[1],H=(0,c.useCallback)((function(e){return function(n){var t=n.isValid;g((0,v.ZP)(e,t))}}),[]),V=(0,c.useCallback)((function(e){return function(n){g((0,v.ZP)(e,n))}}),[]),G=(0,c.useCallback)((function(e){var n;null===(n=p.current.setMessage)||void 0===n||n.call(null,"api",e)}),[]),$=(0,c.useMemo)((function(){return Object.values(y).some((function(e){return!e}))}),[y]),q=(0,c.useMemo)((function(){return b(D,p)}),[]);return(0,r.jsx)(a.Z,{actionProceedText:"Add",content:(0,r.jsx)(O.Z,{columns:{xs:1,sm:o},layout:{"add-peer-ip-address":{children:(0,r.jsx)(Z.Z,{row:!0,spacing:".3em",children:(0,r.jsx)(I.Z,{input:(0,r.jsx)(C.Z,{id:"add-peer-ip-address-input",inputProps:{readOnly:!0,onFocus:function(e){e.target.readOnly=!1}},label:N}),inputTestBatch:(0,E._)(N,(function(){q.ipAddress()}),{onFinishBatch:V(D.ipAddress)},(function(e){q.ipAddress({children:e})})),onFirstRender:H(D.ipAddress),ref:l,required:!0})})},"add-peer-password":{children:(0,r.jsx)(I.Z,{input:(0,r.jsx)(C.Z,{fillRow:!0,id:"add-peer-password-input",label:R,type:f.Z.password}),inputTestBatch:(0,E.Gn)(R,(function(){q.password()}),{onFinishBatch:V(D.password)},(function(e){q.password({children:e})})),onFirstRender:H(D.password),ref:s,required:!0})},"add-peer-is-ping":{children:(0,r.jsx)(A,{checked:w,label:_,onChange:function(e,n){P(n)}}),sx:{display:"flex"}},"add-peer-message-group":{children:(0,r.jsx)(T.Z,{count:1,defaultMessageType:"warning",ref:p}),sm:o}},spacing:"1em"}),dialogProps:{PaperProps:{sx:{minWidth:"16em"}}},loadingAction:L,onActionAppend:function(){G()},onProceedAppend:function(){var e,n,t,r,o;B(!0),h.Z.post("/host/connection",{ipAddress:null===(e=l.current.getValue)||void 0===e?void 0:e.call(null),isPing:w,password:null===(n=s.current.getValue)||void 0===n?void 0:n.call(null),port:null===(t=i.current.getValue)||void 0===t?void 0:t.call(null),sshPort:null===(r=u.current.getValue)||void 0===r?void 0:r.call(null),user:null===(o=d.current.getValue)||void 0===o?void 0:o.call(null)}).then((function(){G({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,S.Z)(e);n.children="Failed to add the given peer. ".concat(n.children),G(n)})).finally((function(){B(!1)}))},proceedButtonProps:{disabled:$},ref:n,titleText:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(j.z,{children:"Add a peer"}),(0,r.jsx)(k.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"})]})})}));L.displayName="AddPeerDialog";var B=L,H=t(6125),V=t(8187),G=t(3679),$=t(5537),q=t(2026),z=t(7169),W={small:j.KI,medium:j.Ac},K={size:"small",stateMap:new Map([[!1,(0,r.jsx)($.Z,{sx:{color:z.Wd}},"state-false")],[!0,(0,r.jsx)(q.Z,{sx:{color:z.Ej}},"state-true")]])},X=function(e){var n=e.label,t=e.size,o=void 0===t?K.size:t,i=e.state,l=e.stateMap,a=(void 0===l?K.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)(W[o],{},n)]})};X.defaultProps=K;var J=X,Y=t(3144);function Q(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 ee(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ne(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){ee(e,n,t[n])}))}return e}function te(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 Q(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 Q(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 re=function(e){var n=e.refreshInterval,t=void 0===n?6e4:n,i=(0,Y.Z)().protect,s=(0,c.useRef)({}),f=(0,c.useRef)({}),p=te((0,M.Z)(void 0,i),2),m=p[0],y=p[1],b=(0,c.useState)({actionProceedText:"",content:"",titleText:""}),v=b[0],g=b[1],x=te((0,M.Z)({},i),2),w=x[0],P=x[1],A=(0,c.useState)(!1),O=A[0],k=A[1],I=te((0,M.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)(V.Z,ne({},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=te(t,2),c=r[0],l=r[1],a=l.networkLinkNumber,s=l.networkNumber,u=l.networkType;return n[c]=ne({},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=te(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]=ne({},e[u],{dbPort:a,dbUser:s,hostUUID:c,ipAddress:o,isPingTest:l}),n}),{})}))}}).isLoading;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(G.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)(H.Z,{header:"Inbound connections",listEmpty:(0,r.jsx)(j.Ac,{align:"center",children:"No inbound connections found."}),listItemKeyPrefix:"config-peers-inbound-connection",listItems:w,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)(j.$_,{children:"".concat(o,"@").concat(e,":").concat(t)}),(0,r.jsx)(j.KI,{children:"".concat(d.Z[c]," ").concat(i)})]})}})}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(H.Z,{header:"Peer connections",allowEdit:!0,edit:O,listEmpty:(0,r.jsx)(j.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=te(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(){h.Z.delete("/host/connection",{data:n}).catch((function(e){var n=(0,S.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(){k((function(e){return!e}))},onItemCheckboxChange:function(e,n,t){T[e].isChecked=t,C((function(e){return ne({},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)(j.$_,{children:e}),(0,r.jsx)(J,{label:"Ping",state:o})]})})}})}),E]})}),(0,r.jsx)(B,{ref:s}),(0,r.jsx)(a.Z,ne({closeOnProceed:!0},v,{ref:f}))]})},oe=t(582),ie=t(5741),ce=t(3906);function le(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 ae(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function se(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){ae(e,n,t[n])}))}return e}function ue(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 le(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 le(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 de=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=ue((0,M.Z)(void 0),2),f=d[0],p=d[1],m=ue((0,M.Z)({}),2),y=m[0],b=m[1],v=ue((0,M.Z)({actionProceedText:"",content:"",titleText:""}),2),g=v[0],x=v[1],w=(0,ce.Z)({list:y}),P=w.checks,A=w.getCheck,O=w.hasAllChecks,k=w.hasChecks,I=w.setAllChecks,T=w.setCheck,C=(0,c.useMemo)((function(){return f&&(0,r.jsx)(V.Z,se({},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){p({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]=se({},n[c],{hostName:r,hostUUID:o,ipAddress:i})})),e}),{})}))},refreshInterval:i}).isLoading;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(G.TZ,{header:"Manage changed SSH keys",loading:F,children:[(0,r.jsxs)(Z.Z,{spacing:".2em",children:[(0,r.jsx)(j.Ac,{children:"The identity of the following targets have unexpectedly changed."}),(0,r.jsxs)(V.Z,{type:"warning",isAllowClose:!0,children:["If you haven't rebuilt the listed targets, then you could be experiencing a"," ",(0,r.jsx)(ie.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)(H.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)(j.Ac,{children:"Host name"}),(0,r.jsx)(oe.Z,{sx:{flexGrow:1}})]}),(0,r.jsxs)(Z.Z,{row:!0,spacing:".3em",sx:{flexGrow:1},children:[(0,r.jsx)(j.Ac,{children:"IP address"}),(0,r.jsx)(oe.Z,{sx:{flexGrow:1}})]}),(0,r.jsx)(oe.Z,{sx:{flexGrow:1}})]}),allowCheckAll:E,allowCheckItem:!0,allowDelete:!0,allowEdit:!1,disableDelete:!k,edit:!0,getListCheckboxProps:function(){return{checked:O}},listEmpty:(0,r.jsx)(j.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(!A(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(){h.Z.delete("/ssh-key/conflict",{data:n}).catch((function(e){var n=(0,S.Z)(e);n.children="Failed to delete selected SSH key conflicts. ".concat(n.children),p(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)(Z.Z,{spacing:0,sm:"row",sx:{width:"100%","& > *":{flexBasis:"50%"}},xs:"column",children:[(0,r.jsx)(j.Ac,{children:t}),(0,r.jsx)(j.Ac,{children:o})]})},renderListItemCheckboxState:function(e){return A(e)}})]}),C]}),(0,r.jsx)(a.Z,se({closeOnProceed:!0},g,{ref:s}))]})};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 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){fe(e,n,t[n])}))}return e}var pe="common-user-input-confirm-password",me="common-user-input-name",ye="common-user-input-password",be="Username",ve="Password",ge=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,h=void 0!==d&&d,p=e.showPasswordField,m=(0,c.useRef)({}),y=(0,c.useRef)({}),b=(0,c.useState)(h),v=b[0],g=b[1],x=(0,c.useMemo)((function(){return p?{"common-user-input-cell-password":{children:(0,r.jsx)(I.Z,{input:(0,r.jsx)(C.Z,{id:ye,label:ve,type:f.Z.password}),inputTestBatch:(0,E.Gn)(ve,(function(){i(ye)}),{onFinishBatch:t(ye)},(function(e){i(ye,{children:e})})),onBlurAppend:function(e){var n,t=e.target.value;g(t.length>0),l(pe,t===(null===(n=y.current.getValue)||void 0===n?void 0:n.call(null)))},onFirstRender:o(ye),ref:m,required:h})},"common-user-input-cell-confirm-password":{children:(0,r.jsx)(I.Z,{input:(0,r.jsx)(C.Z,{id:pe,inputProps:{readOnly:!v},label:"Confirm password",type:f.Z.password}),inputTestBatch:{defaults:{onSuccess:function(){i(pe)}},onFinishBatch:t(pe),tests:[{test:E.HJ},{onFailure:function(){i(pe,{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(pe),ref:y,required:v})}}:void 0}),[t,o,v,h,i,l,p]);return(0,r.jsx)(O.Z,{columns:{xs:1,sm:2,md:3},layout:he({"common-user-input-cell-name":{children:(0,r.jsx)(I.Z,{input:(0,r.jsx)(C.Z,{id:me,inputProps:{readOnly:u},label:be,value:s}),inputTestBatch:(0,E.Gn)(be,(function(){i(me)}),{onFinishBatch:t(me)},(function(e){i(me,{children:e})})),onFirstRender:o(me),required:!0}),md:1,sm:2}},x),spacing:"1em"})},xe=t(2545),je=t(8610),we=t(6632),Pe=t(8859);function Ae(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 Ze(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){Ze(e,n,t[n])}))}return e}function Se(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)||Ie(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 ke(e){return function(e){if(Array.isArray(e))return Ae(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,n){if(e){if("string"===typeof e)return Ae(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)?Ae(e,n):void 0}}var Te=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=Se(n,1),o=r[0].target,i=o.elements,c=i.namedItem(me),l=c.value,a=i.namedItem(ye),s="";a&&(s=a.value);return{password:s,userName:l}},Ce=function(){var e=(0,c.useRef)({}),n=(0,c.useRef)({}),t=(0,c.useRef)({}),o=(0,c.useRef)({}),i=Se((0,we.Z)(),2),s=i[0],d=i[1],f=(0,c.useState)(!1),h=f[0],p=f[1],m=Se((0,M.Z)({children:"No users found."}),2),y=m[0],b=m[1],v=Se((0,M.Z)(void 0),2),g=v[0],x=v[1],w=(0,u.Z)("".concat(l.Z,"/user"),{onError:function(e){b((0,S.Z)(e))}}),P=w.data,A=w.isLoading,Z=(0,Pe.Z)([pe,me,ye],o),O=Z.isFormInvalid,k=Z.isFormSubmitting,I=Z.submitForm,C=(0,ce.Z)({list:P}),E=C.buildDeleteDialogProps,F=C.checks,U=C.getCheck,D=C.hasChecks,N=C.setCheck,R=(0,c.useMemo)((function(){return null!==g&&void 0!==g?g:{}}),[g]),_=R.userName,L=R.userUUID,B=(0,c.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(ge,{formUtils:Z,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=Te.apply(void 0,ke(t));d({actionProceedText:"Add",content:(0,r.jsx)(je.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"}}),[Z,d,I]),$=(0,c.useMemo)((function(){return{actionProceedText:"Edit",content:(0,r.jsx)(ge,{formUtils:Z,previous:{name:_},readOnlyUserName:"admin"===_,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=Te.apply(void 0,ke(t));d({actionProceedText:"Update",content:(0,r.jsx)(je.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(_),url:"/user/".concat(L)})},titleText:"Update user ".concat(_," with the following?")}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},titleText:"Edit user ".concat(_)}}),[Z,d,I,_,L]),q=(0,c.useMemo)((function(){return(0,r.jsx)(T.Z,{count:1,defaultMessageType:"warning",ref:o})}),[]),z=(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)(G.TZ,{header:"Manage users",loading:A,children:(0,r.jsx)(H.Z,{allowAddItem:z,allowDelete:z,allowEdit:!0,allowItemButton:h,disableDelete:!D,edit:h,getListItemCheckboxProps:function(e,n){return{disabled:"admin"===n.userName}},header:!0,listEmpty:(0,r.jsx)(V.Z,Oe({},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)(j.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 p((function(e){return!e}))},onItemCheckboxChange:function(e,n,t){return N(e,t)},onItemClick:function(e){var n;h&&(x(e),null===(n=t.current.setOpen)||void 0===n||n.call(null,!0))},renderListItemCheckboxState:function(e){return U(e)},renderListItem:function(e,n){var t=n.userName;return(0,r.jsx)(j.Ac,{children:t})}})}),(0,r.jsx)(xe.Z,Oe({},B,{disableProceed:O,loadingAction:k,preActionArea:q,ref:e})),(0,r.jsx)(xe.Z,Oe({},$,{disableProceed:O,loadingAction:k,preActionArea:q,ref:t})),(0,r.jsx)(a.Z,Oe({closeOnProceed:!0},s,{ref:n}))]})},Ee=function(){return(0,r.jsxs)(G.s_,{children:[(0,r.jsx)(re,{}),(0,r.jsx)(de,{}),(0,r.jsx)(Ce,{})]})},Me=t(2852),Fe=t(4825),Ue=t(2152);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 Ne(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Re(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){Ne(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)||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 Le=function(e){return(0,r.jsx)(Fe.Z,Re({},e,{sx:{width:"100%"}}))},Be=function(e){var n=e.installTarget,t=void 0===n?"disabled":n,i=e.onSubmit,l=e.title,a=(0,Y.Z)().protect,s=_e((0,M.Z)(void 0,a),2),u=s[0],d=s[1],f=(0,c.useMemo)((function(){return l?(0,r.jsx)(j.z,{sx:{textAlign:"center"},children:l}):(0,r.jsx)(Ue.Z,{mt:0})}),[l]),p=(0,c.useMemo)((function(){return u&&(0,r.jsx)(o.ZP,{item:!0,sm:2,xs:1,children:(0,r.jsx)(V.Z,Re({},u,{onClose:function(){d(void 0)}}))})}),[u,d]);return(0,r.jsxs)(G.s_,{children:[(0,r.jsx)(G.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)(j.Ac,{sx:{flexGrow:1},children:"Install target"}),(0,r.jsx)(Me.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)(j.Ac,{children:["Would you like to ",t,' "Install target" on this striker? It\'ll take a few moments to complete.']}),onProceedAppend:function(){h.Z.put("/host/local",{isEnableInstallTarget:n},{params:{handler:"install-target"}}).catch((function(e){var n=(0,S.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)(Le,{onClick:function(){null===i||void 0===i||i.call(null,{actionProceedText:"Update",content:(0,r.jsx)(j.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(){h.Z.put("/command/update-system").catch((function(e){var n=(0,S.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)(Le,{href:"/init?re=1",children:"Reconfigure striker"})}),(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(Le,{onClick:function(){null===i||void 0===i||i.call(null,{actionProceedText:"Reboot",content:(0,r.jsx)(j.Ac,{children:"Would you like to reboot this striker?"}),onProceedAppend:function(){h.Z.put("/command/reboot-host").catch((function(e){var n=(0,S.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)(Le,{onClick:function(){null===i||void 0===i||i.call(null,{actionProceedText:"Shutdown",content:(0,r.jsx)(j.Ac,{children:"Would you like to shutdown this striker?"}),onProceedAppend:function(){h.Z.put("/command/poweroff-host").catch((function(e){var n=(0,S.Z)(e);n.children="Failed to initiate system shutdown. ".concat(n.children),d(n)}))},titleText:"Shutdown ".concat(l,"?")})},children:"Shutdown"})}),p]})]})};function He(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 Ve(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ge(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){Ve(e,n,t[n])}))}return e}function $e(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 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)||We(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 ze(e){return function(e){if(Array.isArray(e))return He(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||We(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 We(e,n){if(e){if("string"===typeof e)return He(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)?He(e,n):void 0}}var Ke=function(e){var n=e.refreshInterval,t=void 0===n?6e4:n,d=(0,Y.Z)().protect,f=(0,c.useState)(!1),h=f[0],p=f[1],m=(0,c.useState)({actionProceedText:"",closeOnProceed:!0,content:"",dialogProps:{open:h},onCancelAppend:function(){p(!1)},onProceedAppend:function(){p(!1)},titleText:""}),y=m[0],b=m[1],v=qe((0,M.Z)(void 0,d),2),g=v[0],x=v[1],j=qe((0,M.Z)("",d),2),w=j[0],P=j[1],A=(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}),Z=A.data,O=A.isLoading;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.default,{children:(0,r.jsx)("title",{children:O?"Loading...":"".concat(null===Z||void 0===Z?void 0:Z.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)(Be,{installTarget:g,onSubmit:function(e){var n=e.onProceedAppend,t=$e(e,["onProceedAppend"]);b((function(e){return Ge({},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(ze(t))),p(!1)}})})),p(!0)},title:w})}),(0,r.jsx)(o.ZP,{item:!0,md:2,xs:1,children:(0,r.jsx)(Ee,{})})]}),(0,r.jsx)(a.Z,Ge({},y,{dialogProps:{open:h}}))]})}}},function(e){e.O(0,[412,438,894,644,519,62,195,27,157,48,336,560,774,888,179],(function(){return n=329,e(e.s=n);var n}));var n=e.O();_N_E=n}]);