diff --git a/lib/api/routes/notificationAdapterRouter.js b/lib/api/routes/notificationAdapterRouter.js index 5746c4e..6e45ef9 100644 --- a/lib/api/routes/notificationAdapterRouter.js +++ b/lib/api/routes/notificationAdapterRouter.js @@ -18,7 +18,7 @@ const notificationAdapter = await Promise.all( */ export default async function notificationAdapterPlugin(fastify) { fastify.get('/', async () => { - return notificationAdapter.map((adapter) => adapter.config); + return notificationAdapter.map((adapter) => adapter.config).filter(Boolean); }); fastify.post('/try', async (request, reply) => { diff --git a/ui/src/views/jobs/mutation/components/notificationAdapter/NotificationAdapterMutator.jsx b/ui/src/views/jobs/mutation/components/notificationAdapter/NotificationAdapterMutator.jsx index 581f8d6..20d473a 100644 --- a/ui/src/views/jobs/mutation/components/notificationAdapter/NotificationAdapterMutator.jsx +++ b/ui/src/views/jobs/mutation/components/notificationAdapter/NotificationAdapterMutator.jsx @@ -73,7 +73,9 @@ export default function NotificationAdapterMutator({ const adapter = useSelector((state) => state.notificationAdapter); const preFilledSelectedAdapter = - editNotificationAdapter == null ? null : adapter.find((a) => a.id === editNotificationAdapter.id); + editNotificationAdapter == null + ? null + : adapter.filter((a) => a != null).find((a) => a.id === editNotificationAdapter.id); spreadPrefilledAdapterWithValues(preFilledSelectedAdapter, editNotificationAdapter?.fields); @@ -227,9 +229,9 @@ export default function NotificationAdapterMutator({ className="providerMutator__fields" value={selectedAdapter == null ? '' : selectedAdapter.id} optionList={adapter + .filter((a) => a != null) .map((a) => { return { - otherKey: a.id, value: a.id, label: a.name, }; @@ -238,7 +240,7 @@ export default function NotificationAdapterMutator({ .filter((option) => editNotificationAdapter != null ? true - : selected.find((selectedOption) => selectedOption.id === option.key) == null, + : selected.find((selectedOption) => selectedOption.id === option.value) == null, ) .sort(sortAdapter)} onChange={(value) => {