"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[3002],{80372:(M,c,a)=>{a.r(c),a.d(c,{default:()=>D});var e=a(85960),m=a(85954),r=a(85445),n=a(29165),d=a(74042),_=a(64409),s=a(20989),f=a(49683),h=a(6119),g=a(14914);const D=()=>{const T=(0,h.q)("channels"),[i,E]=(0,e.useState)([]),u=async()=>await(0,r.i)().get("/api/alert-notifications"),[l,o]=(0,m.Z)(u);(0,e.useEffect)(()=>{o().then(t=>{E(t)})},[o]);const P=t=>{f.h$.publish(new g.VJ({title:"Delete",text:"Do you want to delete this notification channel?",text2:"Deleting this notification channel will not delete from alerts any references to it",icon:"trash-alt",confirmText:"Delete",yesText:"Delete",onConfirm:async()=>{p(t)}}))},p=async t=>{await(0,r.i)().delete(`/api/alert-notifications/${t}`);const y=await o();E(y)};return e.createElement(s.T,{navModel:T},e.createElement(s.T.Contents,null,l.error&&e.createElement("p",null,l.error.message),!!i.length&&e.createElement(e.Fragment,null,e.createElement("div",{className:"page-action-bar"},e.createElement("div",{className:"page-action-bar__spacer"}),e.createElement(n.Qj,{icon:"channel-add",href:"alerting-legacy/notification/new"},"New channel")),e.createElement("table",{className:"filter-table filter-table--hover"},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",{style:{minWidth:"200px"}},e.createElement("strong",null,"Name")),e.createElement("th",{style:{minWidth:"100px"}},"Type"),e.createElement("th",{style:{width:"1%"}}))),e.createElement("tbody",null,i.map(t=>e.createElement("tr",{key:t.id},e.createElement("td",{className:"link-td"},e.createElement("a",{href:`alerting-legacy/notification/${t.id}/edit`},t.name)),e.createElement("td",{className:"link-td"},e.createElement("a",{href:`alerting-legacy/notification/${t.id}/edit`},t.type)),e.createElement("td",{className:"text-right"},e.createElement(d.Lh,{justify:"flex-end"},t.isDefault&&e.createElement(n.zx,{disabled:!0,variant:"secondary",size:"sm"},"default"),e.createElement(n.zx,{variant:"destructive",icon:"times",size:"sm",onClick:()=>{P(t.id)}})))))))),!(i.length||l.loading)&&e.createElement(_.Z,{title:"There are no notification channels defined yet",buttonIcon:"channel-add",buttonLink:"alerting-legacy/notification/new",buttonTitle:"Add channel",proTip:"You can include images in your alert notifications.",proTipLink:"http://docs.grafana.org/alerting/notifications/",proTipLinkTitle:"Learn more",proTipTarget:"_blank"})))}}}]);

//# sourceMappingURL=NotificationsListLegacyPage.adae7ee8a57f3aa24b19.js.map