From 708a54e3a6ae6a7439d19e1fda01c26465bbc7ef Mon Sep 17 00:00:00 2001 From: abbyhu2000 Date: Wed, 26 Oct 2022 00:42:47 +0000 Subject: [PATCH 1/7] Change save object type, wizard ID and Name to visBuilder Signed-off-by: abbyhu2000 --- config/opensearch_dashboards.yml | 2 +- src/plugins/saved_objects/README.md | 2 +- .../opensearch_dashboards.json | 2 +- .../saved_objects_management/public/plugin.ts | 4 ++-- .../public/register_services.ts | 10 +++++----- src/plugins/vis_builder/README.md | 4 ++-- src/plugins/vis_builder/common/index.ts | 4 ++-- .../vis_builder_saved_object_attributes.ts | 2 +- .../vis_builder/opensearch_dashboards.json | 3 ++- .../application/utils/get_top_nav_config.tsx | 6 +++--- .../utils/use/use_saved_vis_builder_vis.ts | 2 +- .../{wizard_icon.svg => vis_builder_icon.svg} | 0 ...l.svg => vis_builder_icon_secondary_fill.svg} | 0 .../public/embeddable/vis_builder_embeddable.tsx | 4 ++-- .../vis_builder_embeddable_factory.tsx | 2 +- src/plugins/vis_builder/public/plugin.ts | 12 +++--------- .../vis_builder/server/capabilities_provider.ts | 2 +- src/plugins/vis_builder/server/plugin.ts | 6 +++--- .../server/saved_objects/vis_builder_app.ts | 4 ++-- .../saved_objects/vis_builder_migration.test.ts | 16 ++++++++-------- .../saved_objects/vis_builder_migration.ts | 2 ++ test/common/config.js | 2 +- 22 files changed, 44 insertions(+), 47 deletions(-) rename src/plugins/vis_builder/public/assets/{wizard_icon.svg => vis_builder_icon.svg} (100%) rename src/plugins/vis_builder/public/assets/{wizard_icon_secondary_fill.svg => vis_builder_icon_secondary_fill.svg} (100%) diff --git a/config/opensearch_dashboards.yml b/config/opensearch_dashboards.yml index 8c592f7f698f..0a7d8c6b909e 100644 --- a/config/opensearch_dashboards.yml +++ b/config/opensearch_dashboards.yml @@ -222,7 +222,7 @@ # Set the value of this setting to true to start exploring wizard # functionality in Visualization. -# wizard.enabled: false +# visBuilder.enabled: false # Set the value of this setting to true to enable the experimental multiple data source # support feature. Use with caution. diff --git a/src/plugins/saved_objects/README.md b/src/plugins/saved_objects/README.md index 2ea57a3d6334..55f9c219879c 100644 --- a/src/plugins/saved_objects/README.md +++ b/src/plugins/saved_objects/README.md @@ -1,6 +1,6 @@ # Saved object -The saved object plugin provides all the core services and functionalities of saved objects. It is utilized by many core plugins such as [`visualization`](../visualizations/), [`dashboard`](../dashboard/) and [`wizard`](../wizard/), as well as external plugins. Saved object is the primary way to store app and plugin data in a standardized form in OpenSearch Dashboards. They allow plugin developers to manage creating, saving, editing and retrieving data for the application. They can also make reference to other saved objects and have useful features out of the box, such as migrations and strict typings. The saved objects can be managed by the Saved Object Management UI. +The saved object plugin provides all the core services and functionalities of saved objects. It is utilized by many core plugins such as [`visualization`](../visualizations/), [`dashboard`](../dashboard/) and [`visBuilder`](../visBuilder/), as well as external plugins. Saved object is the primary way to store app and plugin data in a standardized form in OpenSearch Dashboards. They allow plugin developers to manage creating, saving, editing and retrieving data for the application. They can also make reference to other saved objects and have useful features out of the box, such as migrations and strict typings. The saved objects can be managed by the Saved Object Management UI. ## Save relationships to index pattern diff --git a/src/plugins/saved_objects_management/opensearch_dashboards.json b/src/plugins/saved_objects_management/opensearch_dashboards.json index 21a0b00860b4..6d02893311e3 100644 --- a/src/plugins/saved_objects_management/opensearch_dashboards.json +++ b/src/plugins/saved_objects_management/opensearch_dashboards.json @@ -4,7 +4,7 @@ "server": true, "ui": true, "requiredPlugins": ["management", "data"], - "optionalPlugins": ["dashboard", "visualizations", "discover", "home", "wizard"], + "optionalPlugins": ["dashboard", "visualizations", "discover", "home", "visBuilder"], "extraPublicDirs": ["public/lib"], "requiredBundles": ["opensearchDashboardsReact", "home"] } diff --git a/src/plugins/saved_objects_management/public/plugin.ts b/src/plugins/saved_objects_management/public/plugin.ts index 1ccf9772ff2c..c15a96bddb7a 100644 --- a/src/plugins/saved_objects_management/public/plugin.ts +++ b/src/plugins/saved_objects_management/public/plugin.ts @@ -31,7 +31,7 @@ import { i18n } from '@osd/i18n'; import { CoreSetup, CoreStart, Plugin } from 'src/core/public'; -import { WizardStart } from '../../vis_builder/public'; +import { VisBuilderStart } from '../../vis_builder/public'; import { ManagementSetup } from '../../management/public'; import { DataPublicPluginStart } from '../../data/public'; import { DashboardStart } from '../../dashboard/public'; @@ -71,7 +71,7 @@ export interface StartDependencies { dashboard?: DashboardStart; visualizations?: VisualizationsStart; discover?: DiscoverStart; - wizard?: WizardStart; + visBuilder?: VisBuilderStart; } export class SavedObjectsManagementPlugin diff --git a/src/plugins/saved_objects_management/public/register_services.ts b/src/plugins/saved_objects_management/public/register_services.ts index 8ce6ed20bc9f..514ab66a4595 100644 --- a/src/plugins/saved_objects_management/public/register_services.ts +++ b/src/plugins/saved_objects_management/public/register_services.ts @@ -36,7 +36,7 @@ export const registerServices = async ( registry: ISavedObjectsManagementServiceRegistry, getStartServices: StartServicesAccessor ) => { - const [, { dashboard, visualizations, discover, wizard }] = await getStartServices(); + const [, { dashboard, visualizations, discover, visBuilder }] = await getStartServices(); if (dashboard) { registry.register({ @@ -62,11 +62,11 @@ export const registerServices = async ( }); } - if (wizard) { + if (visBuilder) { registry.register({ - id: 'savedWizard', - title: 'wizard', - service: wizard.savedWizardLoader, + id: 'savedVisBuilder', + title: 'visBuilder', + service: visBuilder.savedVisBuilderLoader, }); } }; diff --git a/src/plugins/vis_builder/README.md b/src/plugins/vis_builder/README.md index bb2d08fecbbb..fc7c301acefb 100755 --- a/src/plugins/vis_builder/README.md +++ b/src/plugins/vis_builder/README.md @@ -1,4 +1,4 @@ -# Wizard +# Visualization Builder An OpenSearch Dashboards plugin for a visualization experience that makes exploring data and creating visualizations much easier. It will act as an additional way to create visualizations alongside the exiting tools within the current visualizations plugin. The tool will be incremental to the visualization tools available to users in OpenSearch Dashboards today. @@ -6,7 +6,7 @@ An OpenSearch Dashboards plugin for a visualization experience that makes explor To use this plugin, navigate to: -Visualize -> Create Visualization -> Wizard +Visualize -> Create Visualization -> Visualization Builder ## Add a visualization diff --git a/src/plugins/vis_builder/common/index.ts b/src/plugins/vis_builder/common/index.ts index d28c9b8fa58c..b4a9afde4ae5 100644 --- a/src/plugins/vis_builder/common/index.ts +++ b/src/plugins/vis_builder/common/index.ts @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -export const PLUGIN_ID = 'wizard'; -export const PLUGIN_NAME = 'Wizard'; +export const PLUGIN_ID = 'visBuilder'; +export const PLUGIN_NAME = 'Visualization Builder'; export const VISUALIZE_ID = 'visualize'; export const EDIT_PATH = '/edit'; export const VIS_BUILDER_CHART_TYPE = 'VisBuilder'; diff --git a/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts b/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts index c15d9b81295c..e25f91d131a7 100644 --- a/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts +++ b/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts @@ -5,7 +5,7 @@ import { SavedObjectAttributes } from '../../../core/types'; -export const VISBUILDER_SAVED_OBJECT = 'wizard'; +export const VISBUILDER_SAVED_OBJECT = 'visBuilder'; export interface VisBuilderSavedObjectAttributes extends SavedObjectAttributes { title: string; diff --git a/src/plugins/vis_builder/opensearch_dashboards.json b/src/plugins/vis_builder/opensearch_dashboards.json index 1068a7228d18..96ce2db2c36a 100644 --- a/src/plugins/vis_builder/opensearch_dashboards.json +++ b/src/plugins/vis_builder/opensearch_dashboards.json @@ -1,5 +1,6 @@ { - "id": "wizard", + "id": "visBuilder", + "configPath": "visBuilder", "version": "1.0.0", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, diff --git a/src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx b/src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx index 38b6f51e2f4f..3b18d9b9939d 100644 --- a/src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx +++ b/src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx @@ -81,7 +81,7 @@ export const getTopNavConfig = ( : i18n.translate('visBuilder.topNavMenu.saveVisualizationButtonLabel', { defaultMessage: 'save', }), - testId: 'wizardSaveButton', + testId: 'visBuilderSaveButton', disableButton: !!saveDisabledReason, tooltip: saveDisabledReason, run: (_anchorElement) => { @@ -120,7 +120,7 @@ export const getTopNavConfig = ( defaultMessage: 'Finish editing visBuilder and return to the last app', } ), - testId: 'wizardsaveAndReturnButton', + testId: 'visBuilderSaveAndReturnButton', disableButton: !!saveDisabledReason, tooltip: saveDisabledReason, run: async () => { @@ -207,7 +207,7 @@ export const getOnSave = ( if (newlyCreated && stateTransfer) { // create new embeddable to transfer to originatingApp stateTransfer.navigateToWithEmbeddablePackage(originatingApp, { - state: { type: 'wizard', input: { savedObjectId: id } }, + state: { type: 'visBuilder', input: { savedObjectId: id } }, }); return { id }; } else { diff --git a/src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts b/src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts index 3e00c06994a4..d7840b92f8ad 100644 --- a/src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts +++ b/src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts @@ -91,7 +91,7 @@ export const useSavedVisBuilderVis = (visualizationIdFromUrl: string | undefined const managementRedirectTarget = { [PLUGIN_ID]: { app: 'management', - path: `opensearch-dashboards/objects/savedWizard/${visualizationIdFromUrl}`, + path: `opensearch-dashboards/objects/savedVisBuilder/${visualizationIdFromUrl}`, }, }; diff --git a/src/plugins/vis_builder/public/assets/wizard_icon.svg b/src/plugins/vis_builder/public/assets/vis_builder_icon.svg similarity index 100% rename from src/plugins/vis_builder/public/assets/wizard_icon.svg rename to src/plugins/vis_builder/public/assets/vis_builder_icon.svg diff --git a/src/plugins/vis_builder/public/assets/wizard_icon_secondary_fill.svg b/src/plugins/vis_builder/public/assets/vis_builder_icon_secondary_fill.svg similarity index 100% rename from src/plugins/vis_builder/public/assets/wizard_icon_secondary_fill.svg rename to src/plugins/vis_builder/public/assets/vis_builder_icon_secondary_fill.svg diff --git a/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx b/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx index 8ebbd662cc20..a8c41df6cc43 100644 --- a/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx +++ b/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx @@ -183,7 +183,7 @@ export class VisBuilderEmbeddable extends Embeddable ({ - wizard: { + visBuilder: { // TODO: investigate which capabilities we need to provide // createNew: true, // createShortUrl: true, diff --git a/src/plugins/vis_builder/server/plugin.ts b/src/plugins/vis_builder/server/plugin.ts index d1466077061c..b23ee1ef6e53 100644 --- a/src/plugins/vis_builder/server/plugin.ts +++ b/src/plugins/vis_builder/server/plugin.ts @@ -23,7 +23,7 @@ export class VisBuilderPlugin implements Plugin) => title, getEditUrl: ({ id }: SavedObject) => - `/management/opensearch-dashboards/objects/savedWizard/${encodeURIComponent(id)}`, + `/management/opensearch-dashboards/objects/savedVisBuilder/${encodeURIComponent(id)}`, getInAppUrl({ id }: SavedObject) { return { path: `/app/${PLUGIN_ID}${EDIT_PATH}/${encodeURIComponent(id)}`, - uiCapabilitiesPath: 'wizard.show', + uiCapabilitiesPath: 'visBuilder.show', }; }, }, diff --git a/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.test.ts b/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.test.ts index 0a3927b81802..e15b1e60e9fa 100644 --- a/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.test.ts +++ b/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.test.ts @@ -17,19 +17,19 @@ describe('2.3.0', () => { it('should return original doc if visualizationState is not found', () => { const migratedDoc = migrate({ - type: 'wizard', + type: 'visBuilder', attributes: {}, }); expect(migratedDoc).toEqual({ - type: 'wizard', + type: 'visBuilder', attributes: {}, }); }); it('should return original doc if indexPattern is not found within visualizationState', () => { const migratedDoc = migrate({ - type: 'wizard', + type: 'visBuilder', attributes: { visualizationState: { searchSource: '', @@ -39,7 +39,7 @@ describe('2.3.0', () => { }); expect(migratedDoc).toEqual({ - type: 'wizard', + type: 'visBuilder', attributes: { visualizationState: { searchSource: '', @@ -51,7 +51,7 @@ describe('2.3.0', () => { it('should return original doc if references is not an array', () => { const migratedDoc = migrate({ - type: 'wizard', + type: 'visBuilder', attributes: { visualizationState: {}, }, @@ -59,7 +59,7 @@ describe('2.3.0', () => { }); expect(migratedDoc).toEqual({ - type: 'wizard', + type: 'visBuilder', attributes: { visualizationState: {}, }, @@ -69,7 +69,7 @@ describe('2.3.0', () => { it('should migrate the old version visBuilder saved object to new version VisBuilder saved object', () => { const migratedDoc = migrate({ - type: 'wizard', + type: 'visBuilder', attributes: { visualizationState: JSON.stringify({ searchFields: {}, @@ -82,7 +82,7 @@ describe('2.3.0', () => { }); expect(migratedDoc).toEqual({ - type: 'wizard', + type: 'visBuilder', attributes: { visualizationState: JSON.stringify({ searchFields: {}, diff --git a/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.ts b/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.ts index b568f4b8c405..c3a14575d4a4 100644 --- a/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.ts +++ b/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.ts @@ -46,6 +46,8 @@ const migrateIndexPattern: SavedObjectMigrationFn = (doc) => { } }; +// TODO: add migration to change the saved object type from wizard to visBuilder + export const visBuilderSavedObjectTypeMigrations = { '2.3.0': flow(migrateIndexPattern), }; diff --git a/test/common/config.js b/test/common/config.js index 26abcc2fa586..bd70a438eca6 100644 --- a/test/common/config.js +++ b/test/common/config.js @@ -78,7 +78,7 @@ export default function () { `--opensearchDashboards.branding.mark.defaultUrl=https://opensearch.org/assets/brand/SVG/Mark/opensearch_mark_default.svg`, `--opensearchDashboards.branding.mark.darkModeUrl=https://opensearch.org/assets/brand/SVG/Mark/opensearch_mark_darkmode.svg`, `--opensearchDashboards.branding.applicationTitle=OpenSearch`, - `--wizard.enabled=true`, + `--visBuilder.enabled=true`, ], }, services, From 61dc92cd65bd33fa63c41da02fae0a9c122450a2 Mon Sep 17 00:00:00 2001 From: abbyhu2000 Date: Wed, 26 Oct 2022 03:26:19 +0000 Subject: [PATCH 2/7] Rename wizard in functional tests Signed-off-by: abbyhu2000 --- CHANGELOG.md | 5 ++++ src/plugins/vis_builder/common/index.ts | 1 + src/plugins/vis_builder/public/plugin.ts | 8 +++++- src/plugins/vis_builder/server/plugin.ts | 2 +- .../apps/{wizard => vis_builder}/_base.ts | 26 +++++++++---------- .../_experimental_vis.ts | 20 +++++++------- .../apps/{wizard => vis_builder}/index.ts | 6 ++--- test/functional/config.js | 6 ++--- test/functional/page_objects/index.ts | 4 +-- .../{wizard_page.ts => vis_builder_page.ts} | 10 +++---- 10 files changed, 50 insertions(+), 38 deletions(-) rename test/functional/apps/{wizard => vis_builder}/_base.ts (59%) rename test/functional/apps/{wizard => vis_builder}/_experimental_vis.ts (71%) rename test/functional/apps/{wizard => vis_builder}/index.ts (88%) rename test/functional/page_objects/{wizard_page.ts => vis_builder_page.ts} (94%) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc928d9e0bb3..a1042719f7d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### 📈 Features/Enhancements +<<<<<<< HEAD - [MD] Support legacy client for data source ([#2204](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2204)) - [MD] Add data source signing support ([#2510](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2510)) - [Plugin Helpers] Facilitate version changes ([#2398](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2398)) @@ -31,7 +32,11 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multi DataSource] Address UX comments on Data source list and create page ([#2625](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2625)) - [Vis Builder] Rename wizard to visBuilder in i18n id and formatted message id ([#2635](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2635)) - [Vis Builder] Rename wizard to visBuilder in class name, type name and function name ([#2639](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2639)) +<<<<<<< HEAD - [Vis Builder] Rename wizard on save modal and visualization table ([#2645](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2645)) +======= +- Change save object type, wizard id and name to visBuilder #2673 ([#2673](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2673)) +>>>>>>> Rename wizard in functional tests ### 🐛 Bug Fixes diff --git a/src/plugins/vis_builder/common/index.ts b/src/plugins/vis_builder/common/index.ts index b4a9afde4ae5..951a279bd6e6 100644 --- a/src/plugins/vis_builder/common/index.ts +++ b/src/plugins/vis_builder/common/index.ts @@ -6,6 +6,7 @@ export const PLUGIN_ID = 'visBuilder'; export const PLUGIN_NAME = 'Visualization Builder'; export const VISUALIZE_ID = 'visualize'; +export const VIS_BUILDER_TYPE_SHORTHAND = 'VisBuilder'; export const EDIT_PATH = '/edit'; export const VIS_BUILDER_CHART_TYPE = 'VisBuilder'; diff --git a/src/plugins/vis_builder/public/plugin.ts b/src/plugins/vis_builder/public/plugin.ts index 2f70f44efdf3..edc43c1b7c80 100644 --- a/src/plugins/vis_builder/public/plugin.ts +++ b/src/plugins/vis_builder/public/plugin.ts @@ -22,7 +22,13 @@ import { import { VisBuilderEmbeddableFactoryDefinition, VISBUILDER_EMBEDDABLE } from './embeddable'; import visBuilderIconSecondaryFill from './assets/vis_builder_icon_secondary_fill.svg'; import visBuilderIcon from './assets/vis_builder_icon.svg'; -import { EDIT_PATH, PLUGIN_ID, PLUGIN_NAME, VISBUILDER_SAVED_OBJECT, VIS_BUILDER_CHART_TYPE } from '../common'; +import { + EDIT_PATH, + PLUGIN_ID, + PLUGIN_NAME, + VISBUILDER_SAVED_OBJECT, + VIS_BUILDER_CHART_TYPE, +} from '../common'; import { TypeService } from './services/type_service'; import { getPreloadedStore } from './application/utils/state_management'; import { diff --git a/src/plugins/vis_builder/server/plugin.ts b/src/plugins/vis_builder/server/plugin.ts index b23ee1ef6e53..8cc5f02c8d3f 100644 --- a/src/plugins/vis_builder/server/plugin.ts +++ b/src/plugins/vis_builder/server/plugin.ts @@ -39,5 +39,5 @@ export class VisBuilderPlugin implements Plugin { - log.debug('navigateToApp wizard'); - await PageObjects.wizard.navigateToCreateWizard(); + log.debug('navigateToApp visBuilder'); + await PageObjects.visBuilder.navigateToCreateVisBuilder(); }); it('should be able to switch data sources', async () => { - const dataSourceValue = await PageObjects.wizard.selectDataSource( - PageObjects.wizard.index.LOGSTASH_NON_TIME_BASED + const dataSourceValue = await PageObjects.visBuilder.selectDataSource( + PageObjects.visBuilder.index.LOGSTASH_NON_TIME_BASED ); - expect(dataSourceValue).to.equal(PageObjects.wizard.index.LOGSTASH_NON_TIME_BASED); + expect(dataSourceValue).to.equal(PageObjects.visBuilder.index.LOGSTASH_NON_TIME_BASED); // TODO: Switch with a datasource with unique fields to test if it exists }); it('should show visualization when a field is added', async () => { const expectedData = [2904, 2858, 2814, 2784, 1322]; - await PageObjects.wizard.addField('metric', 'Count'); - await PageObjects.wizard.addField('segment', 'Terms', 'machine.os.raw'); + await PageObjects.visBuilder.addField('metric', 'Count'); + await PageObjects.visBuilder.addField('segment', 'Terms', 'machine.os.raw'); const data = await PageObjects.visChart.getBarChartData(); expect(data).to.eql(expectedData); }); it('should clear visualization when field is deleted', async () => { - await PageObjects.wizard.removeField('metric', 0); + await PageObjects.visBuilder.removeField('metric', 0); - const isEmptyWorkspace = await PageObjects.wizard.isEmptyWorkspace(); + const isEmptyWorkspace = await PageObjects.visBuilder.isEmptyWorkspace(); expect(isEmptyWorkspace).to.be(true); }); it('should show warning before changing visualization type', async () => { - await PageObjects.wizard.selectVisType('metric', false); + await PageObjects.visBuilder.selectVisType('metric', false); const confirmModalExists = await testSubjects.exists('confirmVisChangeModal'); expect(confirmModalExists).to.be(true); @@ -52,7 +52,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should change visualization type', async () => { - const pickerValue = await PageObjects.wizard.selectVisType('metric'); + const pickerValue = await PageObjects.visBuilder.selectVisType('metric'); expect(pickerValue).to.eql('Metric'); }); diff --git a/test/functional/apps/wizard/_experimental_vis.ts b/test/functional/apps/vis_builder/_experimental_vis.ts similarity index 71% rename from test/functional/apps/wizard/_experimental_vis.ts rename to test/functional/apps/vis_builder/_experimental_vis.ts index e36c0254e22a..f9cbf393cb47 100644 --- a/test/functional/apps/wizard/_experimental_vis.ts +++ b/test/functional/apps/vis_builder/_experimental_vis.ts @@ -8,25 +8,25 @@ import { VISUALIZE_ENABLE_LABS_SETTING } from '../../../../src/plugins/visualiza import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['visualize', 'wizard']); + const PageObjects = getPageObjects(['visualize', 'visBuilder']); const log = getService('log'); const opensearchDashboardsServer = getService('opensearchDashboardsServer'); - describe('experimental settings for wizard app ', function () { - it('should show an notification when creating wizard visualization', async () => { + describe('experimental settings for visBuilder app ', function () { + it('should show an notification when creating visBuilder visualization', async () => { log.debug('navigateToApp visualize'); await PageObjects.visualize.navigateToNewVisualization(); await PageObjects.visualize.waitForVisualizationSelectPage(); - // Try to find the wizard Vis type. - const wizardVisTypeExists = await PageObjects.visualize.hasVisType('wizard'); + // Try to find the visBuilder Vis type. + const wizardVisTypeExists = await PageObjects.visualize.hasVisType('visBuilder'); expect(wizardVisTypeExists).to.be(true); // Create a new visualization - await PageObjects.visualize.clickVisType('wizard'); + await PageObjects.visualize.clickVisType('visBuilder'); // Check that the experimental banner is there and state that this is experimental - const info = await PageObjects.wizard.getExperimentalInfo(); + const info = await PageObjects.visBuilder.getExperimentalInfo(); expect(await info.getVisibleText()).to.contain('experimental'); }); @@ -38,9 +38,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.navigateToNewVisualization(); await PageObjects.visualize.waitForVisualizationSelectPage(); - // Try to find the wizard Vis type. - const wizardVisTypeExists = await PageObjects.visualize.hasVisType('wizard'); - expect(wizardVisTypeExists).to.be(false); + // Try to find the visBuilder Vis type. + const visBuilderVisTypeExists = await PageObjects.visualize.hasVisType('visBuilder'); + expect(visBuilderVisTypeExists).to.be(false); }); after(async () => { diff --git a/test/functional/apps/wizard/index.ts b/test/functional/apps/vis_builder/index.ts similarity index 88% rename from test/functional/apps/wizard/index.ts rename to test/functional/apps/vis_builder/index.ts index 24c4eb50c263..c0e7b9c35c77 100644 --- a/test/functional/apps/wizard/index.ts +++ b/test/functional/apps/vis_builder/index.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { FtrProviderContext } from '../../ftr_provider_context.d'; +import { FtrProviderContext } from '../../ftr_provider_context'; import { UI_SETTINGS } from '../../../../src/plugins/data/common'; export default function ({ getService, loadTestFile }: FtrProviderContext) { @@ -12,11 +12,11 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const opensearchArchiver = getService('opensearchArchiver'); const opensearchDashboardsServer = getService('opensearchDashboardsServer'); - describe('wizard app', function () { + describe('visBuilder app', function () { this.tags('ciGroup13'); before(async function () { - log.debug('Starting wizard before method'); + log.debug('Starting visBuilder before method'); await browser.setWindowSize(1280, 800); await opensearchArchiver.loadIfNeeded('logstash_functional'); await opensearchArchiver.loadIfNeeded('long_window_logstash'); diff --git a/test/functional/config.js b/test/functional/config.js index bb6be73ebd82..d60250968720 100644 --- a/test/functional/config.js +++ b/test/functional/config.js @@ -48,7 +48,7 @@ export default async function ({ readConfigFile }) { require.resolve('./apps/status_page'), require.resolve('./apps/timeline'), require.resolve('./apps/visualize'), - require.resolve('./apps/wizard'), + require.resolve('./apps/vis_builder'), ], pageObjects, services, @@ -92,8 +92,8 @@ export default async function ({ readConfigFile }) { pathname: '/app/visualize', hash: '/', }, - wizard: { - pathname: '/app/wizard', + visBuilder: { + pathname: '/app/visBuilder', hash: '/', }, dashboard: { diff --git a/test/functional/page_objects/index.ts b/test/functional/page_objects/index.ts index d09445d47026..63cd990c445b 100644 --- a/test/functional/page_objects/index.ts +++ b/test/functional/page_objects/index.ts @@ -44,7 +44,7 @@ import { TimePickerProvider } from './time_picker'; import { TimelinePageProvider } from './timeline_page'; import { VisualBuilderPageProvider } from './visual_builder_page'; import { VisualizePageProvider } from './visualize_page'; -import { WizardPageProvider } from './wizard_page'; +import { VisBuilderPageProvider } from './vis_builder_page'; import { VisualizeEditorPageProvider } from './visualize_editor_page'; import { VisualizeChartPageProvider } from './visualize_chart_page'; import { TileMapPageProvider } from './tile_map_page'; @@ -69,7 +69,7 @@ export const pageObjects = { timePicker: TimePickerProvider, visualBuilder: VisualBuilderPageProvider, visualize: VisualizePageProvider, - wizard: WizardPageProvider, + visBuilder: VisBuilderPageProvider, visEditor: VisualizeEditorPageProvider, visChart: VisualizeChartPageProvider, tileMap: TileMapPageProvider, diff --git a/test/functional/page_objects/wizard_page.ts b/test/functional/page_objects/vis_builder_page.ts similarity index 94% rename from test/functional/page_objects/wizard_page.ts rename to test/functional/page_objects/vis_builder_page.ts index bd206f71fa2f..e2c3c85ec319 100644 --- a/test/functional/page_objects/wizard_page.ts +++ b/test/functional/page_objects/vis_builder_page.ts @@ -5,7 +5,7 @@ import { FtrProviderContext } from '../ftr_provider_context'; -export function WizardPageProvider({ getService, getPageObjects }: FtrProviderContext) { +export function VisBuilderPageProvider({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const find = getService('find'); const browser = getService('browser'); @@ -16,14 +16,14 @@ export function WizardPageProvider({ getService, getPageObjects }: FtrProviderCo * This page object contains the visualization type selection, the landing page, * and the open/save dialog functions */ - class WizardPage { + class VisBuilderPage { index = { LOGSTASH_TIME_BASED: 'logstash-*', LOGSTASH_NON_TIME_BASED: 'logstash*', }; - public async navigateToCreateWizard() { - await common.navigateToApp('wizard'); + public async navigateToCreateVisBuilder() { + await common.navigateToApp('visBuilder'); await header.waitUntilLoadingHasFinished(); } @@ -124,5 +124,5 @@ export function WizardPageProvider({ getService, getPageObjects }: FtrProviderCo } } - return new WizardPage(); + return new VisBuilderPage(); } From 8594781a9d6da55756ba6471307e064f76aba8e4 Mon Sep 17 00:00:00 2001 From: abbyhu2000 Date: Thu, 27 Oct 2022 23:40:19 +0000 Subject: [PATCH 3/7] Finalize plugin-id and plugin-name and saved-object-type Signed-off-by: abbyhu2000 --- CHANGELOG.md | 4 ---- config/opensearch_dashboards.yml | 2 +- src/plugins/vis_builder/common/index.ts | 3 +-- .../vis_builder/common/vis_builder_saved_object_attributes.ts | 2 +- src/plugins/vis_builder/opensearch_dashboards.json | 1 - .../public/application/utils/get_top_nav_config.tsx | 4 ++-- src/plugins/vis_builder/public/plugin.ts | 2 +- src/plugins/vis_builder/server/capabilities_provider.ts | 2 +- src/plugins/vis_builder/server/plugin.ts | 4 ++-- .../vis_builder/server/saved_objects/vis_builder_app.ts | 2 +- test/common/config.js | 2 +- test/functional/apps/visualize/_chart_types.ts | 2 +- 12 files changed, 12 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1042719f7d2..924a5c4244de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### 📈 Features/Enhancements -<<<<<<< HEAD - [MD] Support legacy client for data source ([#2204](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2204)) - [MD] Add data source signing support ([#2510](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2510)) - [Plugin Helpers] Facilitate version changes ([#2398](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2398)) @@ -32,11 +31,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multi DataSource] Address UX comments on Data source list and create page ([#2625](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2625)) - [Vis Builder] Rename wizard to visBuilder in i18n id and formatted message id ([#2635](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2635)) - [Vis Builder] Rename wizard to visBuilder in class name, type name and function name ([#2639](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2639)) -<<<<<<< HEAD - [Vis Builder] Rename wizard on save modal and visualization table ([#2645](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2645)) -======= - Change save object type, wizard id and name to visBuilder #2673 ([#2673](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2673)) ->>>>>>> Rename wizard in functional tests ### 🐛 Bug Fixes diff --git a/config/opensearch_dashboards.yml b/config/opensearch_dashboards.yml index 0a7d8c6b909e..d68c77ad8495 100644 --- a/config/opensearch_dashboards.yml +++ b/config/opensearch_dashboards.yml @@ -222,7 +222,7 @@ # Set the value of this setting to true to start exploring wizard # functionality in Visualization. -# visBuilder.enabled: false +# vis_builder.enabled: false # Set the value of this setting to true to enable the experimental multiple data source # support feature. Use with caution. diff --git a/src/plugins/vis_builder/common/index.ts b/src/plugins/vis_builder/common/index.ts index 951a279bd6e6..18583abaf421 100644 --- a/src/plugins/vis_builder/common/index.ts +++ b/src/plugins/vis_builder/common/index.ts @@ -3,10 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -export const PLUGIN_ID = 'visBuilder'; +export const PLUGIN_ID = 'vis-builder'; export const PLUGIN_NAME = 'Visualization Builder'; export const VISUALIZE_ID = 'visualize'; -export const VIS_BUILDER_TYPE_SHORTHAND = 'VisBuilder'; export const EDIT_PATH = '/edit'; export const VIS_BUILDER_CHART_TYPE = 'VisBuilder'; diff --git a/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts b/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts index e25f91d131a7..243e455d7157 100644 --- a/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts +++ b/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts @@ -5,7 +5,7 @@ import { SavedObjectAttributes } from '../../../core/types'; -export const VISBUILDER_SAVED_OBJECT = 'visBuilder'; +export const VISBUILDER_SAVED_OBJECT = 'visualization-visbuilder'; export interface VisBuilderSavedObjectAttributes extends SavedObjectAttributes { title: string; diff --git a/src/plugins/vis_builder/opensearch_dashboards.json b/src/plugins/vis_builder/opensearch_dashboards.json index 96ce2db2c36a..98ef5153a9b0 100644 --- a/src/plugins/vis_builder/opensearch_dashboards.json +++ b/src/plugins/vis_builder/opensearch_dashboards.json @@ -1,6 +1,5 @@ { "id": "visBuilder", - "configPath": "visBuilder", "version": "1.0.0", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, diff --git a/src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx b/src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx index 3b18d9b9939d..c88bb13f3cb3 100644 --- a/src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx +++ b/src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx @@ -39,7 +39,7 @@ import { import { VisBuilderServices } from '../..'; import { VisBuilderVisSavedObject } from '../../types'; import { AppDispatch } from './state_management'; -import { EDIT_PATH } from '../../../common'; +import { EDIT_PATH, VISBUILDER_SAVED_OBJECT } from '../../../common'; import { setEditorState } from './state_management/metadata_slice'; export interface TopNavConfigParams { visualizationIdFromUrl: string; @@ -207,7 +207,7 @@ export const getOnSave = ( if (newlyCreated && stateTransfer) { // create new embeddable to transfer to originatingApp stateTransfer.navigateToWithEmbeddablePackage(originatingApp, { - state: { type: 'visBuilder', input: { savedObjectId: id } }, + state: { type: VISBUILDER_SAVED_OBJECT, input: { savedObjectId: id } }, }); return { id }; } else { diff --git a/src/plugins/vis_builder/public/plugin.ts b/src/plugins/vis_builder/public/plugin.ts index edc43c1b7c80..085fab408bbb 100644 --- a/src/plugins/vis_builder/public/plugin.ts +++ b/src/plugins/vis_builder/public/plugin.ts @@ -130,7 +130,7 @@ export class VisBuilderPlugin aliasPath: '#/', appExtensions: { visualizations: { - docTypes: [PLUGIN_ID], + docTypes: [VISBUILDER_SAVED_OBJECT], toListItem: ({ id, attributes, updated_at: updatedAt }) => ({ description: attributes?.description, editApp: PLUGIN_ID, diff --git a/src/plugins/vis_builder/server/capabilities_provider.ts b/src/plugins/vis_builder/server/capabilities_provider.ts index fa28c849a547..c810efabdfe5 100644 --- a/src/plugins/vis_builder/server/capabilities_provider.ts +++ b/src/plugins/vis_builder/server/capabilities_provider.ts @@ -4,7 +4,7 @@ */ export const capabilitiesProvider = () => ({ - visBuilder: { + 'visualization-visbuilder': { // TODO: investigate which capabilities we need to provide // createNew: true, // createShortUrl: true, diff --git a/src/plugins/vis_builder/server/plugin.ts b/src/plugins/vis_builder/server/plugin.ts index 8cc5f02c8d3f..d250c21f14ad 100644 --- a/src/plugins/vis_builder/server/plugin.ts +++ b/src/plugins/vis_builder/server/plugin.ts @@ -23,7 +23,7 @@ export class VisBuilderPlugin implements Plugin Date: Thu, 27 Oct 2022 23:53:12 +0000 Subject: [PATCH 4/7] Change official name to VisBuilder Signed-off-by: abbyhu2000 --- src/plugins/vis_builder/README.md | 2 +- src/plugins/vis_builder/common/index.ts | 2 +- src/plugins/vis_builder/public/plugin.ts | 2 +- test/functional/apps/visualize/_chart_types.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/vis_builder/README.md b/src/plugins/vis_builder/README.md index fc7c301acefb..f0ad23a1c0c5 100755 --- a/src/plugins/vis_builder/README.md +++ b/src/plugins/vis_builder/README.md @@ -6,7 +6,7 @@ An OpenSearch Dashboards plugin for a visualization experience that makes explor To use this plugin, navigate to: -Visualize -> Create Visualization -> Visualization Builder +Visualize -> Create Visualization -> VisBuilder ## Add a visualization diff --git a/src/plugins/vis_builder/common/index.ts b/src/plugins/vis_builder/common/index.ts index 18583abaf421..8e50b07f7dc0 100644 --- a/src/plugins/vis_builder/common/index.ts +++ b/src/plugins/vis_builder/common/index.ts @@ -4,7 +4,7 @@ */ export const PLUGIN_ID = 'vis-builder'; -export const PLUGIN_NAME = 'Visualization Builder'; +export const PLUGIN_NAME = 'VisBuilder'; export const VISUALIZE_ID = 'visualize'; export const EDIT_PATH = '/edit'; export const VIS_BUILDER_CHART_TYPE = 'VisBuilder'; diff --git a/src/plugins/vis_builder/public/plugin.ts b/src/plugins/vis_builder/public/plugin.ts index 085fab408bbb..8e90a04784cd 100644 --- a/src/plugins/vis_builder/public/plugin.ts +++ b/src/plugins/vis_builder/public/plugin.ts @@ -122,7 +122,7 @@ export class VisBuilderPlugin name: PLUGIN_ID, title: PLUGIN_NAME, description: i18n.translate('visBuilder.visPicker.description', { - defaultMessage: 'Create visualizations using the new Visualization Builder', + defaultMessage: 'Create visualizations using the new VisBuilder', }), icon: visBuilderIconSecondaryFill, stage: 'experimental', diff --git a/test/functional/apps/visualize/_chart_types.ts b/test/functional/apps/visualize/_chart_types.ts index 2177c1ba21ef..3286edd3cd8b 100644 --- a/test/functional/apps/visualize/_chart_types.ts +++ b/test/functional/apps/visualize/_chart_types.ts @@ -65,7 +65,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'Timeline', 'Vega', 'Vertical Bar', - 'Visualization Builder', + 'VisBuilder', ]; if (!isOss) { expectedChartTypes.push('Maps', 'Lens'); From 022f526512e8e75c350cb45c95539ebdb9cd967f Mon Sep 17 00:00:00 2001 From: abbyhu2000 Date: Fri, 28 Oct 2022 00:05:02 +0000 Subject: [PATCH 5/7] Delete migration Signed-off-by: abbyhu2000 --- src/plugins/saved_objects/README.md | 2 +- .../server/saved_objects/vis_builder_app.ts | 3 +- .../vis_builder_migration.test.ts | 107 ------------------ .../saved_objects/vis_builder_migration.ts | 53 --------- 4 files changed, 2 insertions(+), 163 deletions(-) delete mode 100644 src/plugins/vis_builder/server/saved_objects/vis_builder_migration.test.ts delete mode 100644 src/plugins/vis_builder/server/saved_objects/vis_builder_migration.ts diff --git a/src/plugins/saved_objects/README.md b/src/plugins/saved_objects/README.md index 55f9c219879c..3b6dc4f7a79c 100644 --- a/src/plugins/saved_objects/README.md +++ b/src/plugins/saved_objects/README.md @@ -1,6 +1,6 @@ # Saved object -The saved object plugin provides all the core services and functionalities of saved objects. It is utilized by many core plugins such as [`visualization`](../visualizations/), [`dashboard`](../dashboard/) and [`visBuilder`](../visBuilder/), as well as external plugins. Saved object is the primary way to store app and plugin data in a standardized form in OpenSearch Dashboards. They allow plugin developers to manage creating, saving, editing and retrieving data for the application. They can also make reference to other saved objects and have useful features out of the box, such as migrations and strict typings. The saved objects can be managed by the Saved Object Management UI. +The saved object plugin provides all the core services and functionalities of saved objects. It is utilized by many core plugins such as [`visualization`](../visualizations/), [`dashboard`](../dashboard/) and [`visBuilder`](../vis_builder/), as well as external plugins. Saved object is the primary way to store app and plugin data in a standardized form in OpenSearch Dashboards. They allow plugin developers to manage creating, saving, editing and retrieving data for the application. They can also make reference to other saved objects and have useful features out of the box, such as migrations and strict typings. The saved objects can be managed by the Saved Object Management UI. ## Save relationships to index pattern 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 4769aad73659..15d785b3b451 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 @@ -10,7 +10,6 @@ import { VisBuilderSavedObjectAttributes, VISBUILDER_SAVED_OBJECT, } from '../../common'; -import { visBuilderSavedObjectTypeMigrations } from './vis_builder_migration'; export const visBuilderSavedObjectType: SavedObjectsType = { name: VISBUILDER_SAVED_OBJECT, @@ -30,7 +29,7 @@ export const visBuilderSavedObjectType: SavedObjectsType = { }; }, }, - migrations: visBuilderSavedObjectTypeMigrations, + migrations: {}, mappings: { properties: { title: { diff --git a/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.test.ts b/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.test.ts deleted file mode 100644 index e15b1e60e9fa..000000000000 --- a/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.test.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import { SavedObjectMigrationFn, SavedObjectMigrationContext } from '../../../../core/server'; -import { visBuilderSavedObjectTypeMigrations } from './vis_builder_migration'; - -const savedObjectMigrationContext = (null as unknown) as SavedObjectMigrationContext; - -describe('2.3.0', () => { - const migrate = (doc: any) => - visBuilderSavedObjectTypeMigrations['2.3.0']( - doc as Parameters[0], - savedObjectMigrationContext - ); - - it('should return original doc if visualizationState is not found', () => { - const migratedDoc = migrate({ - type: 'visBuilder', - attributes: {}, - }); - - expect(migratedDoc).toEqual({ - type: 'visBuilder', - attributes: {}, - }); - }); - - it('should return original doc if indexPattern is not found within visualizationState', () => { - const migratedDoc = migrate({ - type: 'visBuilder', - attributes: { - visualizationState: { - searchSource: '', - activeVisualization: {}, - }, - }, - }); - - expect(migratedDoc).toEqual({ - type: 'visBuilder', - attributes: { - visualizationState: { - searchSource: '', - activeVisualization: {}, - }, - }, - }); - }); - - it('should return original doc if references is not an array', () => { - const migratedDoc = migrate({ - type: 'visBuilder', - attributes: { - visualizationState: {}, - }, - references: {}, - }); - - expect(migratedDoc).toEqual({ - type: 'visBuilder', - attributes: { - visualizationState: {}, - }, - references: {}, - }); - }); - - it('should migrate the old version visBuilder saved object to new version VisBuilder saved object', () => { - const migratedDoc = migrate({ - type: 'visBuilder', - attributes: { - visualizationState: JSON.stringify({ - searchFields: {}, - activeVisualization: {}, - indexPattern: 'indexPatternId', - }), - version: 1, - }, - references: [], - }); - - expect(migratedDoc).toEqual({ - type: 'visBuilder', - attributes: { - visualizationState: JSON.stringify({ - searchFields: {}, - activeVisualization: {}, - }), - version: 2, - kibanaSavedObjectMeta: { - searchSourceJSON: JSON.stringify({ - indexRefName: 'kibanaSavedObjectMeta.searchSourceJSON.index', - }), - }, - }, - references: [ - { - name: 'kibanaSavedObjectMeta.searchSourceJSON.index', - type: 'index-pattern', - id: 'indexPatternId', - }, - ], - }); - }); -}); diff --git a/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.ts b/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.ts deleted file mode 100644 index c3a14575d4a4..000000000000 --- a/src/plugins/vis_builder/server/saved_objects/vis_builder_migration.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import { get, flow } from 'lodash'; -import { SavedObjectMigrationFn } from '../../../../core/server'; - -const migrateIndexPattern: SavedObjectMigrationFn = (doc) => { - try { - const visualizationStateJSON = get(doc, 'attributes.visualizationState'); - const visualizationState = JSON.parse(visualizationStateJSON); - const indexPatternId = visualizationState.indexPattern; - const indexRefName = 'kibanaSavedObjectMeta.searchSourceJSON.index'; - - if (indexPatternId && Array.isArray(doc.references)) { - const searchSourceIndex = { - indexRefName, - }; - const visualizationWithoutIndex = { - searchFields: visualizationState.searchFields, - activeVisualization: visualizationState.activeVisualization, - }; - doc.attributes.visualizationState = JSON.stringify(visualizationWithoutIndex); - - doc.references.push({ - name: indexRefName, - type: 'index-pattern', - id: indexPatternId, - }); - doc.attributes.version = 2; - - return { - ...doc, - attributes: { - ...doc.attributes, - kibanaSavedObjectMeta: { - searchSourceJSON: JSON.stringify(searchSourceIndex), - }, - }, - }; - } - return doc; - } catch (e) { - return doc; - } -}; - -// TODO: add migration to change the saved object type from wizard to visBuilder - -export const visBuilderSavedObjectTypeMigrations = { - '2.3.0': flow(migrateIndexPattern), -}; From 24364768d77121f88866a9325c47c6574f403c06 Mon Sep 17 00:00:00 2001 From: abbyhu2000 Date: Fri, 28 Oct 2022 01:00:16 +0000 Subject: [PATCH 6/7] Fix functional test Signed-off-by: abbyhu2000 --- src/plugins/vis_builder/README.md | 2 +- test/functional/apps/vis_builder/_experimental_vis.ts | 8 ++++---- test/functional/page_objects/vis_builder_page.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/vis_builder/README.md b/src/plugins/vis_builder/README.md index f0ad23a1c0c5..88b5afbda1f4 100755 --- a/src/plugins/vis_builder/README.md +++ b/src/plugins/vis_builder/README.md @@ -1,4 +1,4 @@ -# Visualization Builder +# VisBuilder An OpenSearch Dashboards plugin for a visualization experience that makes exploring data and creating visualizations much easier. It will act as an additional way to create visualizations alongside the exiting tools within the current visualizations plugin. The tool will be incremental to the visualization tools available to users in OpenSearch Dashboards today. diff --git a/test/functional/apps/vis_builder/_experimental_vis.ts b/test/functional/apps/vis_builder/_experimental_vis.ts index f9cbf393cb47..1743d4882281 100644 --- a/test/functional/apps/vis_builder/_experimental_vis.ts +++ b/test/functional/apps/vis_builder/_experimental_vis.ts @@ -19,11 +19,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.waitForVisualizationSelectPage(); // Try to find the visBuilder Vis type. - const wizardVisTypeExists = await PageObjects.visualize.hasVisType('visBuilder'); - expect(wizardVisTypeExists).to.be(true); + const visBuilderVisTypeExists = await PageObjects.visualize.hasVisType('vis-builder'); + expect(visBuilderVisTypeExists).to.be(true); // Create a new visualization - await PageObjects.visualize.clickVisType('visBuilder'); + await PageObjects.visualize.clickVisType('vis-builder'); // Check that the experimental banner is there and state that this is experimental const info = await PageObjects.visBuilder.getExperimentalInfo(); @@ -39,7 +39,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.visualize.waitForVisualizationSelectPage(); // Try to find the visBuilder Vis type. - const visBuilderVisTypeExists = await PageObjects.visualize.hasVisType('visBuilder'); + const visBuilderVisTypeExists = await PageObjects.visualize.hasVisType('vis-builder'); expect(visBuilderVisTypeExists).to.be(false); }); diff --git a/test/functional/page_objects/vis_builder_page.ts b/test/functional/page_objects/vis_builder_page.ts index e2c3c85ec319..81ad2f15fe53 100644 --- a/test/functional/page_objects/vis_builder_page.ts +++ b/test/functional/page_objects/vis_builder_page.ts @@ -23,7 +23,7 @@ export function VisBuilderPageProvider({ getService, getPageObjects }: FtrProvid }; public async navigateToCreateVisBuilder() { - await common.navigateToApp('visBuilder'); + await common.navigateToApp('vis-builder'); await header.waitUntilLoadingHasFinished(); } From 509943818de596006f6a69ff569f6d906a508f6e Mon Sep 17 00:00:00 2001 From: abbyhu2000 Date: Fri, 28 Oct 2022 16:20:59 +0000 Subject: [PATCH 7/7] Update snapshot Signed-off-by: abbyhu2000 --- .../src/errors/__snapshots__/schema_error.test.ts.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/osd-config-schema/src/errors/__snapshots__/schema_error.test.ts.snap b/packages/osd-config-schema/src/errors/__snapshots__/schema_error.test.ts.snap index 2acd5f14fb55..38f81a0cc62b 100644 --- a/packages/osd-config-schema/src/errors/__snapshots__/schema_error.test.ts.snap +++ b/packages/osd-config-schema/src/errors/__snapshots__/schema_error.test.ts.snap @@ -3,6 +3,6 @@ exports[`includes stack 1`] = ` "Error: test at new SchemaError (packages/osd-config-schema/src/errors/schema_error.ts:35:5) - at Object. (packages/osd-config-schema/src/errors/schema_error.test.ts:61:11) + at Object. (packages/osd-config-schema/src/errors/schema_error.test.ts:59:11) at new Promise ()" `;