"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7410],{9661:(g,_,e)=>{e.d(_,{x:()=>l});var t=e(39953),r=e(57721),s=e(43686);function l(a){const o=(0,r.useDispatch)(),E=(0,t.useRef)(a);E.current=a,(0,t.useEffect)(()=>()=>{o((0,s.e)({cleanupAction:E.current}))},[o])}},27410:(g,_,e)=>{e.r(_),e.d(_,{default:()=>E});var t=e(39953),r=e(33155),s=e(72401),l=e(328),a=e(65449);const E=()=>{const{selectedAlertmanager:f}=(0,l.ZA)(),{data:i,isLoading:D,error:P}=(0,s.W)(f);return D&&!i?"loading...":P?t.createElement(r.b,{severity:"error",title:"Failed to fetch message template"},String(P)):i?t.createElement(a.e,{config:i,alertManagerSourceName:f}):null}},65449:(g,_,e)=>{e.d(_,{e:()=>L});var t=e(39953),r=e(14058),s=e(33155),l=e(12223),a=e(4919),o=e(9661),E=e(57721),f=e(26544),i=e(79493),D=e(27732),P=e(95712),c=e(76716),v=e(3835),R=e(57675),T=e(45266);const d={smtp_require_tls:!0},L=({config:O,alertManagerSourceName:M})=>{const U=(0,E.useDispatch)();(0,o.x)(n=>n.unifiedAlerting.saveAMConfig=R.oq);const{loading:m,error:u}=(0,f._)(n=>n.saveAMConfig),C=(0,P.RY)(M),A=(0,r.cI)({defaultValues:JSON.parse(JSON.stringify({...d,...O.alertmanager_config.global??{}}))}),{handleSubmit:W,formState:{errors:I}}=A,B=n=>{U((0,i.mM)({newConfig:{...O,alertmanager_config:{...O.alertmanager_config,global:(0,v.oP)(n)}},oldConfig:O,alertManagerSourceName:M,successMessage:"Global config updated.",redirectPath:(0,c.eQ)("/alerting/notifications",M)}))};return t.createElement(r.RV,{...A},t.createElement("form",{onSubmit:W(B)},u&&t.createElement(s.b,{severity:"error",title:"Error saving receiver"},u.message||String(u)),D.g.map(n=>t.createElement(T.t,{readOnly:C,defaultValue:d[n.propertyName],key:n.propertyName,option:n,error:I[n.propertyName],pathPrefix:""})),t.createElement("div",null,t.createElement(l.Lh,null,!C&&t.createElement(t.Fragment,null,m&&t.createElement(a.zx,{disabled:!0,icon:"fa fa-spinner",variant:"primary"},"Saving..."),!m&&t.createElement(a.zx,{type:"submit"},"Save global config")),t.createElement(a.Qj,{disabled:m,fill:"outline",variant:"secondary",href:(0,c.eQ)("alerting/notifications",M)},"Cancel")))))}},72401:(g,_,e)=>{e.d(_,{W:()=>r});var t=e(37546);function r(s,l){const a=t.alertmanagerApi.endpoints.getAlertmanagerConfiguration.useQuery(s??"",{...l,skip:!s});return{...a,error:a.error}}}}]);

//# sourceMappingURL=7410.74529107af512057e3a3.js.map