"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[9224],{7070(A,d,e){e.r(d),e.d(d,{default:()=>Z});var t=e(74848),n=e(54148),a=e(92745),r=e(6975),l=e(34999),o=e(1506),L=e(62939),f=e(5358),M=e(14055),C=e(77256),D=e(42801),u=e(92367),g=e(88547),x=e(36826),T=e(57542),v=e(46787),j=e(40403);const E=(0,t.jsx)(o.L,{entity:"Notification template"}),F=()=>{const{selectedAlertmanager:i}=(0,f.VI)(),{name:c}=(0,n.g)(),m=c?decodeURIComponent(c):void 0,{currentData:s,isLoading:N,error:p}=(0,j.J2)({alertmanager:i??"",uid:m??""}),{currentData:h,isLoading:z,error:W}=(0,j.cC)({alertmanager:i??""}),H=N||z,y=p||W;if(!i)return(0,t.jsx)(o.L,{entity:"Alertmanager"});if(!m)return(0,t.jsx)(o.L,{entity:"Notification template"});if(H)return(0,t.jsx)(r._,{text:(0,a.t)("alerting.duplicate-message-template.text-loading-notification-template","Loading notification template")});if(y)return(0,L.E)(y)?E:(0,t.jsx)(l.F,{title:(0,a.t)("alerting.duplicate-message-template.title-error-loading-notification-template","Error loading notification template"),severity:"error",children:(0,C.JZ)(y)});if(!s)return E;const K=(0,M.V)(s.title,h?.map(O=>O.title)??[]);return(0,t.jsx)(T.By,{alertmanager:i,prefill:{title:K,content:(0,D.a)(s.content)}})};function V(){return(0,t.jsx)(x.y,{navId:"receivers",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:(0,u.G)("/alerting/notifications",{tab:v.ActiveTab.NotificationTemplates})}},children:(0,t.jsx)(F,{})})}const B=(0,g.S)(V),I=(0,t.jsx)(o.L,{entity:"Notification template"}),P=()=>{const{name:i}=(0,n.g)(),c=i?decodeURIComponent(i):void 0,{selectedAlertmanager:m}=(0,f.VI)(),{currentData:s,isLoading:N,error:p,isUninitialized:h}=(0,j.J2)({alertmanager:m??"",uid:c??""});return c?N||h?(0,t.jsx)(r._,{text:(0,a.t)("alerting.edit-message-template.text-loading-template","Loading template...")}):p?(0,L.E)(p)?I:(0,t.jsx)(l.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)(p)}):s?(0,t.jsx)(T.By,{alertmanager:m??"",originalTemplate:s}):I:(0,t.jsx)(o.L,{entity:"Notification template"})};function U(){return(0,t.jsx)(x.y,{navId:"receivers",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:(0,u.G)("/alerting/notifications",{tab:v.ActiveTab.NotificationTemplates})}},children:(0,t.jsx)(P,{})})}const J=(0,g.S)(U);function S(){return(0,t.jsx)(x.y,{navId:"receivers",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:(0,u.G)("/alerting/notifications",{tab:v.ActiveTab.NotificationTemplates})}},children:(0,t.jsx)($,{})})}function $(){const{selectedAlertmanager:i}=(0,f.VI)();return(0,t.jsx)(T.By,{alertmanager:i??""})}const G=(0,g.S)(S);function R(){return(0,t.jsxs)(n.BV,{children:[(0,t.jsx)(n.qh,{path:"new",element:(0,t.jsx)(G,{})}),(0,t.jsx)(n.qh,{path:":name/edit",element:(0,t.jsx)(J,{})}),(0,t.jsx)(n.qh,{path:":name/duplicate",element:(0,t.jsx)(B,{})})]})}const Z=(0,g.S)(R)},14055(A,d,e){e.d(d,{V:()=>t});function t(n,a){const r=n.replace(/\(copy( [0-9]+)?\)$/,"").trim();let l=`${r} (copy)`;for(let o=2;a.includes(l);o++)l=`${r} (copy ${o})`;return l}}}]);

//# sourceMappingURL=Templates.3bc0bc4504155230e840.js.map