diff --git a/public/pages/Notifications/containers/Notifications/Notifications.test.tsx b/public/pages/Notifications/containers/Notifications/Notifications.test.tsx index 5c6798da7..975af1424 100644 --- a/public/pages/Notifications/containers/Notifications/Notifications.test.tsx +++ b/public/pages/Notifications/containers/Notifications/Notifications.test.tsx @@ -12,6 +12,23 @@ import { ServicesContext } from "../../../../services"; import { browserServicesMock, coreServicesMock } from "../../../../../test/mocks"; import { ROUTES } from "../../../../utils/constants"; import { CoreServicesContext } from "../../../../components/core_services"; +import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services"; + +jest.mock("../../../../services/Services", () => ({ + ...jest.requireActual("../../../../services/Services"), + getUISettings: jest.fn(), + getApplication: jest.fn(), + getNavigationUI: jest.fn(), +})); + +beforeEach(() => { + (getUISettings as jest.Mock).mockReturnValue({ + get: jest.fn().mockReturnValue(false), // or false, depending on your test case + }); + (getApplication as jest.Mock).mockReturnValue({}); + + (getNavigationUI as jest.Mock).mockReturnValue({}); +}); function renderNotificationsWithRouter(initialEntries = [ROUTES.NOTIFICATIONS] as string[]) { return { diff --git a/public/pages/Notifications/containers/Notifications/Notifications.tsx b/public/pages/Notifications/containers/Notifications/Notifications.tsx index 953930013..be3b71597 100644 --- a/public/pages/Notifications/containers/Notifications/Notifications.tsx +++ b/public/pages/Notifications/containers/Notifications/Notifications.tsx @@ -33,6 +33,8 @@ import { import { checkPermissionForSubmitLRONConfig } from "../../../../containers/NotificationConfig"; import "./index.scss"; import { DataSourceMenuContext } from "../../../../services/DataSourceMenuContext"; +import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services"; +import { TopNavControlButtonData } from "../../../../../../../src/plugins/navigation/public"; export interface NotificationsProps {} @@ -43,6 +45,11 @@ const Notifications = (props: NotificationsProps) => { const [submitClicked, setSubmitClicked] = useState(false); const [noPermission, setNoPermission] = useState(false); const [permissionForUpdate, setPermissionForUpdate] = useState(false); + const uiSettings = getUISettings(); + const useNewUX = uiSettings.get("home:useNewHomePage"); + const { HeaderControl } = getNavigationUI(); + const { setAppRightControls, setAppDescriptionControls } = getApplication(); + const field = useField({ values: {} as Partial, onBeforeChange(name) { @@ -142,7 +149,10 @@ const Notifications = (props: NotificationsProps) => { field.resetValues(field.getOriginalValues()); }; useEffect(() => { - coreServices.chrome.setBreadcrumbs([BREADCRUMBS.INDEX_MANAGEMENT, BREADCRUMBS.NOTIFICATION_SETTINGS]); + const breadCrumbs = useNewUX + ? [BREADCRUMBS.INDEX_NOTIFICATION_SETTINGS] + : [BREADCRUMBS.INDEX_MANAGEMENT, BREADCRUMBS.NOTIFICATION_SETTINGS]; + coreServices.chrome.setBreadcrumbs(breadCrumbs); reloadNotifications(); checkPermissionForSubmitLRONConfig({ services, @@ -154,32 +164,66 @@ const Notifications = (props: NotificationsProps) => { const values = field.getValues(); const allErrors = Object.entries(field.getErrors()); + const descriptionData = [ + { + renderComponent: ( + + Configure the default notification settings on index operation statuses, such as failed or completed. You can configure

+ additional notification settings while performing an index operation. +
+ ), + }, + ]; + + const controlsData = [ + { + id: "Manage channels", + label: "Manage channels", + href: "notifications-dashboards#/channels", + target: "_blank", + controlType: "button", + display: "base", + iconType: "popout", + fill: true, + } as TopNavControlButtonData, + ]; + return ( <> - - - -

Notification settings

-
- - Configure the default notification settings on index operation statuses, such as failed or completed. You can configure - additional notification settings while performing an index operation. - - } - > - <> - -
- - - Manage channels - - -
- + {useNewUX && ( + <> + + + + )} + {!useNewUX && ( + <> + + + +

Notification settings

+
+ + Configure the default notification settings on index operation statuses, such as failed or completed. You can configure + additional notification settings while performing an index operation. + + } + > + <> + +
+ + + Manage channels + + +
+ + + )} {noPermission ? (