diff --git a/src/components/notifications/AddNotification.tsx b/src/components/notifications/AddNotification.tsx index 8f6602279a..39cb0d7537 100644 --- a/src/components/notifications/AddNotification.tsx +++ b/src/components/notifications/AddNotification.tsx @@ -42,6 +42,7 @@ import { IconsProps, ButtonComponentType, stopPropagation, + BreadCrumb, } from '@devtron-labs/devtron-fe-common-lib' import { components } from 'react-select' import CreatableSelect from 'react-select/creatable' @@ -278,11 +279,17 @@ export class AddNotification extends Component Resource Application Name - Type Env/Branch Events @@ -731,6 +737,7 @@ export class AddNotification extends Component + {renderPipelineTypeIcon(row, 16)} {row.appliedFilters.length ? ( <> @@ -753,7 +760,6 @@ export class AddNotification extends Component {row?.appName} - {renderPipelineTypeIcon(row)} {_isCi && ( @@ -1058,28 +1064,29 @@ export class AddNotification extends Component { + const breadcrumbs = [ + { + name: 'Notifications', + to: URLS.APPLICATION_MANAGEMENT_CONFIGURATIONS_NOTIFICATIONS, + }, + { + name: 'Add Notification', + to: '', + }, + ] + return + } + render() { return (
-
{this.renderAddCard()} {this.renderShowSlackConfigModal()} diff --git a/src/components/notifications/AddNotificationButton.tsx b/src/components/notifications/AddNotificationButton.tsx new file mode 100644 index 0000000000..c8bbb07fab --- /dev/null +++ b/src/components/notifications/AddNotificationButton.tsx @@ -0,0 +1,38 @@ +import { useHistory } from 'react-router-dom' + +import { + Button, + ButtonVariantType, + ComponentSizeType, + Icon, + TOAST_ACCESS_DENIED, + ToastManager, + ToastVariantType, +} from '@devtron-labs/devtron-fe-common-lib' + +import { URLS } from '@Config/routes' + +export const AddNotificationButton = ({ disableEdit }: { disableEdit: boolean }) => { + const history = useHistory() + const createNewNotification = () => { + if (disableEdit) { + ToastManager.showToast({ + variant: ToastVariantType.notAuthorized, + description: TOAST_ACCESS_DENIED.SUBTITLE, + }) + } else { + history.push(URLS.APPLICATION_MANAGEMENT_CONFIGURATIONS_NOTIFICATIONS_ADD_NEW) + } + } + + return ( +
+ + + ) +} diff --git a/src/components/notifications/NotificationTab.tsx b/src/components/notifications/NotificationTab.tsx index 0636f27c72..34f6fb19cd 100644 --- a/src/components/notifications/NotificationTab.tsx +++ b/src/components/notifications/NotificationTab.tsx @@ -45,7 +45,7 @@ import { import { InValidHostUrlWarningBlock } from '@Components/common' import EmptyImage from '../../assets/img/ic-empty-notifications.png' -import { URLS, ViewType } from '../../config' +import { ViewType } from '../../config' import { getHostURLConfiguration } from '../../services/service' import { ModifyRecipientsModal } from './ModifyRecipientsModal' import { @@ -56,10 +56,14 @@ import { } from './notifications.service' import { getRecipientChipStartIcon, renderPipelineTypeIcon } from './notifications.util' import { NotificationPipelineType, NotificationTabState } from './types' -import { ModifyRecipientPopUp } from './ModifyRecipientPopUp' import { EVENT_ID } from './constants' +import { BulkMultiSelectTagWidget } from './BulkMultiSelectWidget' +import React from 'react' +import { AddNotificationButton } from './AddNotificationButton' export class NotificationTab extends Component { + bulkMultiSelectWidgetRef = React.createRef() + constructor(props) { super(props) this.state = { @@ -105,7 +109,6 @@ export class NotificationTab extends Component { deleting: false, confirmation: false, singleDeletedId: 0, - disableEdit: false, selectedNotificationList: [], } } @@ -164,8 +167,8 @@ export class NotificationTab extends Component { })) this.setState({ channelList: list }) }) - .catch((error) => { - this.setState({ disableEdit: true }) + .catch(() => { + this.props.toggleDisableEdit(true) }) } @@ -375,28 +378,9 @@ export class NotificationTab extends Component { ) } - createNewNotification = () => { - if (this.state.disableEdit) { - ToastManager.showToast({ - variant: ToastVariantType.notAuthorized, - description: TOAST_ACCESS_DENIED.SUBTITLE, - }) - } else { - this.props.history.push(URLS.APPLICATION_MANAGEMENT_CONFIGURATIONS_NOTIFICATIONS_ADD_NEW) - } - } - renderAddNotificationButton = () => ( -