diff --git a/.github/workflows/cypress_workflow.yml b/.github/workflows/cypress_workflow.yml index 5b531ad8245..291bd172b80 100644 --- a/.github/workflows/cypress_workflow.yml +++ b/.github/workflows/cypress_workflow.yml @@ -3,7 +3,7 @@ name: Run cypress tests # trigger on every PR for all branches on: pull_request: - branches: ['**'] + branches: [ '**' ] paths-ignore: - '**/*.md' workflow_dispatch: @@ -28,7 +28,7 @@ on: env: TEST_REPO: ${{ inputs.test_repo != '' && inputs.test_repo || 'opensearch-project/opensearch-dashboards-functional-test' }} - TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || 'workspace' }}" + TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || 'main' }}" FTR_PATH: 'ftr' START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true' OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot -E cluster.routing.allocation.disk.threshold_enabled=false' @@ -243,7 +243,7 @@ jobs: with: issue-number: ${{ inputs.pr_number }} comment-author: 'github-actions[bot]' - body-includes: '${{ env.COMMENT_TAG }}' + body-includes: "${{ env.COMMENT_TAG }}" - name: Add comment on the PR uses: peter-evans/create-or-update-comment@v3 diff --git a/cypress/integration/with-security/check_advanced_settings.js b/cypress/integration/with-security/check_advanced_settings.js index 379362063e9..9ca41207724 100644 --- a/cypress/integration/with-security/check_advanced_settings.js +++ b/cypress/integration/with-security/check_advanced_settings.js @@ -13,7 +13,7 @@ const loginPage = new LoginPage(cy); describe('verify the advanced settings are saved', () => { beforeEach(() => { - miscUtils.visitPage('app/settings'); + miscUtils.visitPage('app/management/opensearch-dashboards/settings'); loginPage.enterUserName('admin'); loginPage.enterPassword('admin'); loginPage.submit(); diff --git a/cypress/integration/with-security/helpers/generate_data.js b/cypress/integration/with-security/helpers/generate_data.js index c2c4d2dbe57..dcd711fc7c1 100755 --- a/cypress/integration/with-security/helpers/generate_data.js +++ b/cypress/integration/with-security/helpers/generate_data.js @@ -13,7 +13,7 @@ const loginPage = new LoginPage(cy); describe('Generating BWC test data with security', () => { beforeEach(() => { - miscUtils.visitPage('app/settings'); + miscUtils.visitPage('app/management/opensearch-dashboards/settings'); loginPage.enterUserName('admin'); loginPage.enterPassword('admin'); loginPage.submit(); @@ -29,7 +29,7 @@ describe('Generating BWC test data with security', () => { }); it('adds advanced settings', () => { - miscUtils.visitPage('app/settings'); + miscUtils.visitPage('app/management/opensearch-dashboards/settings'); cy.get('[data-test-subj="advancedSetting-editField-theme:darkMode"]').click(); cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').type( '{selectAll}4' diff --git a/cypress/integration/without-security/check_advanced_settings.js b/cypress/integration/without-security/check_advanced_settings.js index 0094d53835b..9268d86a16e 100644 --- a/cypress/integration/without-security/check_advanced_settings.js +++ b/cypress/integration/without-security/check_advanced_settings.js @@ -9,7 +9,7 @@ const miscUtils = new MiscUtils(cy); describe('verify the advanced settings are saved', () => { beforeEach(() => { - miscUtils.visitPage('app/settings'); + miscUtils.visitPage('app/management/opensearch-dashboards/settings'); }); it('the dark mode is on', () => { diff --git a/cypress/integration/without-security/helpers/generate_data.js b/cypress/integration/without-security/helpers/generate_data.js index 3aff136a70e..47e9c2f5f5e 100755 --- a/cypress/integration/without-security/helpers/generate_data.js +++ b/cypress/integration/without-security/helpers/generate_data.js @@ -12,7 +12,7 @@ describe('Generating BWC test data without security', () => { miscUtils.visitPage('app'); }); it('adds advanced settings', () => { - miscUtils.visitPage('app/settings'); + miscUtils.visitPage('app/management/opensearch-dashboards/settings'); cy.get('[data-test-subj="advancedSetting-editField-theme:darkMode"]').click(); cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').type( '{selectAll}4' diff --git a/src/core/public/core_app/errors/url_overflow.test.ts b/src/core/public/core_app/errors/url_overflow.test.ts index fe9cb8dca66..b2eee9c17d5 100644 --- a/src/core/public/core_app/errors/url_overflow.test.ts +++ b/src/core/public/core_app/errors/url_overflow.test.ts @@ -102,7 +102,7 @@ describe('url overflow detection', () => { option in advanced settings diff --git a/src/core/public/core_app/errors/url_overflow.tsx b/src/core/public/core_app/errors/url_overflow.tsx index 1de6fe785cf..6dbfa96fff4 100644 --- a/src/core/public/core_app/errors/url_overflow.tsx +++ b/src/core/public/core_app/errors/url_overflow.tsx @@ -92,7 +92,7 @@ export const setupUrlOverflowDetection = ({ basePath, history, toasts, uiSetting values={{ storeInSessionStorageParam: state:storeInSessionStorage, advancedSettingsLink: ( - + = ({ basePath }) = values={{ storeInSessionStorageConfig: state:storeInSessionStorage, opensearchDashboardsSettingsLink: ( - + -
- Foo -
- -`; diff --git a/src/plugins/advanced_settings/public/management_app/components/page_wrapper/index.ts b/src/plugins/advanced_settings/public/management_app/components/page_wrapper/index.ts deleted file mode 100644 index 3cf0cdd26c9..00000000000 --- a/src/plugins/advanced_settings/public/management_app/components/page_wrapper/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -export { PageWrapper } from './page_wrapper'; diff --git a/src/plugins/advanced_settings/public/management_app/components/page_wrapper/page_wrapper.test.tsx b/src/plugins/advanced_settings/public/management_app/components/page_wrapper/page_wrapper.test.tsx deleted file mode 100644 index 550eb3ee1ca..00000000000 --- a/src/plugins/advanced_settings/public/management_app/components/page_wrapper/page_wrapper.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import React from 'react'; -import { render } from '@testing-library/react'; -import { PageWrapper } from './page_wrapper'; - -describe('PageWrapper', () => { - it('should render normally', async () => { - const { findByText, container } = render(Foo); - await findByText('Foo'); - expect(container).toMatchSnapshot(); - }); -}); diff --git a/src/plugins/advanced_settings/public/management_app/components/page_wrapper/page_wrapper.tsx b/src/plugins/advanced_settings/public/management_app/components/page_wrapper/page_wrapper.tsx deleted file mode 100644 index 1b1949c334e..00000000000 --- a/src/plugins/advanced_settings/public/management_app/components/page_wrapper/page_wrapper.tsx +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import { EuiPageContent } from '@elastic/eui'; -import React from 'react'; - -export const PageWrapper = (props: { children?: React.ReactChild }) => { - return ( - - ); -}; diff --git a/src/plugins/advanced_settings/public/management_app/mount_management_section.tsx b/src/plugins/advanced_settings/public/management_app/mount_management_section.tsx index 648382771ba..7fa0b9ddd2c 100644 --- a/src/plugins/advanced_settings/public/management_app/mount_management_section.tsx +++ b/src/plugins/advanced_settings/public/management_app/mount_management_section.tsx @@ -34,24 +34,18 @@ import { Router, Switch, Route } from 'react-router-dom'; import { i18n } from '@osd/i18n'; import { I18nProvider } from '@osd/i18n/react'; -import { - AppMountParameters, - ChromeBreadcrumb, - ScopedHistory, - StartServicesAccessor, -} from 'src/core/public'; +import { StartServicesAccessor } from 'src/core/public'; import { AdvancedSettings } from './advanced_settings'; +import { ManagementAppMountParams } from '../../../management/public'; import { ComponentRegistry } from '../types'; -import { reactRouterNavigate } from '../../../opensearch_dashboards_react/public'; -import { PageWrapper } from './components/page_wrapper'; import './index.scss'; const title = i18n.translate('advancedSettings.advancedSettingsLabel', { defaultMessage: 'Advanced settings', }); -const crumb: ChromeBreadcrumb[] = [{ text: title }]; +const crumb = [{ text: title }]; const readOnlyBadge = { text: i18n.translate('advancedSettings.badge.readOnly.text', { @@ -63,18 +57,13 @@ const readOnlyBadge = { iconType: 'glasses', }; -export async function mountAdvancedSettingsManagementSection( +export async function mountManagementSection( getStartServices: StartServicesAccessor, - params: AppMountParameters, + params: ManagementAppMountParams, componentRegistry: ComponentRegistry['start'] ) { + params.setBreadcrumbs(crumb); const [{ uiSettings, notifications, docLinks, application, chrome }] = await getStartServices(); - chrome.setBreadcrumbs([ - ...crumb.map((item) => ({ - ...item, - ...(item.href ? reactRouterNavigate(params.history, item.href) : {}), - })), - ]); const canSave = application.capabilities.advancedSettings.save as boolean; @@ -83,23 +72,21 @@ export async function mountAdvancedSettingsManagementSection( } ReactDOM.render( - - - - - - - - - - - , + + + + + + + + + , params.element ); return () => { diff --git a/src/plugins/advanced_settings/public/plugin.ts b/src/plugins/advanced_settings/public/plugin.ts index 91fe1861274..608bfc6a25e 100644 --- a/src/plugins/advanced_settings/public/plugin.ts +++ b/src/plugins/advanced_settings/public/plugin.ts @@ -29,11 +29,10 @@ */ import { i18n } from '@osd/i18n'; -import { AppMountParameters, CoreSetup, Plugin } from 'opensearch-dashboards/public'; +import { CoreSetup, Plugin } from 'opensearch-dashboards/public'; import { FeatureCatalogueCategory } from '../../home/public'; import { ComponentRegistry } from './component_registry'; import { AdvancedSettingsSetup, AdvancedSettingsStart, AdvancedSettingsPluginSetup } from './types'; -import { DEFAULT_APP_CATEGORIES } from '../../../core/public'; const component = new ComponentRegistry(); @@ -43,21 +42,18 @@ const title = i18n.translate('advancedSettings.advancedSettingsLabel', { export class AdvancedSettingsPlugin implements Plugin { - public setup(core: CoreSetup, { home }: AdvancedSettingsPluginSetup) { - core.application.register({ + public setup(core: CoreSetup, { management, home }: AdvancedSettingsPluginSetup) { + const opensearchDashboardsSection = management.sections.section.opensearchDashboards; + + opensearchDashboardsSection.registerApp({ id: 'settings', title, - order: 99, - category: DEFAULT_APP_CATEGORIES.management, - async mount(params: AppMountParameters) { - const { mountAdvancedSettingsManagementSection } = await import( + order: 3, + async mount(params) { + const { mountManagementSection } = await import( './management_app/mount_management_section' ); - return mountAdvancedSettingsManagementSection( - core.getStartServices, - params, - component.start - ); + return mountManagementSection(core.getStartServices, params, component.start); }, }); @@ -70,7 +66,7 @@ export class AdvancedSettingsPlugin 'Customize your OpenSearch Dashboards experience — change the date format, turn on dark mode, and more.', }), icon: 'gear', - path: '/app/settings', + path: '/app/management/opensearch-dashboards/settings', showOnHomePage: false, category: FeatureCatalogueCategory.ADMIN, }); diff --git a/src/plugins/dashboard/server/saved_objects/dashboard.ts b/src/plugins/dashboard/server/saved_objects/dashboard.ts index 6d6a08954fb..ee2c162733b 100644 --- a/src/plugins/dashboard/server/saved_objects/dashboard.ts +++ b/src/plugins/dashboard/server/saved_objects/dashboard.ts @@ -43,7 +43,9 @@ export const dashboardSavedObjectType: SavedObjectsType = { return obj.attributes.title; }, getEditUrl(obj) { - return `/objects/savedDashboards/${encodeURIComponent(obj.id)}`; + return `/management/opensearch-dashboards/objects/savedDashboards/${encodeURIComponent( + obj.id + )}`; }, getInAppUrl(obj) { return { diff --git a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts index 489ad154afa..68860582109 100644 --- a/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts +++ b/src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts @@ -418,7 +418,11 @@ export class IndexPatternsService { ); if (!savedObject.version) { - throw new SavedObjectNotFound(savedObjectType, id, 'indexPatterns'); + throw new SavedObjectNotFound( + savedObjectType, + id, + 'management/opensearch-dashboards/indexPatterns' + ); } const spec = this.savedObjectToSpec(savedObject); diff --git a/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx b/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx index 1a43ab22aaa..b09bc8adde6 100644 --- a/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx +++ b/src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx @@ -42,7 +42,9 @@ export const onRedirectNoIndexPattern = ( overlays: CoreStart['overlays'] ) => () => { const canManageIndexPatterns = capabilities.management.opensearchDashboards.indexPatterns; - const redirectTarget = canManageIndexPatterns ? '/indexPatterns' : '/home'; + const redirectTarget = canManageIndexPatterns + ? '/management/opensearch-dashboards/indexPatterns' + : '/home'; let timeoutId: NodeJS.Timeout | undefined; if (timeoutId) { @@ -70,8 +72,8 @@ export const onRedirectNoIndexPattern = ( if (redirectTarget === '/home') { navigateToApp('home'); } else { - navigateToApp('indexPatterns', { - path: `?bannerMessage=${bannerMessage}`, + navigateToApp('management', { + path: `/opensearch-dashboards/indexPatterns?bannerMessage=${bannerMessage}`, }); } diff --git a/src/plugins/data/public/search/errors/painless_error.tsx b/src/plugins/data/public/search/errors/painless_error.tsx index ee11d77b98f..1522dcf97cb 100644 --- a/src/plugins/data/public/search/errors/painless_error.tsx +++ b/src/plugins/data/public/search/errors/painless_error.tsx @@ -53,7 +53,9 @@ export class PainlessError extends OsdError { public getErrorMessage(application: ApplicationStart) { function onClick() { - application.navigateToApp('indexPatterns'); + application.navigateToApp('management', { + path: `/opensearch-dashboards/indexPatterns`, + }); } return ( diff --git a/src/plugins/data/server/saved_objects/index_patterns.ts b/src/plugins/data/server/saved_objects/index_patterns.ts index 391adf6a973..5f0864bac92 100644 --- a/src/plugins/data/server/saved_objects/index_patterns.ts +++ b/src/plugins/data/server/saved_objects/index_patterns.ts @@ -43,11 +43,15 @@ export const indexPatternSavedObjectType: SavedObjectsType = { return obj.attributes.title; }, getEditUrl(obj) { - return `/indexPatterns/patterns/${encodeURIComponent(obj.id)}`; + return `/management/opensearch-dashboards/indexPatterns/patterns/${encodeURIComponent( + obj.id + )}`; }, getInAppUrl(obj) { return { - path: `/app/indexPatterns/patterns/${encodeURIComponent(obj.id)}`, + path: `/app/management/opensearch-dashboards/indexPatterns/patterns/${encodeURIComponent( + obj.id + )}`, uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }; }, diff --git a/src/plugins/data_source/server/saved_objects/data_source.ts b/src/plugins/data_source/server/saved_objects/data_source.ts index 0cbd9daf302..3f31e7bd14b 100644 --- a/src/plugins/data_source/server/saved_objects/data_source.ts +++ b/src/plugins/data_source/server/saved_objects/data_source.ts @@ -23,11 +23,11 @@ export const dataSource: SavedObjectsType = { return obj.attributes.title; }, getEditUrl(obj) { - return `/dataSources/${encodeURIComponent(obj.id)}`; + return `/management/opensearch-dashboards/dataSources/${encodeURIComponent(obj.id)}`; }, getInAppUrl(obj) { return { - path: `/app/dataSources/${encodeURIComponent(obj.id)}`, + path: `/app/management/opensearch-dashboards/dataSources/${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'management.opensearchDashboards.dataSources', }; }, diff --git a/src/plugins/data_source_management/opensearch_dashboards.json b/src/plugins/data_source_management/opensearch_dashboards.json index 565ccff401d..cfcfdd2ce43 100644 --- a/src/plugins/data_source_management/opensearch_dashboards.json +++ b/src/plugins/data_source_management/opensearch_dashboards.json @@ -3,7 +3,7 @@ "version": "opensearchDashboards", "server": false, "ui": true, - "requiredPlugins": ["dataSource", "indexPatternManagement"], + "requiredPlugins": ["management", "dataSource", "indexPatternManagement"], "optionalPlugins": [], "requiredBundles": ["opensearchDashboardsReact", "dataSource"], "extraPublicDirs": ["public/components/utils"] diff --git a/src/plugins/data_source_management/public/components/data_source_column/data_source_column.tsx b/src/plugins/data_source_management/public/components/data_source_column/data_source_column.tsx index cd6fc7c17ae..640eb1b369f 100644 --- a/src/plugins/data_source_management/public/components/data_source_column/data_source_column.tsx +++ b/src/plugins/data_source_management/public/components/data_source_column/data_source_column.tsx @@ -56,7 +56,11 @@ export class DataSourceColumn implements IndexPatternTableColumn ?.map((dataSource) => { return { ...dataSource, - relativeUrl: basePath.prepend(`/app/dataSources/${encodeURIComponent(dataSource.id)}`), + relativeUrl: basePath.prepend( + `/app/management/opensearch-dashboards/dataSources/${encodeURIComponent( + dataSource.id + )}` + ), }; }) ?.reduce( diff --git a/src/plugins/data_source_management/public/components/page_wrapper/__snapshots__/page_wrapper.test.tsx.snap b/src/plugins/data_source_management/public/components/page_wrapper/__snapshots__/page_wrapper.test.tsx.snap deleted file mode 100644 index 3c5257e2e8d..00000000000 --- a/src/plugins/data_source_management/public/components/page_wrapper/__snapshots__/page_wrapper.test.tsx.snap +++ /dev/null @@ -1,13 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PageWrapper should render normally 1`] = ` -
-
- Foo -
-
-`; diff --git a/src/plugins/data_source_management/public/components/page_wrapper/index.ts b/src/plugins/data_source_management/public/components/page_wrapper/index.ts deleted file mode 100644 index 3cf0cdd26c9..00000000000 --- a/src/plugins/data_source_management/public/components/page_wrapper/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -export { PageWrapper } from './page_wrapper'; diff --git a/src/plugins/data_source_management/public/components/page_wrapper/page_wrapper.test.tsx b/src/plugins/data_source_management/public/components/page_wrapper/page_wrapper.test.tsx deleted file mode 100644 index 550eb3ee1ca..00000000000 --- a/src/plugins/data_source_management/public/components/page_wrapper/page_wrapper.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import React from 'react'; -import { render } from '@testing-library/react'; -import { PageWrapper } from './page_wrapper'; - -describe('PageWrapper', () => { - it('should render normally', async () => { - const { findByText, container } = render(Foo); - await findByText('Foo'); - expect(container).toMatchSnapshot(); - }); -}); diff --git a/src/plugins/data_source_management/public/components/page_wrapper/page_wrapper.tsx b/src/plugins/data_source_management/public/components/page_wrapper/page_wrapper.tsx deleted file mode 100644 index 1b1949c334e..00000000000 --- a/src/plugins/data_source_management/public/components/page_wrapper/page_wrapper.tsx +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import { EuiPageContent } from '@elastic/eui'; -import React from 'react'; - -export const PageWrapper = (props: { children?: React.ReactChild }) => { - return ( - - ); -}; diff --git a/src/plugins/data_source_management/public/types.ts b/src/plugins/data_source_management/public/types.ts index 719d7702fcb..bf0743468fd 100644 --- a/src/plugins/data_source_management/public/types.ts +++ b/src/plugins/data_source_management/public/types.ts @@ -14,7 +14,6 @@ import { HttpSetup, } from 'src/core/public'; import { ManagementAppMountParams } from 'src/plugins/management/public'; -import { DataPublicPluginStart } from 'src/plugins/data/public'; import { SavedObjectAttributes } from 'src/core/types'; import { i18n } from '@osd/i18n'; import { SigV4ServiceName } from '../../data_source/common/data_sources'; @@ -162,7 +161,3 @@ export interface SigV4Content extends SavedObjectAttributes { region: string; service?: SigV4ServiceName; } - -export interface DataSourceManagementStartDependencies { - data: DataPublicPluginStart; -} diff --git a/src/plugins/discover/public/application/components/top_nav/__snapshots__/open_search_panel.test.tsx.snap b/src/plugins/discover/public/application/components/top_nav/__snapshots__/open_search_panel.test.tsx.snap index 45e15f809f6..1fa9680fa70 100644 --- a/src/plugins/discover/public/application/components/top_nav/__snapshots__/open_search_panel.test.tsx.snap +++ b/src/plugins/discover/public/application/components/top_nav/__snapshots__/open_search_panel.test.tsx.snap @@ -53,7 +53,7 @@ exports[`render 1`] = ` > = ({ addBasePath, onClose }) => { modes. You or your administrator can change to the previous theme by visiting {advancedSettingsLink}." values={{ advancedSettingsLink: ( - + , - params: AppMountParameters, + params: ManagementAppMountParams, getMlCardState: () => MlCardState, dataSource?: DataSourcePluginSetup ) { @@ -85,17 +77,6 @@ export async function mountManagementSection( chrome.setBadge(readOnlyBadge); } - const setBreadcrumbsScope = (crumbs: ChromeBreadcrumb[] = [], appHistory?: ScopedHistory) => { - const wrapBreadcrumb = (item: ChromeBreadcrumb, scopedHistory: ScopedHistory) => ({ - ...item, - ...(item.href ? reactRouterNavigate(scopedHistory, item.href) : {}), - }); - - chrome.setBreadcrumbs([ - ...crumbs.map((item) => wrapBreadcrumb(item, appHistory || params.history)), - ]); - }; - const deps: IndexPatternManagmentContext = { chrome, application, @@ -107,37 +88,33 @@ export async function mountManagementSection( docLinks, data, indexPatternManagementStart: indexPatternManagementStart as IndexPatternManagementStart, - setBreadcrumbs: setBreadcrumbsScope, + setBreadcrumbs: params.setBreadcrumbs, getMlCardState, dataSourceEnabled, hideLocalCluster, }; ReactDOM.render( - - - - - - - - - - - - - - - - - - - - - - - - , + + + + + + + + + + + + + + + + + + + + , params.element ); diff --git a/src/plugins/index_pattern_management/public/plugin.ts b/src/plugins/index_pattern_management/public/plugin.ts index 0b9443a735a..98eaab6160e 100644 --- a/src/plugins/index_pattern_management/public/plugin.ts +++ b/src/plugins/index_pattern_management/public/plugin.ts @@ -29,13 +29,7 @@ */ import { i18n } from '@osd/i18n'; -import { - PluginInitializerContext, - CoreSetup, - CoreStart, - Plugin, - AppMountParameters, -} from 'src/core/public'; +import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'src/core/public'; import { DataPublicPluginStart } from 'src/plugins/data/public'; import { DataSourcePluginSetup, DataSourcePluginStart } from 'src/plugins/data_source/public'; import { UrlForwardingSetup } from '../../url_forwarding/public'; @@ -45,9 +39,10 @@ import { IndexPatternManagementServiceStart, } from './service'; -import { DEFAULT_APP_CATEGORIES } from '../../../core/public'; +import { ManagementSetup } from '../../management/public'; export interface IndexPatternManagementSetupDependencies { + management: ManagementSetup; urlForwarding: UrlForwardingSetup; dataSource?: DataSourcePluginSetup; } @@ -83,9 +78,15 @@ export class IndexPatternManagementPlugin core: CoreSetup, dependencies: IndexPatternManagementSetupDependencies ) { - const { urlForwarding, dataSource } = dependencies; + const { urlForwarding, management, dataSource } = dependencies; + + const opensearchDashboardsSection = management.sections.section.opensearchDashboards; + + if (!opensearchDashboardsSection) { + throw new Error('`opensearchDashboards` management section not found.'); + } - const newAppPath = IPM_APP_ID; + const newAppPath = `management/opensearch-dashboards/${IPM_APP_ID}`; const legacyPatternsPath = 'management/opensearch-dashboards/index_patterns'; urlForwarding.forwardApp( @@ -98,13 +99,11 @@ export class IndexPatternManagementPlugin return pathInApp && `/patterns${pathInApp}`; }); - // register it under Library - core.application.register({ + opensearchDashboardsSection.registerApp({ id: IPM_APP_ID, title: sectionsHeader, - order: 8100, - category: DEFAULT_APP_CATEGORIES.opensearchDashboards, - mount: async (params: AppMountParameters) => { + order: 0, + mount: async (params) => { const { mountManagementSection } = await import('./management_app'); return mountManagementSection( diff --git a/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap b/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap index db7484e2137..9df3bb12cae 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap +++ b/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap @@ -171,7 +171,7 @@ exports[`GettingStarted dark mode on 1`] = ` = ({ addBasePath, isDarkTheme, apps }) => - + = ({ addBasePath, path }) => { diff --git a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx index fcd417a4282..2e27ebd0cb6 100644 --- a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx +++ b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx @@ -200,7 +200,7 @@ describe('OverviewPageHeader toolbar items - Management', () => { return component.find({ className: 'osdOverviewPageHeader__actionButton', - href: '/app/settings', + href: '/app/management', }); }; diff --git a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx index e27a99fc4d4..a636f7ecdb7 100644 --- a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx +++ b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx @@ -136,7 +136,7 @@ export const OverviewPageHeader: FC = ({ className="osdOverviewPageHeader__actionButton" flush="both" iconType="gear" - href={addBasePath('/app/settings')} + href={addBasePath('/app/management')} > {i18n.translate( 'opensearch-dashboards-react.osdOverviewPageHeader.stackManagementButtonLabel', diff --git a/src/plugins/opensearch_dashboards_react/public/table_list_view/table_list_view.tsx b/src/plugins/opensearch_dashboards_react/public/table_list_view/table_list_view.tsx index 0df7289caf7..438971862c7 100644 --- a/src/plugins/opensearch_dashboards_react/public/table_list_view/table_list_view.tsx +++ b/src/plugins/opensearch_dashboards_react/public/table_list_view/table_list_view.tsx @@ -315,7 +315,7 @@ class TableListView extends React.ComponentlistingLimit, advancedSettingsLink: ( - + ; serviceRegistry: ISavedObjectsManagementServiceRegistry; + mountParams: ManagementAppMountParams; dataSourceEnabled: boolean; hideLocalCluster: boolean; - appMountParams?: AppMountParameters; - title: string; - allowedObjectTypes?: string[]; } +let allowedObjectTypes: string[] | undefined; + +const title = i18n.translate('savedObjectsManagement.objects.savedObjectsTitle', { + defaultMessage: 'Saved Objects', +}); + const SavedObjectsEditionPage = lazy(() => import('./saved_objects_edition_page')); const SavedObjectsTablePage = lazy(() => import('./saved_objects_table_page')); export const mountManagementSection = async ({ core, - appMountParams, + mountParams, serviceRegistry, dataSourceEnabled, hideLocalCluster, - title, - allowedObjectTypes, }: MountParams) => { const [coreStart, { data, uiActions }, pluginStart] = await core.getStartServices(); - const usedMountParams = appMountParams || ({} as ManagementAppMountParams); - const { element, history } = usedMountParams; - const { chrome } = coreStart; - const setBreadcrumbs = chrome.setBreadcrumbs; + const { element, history, setBreadcrumbs } = mountParams; if (allowedObjectTypes === undefined) { allowedObjectTypes = await getAllowedTypes(coreStart.http); } @@ -91,36 +90,31 @@ export const mountManagementSection = async ({ }> - - - + }> - - - + diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap index 501c4e96b17..d44cecb5b41 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap @@ -320,10 +320,10 @@ exports[`SavedObjectsTable should render normally 1`] = ` Object { "id": "1", "meta": Object { - "editUrl": "#/indexPatterns/patterns/1", + "editUrl": "#/management/opensearch-dashboards/indexPatterns/patterns/1", "icon": "indexPatternApp", "inAppUrl": Object { - "path": "/indexPatterns/patterns/1", + "path": "/management/opensearch-dashboards/indexPatterns/patterns/1", "uiCapabilitiesPath": "management.opensearchDashboards.indexPatterns", }, "title": "MyIndexPattern*", @@ -333,7 +333,7 @@ exports[`SavedObjectsTable should render normally 1`] = ` Object { "id": "2", "meta": Object { - "editUrl": "/objects/savedSearches/2", + "editUrl": "/management/opensearch-dashboards/objects/savedSearches/2", "icon": "search", "inAppUrl": Object { "path": "/discover/2", @@ -346,7 +346,7 @@ exports[`SavedObjectsTable should render normally 1`] = ` Object { "id": "3", "meta": Object { - "editUrl": "/objects/savedDashboards/3", + "editUrl": "/management/opensearch-dashboards/objects/savedDashboards/3", "icon": "dashboardApp", "inAppUrl": Object { "path": "/dashboard/3", @@ -359,7 +359,7 @@ exports[`SavedObjectsTable should render normally 1`] = ` Object { "id": "4", "meta": Object { - "editUrl": "/objects/savedVisualizations/4", + "editUrl": "/management/opensearch-dashboards/objects/savedVisualizations/4", "icon": "visualizeApp", "inAppUrl": Object { "path": "/edit/4", diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/header.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/header.test.tsx.snap index dace178024f..038e1aaf2d8 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/header.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/header.test.tsx.snap @@ -10,7 +10,13 @@ exports[`Header should render normally 1`] = ` grow={false} > -

+

+ +

void; onImport: () => void; onRefresh: () => void; filteredCount: number; - title: string; }) => ( -

{title}

+

+ +

diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx index 5afdbacf6df..1f21e5990c7 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx @@ -53,7 +53,7 @@ describe('Relationships', () => { id: '1', relationship: 'parent', meta: { - editUrl: '/objects/savedSearches/1', + editUrl: '/management/opensearch-dashboards/objects/savedSearches/1', icon: 'search', inAppUrl: { path: '/app/discover#//1', @@ -67,7 +67,7 @@ describe('Relationships', () => { id: '2', relationship: 'parent', meta: { - editUrl: '/objects/savedVisualizations/2', + editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/2', icon: 'visualizeApp', inAppUrl: { path: '/app/visualize#/edit/2', @@ -85,9 +85,9 @@ describe('Relationships', () => { meta: { title: 'MyIndexPattern*', icon: 'indexPatternApp', - editUrl: '#/indexPatterns/patterns/1', + editUrl: '#/management/opensearch-dashboards/indexPatterns/patterns/1', inAppUrl: { - path: '/indexPatterns/patterns/1', + path: '/management/opensearch-dashboards/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, }, @@ -120,10 +120,10 @@ describe('Relationships', () => { id: '1', relationship: 'child', meta: { - editUrl: '/indexPatterns/patterns/1', + editUrl: '/management/opensearch-dashboards/indexPatterns/patterns/1', icon: 'indexPatternApp', inAppUrl: { - path: '/app/indexPatterns/patterns/1', + path: '/app/management/opensearch-dashboards/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, title: 'My Index Pattern', @@ -134,7 +134,7 @@ describe('Relationships', () => { id: '2', relationship: 'parent', meta: { - editUrl: '/objects/savedVisualizations/2', + editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/2', icon: 'visualizeApp', inAppUrl: { path: '/app/visualize#/edit/2', @@ -152,7 +152,7 @@ describe('Relationships', () => { meta: { title: 'MySearch', icon: 'search', - editUrl: '/objects/savedSearches/1', + editUrl: '/management/opensearch-dashboards/objects/savedSearches/1', inAppUrl: { path: '/discover/1', uiCapabilitiesPath: 'discover.show', @@ -187,7 +187,7 @@ describe('Relationships', () => { id: '1', relationship: 'parent', meta: { - editUrl: '/objects/savedDashboards/1', + editUrl: '/management/opensearch-dashboards/objects/savedDashboards/1', icon: 'dashboardApp', inAppUrl: { path: '/app/opensearch-dashboards#/dashboard/1', @@ -201,7 +201,7 @@ describe('Relationships', () => { id: '2', relationship: 'parent', meta: { - editUrl: '/objects/savedDashboards/2', + editUrl: '/management/opensearch-dashboards/objects/savedDashboards/2', icon: 'dashboardApp', inAppUrl: { path: '/app/opensearch-dashboards#/dashboard/2', @@ -219,7 +219,7 @@ describe('Relationships', () => { meta: { title: 'MyViz', icon: 'visualizeApp', - editUrl: '/objects/savedVisualizations/1', + editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/1', inAppUrl: { path: '/edit/1', uiCapabilitiesPath: 'visualize.show', @@ -256,7 +256,7 @@ describe('Relationships', () => { meta: { title: 'MyViz', icon: 'visualizeApp', - editUrl: '/objects/savedVisualizations/1', + editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/1', inAppUrl: { path: '/edit/1', uiCapabilitiesPath: 'visualize.show', @@ -272,7 +272,7 @@ describe('Relationships', () => { meta: { title: 'MyAugmentVisObject', icon: 'savedObject', - editUrl: '/objects/savedAugmentVis/1', + editUrl: '/management/opensearch-dashboards/objects/savedAugmentVis/1', }, }, close: jest.fn(), @@ -303,7 +303,7 @@ describe('Relationships', () => { id: '1', relationship: 'child', meta: { - editUrl: '/objects/savedVisualizations/1', + editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/1', icon: 'visualizeApp', inAppUrl: { path: '/app/visualize#/edit/1', @@ -317,7 +317,7 @@ describe('Relationships', () => { id: '2', relationship: 'child', meta: { - editUrl: '/objects/savedVisualizations/2', + editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/2', icon: 'visualizeApp', inAppUrl: { path: '/app/visualize#/edit/2', @@ -335,7 +335,7 @@ describe('Relationships', () => { meta: { title: 'MyDashboard', icon: 'dashboardApp', - editUrl: '/objects/savedDashboards/1', + editUrl: '/management/opensearch-dashboards/objects/savedDashboards/1', inAppUrl: { path: '/dashboard/1', uiCapabilitiesPath: 'dashboard.show', @@ -375,7 +375,7 @@ describe('Relationships', () => { meta: { title: 'MyDashboard', icon: 'dashboardApp', - editUrl: '/objects/savedDashboards/1', + editUrl: '/management/opensearch-dashboards/objects/savedDashboards/1', inAppUrl: { path: '/dashboard/1', uiCapabilitiesPath: 'dashboard.show', diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx index c8e378b93b9..7e5bb318f4d 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx @@ -51,9 +51,9 @@ const defaultProps: TableProps = { meta: { title: `MyIndexPattern*`, icon: 'indexPatternApp', - editUrl: '#/indexPatterns/patterns/1', + editUrl: '#/management/opensearch-dashboards/indexPatterns/patterns/1', inAppUrl: { - path: '/indexPatterns/patterns/1', + path: '/management/opensearch-dashboards/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, }, @@ -91,9 +91,9 @@ const defaultProps: TableProps = { meta: { title: `MyIndexPattern*`, icon: 'indexPatternApp', - editUrl: '#/indexPatterns/patterns/1', + editUrl: '#/management/opensearch-dashboards/indexPatterns/patterns/1', inAppUrl: { - path: '/indexPatterns/patterns/1', + path: '/management/opensearch-dashboards/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, }, diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx index 612ace1587c..a0a6329ac5e 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx @@ -179,9 +179,9 @@ describe('SavedObjectsTable', () => { meta: { title: `MyIndexPattern*`, icon: 'indexPatternApp', - editUrl: '#/indexPatterns/patterns/1', + editUrl: '#/management/opensearch-dashboards/indexPatterns/patterns/1', inAppUrl: { - path: '/indexPatterns/patterns/1', + path: '/management/opensearch-dashboards/indexPatterns/patterns/1', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, }, @@ -192,7 +192,7 @@ describe('SavedObjectsTable', () => { meta: { title: `MySearch`, icon: 'search', - editUrl: '/objects/savedSearches/2', + editUrl: '/management/opensearch-dashboards/objects/savedSearches/2', inAppUrl: { path: '/discover/2', uiCapabilitiesPath: 'discover.show', @@ -205,7 +205,7 @@ describe('SavedObjectsTable', () => { meta: { title: `MyDashboard`, icon: 'dashboardApp', - editUrl: '/objects/savedDashboards/3', + editUrl: '/management/opensearch-dashboards/objects/savedDashboards/3', inAppUrl: { path: '/dashboard/3', uiCapabilitiesPath: 'dashboard.show', @@ -218,7 +218,7 @@ describe('SavedObjectsTable', () => { meta: { title: `MyViz`, icon: 'visualizeApp', - editUrl: '/objects/savedVisualizations/4', + editUrl: '/management/opensearch-dashboards/objects/savedVisualizations/4', inAppUrl: { path: '/edit/4', uiCapabilitiesPath: 'visualize.show', @@ -533,7 +533,7 @@ describe('SavedObjectsTable', () => { meta: { title: `MySearch`, icon: 'search', - editUrl: '/objects/savedSearches/2', + editUrl: '/management/opensearch-dashboards/objects/savedSearches/2', inAppUrl: { path: '/discover/2', uiCapabilitiesPath: 'discover.show', @@ -548,7 +548,7 @@ describe('SavedObjectsTable', () => { type: 'search', meta: { title: 'MySearch', - editUrl: '/objects/savedSearches/2', + editUrl: '/management/opensearch-dashboards/objects/savedSearches/2', icon: 'search', inAppUrl: { path: '/discover/2', diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx index dba9277ecf2..28d041563a7 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx @@ -118,7 +118,6 @@ export interface SavedObjectsTableProps { dateFormat: string; dataSourceEnabled: boolean; hideLocalCluster: boolean; - title: string; } export interface SavedObjectsTableState { @@ -589,7 +588,9 @@ export class SavedObjectsTable extends Component diff --git a/src/plugins/saved_objects_management/public/management_section/page_wrapper/__snapshots__/page_wrapper.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/page_wrapper/__snapshots__/page_wrapper.test.tsx.snap deleted file mode 100644 index 3c5257e2e8d..00000000000 --- a/src/plugins/saved_objects_management/public/management_section/page_wrapper/__snapshots__/page_wrapper.test.tsx.snap +++ /dev/null @@ -1,13 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PageWrapper should render normally 1`] = ` -
-
- Foo -
-
-`; diff --git a/src/plugins/saved_objects_management/public/management_section/page_wrapper/index.ts b/src/plugins/saved_objects_management/public/management_section/page_wrapper/index.ts deleted file mode 100644 index 3cf0cdd26c9..00000000000 --- a/src/plugins/saved_objects_management/public/management_section/page_wrapper/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -export { PageWrapper } from './page_wrapper'; diff --git a/src/plugins/saved_objects_management/public/management_section/page_wrapper/page_wrapper.test.tsx b/src/plugins/saved_objects_management/public/management_section/page_wrapper/page_wrapper.test.tsx deleted file mode 100644 index 550eb3ee1ca..00000000000 --- a/src/plugins/saved_objects_management/public/management_section/page_wrapper/page_wrapper.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import React from 'react'; -import { render } from '@testing-library/react'; -import { PageWrapper } from './page_wrapper'; - -describe('PageWrapper', () => { - it('should render normally', async () => { - const { findByText, container } = render(Foo); - await findByText('Foo'); - expect(container).toMatchSnapshot(); - }); -}); diff --git a/src/plugins/saved_objects_management/public/management_section/page_wrapper/page_wrapper.tsx b/src/plugins/saved_objects_management/public/management_section/page_wrapper/page_wrapper.tsx deleted file mode 100644 index 1b1949c334e..00000000000 --- a/src/plugins/saved_objects_management/public/management_section/page_wrapper/page_wrapper.tsx +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import { EuiPageContent } from '@elastic/eui'; -import React from 'react'; - -export const PageWrapper = (props: { children?: React.ReactChild }) => { - return ( - - ); -}; diff --git a/src/plugins/saved_objects_management/public/management_section/saved_objects_table_page.tsx b/src/plugins/saved_objects_management/public/management_section/saved_objects_table_page.tsx index 52177ed40df..ad5f83fc823 100644 --- a/src/plugins/saved_objects_management/public/management_section/saved_objects_table_page.tsx +++ b/src/plugins/saved_objects_management/public/management_section/saved_objects_table_page.tsx @@ -30,13 +30,13 @@ import React, { useEffect } from 'react'; import { get } from 'lodash'; +import { i18n } from '@osd/i18n'; import { CoreStart, ChromeBreadcrumb } from 'src/core/public'; import { DataPublicPluginStart } from '../../../data/public'; import { ISavedObjectsManagementServiceRegistry, SavedObjectsManagementActionServiceStart, SavedObjectsManagementColumnServiceStart, - SavedObjectsManagementNamespaceServiceStart, } from '../services'; import { SavedObjectsTable } from './objects_table'; @@ -51,7 +51,6 @@ const SavedObjectsTablePage = ({ setBreadcrumbs, dataSourceEnabled, hideLocalCluster, - title, }: { coreStart: CoreStart; dataStart: DataPublicPluginStart; @@ -63,7 +62,6 @@ const SavedObjectsTablePage = ({ setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void; dataSourceEnabled: boolean; hideLocalCluster: boolean; - title: string; }) => { const capabilities = coreStart.application.capabilities; const itemsPerPage = coreStart.uiSettings.get('savedObjects:perPage', 50); @@ -72,11 +70,13 @@ const SavedObjectsTablePage = ({ useEffect(() => { setBreadcrumbs([ { - text: title, - href: undefined, + text: i18n.translate('savedObjectsManagement.breadcrumb.index', { + defaultMessage: 'Saved objects', + }), + href: '/', }, ]); - }, [setBreadcrumbs, title]); + }, [setBreadcrumbs]); return ( ); }; diff --git a/src/plugins/saved_objects_management/public/plugin.test.ts b/src/plugins/saved_objects_management/public/plugin.test.ts index 149cee7c5c8..c8e762f73dc 100644 --- a/src/plugins/saved_objects_management/public/plugin.test.ts +++ b/src/plugins/saved_objects_management/public/plugin.test.ts @@ -28,23 +28,12 @@ * under the License. */ -const mountManagementSectionMock = jest.fn(); -jest.doMock('./management_section', () => ({ - mountManagementSection: mountManagementSectionMock, -})); -import { waitFor } from '@testing-library/dom'; import { coreMock } from '../../../core/public/mocks'; import { homePluginMock } from '../../home/public/mocks'; import { managementPluginMock } from '../../management/public/mocks'; import { dataPluginMock } from '../../data/public/mocks'; import { uiActionsPluginMock } from '../../ui_actions/public/mocks'; import { SavedObjectsManagementPlugin } from './plugin'; -import { - MANAGE_LIBRARY_TITLE_WORDINGS, - SAVED_QUERIES_WORDINGS, - SAVED_SEARCHES_WORDINGS, -} from './constants'; -import { DEFAULT_APP_CATEGORIES } from '../../../core/public'; describe('SavedObjectsManagementPlugin', () => { let plugin: SavedObjectsManagementPlugin; @@ -61,22 +50,12 @@ describe('SavedObjectsManagementPlugin', () => { const homeSetup = homePluginMock.createSetupContract(); const managementSetup = managementPluginMock.createSetupContract(); const uiActionsSetup = uiActionsPluginMock.createSetupContract(); - const registerMock = jest.fn((params) => params.mount({} as any, {} as any)); - await plugin.setup( - { - ...coreSetup, - application: { - ...coreSetup.application, - register: registerMock, - }, - }, - { - home: homeSetup, - management: managementSetup, - uiActions: uiActionsSetup, - } - ); + await plugin.setup(coreSetup, { + home: homeSetup, + management: managementSetup, + uiActions: uiActionsSetup, + }); expect(homeSetup.featureCatalogue.register).toHaveBeenCalledTimes(1); expect(homeSetup.featureCatalogue.register).toHaveBeenCalledWith( @@ -84,38 +63,6 @@ describe('SavedObjectsManagementPlugin', () => { id: 'saved_objects', }) ); - expect(registerMock).toBeCalledWith( - expect.objectContaining({ - id: 'objects', - title: MANAGE_LIBRARY_TITLE_WORDINGS, - order: 10000, - category: DEFAULT_APP_CATEGORIES.opensearchDashboards, - }) - ); - expect(registerMock).toBeCalledWith( - expect.objectContaining({ - id: 'objects_searches', - title: SAVED_SEARCHES_WORDINGS, - order: 8000, - category: DEFAULT_APP_CATEGORIES.opensearchDashboards, - }) - ); - expect(registerMock).toBeCalledWith( - expect.objectContaining({ - id: 'objects_query', - title: SAVED_QUERIES_WORDINGS, - order: 8001, - category: DEFAULT_APP_CATEGORIES.opensearchDashboards, - }) - ); - waitFor( - () => { - expect(mountManagementSectionMock).toBeCalledTimes(3); - }, - { - container: document.body, - } - ); }); }); }); diff --git a/src/plugins/saved_objects_management/public/plugin.ts b/src/plugins/saved_objects_management/public/plugin.ts index 66c199b5f5a..035bf096a1a 100644 --- a/src/plugins/saved_objects_management/public/plugin.ts +++ b/src/plugins/saved_objects_management/public/plugin.ts @@ -29,7 +29,7 @@ */ import { i18n } from '@osd/i18n'; -import { AppMountParameters, CoreSetup, CoreStart, Plugin } from 'src/core/public'; +import { CoreSetup, CoreStart, Plugin } from 'src/core/public'; import { DataSourcePluginSetup } from 'src/plugins/data_source/public'; import { VisBuilderStart } from '../../vis_builder/public'; @@ -60,12 +60,6 @@ import { } from './services'; import { registerServices } from './register_services'; import { bootstrap } from './ui_actions_bootstrap'; -import { DEFAULT_APP_CATEGORIES } from '../../../core/public'; -import { - MANAGE_LIBRARY_TITLE_WORDINGS, - SAVED_QUERIES_WORDINGS, - SAVED_SEARCHES_WORDINGS, -} from './constants'; export interface SavedObjectsManagementPluginSetup { actions: SavedObjectsManagementActionServiceSetup; @@ -111,70 +105,9 @@ export class SavedObjectsManagementPlugin private namespaceService = new SavedObjectsManagementNamespaceService(); private serviceRegistry = new SavedObjectsManagementServiceRegistry(); - private registerLibrarySubApp( - coreSetup: CoreSetup, - dataSourceEnabled: boolean, - hideLocalCluster: boolean - ) { - const core = coreSetup; - const mountWrapper = ({ - title, - allowedObjectTypes, - }: { - title: string; - allowedObjectTypes?: string[]; - }) => async (appMountParams: AppMountParameters) => { - const { mountManagementSection } = await import('./management_section'); - return mountManagementSection({ - core, - serviceRegistry: this.serviceRegistry, - appMountParams, - title, - allowedObjectTypes, - dataSourceEnabled, - hideLocalCluster, - }); - }; - - /** - * Register saved objects overview & saved search & saved query here - */ - core.application.register({ - id: 'objects', - title: MANAGE_LIBRARY_TITLE_WORDINGS, - order: 10000, - category: DEFAULT_APP_CATEGORIES.opensearchDashboards, - mount: mountWrapper({ - title: MANAGE_LIBRARY_TITLE_WORDINGS, - }), - }); - - core.application.register({ - id: 'objects_searches', - title: SAVED_SEARCHES_WORDINGS, - order: 8000, - category: DEFAULT_APP_CATEGORIES.opensearchDashboards, - mount: mountWrapper({ - title: SAVED_SEARCHES_WORDINGS, - allowedObjectTypes: ['search'], - }), - }); - - core.application.register({ - id: 'objects_query', - title: SAVED_QUERIES_WORDINGS, - order: 8001, - category: DEFAULT_APP_CATEGORIES.opensearchDashboards, - mount: mountWrapper({ - title: SAVED_QUERIES_WORDINGS, - allowedObjectTypes: ['query'], - }), - }); - } - public setup( core: CoreSetup, - { home, uiActions, dataSource }: SetupDependencies + { home, management, uiActions, dataSource }: SetupDependencies ): SavedObjectsManagementPluginSetup { const actionSetup = this.actionService.setup(); const columnSetup = this.columnService.setup(); @@ -191,20 +124,37 @@ export class SavedObjectsManagementPlugin 'Import, export, and manage your saved searches, visualizations, and dashboards.', }), icon: 'savedObjectsApp', - path: '/app/objects', + path: '/app/management/opensearch-dashboards/objects', showOnHomePage: false, category: FeatureCatalogueCategory.ADMIN, }); } + const opensearchDashboardsSection = management.sections.section.opensearchDashboards; + opensearchDashboardsSection.registerApp({ + id: 'objects', + title: i18n.translate('savedObjectsManagement.managementSectionLabel', { + defaultMessage: 'Saved objects', + }), + order: 1, + mount: async (mountParams) => { + const { mountManagementSection } = await import('./management_section'); + return mountManagementSection({ + core, + serviceRegistry: this.serviceRegistry, + mountParams, + dataSourceEnabled: !!dataSource, + hideLocalCluster: dataSource?.hideLocalCluster ?? false, + }); + }, + }); + // sets up the context mappings and registers any triggers/actions for the plugin bootstrap(uiActions); // depends on `getStartServices`, should not be awaited registerServices(this.serviceRegistry, core.getStartServices); - this.registerLibrarySubApp(core, !!dataSource, dataSource?.hideLocalCluster ?? false); - return { actions: actionSetup, columns: columnSetup, diff --git a/src/plugins/vis_augmenter/server/saved_objects/augment_vis.ts b/src/plugins/vis_augmenter/server/saved_objects/augment_vis.ts index 558649f900b..52188d52998 100644 --- a/src/plugins/vis_augmenter/server/saved_objects/augment_vis.ts +++ b/src/plugins/vis_augmenter/server/saved_objects/augment_vis.ts @@ -15,7 +15,9 @@ export const augmentVisSavedObjectType: SavedObjectsType = { return `augment-vis-${obj?.attributes?.originPlugin}`; }, getEditUrl(obj) { - return `/objects/savedAugmentVis/${encodeURIComponent(obj.id)}`; + return `/management/opensearch-dashboards/objects/savedAugmentVis/${encodeURIComponent( + obj.id + )}`; }, }, mappings: { diff --git a/src/plugins/vis_builder/server/saved_objects/vis_builder_app.ts b/src/plugins/vis_builder/server/saved_objects/vis_builder_app.ts index 2d329227491..029557010be 100644 --- a/src/plugins/vis_builder/server/saved_objects/vis_builder_app.ts +++ b/src/plugins/vis_builder/server/saved_objects/vis_builder_app.ts @@ -20,7 +20,8 @@ export const visBuilderSavedObjectType: SavedObjectsType = { defaultSearchField: 'title', importableAndExportable: true, getTitle: ({ attributes: { title } }: SavedObject) => title, - getEditUrl: ({ id }: SavedObject) => `/objects/savedVisBuilder/${encodeURIComponent(id)}`, + getEditUrl: ({ id }: SavedObject) => + `/management/opensearch-dashboards/objects/savedVisBuilder/${encodeURIComponent(id)}`, getInAppUrl({ id }: SavedObject) { return { path: `/app/${PLUGIN_ID}${EDIT_PATH}/${encodeURIComponent(id)}`, diff --git a/src/plugins/visualizations/server/saved_objects/visualization.ts b/src/plugins/visualizations/server/saved_objects/visualization.ts index 4e46c83db15..15a926b3f81 100644 --- a/src/plugins/visualizations/server/saved_objects/visualization.ts +++ b/src/plugins/visualizations/server/saved_objects/visualization.ts @@ -43,7 +43,9 @@ export const visualizationSavedObjectType: SavedObjectsType = { return obj.attributes.title; }, getEditUrl(obj) { - return `/objects/savedVisualizations/${encodeURIComponent(obj.id)}`; + return `/management/opensearch-dashboards/objects/savedVisualizations/${encodeURIComponent( + obj.id + )}`; }, getInAppUrl(obj) { return { diff --git a/test/api_integration/apis/saved_objects_management/find.ts b/test/api_integration/apis/saved_objects_management/find.ts index 065541a36d7..a82d4e792cd 100644 --- a/test/api_integration/apis/saved_objects_management/find.ts +++ b/test/api_integration/apis/saved_objects_management/find.ts @@ -73,7 +73,8 @@ export default function ({ getService }: FtrProviderContext) { score: 0, updated_at: '2017-09-21T18:51:23.794Z', meta: { - editUrl: '/objects/savedVisualizations/dd7caf20-9efd-11e7-acb3-3dab96693fab', + editUrl: + '/management/opensearch-dashboards/objects/savedVisualizations/dd7caf20-9efd-11e7-acb3-3dab96693fab', icon: 'visualizeApp', inAppUrl: { path: '/app/visualize#/edit/dd7caf20-9efd-11e7-acb3-3dab96693fab', @@ -236,7 +237,8 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.body.saved_objects[0].meta).to.eql({ icon: 'discoverApp', title: 'OneRecord', - editUrl: '/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/discover#/view/960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', @@ -254,7 +256,8 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.body.saved_objects[0].meta).to.eql({ icon: 'dashboardApp', title: 'Dashboard', - editUrl: '/objects/savedDashboards/b70c7ae0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedDashboards/b70c7ae0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/dashboards#/view/b70c7ae0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'dashboard.show', @@ -272,7 +275,8 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.body.saved_objects[0].meta).to.eql({ icon: 'visualizeApp', title: 'VisualizationFromSavedSearch', - editUrl: '/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/visualize#/edit/a42c0580-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', @@ -282,7 +286,8 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.body.saved_objects[1].meta).to.eql({ icon: 'visualizeApp', title: 'Visualization', - editUrl: '/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/visualize#/edit/add810b0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', @@ -300,9 +305,11 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.body.saved_objects[0].meta).to.eql({ icon: 'indexPatternApp', title: 'saved_objects*', - editUrl: '/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', + path: + '/app/management/opensearch-dashboards/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, namespaceType: 'single', diff --git a/test/api_integration/apis/saved_objects_management/relationships.ts b/test/api_integration/apis/saved_objects_management/relationships.ts index 77e838cfed4..f0af2d8d9e7 100644 --- a/test/api_integration/apis/saved_objects_management/relationships.ts +++ b/test/api_integration/apis/saved_objects_management/relationships.ts @@ -94,9 +94,11 @@ export default function ({ getService }: FtrProviderContext) { meta: { title: 'saved_objects*', icon: 'indexPatternApp', - editUrl: '/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', + path: + '/app/management/opensearch-dashboards/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, namespaceType: 'single', @@ -109,7 +111,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { title: 'VisualizationFromSavedSearch', icon: 'visualizeApp', - editUrl: '/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/visualize#/edit/a42c0580-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', @@ -134,9 +137,11 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'indexPatternApp', title: 'saved_objects*', - editUrl: '/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', + path: + '/app/management/opensearch-dashboards/indexPatterns/patterns/8963ca30-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'management.opensearchDashboards.indexPatterns', }, namespaceType: 'single', @@ -149,7 +154,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'visualizeApp', title: 'VisualizationFromSavedSearch', - editUrl: '/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/visualize#/edit/a42c0580-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', @@ -193,7 +199,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'visualizeApp', title: 'Visualization', - editUrl: '/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/visualize#/edit/add810b0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', @@ -208,7 +215,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'visualizeApp', title: 'VisualizationFromSavedSearch', - editUrl: '/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/visualize#/edit/a42c0580-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', @@ -231,7 +239,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'visualizeApp', title: 'Visualization', - editUrl: '/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/visualize#/edit/add810b0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', @@ -246,7 +255,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'visualizeApp', title: 'VisualizationFromSavedSearch', - editUrl: '/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/visualize#/edit/a42c0580-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', @@ -290,7 +300,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'discoverApp', title: 'OneRecord', - editUrl: '/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/discover#/view/960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', @@ -305,7 +316,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'dashboardApp', title: 'Dashboard', - editUrl: '/objects/savedDashboards/b70c7ae0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedDashboards/b70c7ae0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/dashboards#/view/b70c7ae0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'dashboard.show', @@ -330,7 +342,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'discoverApp', title: 'OneRecord', - editUrl: '/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/discover#/view/960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', @@ -373,7 +386,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'discoverApp', title: 'OneRecord', - editUrl: '/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/discover#/view/960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', @@ -388,7 +402,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'visualizeApp', title: 'Visualization', - editUrl: '/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/visualize#/edit/add810b0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', @@ -413,7 +428,8 @@ export default function ({ getService }: FtrProviderContext) { meta: { icon: 'discoverApp', title: 'OneRecord', - editUrl: '/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', + editUrl: + '/management/opensearch-dashboards/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { path: '/app/discover#/view/960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', diff --git a/test/functional/apps/dashboard/create_and_add_embeddables.js b/test/functional/apps/dashboard/create_and_add_embeddables.js index 6701ae0fc94..3b6e8a24355 100644 --- a/test/functional/apps/dashboard/create_and_add_embeddables.js +++ b/test/functional/apps/dashboard/create_and_add_embeddables.js @@ -112,7 +112,8 @@ export default function ({ getService, getPageObjects }) { describe('is false', () => { before(async () => { - await PageObjects.common.navigateToApp('settings'); + await PageObjects.header.clickStackManagement(); + await PageObjects.settings.clickOpenSearchDashboardsSettings(); await PageObjects.settings.toggleAdvancedSettingCheckbox(VISUALIZE_ENABLE_LABS_SETTING); }); @@ -126,7 +127,8 @@ export default function ({ getService, getPageObjects }) { }); after(async () => { - await PageObjects.settings.navigateTo(); + await PageObjects.header.clickStackManagement(); + await PageObjects.settings.clickOpenSearchDashboardsSettings(); await PageObjects.settings.clearAdvancedSettings(VISUALIZE_ENABLE_LABS_SETTING); await PageObjects.header.clickDashboard(); }); diff --git a/test/functional/apps/dashboard/time_zones.js b/test/functional/apps/dashboard/time_zones.js index 225e0bf1d03..4c82cfe8006 100644 --- a/test/functional/apps/dashboard/time_zones.js +++ b/test/functional/apps/dashboard/time_zones.js @@ -51,6 +51,7 @@ export default function ({ getService, getPageObjects }) { await opensearchDashboardsServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsSavedObjects(); await PageObjects.savedObjects.importFile( path.join(__dirname, 'exports', 'timezonetest_6_2_4.json'), @@ -76,6 +77,7 @@ export default function ({ getService, getPageObjects }) { it('Changing timezone changes dashboard timestamp and shows the same data', async () => { await PageObjects.settings.navigateTo(); + await PageObjects.settings.clickOpenSearchDashboardsSettings(); await PageObjects.settings.setAdvancedSettingsSelect('dateFormat:tz', 'Etc/GMT+5'); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.loadSavedDashboard('time zone test'); diff --git a/test/functional/apps/management/_import_objects.js b/test/functional/apps/management/_import_objects.js index f481960b2f7..a4a919aedcd 100644 --- a/test/functional/apps/management/_import_objects.js +++ b/test/functional/apps/management/_import_objects.js @@ -46,6 +46,7 @@ export default function ({ getService, getPageObjects }) { beforeEach(async function () { // delete .kibana index and then wait for OpenSearch Dashboards to re-create it await opensearchDashboardsServer.uiSettings.replace({}); + await PageObjects.settings.navigateTo(); await opensearchArchiver.load('management'); await PageObjects.settings.clickOpenSearchDashboardsSavedObjects(); }); @@ -214,6 +215,7 @@ export default function ({ getService, getPageObjects }) { beforeEach(async function () { // delete .kibana index and then wait for OpenSearch Dashboards to re-create it await opensearchDashboardsServer.uiSettings.replace({}); + await PageObjects.settings.navigateTo(); await opensearchArchiver.load('saved_objects_imports'); await PageObjects.settings.clickOpenSearchDashboardsSavedObjects(); }); diff --git a/test/functional/apps/management/_index_pattern_create_delete.js b/test/functional/apps/management/_index_pattern_create_delete.js index 1d154718c26..b7214590ebd 100644 --- a/test/functional/apps/management/_index_pattern_create_delete.js +++ b/test/functional/apps/management/_index_pattern_create_delete.js @@ -129,7 +129,7 @@ export default function ({ getService, getPageObjects }) { return retry.try(function tryingForTime() { return browser.getCurrentUrl().then(function (currentUrl) { log.debug('currentUrl = ' + currentUrl); - expect(currentUrl).to.contain('indexPatterns'); + expect(currentUrl).to.contain('management/opensearch-dashboards/indexPatterns'); }); }); }); diff --git a/test/functional/apps/management/_mgmt_import_saved_objects.js b/test/functional/apps/management/_mgmt_import_saved_objects.js index c04fa88b0de..c5f852bae5c 100644 --- a/test/functional/apps/management/_mgmt_import_saved_objects.js +++ b/test/functional/apps/management/_mgmt_import_saved_objects.js @@ -42,6 +42,7 @@ export default function ({ getService, getPageObjects }) { beforeEach(async function () { await opensearchArchiver.load('empty_opensearch_dashboards'); await opensearchArchiver.load('discover'); + await PageObjects.settings.navigateTo(); }); afterEach(async function () { diff --git a/test/functional/apps/management/_opensearch_dashboards_settings.js b/test/functional/apps/management/_opensearch_dashboards_settings.js index 637f7073d51..0e310953e8a 100644 --- a/test/functional/apps/management/_opensearch_dashboards_settings.js +++ b/test/functional/apps/management/_opensearch_dashboards_settings.js @@ -39,10 +39,12 @@ export default function ({ getService, getPageObjects }) { before(async function () { // delete .kibana index and then wait for OpenSearch Dashboards to re-create it await opensearchDashboardsServer.uiSettings.replace({}); + await PageObjects.settings.navigateTo(); await PageObjects.settings.createIndexPattern('logstash-*'); }); after(async function afterAll() { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.removeLogstashIndexPatternIfExist(); }); @@ -88,6 +90,7 @@ export default function ({ getService, getPageObjects }) { }); it('setting to true change is preserved', async function () { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsSettings(); await PageObjects.settings.toggleAdvancedSettingCheckbox('state:storeInSessionStorage'); const storeInSessionStorage = await PageObjects.settings.getAdvancedSettingCheckbox( @@ -110,7 +113,8 @@ export default function ({ getService, getPageObjects }) { it("changing 'state:storeInSessionStorage' also takes effect without full page reload", async () => { await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.settings.navigateTo(); + await PageObjects.header.clickStackManagement(); + await PageObjects.settings.clickOpenSearchDashboardsSettings(); await PageObjects.settings.toggleAdvancedSettingCheckbox('state:storeInSessionStorage'); await PageObjects.header.clickDashboard(); const [globalState, appState] = await getStateFromUrl(); diff --git a/test/functional/apps/management/_scripted_fields.js b/test/functional/apps/management/_scripted_fields.js index 3ef74f39cfb..8a4659630ee 100644 --- a/test/functional/apps/management/_scripted_fields.js +++ b/test/functional/apps/management/_scripted_fields.js @@ -75,11 +75,13 @@ export default function ({ getService, getPageObjects }) { }); after(async function afterAll() { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.removeLogstashIndexPatternIfExist(); }); it('should not allow saving of invalid scripts', async function () { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.clickIndexPatternLogstash(); await PageObjects.settings.clickScriptedFieldsTab(); @@ -97,6 +99,7 @@ export default function ({ getService, getPageObjects }) { const scriptedPainlessFieldName = 'ram_Pain_reg'; it('should create and edit scripted field', async function () { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.clickIndexPatternLogstash(); const startingCount = parseInt(await PageObjects.settings.getScriptedFieldsTabCount()); @@ -130,6 +133,7 @@ export default function ({ getService, getPageObjects }) { const scriptedPainlessFieldName = 'ram_Pain1'; it('should create scripted field', async function () { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.clickIndexPatternLogstash(); const startingCount = parseInt(await PageObjects.settings.getScriptedFieldsTabCount()); @@ -251,6 +255,7 @@ export default function ({ getService, getPageObjects }) { const scriptedPainlessFieldName2 = 'painString'; it('should create scripted field', async function () { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.clickIndexPatternLogstash(); const startingCount = parseInt(await PageObjects.settings.getScriptedFieldsTabCount()); @@ -347,6 +352,7 @@ export default function ({ getService, getPageObjects }) { const scriptedPainlessFieldName2 = 'painBool'; it('should create scripted field', async function () { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.clickIndexPatternLogstash(); const startingCount = parseInt(await PageObjects.settings.getScriptedFieldsTabCount()); @@ -446,6 +452,7 @@ export default function ({ getService, getPageObjects }) { const scriptedPainlessFieldName2 = 'painDate'; it('should create scripted field', async function () { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.clickIndexPatternLogstash(); const startingCount = parseInt(await PageObjects.settings.getScriptedFieldsTabCount()); diff --git a/test/functional/apps/management/_scripted_fields_filter.js b/test/functional/apps/management/_scripted_fields_filter.js index 55ec8895608..b1714c425aa 100644 --- a/test/functional/apps/management/_scripted_fields_filter.js +++ b/test/functional/apps/management/_scripted_fields_filter.js @@ -58,6 +58,7 @@ export default function ({ getService, getPageObjects }) { const scriptedPainlessFieldName = 'ram_pain1'; it('should filter scripted fields', async function () { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.clickIndexPatternLogstash(); await PageObjects.settings.clickScriptedFieldsTab(); diff --git a/test/functional/apps/saved_objects_management/edit_saved_object.ts b/test/functional/apps/saved_objects_management/edit_saved_object.ts index 64fe2bf199b..1534c710179 100644 --- a/test/functional/apps/saved_objects_management/edit_saved_object.ts +++ b/test/functional/apps/saved_objects_management/edit_saved_object.ts @@ -88,6 +88,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it('allows to update the saved object when submitting', async () => { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsSavedObjects(); let objects = await PageObjects.savedObjects.getRowTitles(); @@ -153,6 +154,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }, ]; + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsSavedObjects(); const objects = await PageObjects.savedObjects.getRowTitles(); diff --git a/test/functional/apps/visualize/_custom_branding.ts b/test/functional/apps/visualize/_custom_branding.ts index 52cbc8e5fec..37f07e932ee 100644 --- a/test/functional/apps/visualize/_custom_branding.ts +++ b/test/functional/apps/visualize/_custom_branding.ts @@ -46,7 +46,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('with customized logo for opensearch overview header in dark mode', async () => { - await PageObjects.settings.navigateTo(); + await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:darkMode'); await PageObjects.common.navigateToApp('opensearch_dashboards_overview'); await testSubjects.existOrFail('osdOverviewPageHeaderLogo'); @@ -100,7 +100,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('with customized logo in dark mode', async () => { - await PageObjects.settings.navigateTo(); + await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:darkMode'); await PageObjects.common.navigateToApp('home'); await testSubjects.existOrFail('welcomeCustomLogo'); @@ -179,13 +179,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('in dark mode', async () => { before(async function () { - await PageObjects.settings.navigateTo(); + await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:darkMode'); await PageObjects.common.navigateToApp('home'); }); after(async function () { - await PageObjects.settings.navigateTo(); + await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); await PageObjects.settings.clearAdvancedSettings('theme:darkMode'); }); @@ -206,7 +206,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('with customized mark logo button that navigates to home page', async () => { - await PageObjects.settings.navigateTo(); + await PageObjects.common.navigateToApp('settings'); await globalNav.clickHomeButton(); await PageObjects.header.waitUntilLoadingHasFinished(); const url = await browser.getCurrentUrl(); diff --git a/test/functional/apps/visualize/_lab_mode.js b/test/functional/apps/visualize/_lab_mode.js index 1ba36b4b9f9..82ecbcb2a65 100644 --- a/test/functional/apps/visualize/_lab_mode.js +++ b/test/functional/apps/visualize/_lab_mode.js @@ -47,7 +47,8 @@ export default function ({ getService, getPageObjects }) { log.info('found saved search before toggling enableLabs mode'); // Navigate to advanced setting and disable lab mode - await PageObjects.settings.navigateTo(); + await PageObjects.header.clickStackManagement(); + await PageObjects.settings.clickOpenSearchDashboardsSettings(); await PageObjects.settings.toggleAdvancedSettingCheckbox(VISUALIZE_ENABLE_LABS_SETTING); // Expect the discover still to list that saved visualization in the open list @@ -60,7 +61,8 @@ export default function ({ getService, getPageObjects }) { after(async () => { await PageObjects.discover.closeLoadSaveSearchPanel(); - await PageObjects.settings.navigateTo(); + await PageObjects.header.clickStackManagement(); + await PageObjects.settings.clickOpenSearchDashboardsSettings(); await PageObjects.settings.clearAdvancedSettings(VISUALIZE_ENABLE_LABS_SETTING); }); }); diff --git a/test/functional/apps/visualize/_tag_cloud.js b/test/functional/apps/visualize/_tag_cloud.js index 075e7fa2290..a5123434115 100644 --- a/test/functional/apps/visualize/_tag_cloud.js +++ b/test/functional/apps/visualize/_tag_cloud.js @@ -160,6 +160,7 @@ export default function ({ getService, getPageObjects }) { describe('formatted field', function () { before(async function () { + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.clickIndexPatternLogstash(); await PageObjects.settings.filterField(termsField); @@ -177,6 +178,7 @@ export default function ({ getService, getPageObjects }) { after(async function () { await filterBar.removeFilter(termsField); + await PageObjects.settings.navigateTo(); await PageObjects.settings.clickOpenSearchDashboardsIndexPatterns(); await PageObjects.settings.clickIndexPatternLogstash(); await PageObjects.settings.filterField(termsField); diff --git a/test/functional/config.js b/test/functional/config.js index ac9ac6085d2..87d4302b2a1 100644 --- a/test/functional/config.js +++ b/test/functional/config.js @@ -101,6 +101,10 @@ export default async function ({ readConfigFile }) { management: { pathname: '/app/management', }, + /** @obsolete "management" should be instead of "settings" **/ + settings: { + pathname: '/app/management', + }, console: { pathname: '/app/dev_tools', hash: '/console', diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 1e0106229d3..af2bf046e3a 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -51,19 +51,19 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider await find.clickByDisplayedLinkText(text); } async clickOpenSearchDashboardsSettings() { - await PageObjects.common.navigateToApp('settings'); + await testSubjects.click('settings'); await PageObjects.header.waitUntilLoadingHasFinished(); await testSubjects.existOrFail('managementSettingsTitle'); } async clickOpenSearchDashboardsSavedObjects() { - await PageObjects.common.navigateToApp('objects'); + await testSubjects.click('objects'); await PageObjects.savedObjects.waitTableIsLoaded(); } async clickOpenSearchDashboardsIndexPatterns() { log.debug('clickOpenSearchDashboardsIndexPatterns link'); - await PageObjects.common.navigateToApp('indexPatterns'); + await testSubjects.click('indexPatterns'); await PageObjects.header.waitUntilLoadingHasFinished(); }