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ACEA,EAAc,IAAKS,GAClB,gBAAC,MAAG,IAAKA,EAAa,IACpB,gBAAC,MAAG,UAAU,WACZ,gBAAC,KAAE,KAAM,gCAAgCA,EAAa,WAAYA,EAAa,IAAK,CACtF,EACA,gBAAC,MAAG,UAAU,WACZ,gBAAC,KAAE,KAAM,gCAAgCA,EAAa,WAAYA,EAAa,IAAK,CACtF,EACA,gBAAC,MAAG,UAAU,cACZ,gBAAC,KAAe,CAAC,QAAQ,YACtBA,EAAa,WACZ,gBAAC,KAAM,CAAC,SAAQ,GAAC,QAAQ,YAAY,KAAK,MAAK,SAE/C,EAEF,gBAAC,MACC,QAAQ,cACR,KAAK,QACL,KAAK,KACL,QAAS,IAAM,CACbH,EAAmBG,EAAa,EAAE,CACpC,EACF,CACF,CACF,CACF,CACD,CACH,CACF,CACF,EAGD,EAAET,EAAc,QAAUG,EAAM,UAC/B,gBAAC,KACC,MAAM,iDACN,WAAW,cACX,WAAW,mCACX,YAAY,cACZ,OAAO,sDACP,WAAW,kDACX,gBAAgB,aAChB,aAAa,SACf,CAEJ,CACF,CAEJ,C","sources":["webpack://grafana/./public/app/features/alerting/NotificationsListPage.tsx"],"sourcesContent":["import React, { useState, FC, useEffect } from 'react';\nimport { useAsyncFn } from 'react-use';\n\nimport { getBackendSrv } from '@grafana/runtime';\nimport { HorizontalGroup, Button, LinkButton } from '@grafana/ui';\nimport EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';\nimport { Page } from 'app/core/components/Page/Page';\nimport { appEvents } from 'app/core/core';\nimport { useNavModel } from 'app/core/hooks/useNavModel';\nimport { AlertNotification } from 'app/types/alerting';\n\nimport { ShowConfirmModalEvent } from '../../types/events';\n\nconst NotificationsListPage: FC = () => {\n const navModel = useNavModel('channels');\n\n const [notifications, setNotifications] = useState([]);\n\n const getNotifications = async () => {\n return await getBackendSrv().get(`/api/alert-notifications`);\n };\n\n const [state, fetchNotifications] = useAsyncFn(getNotifications);\n useEffect(() => {\n fetchNotifications().then((res) => {\n setNotifications(res);\n });\n }, [fetchNotifications]);\n\n const deleteNotification = (id: number) => {\n appEvents.publish(\n new ShowConfirmModalEvent({\n title: 'Delete',\n text: 'Do you want to delete this notification channel?',\n text2: `Deleting this notification channel will not delete from alerts any references to it`,\n icon: 'trash-alt',\n confirmText: 'Delete',\n yesText: 'Delete',\n onConfirm: async () => {\n deleteNotificationConfirmed(id);\n },\n })\n );\n };\n\n const deleteNotificationConfirmed = async (id: number) => {\n await getBackendSrv().delete(`/api/alert-notifications/${id}`);\n const notifications = await fetchNotifications();\n setNotifications(notifications);\n };\n\n return (\n \n \n {state.error &&

{state.error.message}

}\n {!!notifications.length && (\n <>\n
\n
\n \n New channel\n \n
\n \n \n \n \n \n \n \n \n \n {notifications.map((notification) => (\n \n \n \n \n \n ))}\n \n
\n Name\n Type
\n {notification.name}\n \n {notification.type}\n \n \n {notification.isDefault && (\n \n )}\n {\n deleteNotification(notification.id);\n }}\n />\n \n
\n \n )}\n\n {!(notifications.length || state.loading) && (\n \n )}\n \n \n );\n};\n\nexport default NotificationsListPage;\n"],"names":["navModel","notifications","setNotifications","getNotifications","state","fetchNotifications","res","deleteNotification","id","deleteNotificationConfirmed","notification"],"sourceRoot":""}