"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[192],{51803:(R,e,t)=>{t.r(e),t.d(e,{default:()=>A});var l=t(74848),s=t(96540),o=t(43908),d=t(52120),r=t(11817),u=t(5240),h=t(88214),i=t(58528),c=t(81876),v=t(48583),x=t(54731),f=t(35874);const g=(0,s.lazy)(()=>t.e(617).then(t.bind(t,62339)));function j({dashboardUid:a,onDismiss:n}){return(0,l.jsx)(i._,{title:"Alert rules",subtitle:(0,l.jsx)(m,{dashboardUid:a}),onClose:n,size:"lg",children:(0,l.jsx)(s.Suspense,{fallback:(0,l.jsx)(c._,{text:"Loading alert rules"}),children:(0,l.jsx)(g,{dashboardUid:a})})})}function m({dashboardUid:a}){const n=new URLSearchParams({search:`dashboard:${a}`});return(0,l.jsxs)(v.B,{gap:2,children:[(0,l.jsx)("div",{children:(0,r.t)("dashboard.alert-rules-drawer.subtitle","Alert rules related to this dashboard")}),(0,l.jsx)(x.Y,{href:(0,f.G)(`/alerting/list/?${n.toString()}`),children:(0,r.t)("dashboard.alert-rules-drawer.redirect-link","List in Grafana Alerting")})]})}function A({dashboardUid:a}){const{showModal:n,hideModal:C}=(0,s.useContext)(o.wE),{data:S=[]}=u.hK.endpoints.prometheusRuleNamespaces.useQuery({ruleSourceName:h.hY,dashboardUid:a});if(S.length===0)return null;const D=()=>{n(j,{dashboardUid:a,onDismiss:C})};return(0,l.jsx)(d.I,{tooltip:(0,r.t)("dashboard.toolbar.alert-rules","Alert rules"),icon:"bell",onClick:D},"button-alerting")}}}]);

//# sourceMappingURL=alert-rules-toolbar-button.5c5473d4b15334df5dae.js.map