From e4ea3fd86b1a0ad6b79d58fbce9ff080edf337a9 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Mon, 19 Aug 2024 11:32:25 -0700 Subject: [PATCH] header redesign (#841) * header redesign Signed-off-by: Jackie Han * update snapshot Signed-off-by: Jackie Han --------- Signed-off-by: Jackie Han (cherry picked from commit 399025ab0e7e7caf785087fcae4b3c62a1093e66) --- opensearch_dashboards.json | 3 +- .../Components/utils/DashboardHeader.tsx | 27 +++++- .../Dashboard/Container/DashboardOverview.tsx | 39 ++++++-- .../__tests__/DefineDetector.test.tsx | 29 ++++-- .../DetectorControls/DetectorControls.tsx | 26 ++++- .../__tests__/DetectorControls.test.tsx | 22 +++++ .../containers/DetectorDetail.tsx | 26 +++-- .../__tests__/CustomIndexErrorMsg.test.tsx | 31 ++++-- .../DetectorsList/containers/List/List.tsx | 36 ++++++- .../containers/List/__tests__/List.test.tsx | 29 ++++-- .../containers/AnomalyDetectionOverview.tsx | 95 +++++++++++++++---- .../AnomalyDetectionOverview.test.tsx | 30 ++++-- public/plugin.ts | 8 +- public/services.ts | 8 +- public/utils/constants.ts | 6 +- 15 files changed, 347 insertions(+), 68 deletions(-) diff --git a/opensearch_dashboards.json b/opensearch_dashboards.json index cde8e186..cc8745ca 100644 --- a/opensearch_dashboards.json +++ b/opensearch_dashboards.json @@ -20,7 +20,8 @@ "opensearchDashboardsReact", "savedObjects", "visAugmenter", - "opensearchDashboardsUtils" + "opensearchDashboardsUtils", + "navigation" ], "server": true, "ui": true, diff --git a/public/pages/Dashboard/Components/utils/DashboardHeader.tsx b/public/pages/Dashboard/Components/utils/DashboardHeader.tsx index 0724e633..bb95e1b7 100644 --- a/public/pages/Dashboard/Components/utils/DashboardHeader.tsx +++ b/public/pages/Dashboard/Components/utils/DashboardHeader.tsx @@ -20,9 +20,12 @@ import { import { PLUGIN_NAME, APP_PATH, + USE_NEW_HOME_PAGE, } from '../../../../utils/constants'; import { useLocation } from 'react-router-dom'; import { constructHrefWithDataSourceId, getDataSourceFromURL } from '../../../../pages/utils/helpers'; +import { getApplication, getNavigationUI, getUISettings } from '../../../../services'; +import { TopNavControlButtonData } from '../../../../../../../src/plugins/navigation/public'; export interface DashboardHeaderProps { hasDetectors: boolean; } @@ -32,8 +35,27 @@ export const DashboardHeader = (props: DashboardHeaderProps) => { const MDSQueryParams = getDataSourceFromURL(location); const dataSourceId = MDSQueryParams.dataSourceId; const createDetectorUrl = `${PLUGIN_NAME}#` + constructHrefWithDataSourceId(APP_PATH.CREATE_DETECTOR, dataSourceId, false); + const useUpdatedUX = getUISettings().get(USE_NEW_HOME_PAGE); + const { HeaderControl } = getNavigationUI(); + const { setAppRightControls } = getApplication(); - return ( + return useUpdatedUX ? ( + + ) : ( + <> @@ -54,5 +76,6 @@ export const DashboardHeader = (props: DashboardHeaderProps) => { ) : null} + ); -}; +} diff --git a/public/pages/Dashboard/Container/DashboardOverview.tsx b/public/pages/Dashboard/Container/DashboardOverview.tsx index d1e52b7b..66d2da08 100644 --- a/public/pages/Dashboard/Container/DashboardOverview.tsx +++ b/public/pages/Dashboard/Container/DashboardOverview.tsx @@ -45,7 +45,7 @@ import { getVisibleOptions, isDataSourceCompatible, } from '../../utils/helpers'; -import { BREADCRUMBS, MDS_BREADCRUMBS } from '../../../utils/constants'; +import { BREADCRUMBS, MDS_BREADCRUMBS, USE_NEW_HOME_PAGE } from '../../../utils/constants'; import { DETECTOR_STATE } from '../../../../server/utils/constants'; import { getDetectorStateOptions, @@ -64,6 +64,7 @@ import { getDataSourceEnabled, getNotifications, getSavedObjectsClient, + getUISettings, } from '../../../services'; import { RouteComponentProps } from 'react-router-dom'; @@ -163,6 +164,8 @@ export function DashboardOverview(props: OverviewProps) { const visibleIndices = get(opensearchState, 'indices', []) as CatIndex[]; const visibleAliases = get(opensearchState, 'aliases', []) as IndexAlias[]; + const useUpdatedUX = getUISettings().get(USE_NEW_HOME_PAGE); + const handleIndicesFilterChange = ( options: EuiComboBoxOptionProps[] ): void => { @@ -242,16 +245,32 @@ export function DashboardOverview(props: OverviewProps) { }, [errorGettingDetectors]); useEffect(() => { - if (dataSourceEnabled) { - core.chrome.setBreadcrumbs([ - MDS_BREADCRUMBS.ANOMALY_DETECTOR(MDSOverviewState.selectedDataSourceId), - MDS_BREADCRUMBS.DASHBOARD(MDSOverviewState.selectedDataSourceId), - ]); + if (useUpdatedUX) { + if (dataSourceEnabled) { + core.chrome.setBreadcrumbs([ + MDS_BREADCRUMBS.ANOMALY_DETECTOR(MDSOverviewState.selectedDataSourceId), + MDS_BREADCRUMBS.DASHBOARD(MDSOverviewState.selectedDataSourceId), + BREADCRUMBS.TITLE_REAL_TIME_DASHBOARD, + ]); + } else { + core.chrome.setBreadcrumbs([ + BREADCRUMBS.ANOMALY_DETECTOR, + BREADCRUMBS.DASHBOARD, + BREADCRUMBS.TITLE_REAL_TIME_DASHBOARD, + ]); + } } else { - core.chrome.setBreadcrumbs([ - BREADCRUMBS.ANOMALY_DETECTOR, - BREADCRUMBS.DASHBOARD, - ]); + if (dataSourceEnabled) { + core.chrome.setBreadcrumbs([ + MDS_BREADCRUMBS.ANOMALY_DETECTOR(MDSOverviewState.selectedDataSourceId), + MDS_BREADCRUMBS.DASHBOARD(MDSOverviewState.selectedDataSourceId), + ]); + } else { + core.chrome.setBreadcrumbs([ + BREADCRUMBS.ANOMALY_DETECTOR, + BREADCRUMBS.DASHBOARD, + ]); + } } }); diff --git a/public/pages/DefineDetector/containers/__tests__/DefineDetector.test.tsx b/public/pages/DefineDetector/containers/__tests__/DefineDetector.test.tsx index 0ba9421f..3ee22216 100644 --- a/public/pages/DefineDetector/containers/__tests__/DefineDetector.test.tsx +++ b/public/pages/DefineDetector/containers/__tests__/DefineDetector.test.tsx @@ -27,13 +27,30 @@ import { testDetectorDefinitionValues, } from '../../utils/constants'; -jest.mock('../../../../services', () => ({ - ...jest.requireActual('../../../../services'), +jest.mock('../../../../services', () => { + const originalModule = jest.requireActual('../../../../services'); - getDataSourceEnabled: () => ({ - enabled: false - }) -})); + return { + ...originalModule, + getDataSourceEnabled: () => ({ + enabled: false + }), + getUISettings: () => ({ + get: (flag) => { + if (flag === 'home:useNewHomePage') { + return false; + } + return originalModule.getUISettings().get(flag); + } + }), + getNavigationUI: () => ({ + HeaderControl: null + }), + getApplication: () => ({ + setAppRightControls: null, + }) + }; +}); const renderWithRouterEmpty = (isEdit: boolean = false) => ({ ...render( diff --git a/public/pages/DetectorDetail/components/DetectorControls/DetectorControls.tsx b/public/pages/DetectorDetail/components/DetectorControls/DetectorControls.tsx index 6725b5e7..18276379 100644 --- a/public/pages/DetectorDetail/components/DetectorControls/DetectorControls.tsx +++ b/public/pages/DetectorDetail/components/DetectorControls/DetectorControls.tsx @@ -19,6 +19,8 @@ import { EuiPopover, } from '@elastic/eui'; import { Detector } from '../../../../models/interfaces'; +import { getApplication, getNavigationUI, getUISettings } from '../../../../services'; +import { USE_NEW_HOME_PAGE } from '../../../../utils/constants'; interface DetectorControls { onEditDetector(): void; @@ -30,7 +32,11 @@ interface DetectorControls { } export const DetectorControls = (props: DetectorControls) => { const [isOpen, setIsOpen] = useState(false); - return ( + const useUpdatedUX = getUISettings().get(USE_NEW_HOME_PAGE); + const { HeaderControl } = getNavigationUI(); + const { setAppRightControls } = getApplication(); + + const ActionsPopover = ( { ); + const renderActionsPopover = () => { + return useUpdatedUX ? ( + + ) : ( + ActionsPopover + ); + }; + + return ( + renderActionsPopover() + ); }; diff --git a/public/pages/DetectorDetail/components/DetectorControls/__tests__/DetectorControls.test.tsx b/public/pages/DetectorDetail/components/DetectorControls/__tests__/DetectorControls.test.tsx index 9ac1d383..560a2e89 100644 --- a/public/pages/DetectorDetail/components/DetectorControls/__tests__/DetectorControls.test.tsx +++ b/public/pages/DetectorDetail/components/DetectorControls/__tests__/DetectorControls.test.tsx @@ -14,6 +14,28 @@ import { render } from '@testing-library/react'; import { DetectorControls } from '../DetectorControls'; import { UNITS } from '../../../../../models/interfaces'; +jest.mock('../../../../../services', () => { + const originalModule = jest.requireActual('../../../../../services'); + + return { + ...originalModule, + getUISettings: () => ({ + get: (flag) => { + if (flag === 'home:useNewHomePage') { + return false; + } + return originalModule.getUISettings().get(flag); + } + }), + getNavigationUI: () => ({ + HeaderControl: null + }), + getApplication: () => ({ + setAppRightControls: null, + }) + }; +}); + describe(' spec', () => { const detector = { primaryTerm: 1, diff --git a/public/pages/DetectorDetail/containers/DetectorDetail.tsx b/public/pages/DetectorDetail/containers/DetectorDetail.tsx index 9bb84889..c5503317 100644 --- a/public/pages/DetectorDetail/containers/DetectorDetail.tsx +++ b/public/pages/DetectorDetail/containers/DetectorDetail.tsx @@ -48,7 +48,7 @@ import { import { getAliases, getIndices } from '../../../redux/reducers/opensearch'; import { getErrorMessage, Listener } from '../../../utils/utils'; import { darkModeEnabled } from '../../../utils/opensearchDashboardsUtils'; -import { BREADCRUMBS, MDS_BREADCRUMBS } from '../../../utils/constants'; +import { BREADCRUMBS, MDS_BREADCRUMBS, USE_NEW_HOME_PAGE } from '../../../utils/constants'; import { DetectorControls } from '../components/DetectorControls'; import { ConfirmModal } from '../components/ConfirmModal/ConfirmModal'; import { useFetchMonitorInfo } from '../hooks/useFetchMonitorInfo'; @@ -70,6 +70,7 @@ import { getDataSourceEnabled, getNotifications, getSavedObjectsClient, + getUISettings, } from '../../../services'; import { constructHrefWithDataSourceId, getDataSourceFromURL } from '../../../pages/utils/helpers'; @@ -195,6 +196,8 @@ export const DetectorDetail = (props: DetectorDetailProps) => { deleteTyped: false, }); + const useUpdatedUX = getUISettings().get(USE_NEW_HOME_PAGE); + useHideSideNavBar(true, false); // Jump to top of page on first load @@ -435,6 +438,20 @@ export const DetectorDetail = (props: DetectorDetailProps) => { ); } + const renderPageHeader = () => { + if (useUpdatedUX) { + return null; + } else { + return ( + + +

{detector && detector.name}

+
+
+ ); + } + }; + return ( {!isEmpty(detector) && !hasError ? ( @@ -451,12 +468,7 @@ export const DetectorDetail = (props: DetectorDetailProps) => { justifyContent="spaceBetween" style={{ padding: '10px' }} > - - - {

{detector && detector.name}

} -
-
- + {renderPageHeader()} ({ useFetchDetectorInfo: jest.fn(), })); -jest.mock('../../../../services', () => ({ - ...jest.requireActual('../../../../services'), - - getDataSourceEnabled: () => ({ - enabled: false, - }), -})); +jest.mock('../../../../services', () => { + const originalModule = jest.requireActual('../../../../services'); + + return { + ...originalModule, + getDataSourceEnabled: () => ({ + enabled: false, + }), + getUISettings: () => ({ + get: (flag) => { + if (flag === 'home:useNewHomePage') { + return false; + } + return originalModule.getUISettings().get(flag); + } + }), + getNavigationUI: () => ({ + HeaderControl: null + }), + getApplication: () => ({ + setAppRightControls: null, + }) + }; +}); const detectorId = '4QY4YHEB5W9C7vlb3Mou'; diff --git a/public/pages/DetectorsList/containers/List/List.tsx b/public/pages/DetectorsList/containers/List/List.tsx index 035ebffd..90353d9e 100644 --- a/public/pages/DetectorsList/containers/List/List.tsx +++ b/public/pages/DetectorsList/containers/List/List.tsx @@ -42,7 +42,7 @@ import { getIndices, getPrioritizedIndices, } from '../../../../redux/reducers/opensearch'; -import { APP_PATH, MDS_BREADCRUMBS, PLUGIN_NAME } from '../../../../utils/constants'; +import { APP_PATH, MDS_BREADCRUMBS, PLUGIN_NAME, USE_NEW_HOME_PAGE } from '../../../../utils/constants'; import { DETECTOR_STATE } from '../../../../../server/utils/constants'; import { constructHrefWithDataSourceId, @@ -91,7 +91,11 @@ import { getDataSourceEnabled, getNotifications, getSavedObjectsClient, + getUISettings, + getNavigationUI, + getApplication, } from '../../../../services'; +import { TopNavControlButtonData } from '../../../../../../../src/plugins/navigation/public'; export interface ListRouterParams { from: string; @@ -717,10 +721,36 @@ export const DetectorList = (props: ListProps) => { const createDetectorUrl =`${PLUGIN_NAME}#` + constructHrefWithDataSourceId(APP_PATH.CREATE_DETECTOR, state.selectedDataSourceId, false); + const useUpdatedUX = getUISettings().get(USE_NEW_HOME_PAGE); + const { HeaderControl } = getNavigationUI(); + const { setAppRightControls } = getApplication(); + + const renderCreateButton = () => { + return useUpdatedUX ? ( + + ) : ( + null + ) + }; + return ( {dataSourceEnabled && renderDataSourceComponent} + {renderCreateButton()} { isStartDisabled={listActionsState.isStartDisabled} isStopDisabled={listActionsState.isStopDisabled} />, - Create detector - , + ), ]} > {confirmModal} diff --git a/public/pages/DetectorsList/containers/List/__tests__/List.test.tsx b/public/pages/DetectorsList/containers/List/__tests__/List.test.tsx index 3bc8c268..fa333434 100644 --- a/public/pages/DetectorsList/containers/List/__tests__/List.test.tsx +++ b/public/pages/DetectorsList/containers/List/__tests__/List.test.tsx @@ -31,13 +31,30 @@ import { DetectorList, ListRouterParams } from '../List'; import { DETECTOR_STATE } from '../../../../../../server/utils/constants'; import { CoreServicesContext } from '../../../../../components/CoreServices/CoreServices'; -jest.mock('../../../../../services', () => ({ - ...jest.requireActual('../../../../../services'), +jest.mock('../../../../../services', () => { + const originalModule = jest.requireActual('../../../../../services'); - getDataSourceEnabled: () => ({ - enabled: false - }) -})); + return { + ...originalModule, + getDataSourceEnabled: () => ({ + enabled: false + }), + getUISettings: () => ({ + get: (flag) => { + if (flag === 'home:useNewHomePage') { + return false; + } + return originalModule.getUISettings().get(flag); + } + }), + getNavigationUI: () => ({ + HeaderControl: null + }), + getApplication: () => ({ + setAppRightControls: null, + }) + }; +}); const renderWithRouter = ( initialAdState: Detectors = initialDetectorsState diff --git a/public/pages/Overview/containers/AnomalyDetectionOverview.tsx b/public/pages/Overview/containers/AnomalyDetectionOverview.tsx index d16604e6..1c137feb 100644 --- a/public/pages/Overview/containers/AnomalyDetectionOverview.tsx +++ b/public/pages/Overview/containers/AnomalyDetectionOverview.tsx @@ -29,6 +29,7 @@ import { PLUGIN_NAME, BASE_DOCS_LINK, MDS_BREADCRUMBS, + USE_NEW_HOME_PAGE, } from '../../../utils/constants'; import { SAMPLE_TYPE } from '../../../../server/utils/constants'; import { GET_SAMPLE_INDICES_QUERY } from '../../utils/constants'; @@ -62,11 +63,15 @@ import { getDataSourceEnabled, getNotifications, getSavedObjectsClient, + getNavigationUI, + getApplication, + getUISettings, } from '../../../../public/services'; import { RouteComponentProps } from 'react-router-dom'; import queryString from 'querystring'; import { getDataSourceFromURL, getSampleDetectorsQueryParamsWithDataSouceId, isDataSourceCompatible } from '../../../../public/pages/utils/helpers'; import { MDSStates } from '../../../models/interfaces'; +import { TopNavControlButtonData } from '../../../../../../src/plugins/navigation/public'; interface AnomalyDetectionOverviewProps extends RouteComponentProps { setActionMenu: (menuMount: MountPoint | undefined) => void; @@ -109,12 +114,27 @@ export function AnomalyDetectionOverview(props: AnomalyDetectionOverviewProps) { : queryParams.dataSourceId, }); + const useUpdatedUX = getUISettings().get(USE_NEW_HOME_PAGE); + const { HeaderControl } = getNavigationUI(); + const { setAppRightControls, setAppDescriptionControls } = getApplication(); + // Set breadcrumbs on page initialization useEffect(() => { - if (dataSourceEnabled) { - core.chrome.setBreadcrumbs([MDS_BREADCRUMBS.ANOMALY_DETECTOR(MDSOverviewState.selectedDataSourceId)]); + if (useUpdatedUX) { + if (dataSourceEnabled) { + core.chrome.setBreadcrumbs([ + MDS_BREADCRUMBS.ANOMALY_DETECTOR(MDSOverviewState.selectedDataSourceId), + BREADCRUMBS.TITLE_GET_STARTED + ]); + } else { + core.chrome.setBreadcrumbs([BREADCRUMBS.ANOMALY_DETECTOR, BREADCRUMBS.TITLE_GET_STARTED]); + } } else { - core.chrome.setBreadcrumbs([BREADCRUMBS.ANOMALY_DETECTOR]); + if (dataSourceEnabled) { + core.chrome.setBreadcrumbs([MDS_BREADCRUMBS.ANOMALY_DETECTOR(MDSOverviewState.selectedDataSourceId)]); + } else { + core.chrome.setBreadcrumbs([BREADCRUMBS.ANOMALY_DETECTOR]); + } } }, []); @@ -239,6 +259,12 @@ export function AnomalyDetectionOverview(props: AnomalyDetectionOverviewProps) { } }; + const createDetectorUrl = + `${PLUGIN_NAME}#` + + (dataSourceEnabled + ? `${APP_PATH.CREATE_DETECTOR}?dataSourceId=${MDSOverviewState.selectedDataSourceId}` + : `${APP_PATH.CREATE_DETECTOR}`); + let renderDataSourceComponent = null; if (dataSourceEnabled) { const DataSourceMenu = @@ -265,20 +291,44 @@ export function AnomalyDetectionOverview(props: AnomalyDetectionOverviewProps) { }, [getSavedObjectsClient, getNotifications, props.setActionMenu]); } - const createDetectorUrl = - `${PLUGIN_NAME}#` + - (dataSourceEnabled - ? `${APP_PATH.CREATE_DETECTOR}?dataSourceId=${MDSOverviewState.selectedDataSourceId}` - : `${APP_PATH.CREATE_DETECTOR}`); - - return isLoadingSampleDetectors && isLoadingSampleIndices ? ( -
- -
- ) : ( - + const descriptionData = [ + { + renderComponent: ( + + The anomaly detection plugin automatically detects anomalies in your + data in near real-time using the Random Cut Forest (RCF) algorithm.{' '} + + Learn more + + + ), + }, + ]; + let renderPageHeader = () => { + return useUpdatedUX ? ( + <> + + + + ) : ( + <> - {dataSourceEnabled && renderDataSourceComponent} @@ -303,6 +353,19 @@ export function AnomalyDetectionOverview(props: AnomalyDetectionOverviewProps) { Learn more + + ) + }; + + return isLoadingSampleDetectors && isLoadingSampleIndices ? ( +
+ +
+ ) : ( + + {dataSourceEnabled && renderDataSourceComponent} + {renderPageHeader()} + diff --git a/public/pages/Overview/containers/__tests__/AnomalyDetectionOverview.test.tsx b/public/pages/Overview/containers/__tests__/AnomalyDetectionOverview.test.tsx index 23c2626f..f3814ab3 100644 --- a/public/pages/Overview/containers/__tests__/AnomalyDetectionOverview.test.tsx +++ b/public/pages/Overview/containers/__tests__/AnomalyDetectionOverview.test.tsx @@ -25,13 +25,31 @@ import configureStore from '../../../../redux/configureStore'; import { sampleHttpResponses } from '../../../Overview/utils/constants'; import { CoreServicesContext } from '../../../../components/CoreServices/CoreServices'; -jest.mock('../../../../services', () => ({ - ...jest.requireActual('../../../../services'), +jest.mock('../../../../services', () => { + const originalModule = jest.requireActual('../../../../services'); - getDataSourceEnabled: () => ({ - enabled: false - }) -})); + return { + ...originalModule, + getDataSourceEnabled: () => ({ + enabled: false + }), + getUISettings: () => ({ + get: (flag) => { + if (flag === 'home:useNewHomePage') { + return false; + } + return originalModule.getUISettings().get(flag); + } + }), + getNavigationUI: () => ({ + HeaderControl: null + }), + getApplication: () => ({ + setAppRightControls: null, + setAppDescriptionControls: null + }) + }; +}); const renderWithRouter = () => ({ diff --git a/public/plugin.ts b/public/plugin.ts index 00c211f0..95274204 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -41,6 +41,8 @@ import { setSavedObjectsClient, setDataSourceManagementPlugin, setDataSourceEnabled, + setNavigationUI, + setApplication } from './services'; import { AnomalyDetectionOpenSearchDashboardsPluginStart } from 'public'; import { @@ -51,6 +53,7 @@ import { UiActionsStart } from '../../../src/plugins/ui_actions/public'; import { DataPublicPluginStart } from '../../../src/plugins/data/public'; import { DataSourceManagementPluginSetup } from '../../../src/plugins/data_source_management/public'; import { DataSourcePluginSetup } from '../../../src/plugins/data_source/public'; +import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public'; declare module '../../../src/plugins/ui_actions/public' { export interface ActionContextMapping { @@ -73,6 +76,7 @@ export interface AnomalyDetectionStartDeps { visAugmenter: VisAugmenterStart; uiActions: UiActionsStart; data: DataPublicPluginStart; + navigation: NavigationPublicPluginStart; } export class AnomalyDetectionOpenSearchDashboardsPlugin @@ -192,7 +196,7 @@ export class AnomalyDetectionOpenSearchDashboardsPlugin public start( core: CoreStart, - { embeddable, visAugmenter, uiActions, data }: AnomalyDetectionStartDeps + { embeddable, visAugmenter, uiActions, data, navigation }: AnomalyDetectionStartDeps ): AnomalyDetectionOpenSearchDashboardsPluginStart { setUISettings(core.uiSettings); setEmbeddable(embeddable); @@ -202,6 +206,8 @@ export class AnomalyDetectionOpenSearchDashboardsPlugin setUiActions(uiActions); setQueryService(data.query); setSavedObjectsClient(core.savedObjects.client); + setNavigationUI(navigation.ui); + setApplication(core.application); return {}; } } diff --git a/public/services.ts b/public/services.ts index dbe060e6..0c3d45dd 100644 --- a/public/services.ts +++ b/public/services.ts @@ -15,7 +15,7 @@ import { EmbeddableStart } from '../../../src/plugins/embeddable/public'; import { createGetterSetter } from '../../../src/plugins/opensearch_dashboards_utils/public'; import { UiActionsStart } from '../../../src/plugins/ui_actions/public'; import { SavedAugmentVisLoader } from '../../../src/plugins/vis_augmenter/public'; -import { DataSourcePluginSetup } from '../../../src/plugins/data_source/public'; +import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public'; export interface DataSourceEnabled { enabled: boolean; @@ -54,6 +54,12 @@ export const [getDataSourceManagementPlugin, setDataSourceManagementPlugin] = export const [getDataSourceEnabled, setDataSourceEnabled] = createGetterSetter('DataSourceEnabled'); +export const [getNavigationUI, setNavigationUI] = + createGetterSetter('navigation'); + +export const [getApplication, setApplication] = + createGetterSetter('application'); + // This is primarily used for mocking this module and each of its fns in tests. export default { getSavedFeatureAnywhereLoader, diff --git a/public/utils/constants.ts b/public/utils/constants.ts index 562c5520..6b7f60b4 100644 --- a/public/utils/constants.ts +++ b/public/utils/constants.ts @@ -24,6 +24,8 @@ export const BREADCRUMBS = Object.freeze({ EDIT_DETECTOR: { text: 'Edit detector' }, DASHBOARD: { text: 'Dashboard', href: '#/dashboard' }, EDIT_MODEL_CONFIGURATION: { text: 'Edit model configuration' }, + TITLE_GET_STARTED: { text: 'Get started'}, + TITLE_REAL_TIME_DASHBOARD: { text: 'Real-time dashboard'}, }); export const MDS_BREADCRUMBS = Object.freeze({ @@ -113,4 +115,6 @@ export const OVERVIEW_PAGE_NAV_ID = `anomaly_detection_dashboard-overview`; export const DASHBOARD_PAGE_NAV_ID = `anomaly_detection_dashboard-dashboard`; -export const DETECTORS_PAGE_NAV_ID = `anomaly_detection_dashboard-detectors`; \ No newline at end of file +export const DETECTORS_PAGE_NAV_ID = `anomaly_detection_dashboard-detectors`; + +export const USE_NEW_HOME_PAGE = 'home:useNewHomePage'; \ No newline at end of file