Skip to content

Commit

Permalink
Fix Notifier error message
Browse files Browse the repository at this point in the history
  • Loading branch information
MilanPospisil committed May 23, 2024
1 parent 9b3787c commit f95f463
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useState } from 'react';
import { RunningNotificationsType } from './useNotifiersRowActions';
import { NotificationTemplate } from '../../../interfaces/NotificationTemplate';
import { usePageAlertToaster } from '../../../../../framework';
import { StatusLabel } from '../../../../common/Status';
import { useTranslation } from 'react-i18next';

export function useNotificationsWatch() {
Expand Down Expand Up @@ -35,9 +34,12 @@ export function useNotificationsWatch() {

if (notification && notification.status !== 'pending') {
alertToaster.addAlert({
variant: 'info',
title: t('Notifier (id {{id}}) test result', { id: notificationId }),
children: <StatusLabel status={notification.status} />,
variant: notification.status === 'failed' ? 'danger' : 'success',
title: t('{{name}} (id {{id}})', {
name: notificationTemplate.name,
id: notificationId,
}),
children: <div>{notification.error}</div>,
});

delete obj[notificationTemplate.id];
Expand Down
2 changes: 2 additions & 0 deletions frontend/awx/interfaces/NotificationTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export interface NotificationTemplate
{
id: number;
status: string;
error: string;
created: string;
},
];
user_capabilities: {
Expand Down

0 comments on commit f95f463

Please sign in to comment.