From 00b1812f722f7ceac6ced3ccd169a6b6e5440692 Mon Sep 17 00:00:00 2001 From: abbyhu2000 Date: Fri, 2 Sep 2022 22:24:38 +0000 Subject: [PATCH] change wizard doc version to 2; change migration version to 2.3.0 Signed-off-by: abbyhu2000 --- .../public/application/utils/get_top_nav_config.tsx | 9 +++++++-- .../wizard/public/saved_visualizations/_saved_vis.ts | 2 +- .../wizard/server/saved_objects/wizard_migration.test.ts | 6 ++++-- .../wizard/server/saved_objects/wizard_migration.ts | 3 ++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/plugins/wizard/public/application/utils/get_top_nav_config.tsx b/src/plugins/wizard/public/application/utils/get_top_nav_config.tsx index b9650dc2ed4b..8d83807c058f 100644 --- a/src/plugins/wizard/public/application/utils/get_top_nav_config.tsx +++ b/src/plugins/wizard/public/application/utils/get_top_nav_config.tsx @@ -57,9 +57,14 @@ export const getTopNavConfig = ( visualizationState, styleState, saveDisabledReason, - dispatch + dispatch, }: TopNavConfigParams, - { history, toastNotifications, i18n: { Context: I18nContext }, data: { indexPatterns } }: WizardServices + { + history, + toastNotifications, + i18n: { Context: I18nContext }, + data: { indexPatterns }, + }: WizardServices ) => { const topNavConfig: TopNavMenuData[] = [ { diff --git a/src/plugins/wizard/public/saved_visualizations/_saved_vis.ts b/src/plugins/wizard/public/saved_visualizations/_saved_vis.ts index 672d382ebe12..d269642bd8bc 100644 --- a/src/plugins/wizard/public/saved_visualizations/_saved_vis.ts +++ b/src/plugins/wizard/public/saved_visualizations/_saved_vis.ts @@ -44,7 +44,7 @@ export function createSavedWizardVisClass(services: SavedObjectOpenSearchDashboa description: '', visualizationState: '{}', styleState: '{}', - version: 1, + version: 2, }, }); this.showInRecentlyAccessed = true; diff --git a/src/plugins/wizard/server/saved_objects/wizard_migration.test.ts b/src/plugins/wizard/server/saved_objects/wizard_migration.test.ts index 5b598ad3bc02..0e9248e1951f 100644 --- a/src/plugins/wizard/server/saved_objects/wizard_migration.test.ts +++ b/src/plugins/wizard/server/saved_objects/wizard_migration.test.ts @@ -8,9 +8,9 @@ import { wizardSavedObjectTypeMigrations } from './wizard_migration'; const savedObjectMigrationContext = (null as unknown) as SavedObjectMigrationContext; -describe('3.0.0', () => { +describe('2.3.0', () => { const migrate = (doc: any) => - wizardSavedObjectTypeMigrations['3.0.0']( + wizardSavedObjectTypeMigrations['2.3.0']( doc as Parameters[0], savedObjectMigrationContext ); @@ -76,6 +76,7 @@ describe('3.0.0', () => { activeVisualization: {}, indexPattern: 'indexPatternId', }), + version: 1, }, references: [], }); @@ -87,6 +88,7 @@ describe('3.0.0', () => { searchFields: {}, activeVisualization: {}, }), + version: 2, kibanaSavedObjectMeta: { searchSourceJSON: JSON.stringify({ indexRefName: 'kibanaSavedObjectMeta.searchSourceJSON.index', diff --git a/src/plugins/wizard/server/saved_objects/wizard_migration.ts b/src/plugins/wizard/server/saved_objects/wizard_migration.ts index 1526a4d0211f..dcbaf8252218 100644 --- a/src/plugins/wizard/server/saved_objects/wizard_migration.ts +++ b/src/plugins/wizard/server/saved_objects/wizard_migration.ts @@ -28,6 +28,7 @@ const migrateIndexPattern: SavedObjectMigrationFn = (doc) => { type: 'index-pattern', id: indexPatternId, }); + doc.attributes.version = 2; return { ...doc, @@ -46,5 +47,5 @@ const migrateIndexPattern: SavedObjectMigrationFn = (doc) => { }; export const wizardSavedObjectTypeMigrations = { - '3.0.0': flow(migrateIndexPattern), + '2.3.0': flow(migrateIndexPattern), };