"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[6795],{98548:(x,l,e)=>{e.r(l),e.d(l,{plugin:()=>M});var c=e(7238),h=e(39493),a=e(68404),u=e(4761),d=e(19426),g=e(53217),f=e(81764),v=e(8944),p=e(12006),E=e(47694),i=e(39031);const A=[{value:i.sK.mimir,label:"Mimir",description:"https://grafana.com/oss/mimir/. An open source, horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus."},{value:i.sK.cortex,label:"Cortex",description:"https://cortexmetrics.io/"},{value:i.sK.prometheus,label:"Prometheus",description:"https://prometheus.io/. Does not support editing configuration via API, so contact points and notification policies are read-only."}],S=o=>{const{options:t,onOptionsChange:s}=o;return a.createElement(a.Fragment,null,a.createElement("h3",{className:"page-heading"},"Alertmanager"),a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form"},a.createElement(d.c,{width:13},"Implementation"),a.createElement(g.Ph,{width:40,options:A,value:t.jsonData.implementation||i.sK.mimir,onChange:r=>s({...t,jsonData:{...t.jsonData,implementation:r.value}})}))),a.createElement("div",{className:"gf-form-inline"},a.createElement(f._,{label:"Receive Grafana Alerts",tooltip:"When enabled, Grafana-managed alerts are sent to this Alertmanager.",labelWidth:26},a.createElement(v.x,{value:t.jsonData.handleGrafanaManagedAlerts??!1,onChange:r=>{s((0,h.ZP)(t,n=>{n.jsonData.handleGrafanaManagedAlerts=r.currentTarget.checked}))}})))),a.createElement(p.E,{defaultUrl:"",dataSourceConfig:t,showAccessOptions:!0,onChange:s,sigV4AuthToggleEnabled:E.vc.sigV4AuthEnabled,renderSigV4Editor:a.createElement(u.IW,{...o})}))};var y=e(59980),C=e(65583),m=e(54899),I=e(44737),P=e(46818);class D extends c.MF{constructor(t){super(t),this.instanceSettings=t}query(){return(0,y.of)({data:[]})}_request(t){const s={headers:{},method:"GET",url:this.instanceSettings.url+t};return(this.instanceSettings.basicAuth||this.instanceSettings.withCredentials)&&(this.instanceSettings.withCredentials=!0),this.instanceSettings.basicAuth&&(s.headers.Authorization=this.instanceSettings.basicAuth),(0,C.n)((0,m.i)().fetch(s))}async testDatasource(){let t;const s=this.instanceSettings.url,r=s?await(0,I.SJ)(s):{lazyConfigInit:!1};if(this.instanceSettings.jsonData.implementation===i.sK.prometheus){try{if(t=await this._request("/alertmanager/api/v2/status"),t&&t?.status===200)return{status:"error",message:"It looks like you have chosen Prometheus implementation, but detected a Mimir or Cortex endpoint. Please update implementation selection and try again."}}catch{}try{t=await this._request("/api/v2/status")}catch{}}else{try{if(t=await this._request("/api/v2/status"),t&&t?.status===200)return{status:"error",message:"It looks like you have chosen a Mimir or Cortex implementation, but detected a Prometheus endpoint. Please update implementation selection and try again."}}catch{}try{t=await this._request("/alertmanager/api/v2/status")}catch(n){if((0,m.kW)(n)&&r.lazyConfigInit&&(0,P.kk)(n)?.includes("the Alertmanager is not configured"))return{status:"success",message:"Health check passed.",details:{message:"Mimir Alertmanager without the fallback configuration has been discovered."}}}}return t?.status===200?{status:"success",message:"Health check passed."}:{status:"error",message:"Health check failed."}}}const M=new c.hf(D).setConfigEditor(S)}}]);

//# sourceMappingURL=alertmanagerPlugin.58ae70ad776c1e8ed465.js.map