From d53bc635463110505ae7c6c051ab1d12ed764239 Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Tue, 25 Jun 2024 18:48:21 -0700 Subject: [PATCH 1/2] bug fix for duplicate notification channels Signed-off-by: Riya Saxena --- public/pages/CreateTrigger/utils/helper.js | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/public/pages/CreateTrigger/utils/helper.js b/public/pages/CreateTrigger/utils/helper.js index b8c91bdc6..83d2225d0 100644 --- a/public/pages/CreateTrigger/utils/helper.js +++ b/public/pages/CreateTrigger/utils/helper.js @@ -19,14 +19,30 @@ import moment from 'moment-timezone'; import { formikToTrigger } from '../containers/CreateTrigger/utils/formikToTrigger'; import { getUISettings } from '../../../services'; -export const getChannelOptions = (channels) => - channels.map((channel) => ({ - key: channel.type, - label: channel.type, - options: channels - .filter((local_channel) => local_channel.type === channel.type) - .map((option) => ({ key: option.value, ...option })), - })); +export const getChannelOptions = (channels) => { + const channelMap = {}; + + // Iterate over channels to group options by channel type + channels.forEach(channel => { + if (!channelMap[channel.type]) { + channelMap[channel.type] = { + key: channel.type, + label: channel.type, + options: [] + }; + } + // Add the option to the corresponding channel type + channelMap[channel.type].options.push({ + key: channel.value, + ...channel + }); + }); + + // Convert the channelMap object to an array of values + const channelOptions = Object.values(channelMap); + + return channelOptions; +}; // Custom Webhooks for Destinations used `custom_webhook` for the type whereas Notification Channels use 'webhook' // This conversion ensures Notifications' nomenclature is used for the labeling for consistency From 962ccd270091056d483bd098c43f67476ea2f993 Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Tue, 25 Jun 2024 18:56:09 -0700 Subject: [PATCH 2/2] bug fix for UI dropdown Signed-off-by: Riya Saxena --- public/pages/CreateTrigger/components/Action/Action.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/pages/CreateTrigger/components/Action/Action.js b/public/pages/CreateTrigger/components/Action/Action.js index 3354910a6..fba5e3a69 100644 --- a/public/pages/CreateTrigger/components/Action/Action.js +++ b/public/pages/CreateTrigger/components/Action/Action.js @@ -156,7 +156,7 @@ const Action = ({ ), - rowHeight: 45, + rowHeight: 30, isLoading: !flyoutMode && loadingDestinations, }} />