-
Notifications
You must be signed in to change notification settings - Fork 889
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change wizard to vis_builder in file names and paths (#2587)
Change all wizard reference in file names and paths to vis_builder Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com> Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com> (cherry picked from commit f29f734)
- Loading branch information
1 parent
9113756
commit fd7a97f
Showing
130 changed files
with
231 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
157 changes: 157 additions & 0 deletions
157
src/plugins/vis_builder/public/application/utils/get_top_nav_config.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { WizardServices } from '../../types'; | ||
import { getOnSave } from './get_top_nav_config'; | ||
import { createWizardServicesMock } from './mocks'; | ||
|
||
describe('getOnSave', () => { | ||
let savedWizardVis: any; | ||
let originatingApp: string | undefined; | ||
let visualizationIdFromUrl: string; | ||
let dispatch: any; | ||
let mockServices: jest.Mocked<WizardServices>; | ||
let onSaveProps: { | ||
newTitle: string; | ||
newCopyOnSave: boolean; | ||
isTitleDuplicateConfirmed: boolean; | ||
onTitleDuplicate: any; | ||
newDescription: string; | ||
returnToOrigin: boolean; | ||
}; | ||
|
||
beforeEach(() => { | ||
savedWizardVis = { | ||
id: '1', | ||
title: 'save wizard wiz title', | ||
description: '', | ||
visualizationState: '', | ||
styleState: '', | ||
version: 0, | ||
copyOnSave: true, | ||
searchSourceFields: {}, | ||
save: jest.fn().mockReturnValue('1'), | ||
}; | ||
originatingApp = ''; | ||
visualizationIdFromUrl = ''; | ||
dispatch = jest.fn(); | ||
mockServices = createWizardServicesMock(); | ||
|
||
onSaveProps = { | ||
newTitle: 'new title', | ||
newCopyOnSave: false, | ||
isTitleDuplicateConfirmed: false, | ||
onTitleDuplicate: jest.fn(), | ||
newDescription: 'new description', | ||
returnToOrigin: true, | ||
}; | ||
}); | ||
|
||
test('return undefined when savedWizardVis is null', async () => { | ||
savedWizardVis = null; | ||
const onSave = getOnSave( | ||
savedWizardVis, | ||
originatingApp, | ||
visualizationIdFromUrl, | ||
dispatch, | ||
mockServices | ||
); | ||
const onSaveResult = await onSave(onSaveProps); | ||
|
||
expect(onSaveResult).toBeUndefined(); | ||
}); | ||
|
||
test('savedWizardVis get saved correctly', async () => { | ||
const onSave = getOnSave( | ||
savedWizardVis, | ||
originatingApp, | ||
visualizationIdFromUrl, | ||
dispatch, | ||
mockServices | ||
); | ||
const onSaveReturn = await onSave(onSaveProps); | ||
expect(savedWizardVis).toMatchInlineSnapshot(` | ||
Object { | ||
"copyOnSave": false, | ||
"description": "new description", | ||
"id": "1", | ||
"save": [MockFunction] { | ||
"calls": Array [ | ||
Array [ | ||
Object { | ||
"confirmOverwrite": false, | ||
"isTitleDuplicateConfirmed": false, | ||
"onTitleDuplicate": [MockFunction], | ||
"returnToOrigin": true, | ||
}, | ||
], | ||
], | ||
"results": Array [ | ||
Object { | ||
"type": "return", | ||
"value": "1", | ||
}, | ||
], | ||
}, | ||
"searchSourceFields": Object {}, | ||
"styleState": "", | ||
"title": "new title", | ||
"version": 0, | ||
"visualizationState": "", | ||
} | ||
`); | ||
expect(onSaveReturn?.id).toBe('1'); | ||
}); | ||
|
||
test('savedWizardVis does not change title with a null id', async () => { | ||
savedWizardVis.save = jest.fn().mockReturnValue(null); | ||
const onSave = getOnSave( | ||
savedWizardVis, | ||
originatingApp, | ||
visualizationIdFromUrl, | ||
dispatch, | ||
mockServices | ||
); | ||
const onSaveResult = await onSave(onSaveProps); | ||
expect(savedWizardVis.title).toBe('save wizard wiz title'); | ||
expect(onSaveResult?.id).toBeNull(); | ||
}); | ||
|
||
test('create a new wizard from dashboard', async () => { | ||
savedWizardVis.id = undefined; | ||
savedWizardVis.save = jest.fn().mockReturnValue('2'); | ||
originatingApp = 'dashboard'; | ||
onSaveProps.returnToOrigin = true; | ||
|
||
const onSave = getOnSave( | ||
savedWizardVis, | ||
originatingApp, | ||
visualizationIdFromUrl, | ||
dispatch, | ||
mockServices | ||
); | ||
const onSaveResult = await onSave(onSaveProps); | ||
expect(onSaveResult?.id).toBe('2'); | ||
expect(dispatch).toBeCalledTimes(0); | ||
}); | ||
|
||
test('edit an exising wizard from dashboard', async () => { | ||
savedWizardVis.copyOnSave = false; | ||
onSaveProps.newDescription = 'new description after editing'; | ||
originatingApp = 'dashboard'; | ||
onSaveProps.returnToOrigin = true; | ||
const onSave = getOnSave( | ||
savedWizardVis, | ||
originatingApp, | ||
visualizationIdFromUrl, | ||
dispatch, | ||
mockServices | ||
); | ||
const onSaveResult = await onSave(onSaveProps); | ||
expect(onSaveResult?.id).toBe('1'); | ||
expect(mockServices.application.navigateToApp).toBeCalledTimes(1); | ||
expect(savedWizardVis.description).toBe('new description after editing'); | ||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { ScopedHistory } from '../../../../../core/public'; | ||
import { coreMock, scopedHistoryMock } from '../../../../../core/public/mocks'; | ||
import { dataPluginMock } from '../../../../data/public/mocks'; | ||
import { embeddablePluginMock } from '../../../../embeddable/public/mocks'; | ||
import { expressionsPluginMock } from '../../../../expressions/public/mocks'; | ||
import { navigationPluginMock } from '../../../../navigation/public/mocks'; | ||
import { WizardServices } from '../../types'; | ||
|
||
export const createWizardServicesMock = () => { | ||
const coreStartMock = coreMock.createStart(); | ||
const toastNotifications = coreStartMock.notifications.toasts; | ||
const applicationMock = coreStartMock.application; | ||
const i18nContextMock = coreStartMock.i18n.Context; | ||
const indexPatternMock = dataPluginMock.createStartContract().indexPatterns; | ||
const embeddableMock = embeddablePluginMock.createStartContract(); | ||
const navigationMock = navigationPluginMock.createStartContract(); | ||
const expressionMock = expressionsPluginMock.createStartContract(); | ||
|
||
const wizardServicesMock = { | ||
...coreStartMock, | ||
navigation: navigationMock, | ||
expression: expressionMock, | ||
savedWizardLoader: { | ||
get: jest.fn(), | ||
} as any, | ||
setHeaderActionMenu: () => {}, | ||
applicationMock, | ||
history: { | ||
push: jest.fn(), | ||
location: { pathname: '' }, | ||
}, | ||
toastNotifications, | ||
i18n: i18nContextMock, | ||
data: indexPatternMock, | ||
embeddable: embeddableMock, | ||
scopedHistory: (scopedHistoryMock.create() as unknown) as ScopedHistory, | ||
}; | ||
|
||
return (wizardServicesMock as unknown) as jest.Mocked<WizardServices>; | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export * from './vis_builder_embeddable'; | ||
export * from './vis_builder_embeddable_factory'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/plugins/wizard/tsconfig.json → src/plugins/vis_builder/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.