"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4312],{71409:(Q,O,t)=>{t.d(O,{E3:()=>g,vj:()=>b});const e=`{{ define "__subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ if gt (.Alerts.Resolved | len) 0 }}, RESOLVED:{{ .Alerts.Resolved | len }}{{ end }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}{{ end }}

{{ define "__text_values_list" }}{{ if len .Values }}{{ $first := true }}{{ range $refID, $value := .Values -}}
{{ if $first }}{{ $first = false }}{{ else }}, {{ end }}{{ $refID }}={{ $value }}{{ end -}}
{{ else }}[no value]{{ end }}{{ end }}

{{ define "__text_alert_list" }}{{ range . }}
Value: {{ template "__text_values_list" . }}
Labels:
{{ range .Labels.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}Annotations:
{{ range .Annotations.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}{{ if gt (len .GeneratorURL) 0 }}Source: {{ .GeneratorURL }}
{{ end }}{{ if gt (len .SilenceURL) 0 }}Silence: {{ .SilenceURL }}
{{ end }}{{ if gt (len .DashboardURL) 0 }}Dashboard: {{ .DashboardURL }}
{{ end }}{{ if gt (len .PanelURL) 0 }}Panel: {{ .PanelURL }}
{{ end }}{{ end }}{{ end }}

{{ define "default.title" }}{{ template "__subject" . }}{{ end }}

{{ define "default.message" }}{{ if gt (len .Alerts.Firing) 0 }}**Firing**
{{ template "__text_alert_list" .Alerts.Firing }}{{ if gt (len .Alerts.Resolved) 0 }}

{{ end }}{{ end }}{{ if gt (len .Alerts.Resolved) 0 }}**Resolved**
{{ template "__text_alert_list" .Alerts.Resolved }}{{ end }}{{ end }}

{{ define "__teams_text_alert_list" }}{{ range . }}
Value: {{ template "__text_values_list" . }}
Labels:
{{ range .Labels.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}
Annotations:
{{ range .Annotations.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}
{{ if gt (len .GeneratorURL) 0 }}Source: [{{ .GeneratorURL }}]({{ .GeneratorURL }})

{{ end }}{{ if gt (len .SilenceURL) 0 }}Silence: [{{ .SilenceURL }}]({{ .SilenceURL }})

{{ end }}{{ if gt (len .DashboardURL) 0 }}Dashboard: [{{ .DashboardURL }}]({{ .DashboardURL }})

{{ end }}{{ if gt (len .PanelURL) 0 }}Panel: [{{ .PanelURL }}]({{ .PanelURL }})

{{ end }}
{{ end }}{{ end }}

{{ define "teams.default.message" }}{{ if gt (len .Alerts.Firing) 0 }}**Firing**
{{ template "__teams_text_alert_list" .Alerts.Firing }}{{ if gt (len .Alerts.Resolved) 0 }}

{{ end }}{{ end }}{{ if gt (len .Alerts.Resolved) 0 }}**Resolved**
{{ template "__teams_text_alert_list" .Alerts.Resolved }}{{ end }}{{ end }}`;var m=t(76343),A=t(79120);const N=["TemplateGroup"],s=A.H.enhanceEndpoints({addTagTypes:N}).injectEndpoints({endpoints:u=>({listNamespacedTemplateGroup:u.query({query:n=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${n.namespace}/templategroups`,params:{pretty:n.pretty,allowWatchBookmarks:n.allowWatchBookmarks,continue:n.continue,fieldSelector:n.fieldSelector,labelSelector:n.labelSelector,limit:n.limit,resourceVersion:n.resourceVersion,resourceVersionMatch:n.resourceVersionMatch,sendInitialEvents:n.sendInitialEvents,timeoutSeconds:n.timeoutSeconds,watch:n.watch}}),providesTags:["TemplateGroup"]}),createNamespacedTemplateGroup:u.mutation({query:n=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${n.namespace}/templategroups`,method:"POST",body:n.comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1TemplateGroup,params:{pretty:n.pretty,dryRun:n.dryRun,fieldManager:n.fieldManager,fieldValidation:n.fieldValidation}}),invalidatesTags:["TemplateGroup"]}),readNamespacedTemplateGroup:u.query({query:n=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${n.namespace}/templategroups/${n.name}`,params:{pretty:n.pretty}}),providesTags:["TemplateGroup"]}),replaceNamespacedTemplateGroup:u.mutation({query:n=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${n.namespace}/templategroups/${n.name}`,method:"PUT",body:n.comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1TemplateGroup,params:{pretty:n.pretty,dryRun:n.dryRun,fieldManager:n.fieldManager,fieldValidation:n.fieldValidation}}),invalidatesTags:["TemplateGroup"]}),deleteNamespacedTemplateGroup:u.mutation({query:n=>({url:`/apis/notifications.alerting.grafana.app/v0alpha1/namespaces/${n.namespace}/templategroups/${n.name}`,method:"DELETE",body:n.ioK8SApimachineryPkgApisMetaV1DeleteOptions,params:{pretty:n.pretty,dryRun:n.dryRun,gracePeriodSeconds:n.gracePeriodSeconds,orphanDependents:n.orphanDependents,propagationPolicy:n.propagationPolicy}}),invalidatesTags:["TemplateGroup"]})}),overrideExisting:!1}),p="/api/alertmanager/grafana/config/api/v1/templates/test";s.enhanceEndpoints({endpoints:{readNamespacedTemplateGroup:u=>{const n={hideErrorMessage:!0};u.extraOptions=n}}});const g=s.injectEndpoints({endpoints:u=>({previewTemplate:u.mutation({query:({template:n,alerts:c,name:C})=>({url:p,data:{template:n,alerts:c,name:C},method:"POST"})}),getDefaultTemplates:u.query({queryFn:async()=>({data:(0,m.D)(e)})})})}),{usePreviewTemplateMutation:b}=g},57323:(Q,O,t)=>{t.d(O,{_:()=>s});var e=t(74848),m=t(2543),A=t.n(m),N=t(747);const s=({actions:c,children:C})=>{const l=(0,m.filter)(c,u),L=(0,m.filter)(c,n);return l.length?(0,e.jsx)(p,{actions:l,children:C}):L.length?(0,e.jsx)(g,{actions:L,children:C}):null},p=({actions:c,children:C})=>{const l=(0,N.iI)();return b(l,c)?(0,e.jsx)(e.Fragment,{children:C}):null},g=({actions:c,children:C})=>{const l=(0,N.e2)();return b(l,c)?(0,e.jsx)(e.Fragment,{children:C}):null};function b(c,C){return(0,m.chain)(c).pick(C).values().value().some(([l,L])=>L===!0)}function u(c){return Object.values(N.QI).includes(c)}function n(c){return Object.values(N.RY).includes(c)}},6353:(Q,O,t)=>{t.r(O),t.d(O,{ActiveTab:()=>_,ContactPointsPageContents:()=>re,default:()=>De});var e=t(74848),m=t(96540),A=t(81876),N=t(59830),s=t(54594),p=t(48583),g=t(37e3),b=t(45565),u=t(10247),n=t(88849),c=t(11238),C=t(16110),l=t(87638),L=t(11817),G=t(13693),o=t(85651),r=t(61491),a=t(747),P=t(99797),f=t(84558),S=t(13005),E=t(88214),z=t(37104),W=t(32174),Z=t(93185),H=t(74625),q=t(18729),J=t(29675),d=t(65164),j=t(6736),K=t(66384),I=t(17687),y=t(98747),$=t(57323),D=t(68836),x=t(79653),Y=t(83650),ae=t(27219),X=t(50292),k=t(70437),ce=t(12314);const de=({alertManagerName:i,templates:h})=>{const R=(0,I._2)(),[F]=(0,X._3)({alertmanager:i}),M=(0,J.of)(D.L),[v,V]=(0,m.useState)(),U=async()=>{if(v)try{await F.execute({uid:v.uid}),R.success("Template deleted",`Template ${v.title} has been deleted`)}catch(T){R.error("Error deleting template",`Error deleting template ${v.title}`);const B=T instanceof Error?T:new Error((0,o.JZ)(T));(0,q.vV)(B)}V(void 0)};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("table",{className:M.table,"data-testid":"templates-table",children:[(0,e.jsxs)("colgroup",{children:[(0,e.jsx)("col",{className:M.colExpand}),(0,e.jsx)("col",{}),(0,e.jsx)("col",{})]}),(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{children:[(0,e.jsx)("th",{}),(0,e.jsx)("th",{children:"Template group"}),(0,e.jsx)($._,{actions:[a.QI.CreateNotificationTemplate,a.QI.UpdateNotificationTemplate,a.QI.DeleteNotificationTemplate],children:(0,e.jsx)("th",{children:"Actions"})})]})}),(0,e.jsxs)("tbody",{children:[!h.length&&(0,e.jsx)("tr",{className:M.evenRow,children:(0,e.jsx)("td",{colSpan:3,children:"No templates defined."})}),h.map((T,B)=>(0,e.jsx)(pe,{notificationTemplate:T,idx:B,alertManagerName:i,onDeleteClick:V},T.uid))]})]}),!!v&&(0,e.jsx)(d.u,{isOpen:!0,title:"Delete template group",body:`Are you sure you want to delete template group "${v.title}"?`,confirmText:"Yes, delete",onConfirm:U,onDismiss:()=>V(void 0)})]})};function pe({notificationTemplate:i,idx:h,alertManagerName:R,onDeleteClick:F}){const M=(0,J.of)(D.L),v=R===E.hY,[V,U]=(0,m.useState)(!1),{isProvisioned:T}=(0,X.OA)(i),{uid:B,title:w,content:ee,missing:te}=i,ne=(0,L.t)("alerting.templates.misconfigured-badge-text","Misconfigured");return(0,e.jsxs)(m.Fragment,{children:[(0,e.jsxs)("tr",{className:h%2===0?M.evenRow:void 0,children:[(0,e.jsx)("td",{children:(0,e.jsx)(x.e,{isCollapsed:!V,onToggle:()=>U(!V)})}),(0,e.jsxs)("td",{children:[w," ",T&&(0,e.jsx)(ae.rS,{})," ",te&&!v&&(0,e.jsx)(j.m,{content:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(L.x6,{i18nKey:"alerting.templates.misconfigured-warning",children:"This template is misconfigured."}),(0,e.jsx)("br",{}),(0,e.jsxs)(L.x6,{i18nKey:"alerting.templates.misconfigured-warning-details",children:["Templates must be defined in both the ",(0,e.jsx)(y.X,{content:"template_files"})," and"," ",(0,e.jsx)(y.X,{content:"templates"})," sections of your alertmanager configuration."]})]}),children:(0,e.jsx)("span",{children:(0,e.jsx)(K.E,{text:ne,color:"orange"})})})]}),(0,e.jsxs)("td",{className:M.actionsCell,children:[T&&(0,e.jsx)(k.M,{to:(0,o.nL)(`/alerting/notifications/templates/${encodeURIComponent(B)}/edit`,R),tooltip:"view template",icon:"file-alt"}),!T&&(0,e.jsx)($._,{actions:[a.QI.UpdateNotificationTemplate],children:(0,e.jsx)(k.M,{to:(0,o.nL)(`/alerting/notifications/templates/${encodeURIComponent(B)}/edit`,R),tooltip:"Edit template group",icon:"pen"})}),(0,e.jsx)($._,{actions:[a.QI.CreateNotificationTemplate],children:(0,e.jsx)(k.M,{to:(0,o.nL)(`/alerting/notifications/templates/${encodeURIComponent(B)}/duplicate`,R),tooltip:"Copy template group",icon:"copy"})}),!T&&(0,e.jsx)($._,{actions:[a.QI.DeleteNotificationTemplate],children:(0,e.jsx)(k.M,{onClick:()=>F(i),tooltip:"Delete template group",icon:"trash-alt"})})]})]}),V&&(0,e.jsxs)("tr",{className:h%2===0?M.evenRow:void 0,children:[(0,e.jsx)("td",{}),(0,e.jsx)("td",{colSpan:2,children:(0,e.jsx)(Y.X,{label:"",horizontal:!0,children:(0,e.jsx)(ce.K,{width:"auto",height:"auto",autoHeight:!0,value:ee,showLineNumbers:!1,monacoOptions:{readOnly:!0,scrollBeyondLastLine:!1}})})})]})]},B)}const ue=()=>{const{selectedAlertmanager:i}=(0,S.VI)(),{data:h,isLoading:R,error:F}=(0,X.cC)({alertmanager:i??""});return F?(0,e.jsx)(g.F,{title:"Failed to fetch notification templates",children:(0,o.JZ)(F)}):R?(0,e.jsx)(A._,{text:"Loading notification templates"}):h?(0,e.jsx)(de,{alertManagerName:i,templates:h}):null};var me=t(22803),ge=t(40996),fe=t(86489),he=t(34128),ve=t(79784);const xe=()=>{const i=(0,J.of)(Te),[h,R]=(0,f.l)(),F=h.get("search")??"",[M,v]=(0,m.useState)(F),[V,U]=(0,ge.A)(()=>{R({search:M},!0)},300,[R,M]),T=(0,m.useCallback)(()=>{U(),v(""),R({search:""},!0)},[U,R]),B=!!F;return(0,e.jsxs)(p.B,{direction:"row",alignItems:"end",gap:.5,children:[(0,e.jsx)(fe.D,{className:i.noBottom,label:"Search by name or type",children:(0,e.jsx)(he.p,{"aria-label":"search contact points",placeholder:"Search",width:46,prefix:(0,e.jsx)(ve.I,{name:"search"}),onChange:w=>{v(w.currentTarget.value)},value:M})}),(0,e.jsx)(s.$n,{variant:"secondary",icon:"times",onClick:()=>T(),disabled:!B,"aria-label":"clear",children:"Clear"})]})},Te=()=>({noBottom:(0,me.css)({marginBottom:0})}),Ae=({alertManagerName:i})=>{const h=(0,E.AL)(i);return(0,e.jsx)($._,{actions:[a.QI.UpdateExternalConfiguration],children:(0,e.jsxs)(g.F,{severity:"info",title:"Global config for contact points",children:[(0,e.jsx)("p",{children:"For each external Alertmanager you can define global settings, like server addresses, usernames and password, for all the supported contact points."}),(0,e.jsx)(s.z9,{href:(0,o.nL)("alerting/notifications/global-config",i),variant:"secondary",children:h?"View global config":"Edit global config"})]})})};var oe=t(35626),be=t(84139),Ce=t(2543),Le=t(44862);const se=new be.A({intraMode:1,intraIns:1,intraSub:1,intraDel:1,intraTrn:1}),Pe=(i,h)=>{const R=(0,m.useMemo)(()=>i.map(U=>U.name),[i]),F=(0,m.useMemo)(()=>i.map(U=>U.grafana_managed_receiver_configs.map(T=>T[Le.MX].name).join(" ")),[i]);if(!h)return i;const M=se.filter(R,h)??[],v=se.filter(F,h)??[],V=[...M,...v];return(0,Ce.uniq)(V).map(U=>i[U])??[]};var ie=t(79179),_=(i=>(i.ContactPoints="contact_points",i.NotificationTemplates="templates",i))(_||{});const le=10,Se=()=>{const{selectedAlertmanager:i}=(0,S.VI)(),[h]=(0,f.l)(),R=!(0,G.dM)(i),F=l.TP.hasPermission(r.AccessControlAction.AlertingNotificationsRead),{isLoading:M,error:v,contactPoints:V}=(0,oe.dK)({alertmanager:i,fetchPolicies:R,fetchStatuses:F}),[U,T]=(0,a.L7)(a.QI.CreateContactPoint),[B,w]=(0,a.L7)(a.QI.ExportContactPoint),[ee,te]=(0,ie.G)(),ne=h.get("search");if(M)return(0,e.jsx)(A._,{text:"Loading..."});const Me=i===E.hY;return V.length===0?(0,e.jsx)(N.p,{variant:T?"call-to-action":"not-found",button:T&&(0,e.jsx)(s.z9,{href:(0,o.nL)("/alerting/notifications/receivers/new",i),icon:"plus",size:"lg",children:(0,e.jsx)(L.x6,{i18nKey:"alerting.contact-points.create",children:"Create contact point"})}),message:(0,L.t)("alerting.contact-points.empty-state.title","You don't have any contact points yet")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(p.B,{direction:"row",alignItems:"end",justifyContent:"space-between",children:[(0,e.jsx)(xe,{}),(0,e.jsxs)(p.B,{direction:"row",gap:1,children:[U&&(0,e.jsx)(s.z9,{icon:"plus","aria-label":"add contact point",variant:"primary",href:"/alerting/notifications/receivers/new",disabled:!T,children:(0,e.jsx)(L.x6,{i18nKey:"alerting.contact-points.create",children:"Create contact point"})}),B&&(0,e.jsx)(s.$n,{icon:"download-alt",variant:"secondary","aria-label":"export all",disabled:!w,onClick:()=>te(ie.B),children:"Export all"})]})]}),v?(0,e.jsx)(g.F,{title:"Failed to fetch contact points",children:(0,o.JZ)(v)}):(0,e.jsx)(Ee,{contactPoints:V,search:ne,pageSize:le}),!Me&&(0,e.jsx)(Ae,{alertManagerName:i}),ee]})},je=()=>{const[i,h]=(0,a.L7)(a.QI.CreateNotificationTemplate);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(p.B,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[(0,e.jsx)(b.E,{variant:"body",color:"secondary",children:"Create notification templates to customize your notifications."}),i&&(0,e.jsx)(s.z9,{icon:"plus",variant:"primary",href:"/alerting/notifications/templates/new",disabled:!h,children:"Add notification template group"})]}),(0,e.jsx)(ue,{})]})},ye=i=>{const[h,R]=(0,f.l)();return[(0,m.useMemo)(()=>{const v=h.get("tab");return!v||!Object.values(_).map(String).includes(v)?i:v||i},[i,h]),v=>R({tab:v})]},re=()=>{const{selectedAlertmanager:i}=(0,S.VI)(),[,h]=(0,a.L7)(a.QI.ViewContactPoint),[,R]=(0,a.L7)(a.QI.ViewNotificationTemplate),F=[h&&"contact_points",R&&"templates"].filter(B=>!!B)[0],[M,v]=ye(F),{contactPoints:V}=(0,oe.dK)({alertmanager:i}),U=M==="contact_points",T=M==="templates";return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Z.M,{currentAlertmanager:i}),(0,e.jsxs)(p.B,{direction:"column",children:[(0,e.jsxs)(u.U,{children:[h&&(0,e.jsx)(n.o,{label:"Contact Points",active:U,counter:V.length,onChangeTab:()=>v("contact_points")}),R&&(0,e.jsx)(n.o,{label:"Notification Templates",active:T,onChangeTab:()=>v("templates")})]}),(0,e.jsx)(c.J,{children:(0,e.jsxs)(p.B,{direction:"column",children:[U&&(0,e.jsx)(Se,{}),T&&(0,e.jsx)(je,{})]})})]})]})},Ee=({contactPoints:i,search:h,pageSize:R=le})=>{const F=Pe(i,h),{page:M,pageItems:v,numberOfPages:V,onPageChange:U}=(0,P.W)(F,1,R);if(v.length===0){const T=(0,L.t)("alerting.contact-points.no-contact-points-found","No contact points found");return(0,e.jsx)(N.p,{variant:"not-found",message:T})}return(0,e.jsxs)(e.Fragment,{children:[v.map((T,B)=>{const w=`${T.name}-${B}`;return(0,e.jsx)(H.z8,{contactPoint:T},w)}),(0,e.jsx)(C.d,{currentPage:M,numberOfPages:V,onNavigate:U,hideWhenSinglePage:!0})]})};function Re(){return(0,e.jsx)(W.y,{navId:"receivers",accessType:"notification",children:(0,e.jsx)(re,{})})}const De=(0,z.S)(Re)},50292:(Q,O,t)=>{t.d(O,{A1:()=>Z,J2:()=>E,OA:()=>J,_3:()=>H,cC:()=>a,lx:()=>q,xW:()=>W});var e=t(96540),m=t(77855),A=t(9365),N=t(71409),s=t(25779),p=t(25061),g=t(61499),b=t(18269),u=t(13693),n=t(5900);const{useGetAlertmanagerConfigurationQuery:c,useLazyGetAlertmanagerConfigurationQuery:C}=A.m,{useListNamespacedTemplateGroupQuery:l,useLazyReadNamespacedTemplateGroupQuery:L,useCreateNamespacedTemplateGroupMutation:G,useReplaceNamespacedTemplateGroupMutation:o,useDeleteNamespacedTemplateGroupMutation:r}=N.E3;function a({alertmanager:d}){const j=(0,u.dM)(d),K=l({namespace:(0,m.G)()},{skip:!j,selectFromResult:y=>({...y,data:y.data?P(y.data):void 0,currentData:y.currentData?P(y.currentData):void 0})}),I=c(d,{skip:j,selectFromResult:y=>({...y,data:y.data?S(y.data):void 0,currentData:y.currentData?S(y.currentData):void 0})});return j?K:I}function P(d){return d.items.map(j=>f(j))}function f(d){const j=(0,u.gw)(d,b.T.Provenance)??b.rh;return{uid:d.metadata.name??d.spec.title,title:d.spec.title,content:d.spec.content,provenance:j}}function S(d){const{alertmanager_config:j}=d,{templates:K=[]}=j;return Object.entries(d.template_files).map(([I,y])=>({uid:I,title:I,content:y,provenance:(d.template_file_provenances??{})[I]||b.rh,missing:!K.includes(I)}))}function E({alertmanager:d,uid:j}){const[K,I]=C({selectFromResult:x=>({...x,data:x.data?z(x.data,j):void 0,currentData:x.currentData?z(x.currentData,j):void 0})}),[y,$]=L({selectFromResult:x=>({...x,data:x.data?f(x.data):void 0,currentData:x.currentData?f(x.currentData):void 0})}),D=(0,u.dM)(d);return(0,e.useEffect)(()=>{D?y({namespace:(0,m.G)(),name:j}):K(d)},[d,j,D,K,y]),D?$:I}function z(d,j){return S(d).find(I=>I.title===j)}function W({alertmanager:d}){const[j]=G(),[K]=(0,p.d)(),I=(0,u.dM)(d),y=(0,s.Yb)(({templateValues:D})=>{const x=(0,g.FB)({template:D});return K(x)}),$=(0,s.Yb)(({templateValues:D})=>{const x=(0,n.o)(D.title,D.content);return j({namespace:(0,m.G)(),comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1TemplateGroup:{spec:{title:D.title,content:x},metadata:{}}}).unwrap()});return I?$:y}function Z({alertmanager:d}){const[j]=o(),[K]=(0,p.d)(),I=(0,u.dM)(d),y=(0,s.Yb)(({template:D,patch:x})=>{const Y=(0,g.jS)({name:D.title,template:x});return K(Y)}),$=(0,s.Yb)(({template:D,patch:x})=>{const Y=(0,n.o)(x.title,x.content);return j({namespace:(0,m.G)(),name:D.uid,comGithubGrafanaGrafanaPkgApisAlertingNotificationsV0Alpha1TemplateGroup:{spec:{title:x.title,content:Y},metadata:{name:D.uid}}}).unwrap()});return I?$:y}function H({alertmanager:d}){const[j]=r(),[K]=(0,p.d)(),I=(0,s.Yb)(async({uid:D})=>{const x=(0,g.JI)({name:D});return K(x)}),y=(0,s.Yb)(({uid:D})=>j({namespace:(0,m.G)(),name:D,ioK8SApimachineryPkgApisMetaV1DeleteOptions:{}}).unwrap());return(0,u.dM)(d)?y:I}function q({alertmanager:d,originalTemplate:j}){const{useLazyGetAlertmanagerConfigurationQuery:K}=A.m,[I]=K();return{titleIsUnique:async $=>{if((0,u.dM)(d)||j?.title===$)return!0;const x=await I(d).unwrap();return S(x).some(X=>X.title===$)?"Another template with this name already exists":!0}}}function J(d){return d?{isProvisioned:!!d.provenance&&d.provenance!==b.rh}:{isProvisioned:!1}}},12314:(Q,O,t)=>{t.d(O,{K:()=>o});var e=t(74848),m=t(96540),A=t(3886),N=t(2543),s=t(97671);function p(r){const a=r.languages.CompletionItemKind.Function;return[{label:s.AlertmanagerTemplateFunction.toUpper,detail:"function(s string)",kind:a},{label:s.AlertmanagerTemplateFunction.toLower,detail:"function(s string)",kind:a},{label:s.AlertmanagerTemplateFunction.title,documentation:"Capitalizes the first letter of each word",detail:"function(s string)",kind:a},{label:s.AlertmanagerTemplateFunction.join,documentation:{value:"Joins an array of strings using the separator provided."},detail:"function(separator string, s []string)",kind:a},{label:s.AlertmanagerTemplateFunction.match,detail:"function",kind:a},{label:s.AlertmanagerTemplateFunction.safeHtml,detail:"function(pattern, repl, text)",kind:a},{label:s.AlertmanagerTemplateFunction.reReplaceAll,detail:"function(pattern, repl, text)",kind:a},{label:s.AlertmanagerTemplateFunction.stringSlice,detail:"function(s ...string)",kind:a}]}var g=t(30930);function b(r){const a={triggerCharacters:["."],provideCompletionItems(P,f,S){const E=P.getWordUntilPosition(f),z={startLineNumber:f.lineNumber,endLineNumber:f.lineNumber,startColumn:E.startColumn,endColumn:E.endColumn},W=new n(r,z);if(!u(P,f))return W.getSnippetsSuggestions();if(S.triggerKind===r.languages.CompletionTriggerKind.Invoke&&!S.triggerCharacter)return W.getFunctionsSuggestions();const H=P.getWordUntilPosition({lineNumber:f.lineNumber,column:f.column-1});return W.getTemplateDataSuggestions(H.word)}};return r.languages.registerCompletionItemProvider("go-template",a)}function u(r,a){const P={startLineNumber:a.lineNumber,endLineNumber:a.lineNumber,startColumn:r.getLineMinColumn(a.lineNumber),endColumn:r.getLineMaxColumn(a.lineNumber)};return r.findMatches('\\{\\{[a-zA-Z0-9._() "]+\\}\\}',P,!0,!1,null,!0).some(E=>E.range.containsPosition(a))}class n{constructor(a,P){this.monaco=a,this.range=P,this.getSnippetsSuggestions=()=>this.getCompletionsFromDefinitions((0,g.Mq)(this.monaco)),this.getFunctionsSuggestions=()=>this.getCompletionsFromDefinitions(p(this.monaco)),this.getTemplateDataSuggestions=f=>{switch(f){case"":return this.getCompletionsFromDefinitions((0,g.Xt)(this.monaco),(0,g.So)(this.monaco));case"Alerts":return this.getCompletionsFromDefinitions((0,g.J2)(this.monaco));case"GroupLabels":case"CommonLabels":case"CommonAnnotations":case"Labels":case"Annotations":return this.getCompletionsFromDefinitions((0,g.KS)(this.monaco));default:return{suggestions:[]}}},this.getCompletionsFromDefinitions=(...f)=>({suggestions:(0,N.concat)(...f).map(E=>c(E,this.range))})}}function c({label:r,detail:a,documentation:P,kind:f,insertText:S},E){const z=typeof r=="string"?r:r.label,W=typeof r=="string"?{label:r,description:a}:{...r};return W.description??=a,{label:W,kind:f,insertText:S??z,range:E,documentation:P,detail:a}}const C="go-template",L={id:C,extensions:[],aliases:[],mimetypes:[],loader:()=>Promise.resolve().then(t.bind(t,97671))},G=(r,a)=>{const{id:P,loader:f}=a;r.languages.getLanguages().find(E=>E.id===P)||(r.languages.register({id:P}),f().then(E=>{r.languages.setMonarchTokensProvider(P,E.language),r.languages.setLanguageConfiguration(P,E.conf)}))},o=r=>{const a=!!r.autoHeight,P=(0,m.useRef)(null),f=S=>{if(a){const E=S.getContentHeight();try{S.layout({height:E,width:NaN})}catch{}}};return(0,m.useEffect)(()=>()=>{P.current?.dispose()},[]),(0,e.jsx)(A.B,{showLineNumbers:!0,showMiniMap:!1,...r,monacoOptions:{scrollBeyondLastLine:!1},onEditorDidMount:f,onBeforeEditorMount:S=>{G(S,L),P.current=b(S)},language:C})}},30930:(Q,O,t)=>{t.d(O,{So:()=>n,J2:()=>c,Xt:()=>u,KS:()=>C,Mq:()=>L,L:()=>l});const e=`
{{ range .Alerts }}
  Status: {{ .Status }}
  Starts at: {{ .StartsAt }}
{{ end }}
`,m=`
[{{.Status}}] {{ .Labels.alertname }}

Labels:
{{ range .Labels.SortedPairs }}
  {{ .Name }}: {{ .Value }}
{{ end }}

{{ if gt (len .Annotations) 0 }}
Annotations:
{{ range .Annotations.SortedPairs }}
  {{ .Name }}: {{ .Value }}
{{ end }}
{{ end }}

{{ if gt (len .SilenceURL ) 0 }}
  Silence alert: {{ .SilenceURL }}
{{ end }}
{{ if gt (len .DashboardURL ) 0 }}
  Go to dashboard: {{ .DashboardURL }}
{{ end }}
`,A=b("GroupLabels.SortedPairs"),N=b("CommonLabels.SortedPairs"),s=b("CommonAnnotations.SortedPairs"),p=b("Labels.SortedPairs"),g=b("Annotations.SortedPairs");function b(G){return`
{{ range .${G} }}
  {{ .Name }} = {{ .Value }}
{{ end }}`}function u(G){const o=G.languages.CompletionItemKind.Field;return[{label:"Alerts",kind:o,detail:"Alert[]",documentation:{value:"An Array containing all alerts"}},{label:"Receiver",kind:o,detail:"string"},{label:"Status",kind:o,detail:"string"},{label:"GroupLabels",kind:o,detail:"[]KeyValue"},{label:"CommonLabels",kind:o,detail:"[]KeyValue"},{label:"CommonAnnotations",kind:o,detail:"[]KeyValue"},{label:"ExternalURL",kind:o,detail:"string"}]}function n(G){const o=G.languages.CompletionItemKind.Field;return[{label:{label:"Status",detail:"(Alert)",description:"string"},kind:o,detail:"string",documentation:{value:"Status of the alert. It can be `firing` or `resolved`"}},{label:{label:"Labels",detail:"(Alert)"},kind:o,detail:"[]KeyValue",documentation:{value:"A set of labels attached to the alert."}},{label:{label:"Annotations",detail:"(Alert)"},kind:o,detail:"[]KeyValue",documentation:"A set of annotations attached to the alert."},{label:{label:"StartsAt",detail:"(Alert)"},kind:o,detail:"time.Time",documentation:"Time the alert started firing."},{label:{label:"EndsAt",detail:"(Alert)"},kind:o,detail:"time.Time",documentation:"Only set if the end time of an alert is known. Otherwise set to a configurable timeout period from the time since the last alert was received."},{label:{label:"GeneratorURL",detail:"(Alert)"},kind:o,detail:"string",documentation:"Back link to Grafana or external Alertmanager."},{label:{label:"SilenceURL",detail:"(Alert)"},kind:o,detail:"string",documentation:"Link to Grafana silence for with labels for this alert pre-filled. Only for Grafana managed alerts."},{label:{label:"DashboardURL",detail:"(Alert)"},kind:o,detail:"string",documentation:"Link to Grafana dashboard, if alert rule belongs to one. Only for Grafana managed alerts."},{label:{label:"PanelURL",detail:"(Alert)"},kind:o,detail:"string",documentation:"Link to Grafana dashboard panel, if alert rule belongs to one. Only for Grafana managed alerts."},{label:{label:"Fingerprint",detail:"(Alert)"},kind:o,detail:"string",documentation:"Fingerprint that can be used to identify the alert."},{label:{label:"ValueString",detail:"(Alert)"},kind:o,detail:"string",documentation:"String that contains labels and values of each reduced expression in the alert."}]}function c(G){const o=G.languages.CompletionItemKind.Field;return[{label:"Firing",kind:o,detail:"Alert[]"},{label:"Resolved",kind:o,detail:"Alert[]"}]}function C(G){const o=G.languages.CompletionItemKind.Field;return[{label:"SortedPairs",kind:o,detail:"[]KeyValue"},{label:"Names",kind:o,detail:"[]string"},{label:"Values",kind:o,detail:"[]string"},{label:"Remove",detail:"KeyValue[] function(keys []string)",kind:G.languages.CompletionItemKind.Method}]}const l={alerts:{label:"alertsloop",description:"Renders a loop through alerts",snippet:e},alertDetails:{label:"alertdetails",description:"Renders all information available about the alert",snippet:m},groupLabels:{label:"grouplabelsloop",description:"Renders a loop through group labels",snippet:A},commonLabels:{label:"commonlabelsloop",description:"Renders a loop through common labels",snippet:N},commonAnnotations:{label:"commonannotationsloop",description:"Renders a loop through common annotations",snippet:s},labels:{label:"labelsloop",description:"Renders a loop through labels",snippet:p},annotations:{label:"annotationsloop",description:"Renders a loop through annotations",snippet:g}};function L(G){const o=G.languages.CompletionItemKind.Snippet,r=G.languages.CompletionItemInsertTextRule.InsertAsSnippet,{alerts:a,alertDetails:P,groupLabels:f,commonLabels:S,commonAnnotations:E,labels:z,annotations:W}=l;return[{label:a.label,documentation:a.description,kind:o,insertText:a.snippet,insertTextRules:r},{label:{label:P.label,detail:"(Alert)"},documentation:P.description,kind:o,insertText:P.snippet,insertTextRules:r},{label:f.label,documentation:f.description,kind:o,insertText:f.snippet,insertTextRules:r},{label:S.label,documentation:S.description,kind:o,insertText:S.snippet,insertTextRules:r},{label:E.label,documentation:E.description,kind:o,insertText:E.snippet,insertTextRules:r},{label:{label:z.label,detail:"(Alert)"},documentation:z.description,kind:o,insertText:z.snippet,insertTextRules:r},{label:{label:W.label,detail:"(Alert)"},documentation:W.description,kind:o,insertText:W.snippet,insertTextRules:r}]}},76343:(Q,O,t)=>{t.d(O,{D:()=>e,G7:()=>N,Jl:()=>m,gY:()=>A});function e(s){const p={},g=[],b=/{{-?\s*(define|end|if|range|else|with|template|block)\b(.*?)-?}}/gs;let u,n=0;for(;(u=b.exec(s))!==null;){const[,c,C]=u;if(n=u.index,c==="define"){const l=C?.match(/"([^"]+)"/);l&&g.push({type:"define",startIndex:n,name:l[1]})}else if(c==="end"){let l=g.pop();for(;l&&l.type!=="define"&&l.type!=="if"&&l.type!=="range"&&l.type!=="with"&&l.type!=="block";)l=g.pop();if(l){const L=b.lastIndex;l.type==="define"&&!l.name?.startsWith("__")&&(p[l.name]={name:l.name,content:s.slice(l.startIndex,L)})}}else(c==="if"||c==="range"||c==="else"||c==="with"||c==="block")&&g.push({type:c,startIndex:n})}for(const c of Object.values(p)){const C=/{{ template "([^"]+)" }}/g;let l;for(;(l=C.exec(c.content))!==null;){const L=l[1];p[L]?.content&&(c.content+=`
`+p[L]?.content,delete p[L])}}return Object.values(p)}function m(s){return`{{ template "${s}" . }}`}function A(s){const p=s.match(/\{\{\s*template\s*"(.*)"\s*\.\s*\}\}/);return p?p[1]:""}function N(s){const p=/\{\{\s*template\s*".*?"\s*\.\s*\}\}/g;if(s.match(p)?.length!==1)return!1;const b=s.split(p);for(const u of b)if(u.trim()!=="")return!1;return!0}},70437:(Q,O,t)=>{t.d(O,{M:()=>N});var e=t(74848),m=t(6736),A=t(54594);const N=({tooltip:s,icon:p,to:g,target:b,onClick:u,className:n,tooltipPlacement:c="top",...C})=>{const l=typeof s=="string"?s:void 0;return(0,e.jsx)(m.m,{content:s,placement:c,children:g?(0,e.jsx)(A.z9,{variant:"secondary",fill:"text",icon:p,href:g,size:"sm",target:b,...C,"aria-label":l}):(0,e.jsx)(A.$n,{className:n,variant:"secondary",fill:"text",size:"sm",icon:p,type:"button",onClick:u,...C,"aria-label":l})})}},68836:(Q,O,t)=>{t.d(O,{L:()=>m});var e=t(22803);const m=A=>({table:(0,e.css)({width:"100%",borderRadius:A.shape.radius.default,border:`solid 1px ${A.colors.border.weak}`,backgroundColor:A.colors.background.secondary,th:{padding:A.spacing(1)},td:{padding:`0 ${A.spacing(1)}`},tr:{height:"38px"}}),evenRow:(0,e.css)({backgroundColor:A.colors.background.primary}),colExpand:(0,e.css)({width:"36px"}),nameCell:(0,e.css)({gap:A.spacing(1)}),actionsCell:(0,e.css)({textAlign:"right",width:"1%",whiteSpace:"nowrap","& > * + *":{marginLeft:A.spacing(.5)}})})}}]);

//# sourceMappingURL=ContactPoints.486e10a9b4adf88528a3.js.map