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
22 KiB

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[249],{88668:function(e,t,r){var n=r(83369),i=r(90619),a=r(72385);function SetCache(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new n;++t<r;)this.add(e[t])}SetCache.prototype.add=SetCache.prototype.push=i,SetCache.prototype.has=a,e.exports=SetCache},82908:function(e){e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}},90939:function(e,t,r){var n=r(2492),i=r(37005);e.exports=function baseIsEqual(e,t,r,a,l){return e===t||(null!=e&&null!=t&&(i(e)||i(t))?n(e,t,r,a,baseIsEqual,l):e!=e&&t!=t)}},2492:function(e,t,r){var n=r(46384),i=r(67114),a=r(18351),l=r(16096),s=r(64160),o=r(1469),d=r(44144),u=r(36719),c="[object Arguments]",m="[object Array]",p="[object Object]",h=Object.prototype.hasOwnProperty;e.exports=function(e,t,r,v,g,f){var x=o(e),j=o(t),Z=x?m:s(e),b=j?m:s(t);Z=Z==c?p:Z,b=b==c?p:b;var M=Z==p,y=b==p,_=Z==b;if(_&&d(e)){if(!d(t))return!1;x=!0,M=!1}if(_&&!M)return f||(f=new n),x||u(e)?i(e,t,r,v,g,f):a(e,t,Z,r,v,g,f);if(!(1&r)){var w=M&&h.call(e,"__wrapped__"),O=y&&h.call(t,"__wrapped__");if(w||O){var A=w?e.value():e,S=O?t.value():t;return f||(f=new n),g(A,S,r,v,f)}}return!!_&&(f||(f=new n),l(e,t,r,v,g,f))}},74757:function(e){e.exports=function(e,t){return e.has(t)}},67114:function(e,t,r){var n=r(88668),i=r(82908),a=r(74757);e.exports=function(e,t,r,l,s,o){var d=1&r,u=e.length,c=t.length;if(u!=c&&!(d&&c>u))return!1;var m=o.get(e),p=o.get(t);if(m&&p)return m==t&&p==e;var h=-1,v=!0,g=2&r?new n:void 0;for(o.set(e,t),o.set(t,e);++h<u;){var f=e[h],x=t[h];if(l)var j=d?l(x,f,h,t,e,o):l(f,x,h,e,t,o);if(void 0!==j){if(j)continue;v=!1;break}if(g){if(!i(t,function(e,t){if(!a(g,t)&&(f===e||s(f,e,r,l,o)))return g.push(t)})){v=!1;break}}else if(!(f===x||s(f,x,r,l,o))){v=!1;break}}return o.delete(e),o.delete(t),v}},18351:function(e,t,r){var n=r(62705),i=r(11149),a=r(77813),l=r(67114),s=r(68776),o=r(21814),d=n?n.prototype:void 0,u=d?d.valueOf:void 0;e.exports=function(e,t,r,n,d,c,m){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!c(new i(e),new i(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return a(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var p=s;case"[object Set]":var h=1&n;if(p||(p=o),e.size!=t.size&&!h)break;var v=m.get(e);if(v)return v==t;n|=2,m.set(e,t);var g=l(p(e),p(t),n,d,c,m);return m.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(t)}return!1}},16096:function(e,t,r){var n=r(58234),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,r,a,l,s){var o=1&r,d=n(e),u=d.length;if(u!=n(t).length&&!o)return!1;for(var c=u;c--;){var m=d[c];if(!(o?m in t:i.call(t,m)))return!1}var p=s.get(e),h=s.get(t);if(p&&h)return p==t&&h==e;var v=!0;s.set(e,t),s.set(t,e);for(var g=o;++c<u;){var f=e[m=d[c]],x=t[m];if(a)var j=o?a(x,f,m,t,e,s):a(f,x,m,e,t,s);if(!(void 0===j?f===x||l(f,x,r,a,s):j)){v=!1;break}g||(g="constructor"==m)}if(v&&!g){var Z=e.constructor,b=t.constructor;Z!=b&&"constructor"in e&&"constructor"in t&&!("function"==typeof Z&&Z instanceof Z&&"function"==typeof b&&b instanceof b)&&(v=!1)}return s.delete(e),s.delete(t),v}},68776:function(e){e.exports=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}},90619:function(e){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},72385:function(e){e.exports=function(e){return this.__data__.has(e)}},21814:function(e){e.exports=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}},18446:function(e,t,r){var n=r(90939);e.exports=function(e,t){return n(e,t)}},24084:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mail-config",function(){return r(75338)}])},21642:function(e,t,r){"use strict";var n=r(85893),i=r(67294),a=r(68917);let l={count:0,defaultMessageType:"info",messages:void 0,onSet:void 0,usePlaceholder:!0},s=(0,i.forwardRef)((e,t)=>{let{count:r=l.count,defaultMessageType:s=l.defaultMessageType,messages:o,onSet:d,usePlaceholder:u=l.usePlaceholder}=e,[c,m]=(0,i.useState)({}),p=(0,i.useMemo)(()=>({...o,...c}),[o,c]),h=(0,i.useCallback)(e=>void 0!==p[e],[p]),v=(0,i.useCallback)((e,t)=>{let r=0;m(n=>{let{[e]:i,...a}=n;return t&&(a[e]=t),r=Object.keys(a).length,a}),null==d||d.call(null,r)},[d]),g=(0,i.useCallback)((e,t)=>{let r=0,n=t?(e,n)=>{e[n]=t,r+=1}:void 0;m(t=>{let i={};return Object.keys(t).forEach(a=>{e.test(a)?null==n||n.call(null,i,a):(i[a]=t[a],r+=1)}),i}),null==d||d.call(null,r)},[d]),f=(0,i.useMemo)(()=>{let e=Object.entries(p),t=r>0,i=t?r:e.length,l=[];if(e.every(e=>{let[t,r]=e,{children:o,type:d=s}=r;return l.push((0,n.jsx)(a.Z,{type:d,children:o},"message-".concat(t))),l.length<i}),u&&t&&0===l.length){let e=r-l.length;for(let t=0;t<e;t+=1)l.push((0,n.jsx)(a.Z,{sx:{visibility:"hidden"},text:"Placeholder"},"message-placeholder-".concat(t)))}return l},[r,s,u,p]);return(0,i.useImperativeHandle)(t,()=>({exists:h,setMessage:v,setMessageRe:g}),[h,v,g]),(0,n.jsx)(n.Fragment,{children:f})});s.defaultProps=l,s.displayName="MessageGroup",t.Z=s},48882:function(e,t,r){"use strict";r.d(t,{Z:function(){return api_converters_toAnvilOverviewList}});var api_converters_toAnvilOverviewHostList=e=>e.reduce((e,t)=>{let{hostName:r,hostType:n,hostUUID:i}=t;return e[i]={name:r,type:n,uuid:i},e},{}),api_converters_toAnvilOverviewList=e=>e.reduce((e,t)=>{let{anvilDescription:r,anvilName:n,anvilUUID:i,hosts:a}=t;return e[i]={description:r,hosts:api_converters_toAnvilOverviewHostList(a),name:n,uuid:i},e},{})},78438:function(e,t){"use strict";t.Z=(e,t)=>e&&Object.keys(e).reduce((e,r)=>({...e,[r]:t}),{})},591:function(e,t){"use strict";t.Z={boolean:e=>!!e,number:e=>parseInt(String(e),10)||0,string:e=>String(e)}},75338:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return mail_config}});var n=r(85893),i=r(48263),a=r(9008),l=r.n(a),s=r(21405),o=r(272),d=r(67294),u=r(25934),c=r(73393),m=r(67645),p=r(55238),h=r(15079),v=r(41247),g=r(16310),f=r(78438);let x=g.Rx().oneOf([0,1,2,3,4]),j=g.Ry({delete:g.O7().optional(),level:x.required(),target:g.Ry({type:g.Z_().oneOf(["node","subnode"]).required(),uuid:g.Z_().uuid().required()}),uuid:g.Z_().uuid().optional()}),Z=g.Vo(e=>g.Ry((0,f.Z)(e,j))),b=g.Ry({alertOverrides:Z,email:g.Z_().email().required(),language:g.Z_().oneOf(["en_CA"]).optional(),level:x.required(),name:g.Z_().required(),uuid:g.Z_().uuid().optional()}),M=g.Vo(e=>g.Ry((0,f.Z)(e,b)));var y=r(89712),_=r(83221),w=r(52886),O=r(84154),A=r(88468);let S=[{displayValue:"Ignore",value:0},{displayValue:"Critical",value:1},{displayValue:"Warning",value:2},{displayValue:"Notice",value:3},{displayValue:"Info",value:4}];var ManageMailRecipient_AlertOverrideInputGroup=e=>{let{alertOverrideTargetOptions:t,alertOverrideValueId:r,mailRecipientUuid:a,formikUtils:l}=e,s=(0,d.useMemo)(()=>null!=r?r:(0,u.Z)(),[r]),{formik:o}=l,{values:{[a]:c}}=o,{alertOverrides:{[s]:m}}=c,h=(0,d.useMemo)(()=>"".concat(a,".alertOverrides.").concat(s),[s,a]),v=(0,d.useMemo)(()=>"".concat(h,".remove"),[h]),g=(0,d.useMemo)(()=>"".concat(h,".target"),[h]),f=(0,d.useMemo)(()=>"".concat(h,".level"),[h]);return(0,n.jsxs)(i.ZP,{alignItems:"center",columns:{xs:1,sm:10},container:!0,justifyContent:"stretch",spacing:"1em",children:[(0,n.jsx)(i.ZP,{item:!0,xs:6,children:(0,n.jsx)(y.Z,{getOptionLabel:e=>e.name,id:g,isOptionEqualToValue:(e,t)=>e.uuid===t.uuid,label:"Target",noOptionsText:"No node or subnode found.",onChange:(e,t)=>o.setFieldValue(g,t,!0),openOnFocus:!0,options:t,renderOption:(e,t)=>(0,d.createElement)("li",{...e,key:"".concat(t.node,"-").concat(t.uuid)},"node"===t.type?(0,n.jsxs)(p.Z,{spacing:0,children:[(0,n.jsx)(O.Ac,{inheritColour:!0,children:t.name}),(0,n.jsx)(O.KI,{inheritColour:!0,children:t.description})]}):(0,n.jsx)(O.Ac,{inheritColour:!0,paddingLeft:".6em",children:t.name})),value:m.target})}),(0,n.jsx)(i.ZP,{item:!0,flexGrow:1,children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(w.Z,{id:f,label:"Alert level",name:f,onChange:o.handleChange,selectItems:S,value:m.level})})}),(0,n.jsx)(i.ZP,{item:!0,width:"min-content",children:(0,n.jsx)(_.Z,{mapPreset:"delete",onClick:()=>{m.uuids?o.setFieldValue(v,!0,!0):o.setValues(e=>{let t={...e},{[a]:r}=t,{[s]:n,...i}=r.alertOverrides;return r.alertOverrides={...i},t})},size:"small"})})]})},C=r(63071),ManageMailRecipient_ManageAlertOverride=e=>{let{alertOverrideTargetOptions:t,formikUtils:r,mailRecipientUuid:i}=e,{formik:a}=r,{values:{[i]:l}}=a,{alertOverrides:s}=l;return(0,n.jsx)(C.Z,{allowAddItem:!0,edit:!0,header:"Alert override rules",listEmpty:"No alert overrides(s)",listItems:s,onAdd:()=>{let e=(0,u.Z)();a.setValues(t=>{let r={...t},{[i]:n}=r;return n.alertOverrides={...n.alertOverrides,[e]:{level:2,target:null}},r})},renderListItem:(e,a)=>!a.remove&&(0,n.jsx)(ManageMailRecipient_AlertOverrideInputGroup,{alertOverrideTargetOptions:t,alertOverrideValueId:e,formikUtils:r,mailRecipientUuid:i})})},F=r(21642),P=r(55675),R=r(21197);let E=[{displayValue:(0,n.jsxs)(p.Z,{spacing:0,children:[(0,n.jsx)(O.Ac,{inheritColour:!0,fontWeight:"inherit",children:"Critical"}),(0,n.jsx)(O.KI,{inheritColour:!0,whiteSpace:"normal",children:"Alerts that could lead to imminent service interruption or unexpected loss of redundancy."})]}),value:1},{displayValue:(0,n.jsxs)(p.Z,{spacing:0,children:[(0,n.jsx)(O.Ac,{inheritColour:!0,fontWeight:"inherit",children:"Warning"}),(0,n.jsx)(O.KI,{inheritColour:!0,whiteSpace:"normal",children:"Alerts that require attention from administrators, such as redundancy loss due to load shedding, hardware in pre-failure, input power loss, temperature anomalies, etc."})]}),value:2},{displayValue:(0,n.jsxs)(p.Z,{spacing:0,children:[(0,n.jsx)(O.Ac,{inheritColour:!0,fontWeight:"inherit",children:"Notice"}),(0,n.jsx)(O.KI,{inheritColour:!0,whiteSpace:"normal",children:"Alerts that are generally safe to ignore, but might provide early warnings of developing issues or insight into system behaviour."})]}),value:3},{displayValue:(0,n.jsxs)(p.Z,{spacing:0,children:[(0,n.jsx)(O.Ac,{inheritColour:!0,fontWeight:"inherit",children:"Info"}),(0,n.jsx)(O.KI,{inheritColour:!0,whiteSpace:"normal",children:"Alerts that are almost always safe to ignore, but may be useful in testing and debugging."})]}),value:4}],I={1:"Critical",2:"Warning",3:"Notice",4:"Info"},getAlertOverrideRequestList=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/alert-override",{uuid:n}=e;return n?Object.values(e.alertOverrides).reduce((e,t)=>{let{remove:i,level:a,target:l,uuids:s}=t;if(s&&e.push(...Object.keys(s).map(e=>({method:"delete",url:"".concat(r,"/").concat(e)}))),l&&!i){var o;let t=null!==(o=l.subnodes)&&void 0!==o?o:[l.uuid];e.push(...t.map(e=>({body:{hostUuid:e,level:a,mailRecipientUuid:n},method:"post",url:r})))}return e},[]):[]};var ManageMailRecipient_AddMailRecipientForm=e=>{let{alertOverrideTargetOptions:t,mailRecipientUuid:r,previousFormikValues:a,tools:l}=e,s=(0,d.useMemo)(()=>null!=r?r:(0,u.Z)(),[r]),p=(0,R.Z)({initialValues:null!=a?a:{[s]:{alertOverrides:{},email:"",language:"en_CA",level:2,name:""}},onSubmit:(e,t)=>{let{setSubmitting:r}=t,{[s]:i}=e,o="Add",d=(0,n.jsx)(n.Fragment,{children:"Failed to add mail recipient."}),u="post",c=(0,n.jsx)(n.Fragment,{children:"Mail recipient added."}),p="Add mail recipient with the following?",g="/mail-recipient";a&&(o="Update",d=(0,n.jsx)(n.Fragment,{children:"Failed to update mail server."}),u="put",c=(0,n.jsx)(n.Fragment,{children:"Mail recipient updated."}),p="Update ".concat(i.name," with the following?"),g+="/".concat(s));let{alertOverrides:f,uuid:x,...j}=i;l.confirm.prepare({actionProceedText:o,content:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.Z,{entries:j}),(0,n.jsx)(h.Z,{entries:{alertOverrides:Object.entries(f).reduce((e,t)=>{let[r,n]=t;return n.remove||!n.target||(e[r]={level:n.level,name:n.target.name}),e},{})}})]}),onCancelAppend:()=>r(!1),onProceedAppend:async()=>{l.confirm.loading(!0);let handleError=e=>{let t=(0,v.Z)(e);t.children=(0,n.jsxs)(n.Fragment,{children:[d," ",t.children]}),l.confirm.finish("Error",t),r(!1)};m.Z[u](g,j).then(e=>{let{data:t}=e,r={...i};t&&(r.uuid=t.uuid);let n=a&&a[s],o=getAlertOverrideRequestList(r,n).map(e=>m.Z[e.method](e.url,e.body));Promise.all(o).then(()=>{l.confirm.finish("Success",{children:c}),l["post"===u?"add":"edit"].open(!1)}).catch(handleError)}).catch(handleError)},titleText:p}),l.confirm.open(!0)},validationSchema:M}),{disabledSubmit:g,formik:f,formikErrors:x,handleChange:j}=p,Z=(0,d.useMemo)(()=>"".concat(s,".email"),[s]),b=(0,d.useMemo)(()=>"".concat(s,".level"),[s]),y=(0,d.useMemo)(()=>"".concat(s,".name"),[s]);return(0,n.jsxs)(i.ZP,{columns:{xs:1,sm:2},component:"form",container:!0,onSubmit:e=>{e.preventDefault(),f.submitForm()},spacing:"1em",children:[(0,n.jsx)(i.ZP,{item:!0,xs:1,children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(P.Z,{id:y,label:"Recipient name",name:y,onChange:j,required:!0,value:f.values[s].name})})}),(0,n.jsx)(i.ZP,{item:!0,xs:1,children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(P.Z,{id:Z,label:"Recipient email",name:Z,onChange:j,required:!0,value:f.values[s].email})})}),(0,n.jsx)(i.ZP,{item:!0,xs:1,children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(w.Z,{id:b,label:"Alert level",name:b,onChange:f.handleChange,required:!0,selectItems:E,selectProps:{MenuProps:{sx:{["& .".concat(o.Z.paper)]:{maxWidth:{md:"60%",lg:"40%"}}}},renderValue:e=>I[e]},value:f.values[s].level})})}),(0,n.jsx)(i.ZP,{item:!0,width:"100%",children:(0,n.jsx)(ManageMailRecipient_ManageAlertOverride,{alertOverrideTargetOptions:t,formikUtils:p,mailRecipientUuid:s})}),(0,n.jsx)(i.ZP,{item:!0,width:"100%",children:(0,n.jsx)(F.Z,{count:1,messages:x})}),(0,n.jsx)(i.ZP,{item:!0,width:"100%",children:(0,n.jsx)(c.Z,{actions:[{background:"blue",children:a?"Update":"Add",disabled:g,type:"submit"}]})})]})},k=r(48882),q=r(82456),ManageMailRecipient_EditMailRecipientForm=e=>(0,n.jsx)(ManageMailRecipient_AddMailRecipientForm,{...e}),V=r(6903),D=r(67978),ManageMailRecipient_ManageMailRecipient=()=>{let[e,t]=(0,d.useState)(),{altData:r,loading:i}=(0,D.Z)("/anvil",{mod:k.Z}),a=(0,d.useMemo)(()=>r&&Object.values(r).sort((e,t)=>e.name.localeCompare(t.name)).reduce((e,t)=>{let r={description:t.description,name:t.name,node:t.uuid,subnodes:[],type:"node",uuid:t.uuid},n=Object.values(t.hosts).sort((e,t)=>e.name.localeCompare(t.name)).reduce((e,n)=>{var i;return"dr"===n.type||(e.push({name:n.name,node:t.uuid,type:"subnode",uuid:n.uuid}),null===(i=r.subnodes)||void 0===i||i.push(n.uuid)),e},[]);return e.push(r,...n),e},[]),[r]),{fetch:l,loading:s}=(0,V.Z)({onData:e=>t(e),url:"/alert-override"}),o=(0,d.useMemo)(()=>{if(!r||!e)return;let t=Object.values(e).reduce((e,t)=>{let{node:{uuid:r}}=t;return e[r]?e[r].push(t):e[r]=[t],e},{});return Object.entries(t).reduce((e,t)=>{let[n,i]=t,[a,...l]=i,s=i.length>1&&l.every(e=>{let{level:t}=e;return t===a.level});if(s){let{0:{level:t}}=i,{[n]:a}=r;e[n]={level:t,target:{description:a.description,name:a.name,node:a.uuid,subnodes:i.map(e=>{let{subnode:{uuid:t}}=e;return t}),type:"node",uuid:a.uuid},uuids:i.reduce((e,t)=>{let{subnode:r,uuid:n}=t;return e[n]=r.uuid,e},{})}}else i.forEach(t=>{let{level:r,node:n,subnode:i,uuid:a}=t;e[i.uuid]={level:r,target:{name:i.name,node:n.uuid,type:"subnode",uuid:i.uuid},uuids:{[a]:i.uuid}}});return e},{})},[e,r]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(q.Z,{addHeader:"Add mail recipient",editHeader:e=>"Update ".concat(null==e?void 0:e.name),entriesUrl:"/mail-recipient",getAddLoading:e=>e||i,getDeleteErrorMessage:e=>{let{children:t,...r}=e;return{...r,children:(0,n.jsxs)(n.Fragment,{children:["Failed to delete mail recipient(s). ",t]})}},getDeleteHeader:e=>"Delete the following ".concat(e," mail recipient(s)?"),getDeleteSuccessMessage:()=>({children:(0,n.jsx)(n.Fragment,{children:"Successfully deleted mail recipient(s)."})}),getEditLoading:e=>e||s,listEmpty:"No mail recipient(s) found.",onItemClick:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];let[,i]=r;e(...r),l(void 0,{params:{"mail-recipient":i}})},renderAddForm:e=>a&&(0,n.jsx)(ManageMailRecipient_AddMailRecipientForm,{alertOverrideTargetOptions:a,tools:e}),renderDeleteItem:(e,t)=>{let{key:r}=t,i=null==e?void 0:e[r];return(0,n.jsx)(O.Ac,{children:null==i?void 0:i.name})},renderEditForm:(e,t)=>a&&t&&o&&(0,n.jsx)(ManageMailRecipient_EditMailRecipientForm,{alertOverrideTargetOptions:a,mailRecipientUuid:t.uuid,previousFormikValues:{[t.uuid]:{alertOverrides:o,...t}},tools:e}),renderListItem:(e,t)=>{let{name:r}=t;return(0,n.jsx)(O.Ac,{children:r})}})})};let U=g.Ry({address:g.Z_().required(),authentication:g.Z_().oneOf(["none","plain-text","encrypted"]),confirmPassword:g.Z_().when("password",(e,t)=>String(e).length>0?t.required().oneOf([g.iH("password")]):t.optional()),heloDomain:g.Z_().required(),password:g.Z_().optional(),port:g.Rx().required(),security:g.Z_().oneOf(["none","starttls","tls-ssl"]),username:g.Z_().optional(),uuid:g.Z_().uuid().required()}),L=g.Vo(e=>g.Ry((0,f.Z)(e,U)));var ManageMailServer_AddMailServerForm=e=>{let{localhostDomain:t="",mailServerUuid:r,previousFormikValues:a,tools:l}=e,s=(0,d.useMemo)(()=>null!=r?r:(0,u.Z)(),[r]),{disabledSubmit:o,formik:p,formikErrors:g,handleChange:f}=(0,R.Z)({initialValues:null!=a?a:{[s]:{address:"",authentication:"none",heloDomain:t,port:587,security:"none",uuid:s}},onSubmit:(e,t)=>{let{setSubmitting:r}=t,{[s]:i}=e,o="Add",d=(0,n.jsx)(n.Fragment,{children:"Failed to add mail server."}),u="post",c=(0,n.jsx)(n.Fragment,{children:"Mail server added."}),p="Add mail server with the following?",g="/mail-server";a&&(o="Update",d=(0,n.jsx)(n.Fragment,{children:"Failed to update mail server."}),u="put",c=(0,n.jsx)(n.Fragment,{children:"Mail server updated."}),p="Update ".concat(i.address,":").concat(i.port," with the following?"),g+="/".concat(s));let{confirmPassword:f,uuid:x,...j}=i;l.confirm.prepare({actionProceedText:o,content:(0,n.jsx)(h.Z,{entries:j}),onCancelAppend:()=>r(!1),onProceedAppend:()=>{l.confirm.loading(!0),m.Z[u](g,i).then(()=>{l.confirm.finish("Success",{children:c}),l["post"===u?"add":"edit"].open(!1)}).catch(e=>{let t=(0,v.Z)(e);t.children=(0,n.jsxs)(n.Fragment,{children:[d," ",t.children]}),l.confirm.finish("Error",t),r(!1)})},titleText:p}),l.confirm.open(!0)},validationSchema:L}),x=(0,d.useMemo)(()=>"".concat(s,".address"),[s]),j=(0,d.useMemo)(()=>"".concat(s,".authentication"),[s]),Z=(0,d.useMemo)(()=>"".concat(s,".confirmPassword"),[s]),b=(0,d.useMemo)(()=>"".concat(s,".heloDomain"),[s]),M=(0,d.useMemo)(()=>"".concat(s,".password"),[s]),y=(0,d.useMemo)(()=>"".concat(s,".port"),[s]),_=(0,d.useMemo)(()=>"".concat(s,".security"),[s]),O=(0,d.useMemo)(()=>"".concat(s,".username"),[s]);return(0,n.jsxs)(i.ZP,{component:"form",onSubmit:e=>{e.preventDefault(),p.submitForm()},container:!0,columns:{xs:1,sm:2},spacing:"1em",children:[(0,n.jsx)(i.ZP,{item:!0,xs:1,children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(P.Z,{id:x,label:"Server address",name:x,onChange:f,required:!0,value:p.values[s].address})})}),(0,n.jsx)(i.ZP,{item:!0,xs:1,children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(P.Z,{id:y,label:"Server port",name:y,onChange:f,required:!0,type:"number",value:p.values[s].port})})}),(0,n.jsx)(i.ZP,{item:!0,width:"100%",children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(w.Z,{id:_,label:"Server security type",name:_,onChange:f,required:!0,selectItems:["none","starttls","tls-ssl"],value:p.values[s].security})})}),(0,n.jsx)(i.ZP,{item:!0,width:"100%",children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(w.Z,{id:j,label:"Server authentication method",name:j,onChange:f,required:!0,selectItems:["none","plain-text","encrypted"],value:p.values[s].authentication})})}),(0,n.jsx)(i.ZP,{item:!0,width:"100%",children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(P.Z,{id:b,label:"HELO domain",name:b,onChange:f,required:!0,value:p.values[s].heloDomain})})}),(0,n.jsx)(i.ZP,{item:!0,xs:1,children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(P.Z,{disableAutofill:!0,id:O,label:"Server username",name:O,onChange:f,value:p.values[s].username})})}),(0,n.jsx)(i.ZP,{item:!0,xs:1,children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(P.Z,{disableAutofill:!0,id:M,label:"Server password",name:M,onChange:f,type:"password",value:p.values[s].password})})}),(0,n.jsx)(i.ZP,{display:{xs:"none",sm:"initial"},item:!0,sm:1}),(0,n.jsx)(i.ZP,{item:!0,xs:1,children:(0,n.jsx)(A.Z,{input:(0,n.jsx)(P.Z,{disableAutofill:!0,id:Z,label:"Confirm password",name:Z,onChange:f,type:"password",value:p.values[s].confirmPassword})})}),(0,n.jsx)(i.ZP,{item:!0,width:"100%",children:(0,n.jsx)(F.Z,{count:1,messages:g})}),(0,n.jsx)(i.ZP,{item:!0,width:"100%",children:(0,n.jsx)(c.Z,{actions:[{background:"blue",children:a?"Update":"Add",disabled:o,type:"submit"}]})})]})},ManageMailServer_EditMailServerForm=e=>(0,n.jsx)(ManageMailServer_AddMailServerForm,{...e}),ManageMailServer_ManageMailServer=()=>{let{data:e,loading:t}=(0,D.Z)("/host/local");return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(q.Z,{addHeader:"Add mail server",editHeader:e=>"Update ".concat(null==e?void 0:e.address,":").concat(null==e?void 0:e.port),entriesUrl:"/mail-server",getAddLoading:e=>e||t,getDeleteErrorMessage:e=>{let{children:t,...r}=e;return{...r,children:(0,n.jsxs)(n.Fragment,{children:["Failed to delete mail server(s). ",t]})}},getDeleteHeader:e=>"Delete the following ".concat(e," mail server(s)?"),getDeleteSuccessMessage:()=>({children:(0,n.jsx)(n.Fragment,{children:"Successfully deleted mail server(s)."})}),listEmpty:"No mail server(s) found",renderAddForm:t=>e&&(0,n.jsx)(ManageMailServer_AddMailServerForm,{localhostDomain:e.domain,tools:t}),renderDeleteItem:(e,t)=>{let{key:r}=t,i=null==e?void 0:e[r];return(0,n.jsxs)(O.Ac,{children:[null==i?void 0:i.address,":",null==i?void 0:i.port]})},renderEditForm:(e,t)=>t&&(0,n.jsx)(ManageMailServer_EditMailServerForm,{mailServerUuid:t.uuid,previousFormikValues:{[t.uuid]:t},tools:e}),renderListItem:(e,t)=>{let{address:r,port:i}=t;return(0,n.jsxs)(O.Ac,{children:[r,":",i]})}})})},N=r(37260),mail_config=()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l(),{children:(0,n.jsx)("title",{children:"Mail Config"})}),(0,n.jsx)(s.Z,{}),(0,n.jsxs)(i.ZP,{container:!0,columns:{xs:1,md:6,lg:4},children:[(0,n.jsx)(i.ZP,{item:!0,xs:1}),(0,n.jsx)(i.ZP,{item:!0,xs:1,md:4,lg:2,children:(0,n.jsxs)(N.s_,{children:[(0,n.jsx)(N.V9,{children:(0,n.jsx)(O.z,{children:"Mail config"})}),(0,n.jsx)(N.TZ,{expandInitially:!0,header:"Manage mail servers",children:(0,n.jsx)(ManageMailServer_ManageMailServer,{})}),(0,n.jsx)(N.TZ,{expandInitially:!0,header:"Manage mail recipients",children:(0,n.jsx)(ManageMailRecipient_ManageMailRecipient,{})})]})})]})]})}},function(e){e.O(0,[466,804,494,50,263,213,310,461,264,775,541,633,733,17,774,888,179],function(){return e(e.s=24084)}),_N_E=e.O()}]);