Skip to content

Commit

Permalink
Change save object type, wizard id and name to visBuilder (opensearch…
Browse files Browse the repository at this point in the history
…-project#2673)

* Change save object type, wizard ID and Name to visBuilder

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Rename wizard in functional tests

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Finalize plugin-id and plugin-name and saved-object-type

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Change official name to VisBuilder

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Delete migration

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Fix functional test

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Update snapshot

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
  • Loading branch information
abbyhu2000 authored and AMoo-Miki committed Oct 31, 2022
1 parent 056e3bf commit bfbc166
Show file tree
Hide file tree
Showing 30 changed files with 74 additions and 232 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [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))
- [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))

### 🐛 Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@

# Set the value of this setting to true to start exploring wizard
# functionality in Visualization.
# wizard.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.
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/saved_objects/README.md
Original file line number Diff line number Diff line change
@@ -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`](../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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
4 changes: 2 additions & 2 deletions src/plugins/saved_objects_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -71,7 +71,7 @@ export interface StartDependencies {
dashboard?: DashboardStart;
visualizations?: VisualizationsStart;
discover?: DiscoverStart;
wizard?: WizardStart;
visBuilder?: VisBuilderStart;
}

export class SavedObjectsManagementPlugin
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/saved_objects_management/public/register_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const registerServices = async (
registry: ISavedObjectsManagementServiceRegistry,
getStartServices: StartServicesAccessor<StartDependencies, SavedObjectsManagementPluginStart>
) => {
const [, { dashboard, visualizations, discover, wizard }] = await getStartServices();
const [, { dashboard, visualizations, discover, visBuilder }] = await getStartServices();

if (dashboard) {
registry.register({
Expand All @@ -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,
});
}
};
4 changes: 2 additions & 2 deletions src/plugins/vis_builder/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Wizard
# 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.

## Usage

To use this plugin, navigate to:

Visualize -> Create Visualization -> Wizard
Visualize -> Create Visualization -> VisBuilder

## Add a visualization

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/vis_builder/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

export const PLUGIN_ID = 'wizard';
export const PLUGIN_NAME = 'Wizard';
export const PLUGIN_ID = 'vis-builder';
export const PLUGIN_NAME = 'VisBuilder';
export const VISUALIZE_ID = 'visualize';
export const EDIT_PATH = '/edit';
export const VIS_BUILDER_CHART_TYPE = 'VisBuilder';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { SavedObjectAttributes } from '../../../core/types';

export const VISBUILDER_SAVED_OBJECT = 'wizard';
export const VISBUILDER_SAVED_OBJECT = 'visualization-visbuilder';

export interface VisBuilderSavedObjectAttributes extends SavedObjectAttributes {
title: string;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_builder/opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "wizard",
"id": "visBuilder",
"version": "1.0.0",
"opensearchDashboardsVersion": "opensearchDashboards",
"server": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -81,7 +81,7 @@ export const getTopNavConfig = (
: i18n.translate('visBuilder.topNavMenu.saveVisualizationButtonLabel', {
defaultMessage: 'save',
}),
testId: 'wizardSaveButton',
testId: 'visBuilderSaveButton',
disableButton: !!saveDisabledReason,
tooltip: saveDisabledReason,
run: (_anchorElement) => {
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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_SAVED_OBJECT, input: { savedObjectId: id } },
});
return { id };
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export class VisBuilderEmbeddable extends Embeddable<SavedObjectEmbeddableInput,
this.timeRange = cloneDeep(this.input.timeRange);

const div = document.createElement('div');
div.className = `wizard visualize panel-content panel-content--fullWidth`;
div.className = `visBuilder visualize panel-content panel-content--fullWidth`;
node.appendChild(div);

this.node = div;
Expand All @@ -201,7 +201,7 @@ export class VisBuilderEmbeddable extends Embeddable<SavedObjectEmbeddableInput,
div.setAttribute('data-description', this.savedVisBuilder.description);
}

div.setAttribute('data-test-subj', 'wizardLoader');
div.setAttribute('data-test-subj', 'visBuilderLoader');

this.subscriptions.push(this.handler.loading$.subscribe(this.onContainerLoading));
this.subscriptions.push(this.handler.render$.subscribe(this.onContainerRender));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
VisBuilderOutput,
VISBUILDER_EMBEDDABLE,
} from './vis_builder_embeddable';
import visBuilderIcon from '../assets/wizard_icon.svg';
import visBuilderIcon from '../assets/vis_builder_icon.svg';
import {
getHttp,
getSavedVisBuilderLoader,
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/vis_builder/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
VisBuilderStart,
} from './types';
import { VisBuilderEmbeddableFactoryDefinition, VISBUILDER_EMBEDDABLE } from './embeddable';
import visBuilderIconSecondaryFill from './assets/wizard_icon_secondary_fill.svg';
import visBuilderIcon from './assets/wizard_icon.svg';
import visBuilderIconSecondaryFill from './assets/vis_builder_icon_secondary_fill.svg';
import visBuilderIcon from './assets/vis_builder_icon.svg';
import {
EDIT_PATH,
PLUGIN_ID,
Expand Down Expand Up @@ -122,15 +122,15 @@ 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',
aliasApp: PLUGIN_ID,
aliasPath: '#/',
appExtensions: {
visualizations: {
docTypes: [PLUGIN_ID],
docTypes: [VISBUILDER_SAVED_OBJECT],
toListItem: ({ id, attributes, updated_at: updatedAt }) => ({
description: attributes?.description,
editApp: PLUGIN_ID,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_builder/server/capabilities_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

export const capabilitiesProvider = () => ({
wizard: {
'visualization-visbuilder': {
// TODO: investigate which capabilities we need to provide
// createNew: true,
// createShortUrl: true,
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/vis_builder/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class VisBuilderPlugin implements Plugin<VisBuilderPluginSetup, VisBuilde
}

public setup({ capabilities, http, savedObjects }: CoreSetup) {
this.logger.debug('wizard: Setup');
this.logger.debug('vis-builder: Setup');

// Register saved object types
savedObjects.registerType(visBuilderSavedObjectType);
Expand All @@ -35,7 +35,7 @@ export class VisBuilderPlugin implements Plugin<VisBuilderPluginSetup, VisBuilde
}

public start(_core: CoreStart) {
this.logger.debug('wizard: Started');
this.logger.debug('vis-builder: Started');
return {};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -22,15 +21,15 @@ export const visBuilderSavedObjectType: SavedObjectsType = {
importableAndExportable: true,
getTitle: ({ attributes: { title } }: SavedObject<VisBuilderSavedObjectAttributes>) => 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: 'visualization-visbuilder.show',
};
},
},
migrations: visBuilderSavedObjectTypeMigrations,
migrations: {},
mappings: {
properties: {
title: {
Expand Down

This file was deleted.

Loading

0 comments on commit bfbc166

Please sign in to comment.