diff --git a/public/pages/CreateTrigger/components/Action/Action.js b/public/pages/CreateTrigger/components/Action/Action.js index b1b71484b..3354910a6 100644 --- a/public/pages/CreateTrigger/components/Action/Action.js +++ b/public/pages/CreateTrigger/components/Action/Action.js @@ -33,7 +33,7 @@ import { } from '../../utils/constants'; import NotificationsCallOut from '../NotificationsCallOut'; import MinimalAccordion from '../../../../components/FeatureAnywhereContextMenu/MinimalAccordion'; -import { MANAGE_CHANNELS_URL } from '../../../../utils/constants'; +import { getManageChannelsUrl } from '../../../../utils/helpers'; const Action = ({ action, @@ -167,7 +167,7 @@ const Action = ({ disabled={!hasNotificationPlugin} iconType="popout" iconSide="right" - onClick={() => window.open(MANAGE_CHANNELS_URL)} + onClick={() => window.open(getManageChannelsUrl())} > Manage channels diff --git a/public/pages/CreateTrigger/components/ActionEmptyPrompt/ActionEmptyPrompt.js b/public/pages/CreateTrigger/components/ActionEmptyPrompt/ActionEmptyPrompt.js index b63f2fc3f..30087f457 100644 --- a/public/pages/CreateTrigger/components/ActionEmptyPrompt/ActionEmptyPrompt.js +++ b/public/pages/CreateTrigger/components/ActionEmptyPrompt/ActionEmptyPrompt.js @@ -6,7 +6,7 @@ import React from 'react'; import { EuiButton, EuiEmptyPrompt, EuiText } from '@elastic/eui'; import AddActionButton from '../AddActionButton'; -import { MANAGE_CHANNELS_URL } from '../../../../utils/constants'; +import { getManageChannelsUrl } from '../../../../utils/helpers'; const actionEmptyText = 'Add an action to perform when this trigger is triggered.'; const destinationEmptyText = 'There are no existing channels. Add a channel to create an action.'; @@ -38,7 +38,7 @@ const ActionEmptyPrompt = ({ disabled={!hasNotificationPlugin} iconType="popout" iconSide="right" - onClick={() => window.open(MANAGE_CHANNELS_URL)} + onClick={() => window.open(getManageChannelsUrl())} > Manage channels diff --git a/public/pages/CreateTrigger/containers/DefineCompositeLevelTrigger/TriggerNotificationsContent.js b/public/pages/CreateTrigger/containers/DefineCompositeLevelTrigger/TriggerNotificationsContent.js index 8867c5ac2..afa7cfa0c 100644 --- a/public/pages/CreateTrigger/containers/DefineCompositeLevelTrigger/TriggerNotificationsContent.js +++ b/public/pages/CreateTrigger/containers/DefineCompositeLevelTrigger/TriggerNotificationsContent.js @@ -11,7 +11,7 @@ import _ from 'lodash'; import { FORMIK_INITIAL_ACTION_VALUES } from '../../utils/constants'; import { NOTIFY_OPTIONS_VALUES } from '../../components/Action/actions/Message'; import { required } from '../../../../utils/validate'; -import { MANAGE_CHANNELS_URL } from '../../../../utils/constants'; +import { getManageChannelsUrl } from '../../../../utils/helpers'; const TriggerNotificationsContent = ({ action, @@ -98,7 +98,7 @@ const TriggerNotificationsContent = ({ iconType={'popout'} style={{ marginTop: '22px' }} disabled={!hasNotifications} - onClick={() => window.open(MANAGE_CHANNELS_URL)} + onClick={() => window.open(getManageChannelsUrl())} > Manage channels diff --git a/public/pages/Destinations/components/DestinationsList/EmptyDestinations/EmptyDestinations.js b/public/pages/Destinations/components/DestinationsList/EmptyDestinations/EmptyDestinations.js index 9d2bcdb48..89a3e82dc 100644 --- a/public/pages/Destinations/components/DestinationsList/EmptyDestinations/EmptyDestinations.js +++ b/public/pages/Destinations/components/DestinationsList/EmptyDestinations/EmptyDestinations.js @@ -6,7 +6,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { EuiButton, EuiEmptyPrompt, EuiLink, EuiText } from '@elastic/eui'; -import { MANAGE_CHANNELS_URL } from '../../../../../utils/constants'; +import { getManageChannelsUrl } from '../../../../../utils/helpers'; const filterText = (hasNotificationPlugin) => hasNotificationPlugin ? ( @@ -17,7 +17,7 @@ const filterText = (hasNotificationPlugin) =>

Migrated destinations can be found in  - {Notifications} + {Notifications}

) : ( diff --git a/public/pages/Destinations/components/FullPageNotificationsInfoCallOut/FullPageNotificationsInfoCallOut.js b/public/pages/Destinations/components/FullPageNotificationsInfoCallOut/FullPageNotificationsInfoCallOut.js index a3e365d84..9025a3354 100644 --- a/public/pages/Destinations/components/FullPageNotificationsInfoCallOut/FullPageNotificationsInfoCallOut.js +++ b/public/pages/Destinations/components/FullPageNotificationsInfoCallOut/FullPageNotificationsInfoCallOut.js @@ -6,7 +6,7 @@ import React from 'react'; import { EuiButton, EuiEmptyPrompt, EuiLink, EuiPanel, EuiText } from '@elastic/eui'; import { NOTIFICATIONS_LEARN_MORE_HREF } from '../../utils/constants'; -import { MANAGE_CHANNELS_URL } from '../../../../utils/constants'; +import { getManageChannelsUrl } from '../../../../utils/helpers'; const noNotificationsTitle = 'Destinations will become channels in Notifications'; const noNotificationsText = ( @@ -40,20 +40,23 @@ const hasNotificationsText = (

); -const hasNotificationsButton = ( - - View in Notifications - -); -const FullPageNotificationsInfoCallOut = ({ hasNotificationPlugin }) => ( - - {hasNotificationPlugin ? hasNotificationsTitle : noNotificationsTitle}} - body={hasNotificationPlugin ? hasNotificationsText : noNotificationsText} - actions={hasNotificationPlugin ? hasNotificationsButton : noNotificationsButton} - /> - -); +const FullPageNotificationsInfoCallOut = ({ hasNotificationPlugin }) => { + const hasNotificationsButton = ( + + View in Notifications + + ); + + return ( + + {hasNotificationPlugin ? hasNotificationsTitle : noNotificationsTitle}} + body={hasNotificationPlugin ? hasNotificationsText : noNotificationsText} + actions={hasNotificationPlugin ? hasNotificationsButton : noNotificationsButton} + /> + + ); +} export default FullPageNotificationsInfoCallOut; diff --git a/public/pages/Destinations/components/NotificationsInfoCallOut/NotificationsInfoCallOut.js b/public/pages/Destinations/components/NotificationsInfoCallOut/NotificationsInfoCallOut.js index c203af06c..bfe9df8e7 100644 --- a/public/pages/Destinations/components/NotificationsInfoCallOut/NotificationsInfoCallOut.js +++ b/public/pages/Destinations/components/NotificationsInfoCallOut/NotificationsInfoCallOut.js @@ -6,7 +6,7 @@ import React from 'react'; import { EuiCallOut, EuiButton, EuiLink, EuiSpacer } from '@elastic/eui'; import { NOTIFICATIONS_LEARN_MORE_HREF } from '../../utils/constants'; -import { MANAGE_CHANNELS_URL } from '../../../../utils/constants'; +import { getManageChannelsUrl } from '../../../../utils/helpers'; const noNotificationsTitle = 'Unable to send notifications. Notifications plugin is required.'; const noNotificationsBodyText = ( @@ -42,11 +42,12 @@ const hasNotificationsBodyText = (

); -const hasNotificationsButton = ( - View in Notifications -); const NotificationsInfoCallOut = ({ hasNotificationPlugin }) => { + const hasNotificationsButton = ( + View in Notifications + ); + return (
( ); +// This is updated to include the server.basepath during plugin's first render inside app.js using `initManageChannelsUrl` function +export let MANAGE_CHANNELS_URL = '/app/notifications-dashboards#/channels'; + export function initManageChannelsUrl(httpClient) { const manageChannelsRelativePath = `/app/notifications-dashboards#/channels`; MANAGE_CHANNELS_URL = httpClient.basePath.prepend(manageChannelsRelativePath); } + +export function getManageChannelsUrl() { + return MANAGE_CHANNELS_URL; +}