@@ -10,7 +10,7 @@ import { useTheme } from "@mui/material/styles";
1010import { useNavigate } from "react-router" ;
1111import type { ActionMenuItem } from "@/components/actions-menu" ;
1212import type { Header } from "@/components/design-elements/Table" ;
13- import type { INotificationChannel } from "@/types/notification-channel" ;
13+ import type { NotificationChannel } from "@/types/notification-channel" ;
1414import { useGet , usePatch , useDelete } from "@/hooks/UseApi" ;
1515import type { ApiResponse } from "@/types/api" ;
1616import { useTranslation } from "react-i18next" ;
@@ -21,11 +21,11 @@ const NotificationChannelsPage = () => {
2121 const navigate = useNavigate ( ) ;
2222 const theme = useTheme ( ) ;
2323 const [ selectedChannel , setSelectedChannel ] =
24- useState < INotificationChannel | null > ( null ) ;
24+ useState < NotificationChannel | null > ( null ) ;
2525 const open = Boolean ( selectedChannel ) ;
2626
2727 const { response, isValidating, error, refetch } = useGet <
28- ApiResponse < INotificationChannel [ ] >
28+ ApiResponse < NotificationChannel [ ] >
2929 > (
3030 "/notification-channels" ,
3131 { } ,
@@ -37,15 +37,15 @@ const NotificationChannelsPage = () => {
3737 { useTeamIdAsKey : true }
3838 ) ;
3939
40- const { patch, loading : pausing } = usePatch < { } , INotificationChannel > ( ) ;
40+ const { patch, loading : pausing } = usePatch < { } , NotificationChannel > ( ) ;
4141 const { deleteFn, loading : isDeleting } =
42- useDelete < ApiResponse < INotificationChannel > > ( ) ;
42+ useDelete < ApiResponse < NotificationChannel > > ( ) ;
4343
4444 const notificationChannels = response ?. data || [ ] ;
4545
4646 const handleConfirm = async ( ) => {
4747 if ( ! selectedChannel ) return ;
48- const res = await deleteFn ( `/notification-channels/${ selectedChannel . _id } ` ) ;
48+ const res = await deleteFn ( `/notification-channels/${ selectedChannel . id } ` ) ;
4949 if ( res ) {
5050 setSelectedChannel ( null ) ;
5151 refetch ( ) ;
@@ -56,13 +56,13 @@ const NotificationChannelsPage = () => {
5656 setSelectedChannel ( null ) ;
5757 } ;
5858
59- const getActions = ( channel : INotificationChannel ) : ActionMenuItem [ ] => {
59+ const getActions = ( channel : NotificationChannel ) : ActionMenuItem [ ] => {
6060 return [
6161 {
6262 id : 1 ,
6363 label : t ( "monitors.common.actions.configure" ) ,
6464 action : ( ) => {
65- navigate ( `/notification-channels/${ channel . _id } /configure` ) ;
65+ navigate ( `/notification-channels/${ channel . id } /configure` ) ;
6666 } ,
6767 closeMenu : true ,
6868 } ,
@@ -73,7 +73,7 @@ const NotificationChannelsPage = () => {
7373 : t ( "common.buttons.enable" ) ,
7474 action : async ( ) => {
7575 const res = await patch (
76- `/notification-channels/${ channel . _id } /active` ,
76+ `/notification-channels/${ channel . id } /active` ,
7777 { }
7878 ) ;
7979 if ( res ) {
@@ -98,7 +98,7 @@ const NotificationChannelsPage = () => {
9898 } ;
9999
100100 const getHeaders = ( ) => {
101- const headers : Header < INotificationChannel > [ ] = [
101+ const headers : Header < NotificationChannel > [ ] = [
102102 {
103103 id : "name" ,
104104 content : t ( "common.table.headers.name" ) ,
@@ -125,6 +125,17 @@ const NotificationChannelsPage = () => {
125125 ) ;
126126 } ,
127127 } ,
128+ {
129+ id : "destination" ,
130+ content : t ( "notificationChannels.table.headers.destination" ) ,
131+ render : ( row ) => {
132+ return (
133+ < Typography >
134+ { row ?. config ?. url || row ?. config ?. emailAddress }
135+ </ Typography >
136+ ) ;
137+ } ,
138+ } ,
128139 {
129140 id : "actions" ,
130141 content : t ( "common.table.headers.actions" ) ,
@@ -167,7 +178,7 @@ const NotificationChannelsPage = () => {
167178 headers = { headers }
168179 data = { notificationChannels }
169180 onRowClick = { ( row ) => {
170- navigate ( `/notification-channels/${ row . _id } /configure` ) ;
181+ navigate ( `/notification-channels/${ row . id } /configure` ) ;
171182 } }
172183 />
173184
0 commit comments