From 18a8a47cde4495927e35e555ef0b519c62833636 Mon Sep 17 00:00:00 2001 From: abbyhu2000 Date: Wed, 7 May 2025 22:13:08 +0000 Subject: [PATCH 1/2] remove theme modal Signed-off-by: abbyhu2000 --- config/opensearch_dashboards.yml | 3 - src/plugins/home/config.ts | 1 - .../legacy/__snapshots__/home.test.js.snap | 63 ----------- .../application/components/legacy/home.js | 23 ---- .../components/legacy/home.test.js | 51 +-------- .../components/new_theme_modal.tsx | 100 ------------------ src/plugins/home/server/index.ts | 1 - test/common/config.js | 1 - 8 files changed, 2 insertions(+), 241 deletions(-) delete mode 100644 src/plugins/home/public/application/components/new_theme_modal.tsx diff --git a/config/opensearch_dashboards.yml b/config/opensearch_dashboards.yml index c29d7db53748..898d79b33523 100644 --- a/config/opensearch_dashboards.yml +++ b/config/opensearch_dashboards.yml @@ -46,9 +46,6 @@ # Set the value to true to disable the welcome screen #home.disableWelcomeScreen: false -# Set the value to true to disable the new theme introduction modal -#home.disableNewThemeModal: false - # Setting for an optimized healthcheck that only uses the local OpenSearch node to do Dashboards healthcheck. # This settings should be used for large clusters or for clusters with ingest heavy nodes. # It allows Dashboards to only healthcheck using the local OpenSearch node rather than fan out requests across all nodes. diff --git a/src/plugins/home/config.ts b/src/plugins/home/config.ts index 399c92174c6a..e3372ce77767 100644 --- a/src/plugins/home/config.ts +++ b/src/plugins/home/config.ts @@ -32,7 +32,6 @@ import { schema, TypeOf } from '@osd/config-schema'; export const configSchema = schema.object({ disableWelcomeScreen: schema.boolean({ defaultValue: false }), - disableNewThemeModal: schema.boolean({ defaultValue: false }), }); export type ConfigSchema = TypeOf; diff --git a/src/plugins/home/public/application/components/legacy/__snapshots__/home.test.js.snap b/src/plugins/home/public/application/components/legacy/__snapshots__/home.test.js.snap index 31df3b66efb5..61855f17954e 100644 --- a/src/plugins/home/public/application/components/legacy/__snapshots__/home.test.js.snap +++ b/src/plugins/home/public/application/components/legacy/__snapshots__/home.test.js.snap @@ -650,61 +650,6 @@ exports[`home isNewOpenSearchDashboardsInstance should set isNewOpenSearchDashbo `; -exports[`home new theme modal should show the new theme modal if not previously dismissed 1`] = ` -
- - } - /> -
- - - - - - - - -
-
-`; - exports[`home should render home component 1`] = `
-
diff --git a/src/plugins/home/public/application/components/legacy/home.test.js b/src/plugins/home/public/application/components/legacy/home.test.js index 29303d3d5340..38ba6509b7ae 100644 --- a/src/plugins/home/public/application/components/legacy/home.test.js +++ b/src/plugins/home/public/application/components/legacy/home.test.js @@ -32,7 +32,6 @@ import React from 'react'; import sinon from 'sinon'; import { shallow } from 'enzyme'; import { Home } from './home'; -import { NewThemeModal } from '../new_theme_modal'; import { FeatureCatalogueCategory } from '../../../services'; @@ -88,7 +87,7 @@ describe('home', () => { }, localStorage: { getItem: sinon.spy((path) => { - expect(path).toMatch(/home:(welcome|newThemeModal):show/); + expect(path).toMatch(/home:(welcome):show/); return 'false'; }), setItem: sinon.mock(), @@ -105,7 +104,7 @@ describe('home', () => { if (homeConfig) { mockHomeConfig.mockReturnValue(homeConfig); } else { - mockHomeConfig.mockReturnValue({ disableWelcomeScreen: false, disableNewThemeModal: false }); + mockHomeConfig.mockReturnValue({ disableWelcomeScreen: false }); } if (uiSettings) { mockUiSettings.mockReturnValue(uiSettings); @@ -368,50 +367,4 @@ describe('home', () => { expect(component).toMatchSnapshot(); }); }); - - describe('new theme modal', () => { - test('should show the new theme modal if not previously dismissed', async () => { - defaultProps.localStorage.getItem = sinon.spy(() => undefined); - - const component = await renderHome(); - - sinon.assert.calledWith(defaultProps.localStorage.getItem, 'home:newThemeModal:show'); - - expect(component.find(NewThemeModal).exists()).toBeTruthy(); - expect(component).toMatchSnapshot(); - }); - test('should not show the new theme modal if v7 theme in use', async () => { - defaultProps.localStorage.getItem = sinon.spy(() => undefined); - - const component = await renderHome({}, undefined, 'v7'); - - sinon.assert.neverCalledWith(defaultProps.localStorage.getItem, 'home:newThemeModal:show'); - - expect(component.find(NewThemeModal).exists()).toBeFalsy(); - }); - test('should not show the new theme modal if disabled in config', async () => { - defaultProps.localStorage.getItem = sinon.spy(() => undefined); - - const component = await renderHome( - {}, - { - disableWelcomeScreen: true, - disableNewThemeModal: true, - } - ); - - sinon.assert.neverCalledWith(defaultProps.localStorage.getItem, 'home:newThemeModal:show'); - - expect(component.find(NewThemeModal).exists()).toBeFalsy(); - }); - test('should not show the new theme modal if previously dismissed', async () => { - defaultProps.localStorage.getItem = sinon.spy(() => 'false'); - - const component = await renderHome(); - - sinon.assert.calledWith(defaultProps.localStorage.getItem, 'home:newThemeModal:show'); - - expect(component.find(NewThemeModal).exists()).toBeFalsy(); - }); - }); }); diff --git a/src/plugins/home/public/application/components/new_theme_modal.tsx b/src/plugins/home/public/application/components/new_theme_modal.tsx deleted file mode 100644 index e36dfa24f8b5..000000000000 --- a/src/plugins/home/public/application/components/new_theme_modal.tsx +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import React, { FC } from 'react'; -import { - EuiSmallButton, - EuiFlexGroup, - EuiFlexItem, - EuiImage, - EuiLink, - EuiModal, - EuiModalHeader, - EuiModalHeaderTitle, - EuiModalBody, - EuiModalFooter, - EuiSpacer, - EuiText, -} from '@elastic/eui'; -import { i18n } from '@osd/i18n'; -import { FormattedMessage } from '@osd/i18n/react'; -import { CoreStart } from 'opensearch-dashboards/public'; -import { - RedirectAppLinks, - useOpenSearchDashboards, -} from '../../../../../../src/plugins/opensearch_dashboards_react/public'; - -interface Props { - addBasePath: (path: string) => string; - onClose: () => void; -} - -export const NewThemeModal: FC = ({ addBasePath, onClose }) => { - const { - services: { application }, - } = useOpenSearchDashboards(); - - return ( - - - - - - - - - - - - - - ), - }} - /> - - - - - - - - - - - - - - - - - - - - ); -}; diff --git a/src/plugins/home/server/index.ts b/src/plugins/home/server/index.ts index 8a9052419009..47c321243b5d 100644 --- a/src/plugins/home/server/index.ts +++ b/src/plugins/home/server/index.ts @@ -38,7 +38,6 @@ import { configSchema, ConfigSchema } from '../config'; export const config: PluginConfigDescriptor = { exposeToBrowser: { disableWelcomeScreen: true, - disableNewThemeModal: true, }, schema: configSchema, deprecations: ({ renameFromRoot }) => [ diff --git a/test/common/config.js b/test/common/config.js index c1bed920cd8a..042ee1b8b09b 100644 --- a/test/common/config.js +++ b/test/common/config.js @@ -58,7 +58,6 @@ export default function () { `--opensearch.username=${opensearchDashboardsServerTestUser.username}`, `--opensearch.password=${opensearchDashboardsServerTestUser.password}`, `--home.disableWelcomeScreen=false`, - `--home.disableNewThemeModal=true`, // Needed for async search functional tests to introduce a delay `--data.search.aggs.shardDelay.enabled=true`, //`--security.showInsecureClusterWarning=false`, From 99777e9e850a39f88f2c4bf11cef451dce7c65ad Mon Sep 17 00:00:00 2001 From: "opensearch-changeset-bot[bot]" <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Date: Wed, 7 May 2025 22:16:35 +0000 Subject: [PATCH 2/2] Changeset file for PR #9776 created/updated --- changelogs/fragments/9776.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/9776.yml diff --git a/changelogs/fragments/9776.yml b/changelogs/fragments/9776.yml new file mode 100644 index 000000000000..ec648bd220f0 --- /dev/null +++ b/changelogs/fragments/9776.yml @@ -0,0 +1,2 @@ +feat: +- Remove theme update modal ([#9776](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9776)) \ No newline at end of file