"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[9224],{7070(U,d,e){e.r(d),e.d(d,{default:()=>W});var t=e(74848),l=e(54148),a=e(92745),s=e(43173),r=e(6975),m=e(34999),p=e(1506),L=e(62939),u=e(57276),v=e(5358),M=e(14055),C=e(77256),x=e(29442),D=e(42801),f=e(88547),T=e(36826),N=e(89292),y=e(40403);const V=(0,t.jsx)(p.L,{entity:"Notification template"}),F=()=>{const{selectedAlertmanager:n}=(0,v.VI)(),{name:i}=(0,l.g)(),o=i?decodeURIComponent(i):void 0,{currentData:c,isLoading:j,error:g}=(0,y.J2)({alertmanager:n??"",uid:o??""}),{currentData:h,isLoading:G,error:H}=(0,y.cC)({alertmanager:n??""}),K=j||G,E=g||H;if(!n)return(0,t.jsx)(p.L,{entity:"Alertmanager"});if(!o)return(0,t.jsx)(p.L,{entity:"Notification template"});if(K)return(0,t.jsx)(r._,{text:(0,a.t)("alerting.duplicate-message-template.text-loading-notification-template","Loading notification template")});if(E)return(0,L.E)(E)?V:(0,t.jsx)(m.F,{title:(0,a.t)("alerting.duplicate-message-template.title-error-loading-notification-template","Error loading notification template"),severity:"error",children:(0,C.JZ)(E)});if(!c)return V;const O=(0,M.V)(c.title,h?.map(Q=>Q.title)??[]);return(0,t.jsx)(N.By,{alertmanager:n,prefill:{title:O,content:(0,D.a)(c.content)}})};function A(){const{navId:n}=(0,u.yy)(),i=s.$.featureToggles.alertingNavigationV2,o=(0,x.UE)(i);return(0,t.jsx)(T.y,{navId:n,accessType:"notification",pageNav:{id:"templates",text:(0,a.t)("alerting.notification-templates.duplicate.title","Duplicate notification template group"),subTitle:(0,a.t)("alerting.notification-templates.duplicate.subTitle","Duplicate a group of notification templates"),parentItem:{text:(0,a.t)("alerting.common.titles.notification-templates","Notification Templates"),url:o}},children:(0,t.jsx)(F,{})})}const $=(0,f.S)(A),I=(0,t.jsx)(p.L,{entity:"Notification template"}),B=()=>{const{name:n}=(0,l.g)(),i=n?decodeURIComponent(n):void 0,{selectedAlertmanager:o}=(0,v.VI)(),{currentData:c,isLoading:j,error:g,isUninitialized:h}=(0,y.J2)({alertmanager:o??"",uid:i??""});return i?j||h?(0,t.jsx)(r._,{text:(0,a.t)("alerting.edit-message-template.text-loading-template","Loading template...")}):g?(0,L.E)(g)?I:(0,t.jsx)(m.F,{severity:"error",title:(0,a.t)("alerting.edit-message-template.title-failed-to-fetch-notification-template","Failed to fetch notification template"),children:(0,C.JZ)(g)}):c?(0,t.jsx)(N.By,{alertmanager:o??"",originalTemplate:c}):I:(0,t.jsx)(p.L,{entity:"Notification template"})};function J(){const{navId:n}=(0,u.yy)(),i=s.$.featureToggles.alertingNavigationV2,o=(0,x.UE)(i);return(0,t.jsx)(T.y,{navId:n,accessType:"notification",pageNav:{id:"templates",text:(0,a.t)("alerting.notification-templates.edit.title","Edit notification template group"),subTitle:(0,a.t)("alerting.notification-templates.edit.subTitle","Edit a group of notification templates"),parentItem:{text:(0,a.t)("alerting.common.titles.notification-templates","Notification Templates"),url:o}},children:(0,t.jsx)(B,{})})}const P=(0,f.S)(J);function S(){const{navId:n}=(0,u.yy)(),i=s.$.featureToggles.alertingNavigationV2,o=(0,x.UE)(i);return(0,t.jsx)(T.y,{navId:n,accessType:"notification",pageNav:{id:"templates",text:(0,a.t)("alerting.notification-templates.new.title","New notification template group"),subTitle:(0,a.t)("alerting.notification-templates.new.subTitle","Create a new group of notification templates"),parentItem:{text:(0,a.t)("alerting.common.titles.notification-templates","Notification Templates"),url:o}},children:(0,t.jsx)(R,{})})}function R(){const{selectedAlertmanager:n}=(0,v.VI)();return(0,t.jsx)(N.By,{alertmanager:n??""})}const Z=(0,f.S)(S);function z(){return(0,t.jsxs)(l.BV,{children:[(0,t.jsx)(l.qh,{path:"new",element:(0,t.jsx)(Z,{})}),(0,t.jsx)(l.qh,{path:":name/edit",element:(0,t.jsx)(P,{})}),(0,t.jsx)(l.qh,{path:":name/duplicate",element:(0,t.jsx)($,{})})]})}const W=(0,f.S)(z)},14055(U,d,e){e.d(d,{V:()=>t});function t(l,a){const s=l.replace(/\(copy( [0-9]+)?\)$/,"").trim();let r=`${s} (copy)`;for(let m=2;a.includes(r);m++)r=`${s} (copy ${m})`;return r}}}]);

//# sourceMappingURL=Templates.210732b6d7f2afa0f410.js.map