diff --git a/config/opensearch_dashboards.yml b/config/opensearch_dashboards.yml index 8c592f7f698f..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. -# 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. diff --git a/src/plugins/saved_objects/README.md b/src/plugins/saved_objects/README.md index 2ea57a3d6334..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 [`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 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 8ddbd07e3095..ec7d64ed700c 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 '../../wizard/public'; +import { VisBuilderStart } from '../../vis_builder/public'; import { ManagementSetup } from '../../management/public'; import { DataPublicPluginStart } from '../../data/public'; import { DashboardStart } from '../../dashboard/public'; @@ -76,7 +76,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/wizard/README.md b/src/plugins/vis_builder/README.md similarity index 96% rename from src/plugins/wizard/README.md rename to src/plugins/vis_builder/README.md index bb2d08fecbbb..88b5afbda1f4 100755 --- a/src/plugins/wizard/README.md +++ b/src/plugins/vis_builder/README.md @@ -1,4 +1,4 @@ -# 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. @@ -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 -> VisBuilder ## Add a visualization diff --git a/src/plugins/vis_builder/common/index.ts b/src/plugins/vis_builder/common/index.ts new file mode 100644 index 000000000000..8e50b07f7dc0 --- /dev/null +++ b/src/plugins/vis_builder/common/index.ts @@ -0,0 +1,15 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +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'; + +export { + VisBuilderSavedObjectAttributes, + VISBUILDER_SAVED_OBJECT, +} from './vis_builder_saved_object_attributes'; diff --git a/src/plugins/wizard/common/wizard_saved_object_attributes.ts b/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts similarity index 69% rename from src/plugins/wizard/common/wizard_saved_object_attributes.ts rename to src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts index bcaf0a0490f1..243e455d7157 100644 --- a/src/plugins/wizard/common/wizard_saved_object_attributes.ts +++ b/src/plugins/vis_builder/common/vis_builder_saved_object_attributes.ts @@ -5,9 +5,9 @@ import { SavedObjectAttributes } from '../../../core/types'; -export const WIZARD_SAVED_OBJECT = 'wizard'; +export const VISBUILDER_SAVED_OBJECT = 'visualization-visbuilder'; -export interface WizardSavedObjectAttributes extends SavedObjectAttributes { +export interface VisBuilderSavedObjectAttributes extends SavedObjectAttributes { title: string; description?: string; visualizationState?: string; diff --git a/src/plugins/wizard/config.ts b/src/plugins/vis_builder/config.ts similarity index 100% rename from src/plugins/wizard/config.ts rename to src/plugins/vis_builder/config.ts diff --git a/src/plugins/wizard/opensearch_dashboards.json b/src/plugins/vis_builder/opensearch_dashboards.json similarity index 95% rename from src/plugins/wizard/opensearch_dashboards.json rename to src/plugins/vis_builder/opensearch_dashboards.json index 1068a7228d18..98ef5153a9b0 100644 --- a/src/plugins/wizard/opensearch_dashboards.json +++ b/src/plugins/vis_builder/opensearch_dashboards.json @@ -1,5 +1,5 @@ { - "id": "wizard", + "id": "visBuilder", "version": "1.0.0", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, diff --git a/src/plugins/wizard/public/application/_util.scss b/src/plugins/vis_builder/public/application/_util.scss similarity index 100% rename from src/plugins/wizard/public/application/_util.scss rename to src/plugins/vis_builder/public/application/_util.scss diff --git a/src/plugins/wizard/public/application/_variables.scss b/src/plugins/vis_builder/public/application/_variables.scss similarity index 100% rename from src/plugins/wizard/public/application/_variables.scss rename to src/plugins/vis_builder/public/application/_variables.scss diff --git a/src/plugins/wizard/public/application/app.scss b/src/plugins/vis_builder/public/application/app.scss similarity index 100% rename from src/plugins/wizard/public/application/app.scss rename to src/plugins/vis_builder/public/application/app.scss diff --git a/src/plugins/wizard/public/application/app.tsx b/src/plugins/vis_builder/public/application/app.tsx similarity index 98% rename from src/plugins/wizard/public/application/app.tsx rename to src/plugins/vis_builder/public/application/app.tsx index bdf6936ee969..bd5f2be1feda 100644 --- a/src/plugins/wizard/public/application/app.tsx +++ b/src/plugins/vis_builder/public/application/app.tsx @@ -13,7 +13,7 @@ import { Workspace } from './components/workspace'; import './app.scss'; import { RightNav } from './components/right_nav'; -export const WizardApp = () => { +export const VisBuilderApp = () => { // Render the application DOM. return ( diff --git a/src/plugins/wizard/public/application/components/data_source_select.tsx b/src/plugins/vis_builder/public/application/components/data_source_select.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/data_source_select.tsx rename to src/plugins/vis_builder/public/application/components/data_source_select.tsx diff --git a/src/plugins/wizard/public/application/components/data_tab/config_panel.scss b/src/plugins/vis_builder/public/application/components/data_tab/config_panel.scss similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/config_panel.scss rename to src/plugins/vis_builder/public/application/components/data_tab/config_panel.scss diff --git a/src/plugins/wizard/public/application/components/data_tab/config_panel.tsx b/src/plugins/vis_builder/public/application/components/data_tab/config_panel.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/config_panel.tsx rename to src/plugins/vis_builder/public/application/components/data_tab/config_panel.tsx diff --git a/src/plugins/wizard/public/application/components/data_tab/dropbox.scss b/src/plugins/vis_builder/public/application/components/data_tab/dropbox.scss similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/dropbox.scss rename to src/plugins/vis_builder/public/application/components/data_tab/dropbox.scss diff --git a/src/plugins/wizard/public/application/components/data_tab/dropbox.tsx b/src/plugins/vis_builder/public/application/components/data_tab/dropbox.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/dropbox.tsx rename to src/plugins/vis_builder/public/application/components/data_tab/dropbox.tsx diff --git a/src/plugins/wizard/public/application/components/data_tab/field_search.tsx b/src/plugins/vis_builder/public/application/components/data_tab/field_search.tsx similarity index 94% rename from src/plugins/wizard/public/application/components/data_tab/field_search.tsx rename to src/plugins/vis_builder/public/application/components/data_tab/field_search.tsx index a2dec9156dba..3998e146933e 100644 --- a/src/plugins/wizard/public/application/components/data_tab/field_search.tsx +++ b/src/plugins/vis_builder/public/application/components/data_tab/field_search.tsx @@ -17,7 +17,7 @@ export interface Props { } /** - * Component is Wizard's side bar to search of available fields + * Component is VisBuilder's side bar to search of available fields * Additionally there's a button displayed that allows the user to show/hide more filter fields */ export function FieldSearch({ value }: Props) { diff --git a/src/plugins/wizard/public/application/components/data_tab/field_selector.scss b/src/plugins/vis_builder/public/application/components/data_tab/field_selector.scss similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/field_selector.scss rename to src/plugins/vis_builder/public/application/components/data_tab/field_selector.scss diff --git a/src/plugins/wizard/public/application/components/data_tab/field_selector.tsx b/src/plugins/vis_builder/public/application/components/data_tab/field_selector.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/field_selector.tsx rename to src/plugins/vis_builder/public/application/components/data_tab/field_selector.tsx diff --git a/src/plugins/wizard/public/application/components/data_tab/field_selector_field.scss b/src/plugins/vis_builder/public/application/components/data_tab/field_selector_field.scss similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/field_selector_field.scss rename to src/plugins/vis_builder/public/application/components/data_tab/field_selector_field.scss diff --git a/src/plugins/wizard/public/application/components/data_tab/field_selector_field.tsx b/src/plugins/vis_builder/public/application/components/data_tab/field_selector_field.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/field_selector_field.tsx rename to src/plugins/vis_builder/public/application/components/data_tab/field_selector_field.tsx diff --git a/src/plugins/wizard/public/application/components/data_tab/index.scss b/src/plugins/vis_builder/public/application/components/data_tab/index.scss similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/index.scss rename to src/plugins/vis_builder/public/application/components/data_tab/index.scss diff --git a/src/plugins/wizard/public/application/components/data_tab/index.tsx b/src/plugins/vis_builder/public/application/components/data_tab/index.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/index.tsx rename to src/plugins/vis_builder/public/application/components/data_tab/index.tsx diff --git a/src/plugins/wizard/public/application/components/data_tab/schema_to_dropbox.tsx b/src/plugins/vis_builder/public/application/components/data_tab/schema_to_dropbox.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/schema_to_dropbox.tsx rename to src/plugins/vis_builder/public/application/components/data_tab/schema_to_dropbox.tsx diff --git a/src/plugins/wizard/public/application/components/data_tab/secondary_panel.tsx b/src/plugins/vis_builder/public/application/components/data_tab/secondary_panel.tsx similarity index 97% rename from src/plugins/wizard/public/application/components/data_tab/secondary_panel.tsx rename to src/plugins/vis_builder/public/application/components/data_tab/secondary_panel.tsx index f7e160bb1b54..385fcda9a805 100644 --- a/src/plugins/wizard/public/application/components/data_tab/secondary_panel.tsx +++ b/src/plugins/vis_builder/public/application/components/data_tab/secondary_panel.tsx @@ -11,7 +11,7 @@ import { DefaultEditorAggParams } from '../../../../../vis_default_editor/public import { Title } from './title'; import { useIndexPatterns, useVisualizationType } from '../../utils/use'; import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public'; -import { WizardServices } from '../../../types'; +import { VisBuilderServices } from '../../../types'; import { AggParam, IAggType, IFieldParamType } from '../../../../../data/public'; import { saveDraftAgg, editDraftAgg } from '../../utils/state_management/visualization_slice'; import { setValidity } from '../../utils/state_management/metadata_slice'; @@ -33,7 +33,7 @@ export function SecondaryPanel() { search: { aggs: aggService }, }, }, - } = useOpenSearchDashboards(); + } = useOpenSearchDashboards(); const schemas = vizType.ui.containerConfig.data.schemas.all; const aggConfigs = useMemo(() => { diff --git a/src/plugins/wizard/public/application/components/data_tab/title.tsx b/src/plugins/vis_builder/public/application/components/data_tab/title.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/title.tsx rename to src/plugins/vis_builder/public/application/components/data_tab/title.tsx diff --git a/src/plugins/wizard/public/application/components/data_tab/use/index.ts b/src/plugins/vis_builder/public/application/components/data_tab/use/index.ts similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/use/index.ts rename to src/plugins/vis_builder/public/application/components/data_tab/use/index.ts diff --git a/src/plugins/wizard/public/application/components/data_tab/use/use_dropbox.tsx b/src/plugins/vis_builder/public/application/components/data_tab/use/use_dropbox.tsx similarity index 98% rename from src/plugins/wizard/public/application/components/data_tab/use/use_dropbox.tsx rename to src/plugins/vis_builder/public/application/components/data_tab/use/use_dropbox.tsx index 8229073c1b4c..87c004f0ae62 100644 --- a/src/plugins/wizard/public/application/components/data_tab/use/use_dropbox.tsx +++ b/src/plugins/vis_builder/public/application/components/data_tab/use/use_dropbox.tsx @@ -18,7 +18,7 @@ import { } from '../../../utils/state_management/visualization_slice'; import { useIndexPatterns } from '../../../utils/use/use_index_pattern'; import { useOpenSearchDashboards } from '../../../../../../opensearch_dashboards_react/public'; -import { WizardServices } from '../../../../types'; +import { VisBuilderServices } from '../../../../types'; const filterByName = propFilter('name'); const filterByType = propFilter('type'); @@ -38,7 +38,7 @@ export const useDropbox = (props: UseDropboxProps): DropboxProps => { search: { aggs: aggService }, }, }, - } = useOpenSearchDashboards(); + } = useOpenSearchDashboards(); const aggConfigParams = useTypedSelector( (state) => state.visualization.activeVisualization?.aggConfigParams ); diff --git a/src/plugins/wizard/public/application/components/data_tab/use/use_prefers_reduced_motion.ts b/src/plugins/vis_builder/public/application/components/data_tab/use/use_prefers_reduced_motion.ts similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/use/use_prefers_reduced_motion.ts rename to src/plugins/vis_builder/public/application/components/data_tab/use/use_prefers_reduced_motion.ts diff --git a/src/plugins/wizard/public/application/components/data_tab/utils/get_available_fields.ts b/src/plugins/vis_builder/public/application/components/data_tab/utils/get_available_fields.ts similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/utils/get_available_fields.ts rename to src/plugins/vis_builder/public/application/components/data_tab/utils/get_available_fields.ts diff --git a/src/plugins/wizard/public/application/components/data_tab/utils/index.ts b/src/plugins/vis_builder/public/application/components/data_tab/utils/index.ts similarity index 100% rename from src/plugins/wizard/public/application/components/data_tab/utils/index.ts rename to src/plugins/vis_builder/public/application/components/data_tab/utils/index.ts diff --git a/src/plugins/wizard/public/application/components/experimental_info.tsx b/src/plugins/vis_builder/public/application/components/experimental_info.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/experimental_info.tsx rename to src/plugins/vis_builder/public/application/components/experimental_info.tsx diff --git a/src/plugins/wizard/public/application/components/left_nav.tsx b/src/plugins/vis_builder/public/application/components/left_nav.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/left_nav.tsx rename to src/plugins/vis_builder/public/application/components/left_nav.tsx diff --git a/src/plugins/wizard/public/application/components/option.scss b/src/plugins/vis_builder/public/application/components/option.scss similarity index 100% rename from src/plugins/wizard/public/application/components/option.scss rename to src/plugins/vis_builder/public/application/components/option.scss diff --git a/src/plugins/wizard/public/application/components/option.tsx b/src/plugins/vis_builder/public/application/components/option.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/option.tsx rename to src/plugins/vis_builder/public/application/components/option.tsx diff --git a/src/plugins/wizard/public/application/components/right_nav.tsx b/src/plugins/vis_builder/public/application/components/right_nav.tsx similarity index 96% rename from src/plugins/wizard/public/application/components/right_nav.tsx rename to src/plugins/vis_builder/public/application/components/right_nav.tsx index fad0ac29f20a..d7e5586b3e94 100644 --- a/src/plugins/wizard/public/application/components/right_nav.tsx +++ b/src/plugins/vis_builder/public/application/components/right_nav.tsx @@ -16,14 +16,14 @@ import { FormattedMessage } from '@osd/i18n/react'; import { useVisualizationType } from '../utils/use'; import './side_nav.scss'; import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public'; -import { WizardServices } from '../../types'; +import { VisBuilderServices } from '../../types'; import { setActiveVisualization, useTypedDispatch } from '../utils/state_management'; export const RightNav = () => { const [newVisType, setNewVisType] = useState(); const { services: { types }, - } = useOpenSearchDashboards(); + } = useOpenSearchDashboards(); const { ui, name: activeVisName } = useVisualizationType(); const dispatch = useTypedDispatch(); const StyleSection = ui.containerConfig.style.render; diff --git a/src/plugins/wizard/public/application/components/searchable_dropdown.scss b/src/plugins/vis_builder/public/application/components/searchable_dropdown.scss similarity index 100% rename from src/plugins/wizard/public/application/components/searchable_dropdown.scss rename to src/plugins/vis_builder/public/application/components/searchable_dropdown.scss diff --git a/src/plugins/wizard/public/application/components/searchable_dropdown.tsx b/src/plugins/vis_builder/public/application/components/searchable_dropdown.tsx similarity index 100% rename from src/plugins/wizard/public/application/components/searchable_dropdown.tsx rename to src/plugins/vis_builder/public/application/components/searchable_dropdown.tsx diff --git a/src/plugins/wizard/public/application/components/side_nav.scss b/src/plugins/vis_builder/public/application/components/side_nav.scss similarity index 100% rename from src/plugins/wizard/public/application/components/side_nav.scss rename to src/plugins/vis_builder/public/application/components/side_nav.scss diff --git a/src/plugins/wizard/public/application/components/top_nav.scss b/src/plugins/vis_builder/public/application/components/top_nav.scss similarity index 100% rename from src/plugins/wizard/public/application/components/top_nav.scss rename to src/plugins/vis_builder/public/application/components/top_nav.scss diff --git a/src/plugins/wizard/public/application/components/top_nav.tsx b/src/plugins/vis_builder/public/application/components/top_nav.tsx similarity index 83% rename from src/plugins/wizard/public/application/components/top_nav.tsx rename to src/plugins/vis_builder/public/application/components/top_nav.tsx index ab23aa563e91..62d3bb78cc52 100644 --- a/src/plugins/wizard/public/application/components/top_nav.tsx +++ b/src/plugins/vis_builder/public/application/components/top_nav.tsx @@ -9,10 +9,10 @@ import { useUnmount } from 'react-use'; import { PLUGIN_ID } from '../../../common'; import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public'; import { getTopNavConfig } from '../utils/get_top_nav_config'; -import { WizardServices } from '../../types'; +import { VisBuilderServices } from '../../types'; import './top_nav.scss'; -import { useIndexPatterns, useSavedWizardVis } from '../utils/use'; +import { useIndexPatterns, useSavedVisBuilderVis } from '../utils/use'; import { useTypedSelector, useTypedDispatch } from '../utils/state_management'; import { setEditorState } from '../utils/state_management/metadata_slice'; import { useCanSave } from '../utils/use/use_can_save'; @@ -22,7 +22,7 @@ import { TopNavMenuData } from '../../../../navigation/public'; export const TopNav = () => { // id will only be set for the edit route const { id: visualizationIdFromUrl } = useParams<{ id: string }>(); - const { services } = useOpenSearchDashboards(); + const { services } = useOpenSearchDashboards(); const { setHeaderActionMenu, navigation: { @@ -33,18 +33,18 @@ export const TopNav = () => { const dispatch = useTypedDispatch(); const saveDisabledReason = useCanSave(); - const savedWizardVis = useSavedWizardVis(visualizationIdFromUrl); + const savedVisBuilderVis = useSavedVisBuilderVis(visualizationIdFromUrl); const { selected: indexPattern } = useIndexPatterns(); const [config, setConfig] = useState(); useEffect(() => { const getConfig = () => { - if (!savedWizardVis || !indexPattern) return; + if (!savedVisBuilderVis || !indexPattern) return; return getTopNavConfig( { visualizationIdFromUrl, - savedWizardVis: saveStateToSavedObject(savedWizardVis, rootState, indexPattern), + savedVisBuilderVis: saveStateToSavedObject(savedVisBuilderVis, rootState, indexPattern), saveDisabledReason, dispatch, }, @@ -55,7 +55,7 @@ export const TopNav = () => { setConfig(getConfig()); }, [ rootState, - savedWizardVis, + savedVisBuilderVis, services, visualizationIdFromUrl, saveDisabledReason, diff --git a/src/plugins/wizard/public/application/components/workspace.scss b/src/plugins/vis_builder/public/application/components/workspace.scss similarity index 100% rename from src/plugins/wizard/public/application/components/workspace.scss rename to src/plugins/vis_builder/public/application/components/workspace.scss diff --git a/src/plugins/wizard/public/application/components/workspace.tsx b/src/plugins/vis_builder/public/application/components/workspace.tsx similarity index 97% rename from src/plugins/wizard/public/application/components/workspace.tsx rename to src/plugins/vis_builder/public/application/components/workspace.tsx index 470e9c05dbb8..6aa5af5132a4 100644 --- a/src/plugins/wizard/public/application/components/workspace.tsx +++ b/src/plugins/vis_builder/public/application/components/workspace.tsx @@ -7,7 +7,7 @@ import { EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, EuiIcon, EuiPanel } from '@e import React, { FC, useState, useMemo, useEffect, useLayoutEffect } from 'react'; import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public'; import { IExpressionLoaderParams } from '../../../../expressions/public'; -import { WizardServices } from '../../types'; +import { VisBuilderServices } from '../../types'; import { validateSchemaState } from '../utils/validate_schema_state'; import { useTypedSelector } from '../utils/state_management'; import { useVisualizationType } from '../utils/use'; @@ -26,7 +26,7 @@ export const Workspace: FC = ({ children }) => { notifications: { toasts }, data, }, - } = useOpenSearchDashboards(); + } = useOpenSearchDashboards(); const { toExpression, ui } = useVisualizationType(); const [expression, setExpression] = useState(); const [searchContext, setSearchContext] = useState({ diff --git a/src/plugins/wizard/public/application/index.tsx b/src/plugins/vis_builder/public/application/index.tsx similarity index 87% rename from src/plugins/wizard/public/application/index.tsx rename to src/plugins/vis_builder/public/application/index.tsx index 28ee13a80bf6..89a67648a7dd 100644 --- a/src/plugins/wizard/public/application/index.tsx +++ b/src/plugins/vis_builder/public/application/index.tsx @@ -9,14 +9,14 @@ import { Router, Route, Switch } from 'react-router-dom'; import { Provider as ReduxProvider } from 'react-redux'; import { Store } from 'redux'; import { AppMountParameters } from '../../../../core/public'; -import { WizardServices } from '../types'; -import { WizardApp } from './app'; +import { VisBuilderServices } from '../types'; +import { VisBuilderApp } from './app'; import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public'; import { EDIT_PATH } from '../../common'; export const renderApp = ( { element, history }: AppMountParameters, - services: WizardServices, + services: VisBuilderServices, store: Store ) => { ReactDOM.render( @@ -26,7 +26,7 @@ export const renderApp = ( - + diff --git a/src/plugins/wizard/public/application/utils/breadcrumbs.ts b/src/plugins/vis_builder/public/application/utils/breadcrumbs.ts similarity index 100% rename from src/plugins/wizard/public/application/utils/breadcrumbs.ts rename to src/plugins/vis_builder/public/application/utils/breadcrumbs.ts diff --git a/src/plugins/wizard/public/application/utils/drag_drop/drag_drop_context.tsx b/src/plugins/vis_builder/public/application/utils/drag_drop/drag_drop_context.tsx similarity index 100% rename from src/plugins/wizard/public/application/utils/drag_drop/drag_drop_context.tsx rename to src/plugins/vis_builder/public/application/utils/drag_drop/drag_drop_context.tsx diff --git a/src/plugins/wizard/public/application/utils/drag_drop/index.ts b/src/plugins/vis_builder/public/application/utils/drag_drop/index.ts similarity index 100% rename from src/plugins/wizard/public/application/utils/drag_drop/index.ts rename to src/plugins/vis_builder/public/application/utils/drag_drop/index.ts diff --git a/src/plugins/wizard/public/application/utils/drag_drop/types.ts b/src/plugins/vis_builder/public/application/utils/drag_drop/types.ts similarity index 100% rename from src/plugins/wizard/public/application/utils/drag_drop/types.ts rename to src/plugins/vis_builder/public/application/utils/drag_drop/types.ts diff --git a/src/plugins/vis_builder/public/application/utils/get_saved_vis_builder_vis.ts b/src/plugins/vis_builder/public/application/utils/get_saved_vis_builder_vis.ts new file mode 100644 index 000000000000..6e4551e67e5d --- /dev/null +++ b/src/plugins/vis_builder/public/application/utils/get_saved_vis_builder_vis.ts @@ -0,0 +1,19 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { VisBuilderServices } from '../..'; + +export const getSavedVisBuilderVis = async ( + services: VisBuilderServices, + visBuilderVisId?: string +) => { + const { savedVisBuilderLoader } = services; + if (!savedVisBuilderLoader) { + return {}; + } + const savedVisBuilderVis = await savedVisBuilderLoader.get(visBuilderVisId); + + return savedVisBuilderVis; +}; diff --git a/src/plugins/wizard/public/application/utils/get_top_nav_config.test.tsx b/src/plugins/vis_builder/public/application/utils/get_top_nav_config.test.tsx similarity index 72% rename from src/plugins/wizard/public/application/utils/get_top_nav_config.test.tsx rename to src/plugins/vis_builder/public/application/utils/get_top_nav_config.test.tsx index 3928858d08e8..353b9d90e1ff 100644 --- a/src/plugins/wizard/public/application/utils/get_top_nav_config.test.tsx +++ b/src/plugins/vis_builder/public/application/utils/get_top_nav_config.test.tsx @@ -3,16 +3,16 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { WizardServices } from '../../types'; +import { VisBuilderServices } from '../../types'; import { getOnSave } from './get_top_nav_config'; -import { createWizardServicesMock } from './mocks'; +import { createVisBuilderServicesMock } from './mocks'; describe('getOnSave', () => { - let savedWizardVis: any; + let savedVisBuilderVis: any; let originatingApp: string | undefined; let visualizationIdFromUrl: string; let dispatch: any; - let mockServices: jest.Mocked; + let mockServices: jest.Mocked; let onSaveProps: { newTitle: string; newCopyOnSave: boolean; @@ -23,9 +23,9 @@ describe('getOnSave', () => { }; beforeEach(() => { - savedWizardVis = { + savedVisBuilderVis = { id: '1', - title: 'save wizard wiz title', + title: 'save visBuilder wiz title', description: '', visualizationState: '', styleState: '', @@ -37,7 +37,7 @@ describe('getOnSave', () => { originatingApp = ''; visualizationIdFromUrl = ''; dispatch = jest.fn(); - mockServices = createWizardServicesMock(); + mockServices = createVisBuilderServicesMock(); onSaveProps = { newTitle: 'new title', @@ -49,10 +49,10 @@ describe('getOnSave', () => { }; }); - test('return undefined when savedWizardVis is null', async () => { - savedWizardVis = null; + test('return undefined when savedVisBuilderVis is null', async () => { + savedVisBuilderVis = null; const onSave = getOnSave( - savedWizardVis, + savedVisBuilderVis, originatingApp, visualizationIdFromUrl, dispatch, @@ -63,16 +63,16 @@ describe('getOnSave', () => { expect(onSaveResult).toBeUndefined(); }); - test('savedWizardVis get saved correctly', async () => { + test('savedVisBuilderVis get saved correctly', async () => { const onSave = getOnSave( - savedWizardVis, + savedVisBuilderVis, originatingApp, visualizationIdFromUrl, dispatch, mockServices ); const onSaveReturn = await onSave(onSaveProps); - expect(savedWizardVis).toMatchInlineSnapshot(` + expect(savedVisBuilderVis).toMatchInlineSnapshot(` Object { "copyOnSave": false, "description": "new description", @@ -105,28 +105,28 @@ describe('getOnSave', () => { expect(onSaveReturn?.id).toBe('1'); }); - test('savedWizardVis does not change title with a null id', async () => { - savedWizardVis.save = jest.fn().mockReturnValue(null); + test('savedVisBuilderVis does not change title with a null id', async () => { + savedVisBuilderVis.save = jest.fn().mockReturnValue(null); const onSave = getOnSave( - savedWizardVis, + savedVisBuilderVis, originatingApp, visualizationIdFromUrl, dispatch, mockServices ); const onSaveResult = await onSave(onSaveProps); - expect(savedWizardVis.title).toBe('save wizard wiz title'); + expect(savedVisBuilderVis.title).toBe('save visBuilder wiz title'); expect(onSaveResult?.id).toBeNull(); }); - test('create a new wizard from dashboard', async () => { - savedWizardVis.id = undefined; - savedWizardVis.save = jest.fn().mockReturnValue('2'); + test('create a new visBuilder from dashboard', async () => { + savedVisBuilderVis.id = undefined; + savedVisBuilderVis.save = jest.fn().mockReturnValue('2'); originatingApp = 'dashboard'; onSaveProps.returnToOrigin = true; const onSave = getOnSave( - savedWizardVis, + savedVisBuilderVis, originatingApp, visualizationIdFromUrl, dispatch, @@ -137,13 +137,13 @@ describe('getOnSave', () => { expect(dispatch).toBeCalledTimes(0); }); - test('edit an exising wizard from dashboard', async () => { - savedWizardVis.copyOnSave = false; + test('edit an exising visBuilder from dashboard', async () => { + savedVisBuilderVis.copyOnSave = false; onSaveProps.newDescription = 'new description after editing'; originatingApp = 'dashboard'; onSaveProps.returnToOrigin = true; const onSave = getOnSave( - savedWizardVis, + savedVisBuilderVis, originatingApp, visualizationIdFromUrl, dispatch, @@ -152,6 +152,6 @@ describe('getOnSave', () => { const onSaveResult = await onSave(onSaveProps); expect(onSaveResult?.id).toBe('1'); expect(mockServices.application.navigateToApp).toBeCalledTimes(1); - expect(savedWizardVis.description).toBe('new description after editing'); + expect(savedVisBuilderVis.description).toBe('new description after editing'); }); }); diff --git a/src/plugins/wizard/public/application/utils/get_top_nav_config.tsx b/src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx similarity index 77% rename from src/plugins/wizard/public/application/utils/get_top_nav_config.tsx rename to src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx index fcf5a20f7dbf..c88bb13f3cb3 100644 --- a/src/plugins/wizard/public/application/utils/get_top_nav_config.tsx +++ b/src/plugins/vis_builder/public/application/utils/get_top_nav_config.tsx @@ -36,21 +36,21 @@ import { SavedObjectSaveOpts, showSaveModal, } from '../../../../saved_objects/public'; -import { WizardServices } from '../..'; -import { WizardVisSavedObject } from '../../types'; +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; - savedWizardVis: WizardVisSavedObject; + savedVisBuilderVis: VisBuilderVisSavedObject; saveDisabledReason?: string; dispatch: AppDispatch; } export const getTopNavConfig = ( - { visualizationIdFromUrl, savedWizardVis, saveDisabledReason, dispatch }: TopNavConfigParams, - services: WizardServices + { visualizationIdFromUrl, savedVisBuilderVis, saveDisabledReason, dispatch }: TopNavConfigParams, + services: VisBuilderServices ) => { const { i18n: { Context: I18nContext }, @@ -67,35 +67,35 @@ export const getTopNavConfig = ( const topNavConfig: TopNavMenuData[] = [ { id: 'save', - iconType: savedWizardVis?.id && originatingApp ? undefined : ('save' as const), - emphasize: savedWizardVis && !savedWizardVis.id, + iconType: savedVisBuilderVis?.id && originatingApp ? undefined : ('save' as const), + emphasize: savedVisBuilderVis && !savedVisBuilderVis.id, description: i18n.translate('visBuilder.topNavMenu.saveVisualizationButtonAriaLabel', { defaultMessage: 'Save Visualization', }), - className: savedWizardVis?.id && originatingApp ? 'saveAsButton' : '', + className: savedVisBuilderVis?.id && originatingApp ? 'saveAsButton' : '', label: - savedWizardVis?.id && originatingApp + savedVisBuilderVis?.id && originatingApp ? i18n.translate('visBuilder.topNavMenu.saveVisualizationAsButtonLabel', { defaultMessage: 'save as', }) : i18n.translate('visBuilder.topNavMenu.saveVisualizationButtonLabel', { defaultMessage: 'save', }), - testId: 'wizardSaveButton', + testId: 'visBuilderSaveButton', disableButton: !!saveDisabledReason, tooltip: saveDisabledReason, run: (_anchorElement) => { const saveModal = ( {}} originatingApp={originatingApp} getAppNameFromId={stateTransfer.getAppNameFromId} @@ -105,7 +105,7 @@ export const getTopNavConfig = ( showSaveModal(saveModal, I18nContext); }, }, - ...(originatingApp && ((savedWizardVis && savedWizardVis.id) || embeddableId) + ...(originatingApp && ((savedVisBuilderVis && savedVisBuilderVis.id) || embeddableId) ? [ { id: 'saveAndReturn', @@ -117,23 +117,23 @@ export const getTopNavConfig = ( description: i18n.translate( 'visBuilder.topNavMenu.saveAndReturnVisualizationButtonAriaLabel', { - defaultMessage: 'Finish editing wizard and return to the last app', + defaultMessage: 'Finish editing visBuilder and return to the last app', } ), - testId: 'wizardsaveAndReturnButton', + testId: 'visBuilderSaveAndReturnButton', disableButton: !!saveDisabledReason, tooltip: saveDisabledReason, run: async () => { const saveOptions = { - newTitle: savedWizardVis.title, + newTitle: savedVisBuilderVis.title, newCopyOnSave: false, isTitleDuplicateConfirmed: false, - newDescription: savedWizardVis.description, + newDescription: savedVisBuilderVis.description, returnToOrigin: true, }; const onSave = getOnSave( - savedWizardVis, + savedVisBuilderVis, originatingApp, visualizationIdFromUrl, dispatch, @@ -151,7 +151,7 @@ export const getTopNavConfig = ( }; export const getOnSave = ( - savedWizardVis, + savedVisBuilderVis, originatingApp, visualizationIdFromUrl, dispatch, @@ -173,18 +173,18 @@ export const getOnSave = ( const { embeddable, toastNotifications, application, history } = services; const stateTransfer = embeddable.getStateTransfer(); - if (!savedWizardVis) { + if (!savedVisBuilderVis) { return; } - const currentTitle = savedWizardVis.title; - savedWizardVis.title = newTitle; - savedWizardVis.description = newDescription; - savedWizardVis.copyOnSave = newCopyOnSave; - const newlyCreated = !savedWizardVis.id || savedWizardVis.copyOnSave; + const currentTitle = savedVisBuilderVis.title; + savedVisBuilderVis.title = newTitle; + savedVisBuilderVis.description = newDescription; + savedVisBuilderVis.copyOnSave = newCopyOnSave; + const newlyCreated = !savedVisBuilderVis.id || savedVisBuilderVis.copyOnSave; try { - const id = await savedWizardVis.save({ + const id = await savedVisBuilderVis.save({ confirmOverwrite: false, isTitleDuplicateConfirmed, onTitleDuplicate, @@ -196,22 +196,22 @@ export const getOnSave = ( title: i18n.translate('visBuilder.topNavMenu.saveVisualization.successNotificationText', { defaultMessage: `Saved '{visTitle}'`, values: { - visTitle: savedWizardVis.title, + visTitle: savedVisBuilderVis.title, }, }), 'data-test-subj': 'saveVisualizationSuccess', }); if (originatingApp && returnToOrigin) { - // create or edit wizard directly from another app, such as `dashboard` + // create or edit visBuilder directly from another app, such as `dashboard` 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 { - // update an existing wizard from another app + // update an existing visBuilder from another app application.navigateToApp(originatingApp); } } @@ -226,7 +226,7 @@ export const getOnSave = ( dispatch(setEditorState({ state: 'clean' })); } else { // reset title if save not successful - savedWizardVis.title = currentTitle; + savedVisBuilderVis.title = currentTitle; } // Even if id='', which it will be for a duplicate title warning, we still want to return it, to avoid closing the modal @@ -247,7 +247,7 @@ export const getOnSave = ( }); // reset title if save not successful - savedWizardVis.title = currentTitle; + savedVisBuilderVis.title = currentTitle; return { error }; } }; diff --git a/src/plugins/wizard/public/application/utils/mocks.ts b/src/plugins/vis_builder/public/application/utils/mocks.ts similarity index 85% rename from src/plugins/wizard/public/application/utils/mocks.ts rename to src/plugins/vis_builder/public/application/utils/mocks.ts index 3898b3121164..df0687efaa6b 100644 --- a/src/plugins/wizard/public/application/utils/mocks.ts +++ b/src/plugins/vis_builder/public/application/utils/mocks.ts @@ -9,9 +9,9 @@ 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'; +import { VisBuilderServices } from '../../types'; -export const createWizardServicesMock = () => { +export const createVisBuilderServicesMock = () => { const coreStartMock = coreMock.createStart(); const toastNotifications = coreStartMock.notifications.toasts; const applicationMock = coreStartMock.application; @@ -21,11 +21,11 @@ export const createWizardServicesMock = () => { const navigationMock = navigationPluginMock.createStartContract(); const expressionMock = expressionsPluginMock.createStartContract(); - const wizardServicesMock = { + const visBuilderServicesMock = { ...coreStartMock, navigation: navigationMock, expression: expressionMock, - savedWizardLoader: { + savedVisBuilderLoader: { get: jest.fn(), } as any, setHeaderActionMenu: () => {}, @@ -41,5 +41,5 @@ export const createWizardServicesMock = () => { scopedHistory: (scopedHistoryMock.create() as unknown) as ScopedHistory, }; - return (wizardServicesMock as unknown) as jest.Mocked; + return (visBuilderServicesMock as unknown) as jest.Mocked; }; diff --git a/src/plugins/wizard/public/application/utils/schema.json b/src/plugins/vis_builder/public/application/utils/schema.json similarity index 100% rename from src/plugins/wizard/public/application/utils/schema.json rename to src/plugins/vis_builder/public/application/utils/schema.json diff --git a/src/plugins/wizard/public/application/utils/state_management/hooks.ts b/src/plugins/vis_builder/public/application/utils/state_management/hooks.ts similarity index 100% rename from src/plugins/wizard/public/application/utils/state_management/hooks.ts rename to src/plugins/vis_builder/public/application/utils/state_management/hooks.ts diff --git a/src/plugins/wizard/public/application/utils/state_management/index.ts b/src/plugins/vis_builder/public/application/utils/state_management/index.ts similarity index 100% rename from src/plugins/wizard/public/application/utils/state_management/index.ts rename to src/plugins/vis_builder/public/application/utils/state_management/index.ts diff --git a/src/plugins/wizard/public/application/utils/state_management/metadata_slice.ts b/src/plugins/vis_builder/public/application/utils/state_management/metadata_slice.ts similarity index 89% rename from src/plugins/wizard/public/application/utils/state_management/metadata_slice.ts rename to src/plugins/vis_builder/public/application/utils/state_management/metadata_slice.ts index a7be76061620..8cc71804f12e 100644 --- a/src/plugins/wizard/public/application/utils/state_management/metadata_slice.ts +++ b/src/plugins/vis_builder/public/application/utils/state_management/metadata_slice.ts @@ -4,10 +4,10 @@ */ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { WizardServices } from '../../../types'; +import { VisBuilderServices } from '../../../types'; /* - * Initial state: default state when opening wizard plugin + * Initial state: default state when opening visBuilder plugin * Clean state: when viz finished loading and ready to be edited * Dirty state: when there are changes applied to the viz after it finished loading */ @@ -33,7 +33,7 @@ const initialState: MetadataState = { export const getPreloadedState = async ({ types, data, -}: WizardServices): Promise => { +}: VisBuilderServices): Promise => { const preloadedState = { ...initialState }; return preloadedState; diff --git a/src/plugins/wizard/public/application/utils/state_management/preload.ts b/src/plugins/vis_builder/public/application/utils/state_management/preload.ts similarity index 91% rename from src/plugins/wizard/public/application/utils/state_management/preload.ts rename to src/plugins/vis_builder/public/application/utils/state_management/preload.ts index 1d96608e33cc..43aa2e7b8ede 100644 --- a/src/plugins/wizard/public/application/utils/state_management/preload.ts +++ b/src/plugins/vis_builder/public/application/utils/state_management/preload.ts @@ -4,14 +4,14 @@ */ import { PreloadedState } from '@reduxjs/toolkit'; -import { WizardServices } from '../../..'; +import { VisBuilderServices } from '../../..'; import { getPreloadedState as getPreloadedStyleState } from './style_slice'; import { getPreloadedState as getPreloadedVisualizationState } from './visualization_slice'; import { getPreloadedState as getPreloadedMetadataState } from './metadata_slice'; import { RootState } from './store'; export const getPreloadedState = async ( - services: WizardServices + services: VisBuilderServices ): Promise> => { const styleState = await getPreloadedStyleState(services); const visualizationState = await getPreloadedVisualizationState(services); diff --git a/src/plugins/wizard/public/application/utils/state_management/shared_actions.ts b/src/plugins/vis_builder/public/application/utils/state_management/shared_actions.ts similarity index 100% rename from src/plugins/wizard/public/application/utils/state_management/shared_actions.ts rename to src/plugins/vis_builder/public/application/utils/state_management/shared_actions.ts diff --git a/src/plugins/wizard/public/application/utils/state_management/store.ts b/src/plugins/vis_builder/public/application/utils/state_management/store.ts similarity index 95% rename from src/plugins/wizard/public/application/utils/state_management/store.ts rename to src/plugins/vis_builder/public/application/utils/state_management/store.ts index 1610b3333062..34f777e59508 100644 --- a/src/plugins/wizard/public/application/utils/state_management/store.ts +++ b/src/plugins/vis_builder/public/application/utils/state_management/store.ts @@ -7,7 +7,7 @@ import { combineReducers, configureStore, PreloadedState } from '@reduxjs/toolki import { reducer as styleReducer } from './style_slice'; import { reducer as visualizationReducer } from './visualization_slice'; import { reducer as metadataReducer } from './metadata_slice'; -import { WizardServices } from '../../..'; +import { VisBuilderServices } from '../../..'; import { getPreloadedState } from './preload'; import { setEditorState } from './metadata_slice'; @@ -24,7 +24,7 @@ export const configurePreloadedStore = (preloadedState: PreloadedState { +export const getPreloadedStore = async (services: VisBuilderServices) => { const preloadedState = await getPreloadedState(services); const store = configurePreloadedStore(preloadedState); diff --git a/src/plugins/wizard/public/application/utils/state_management/style_slice.ts b/src/plugins/vis_builder/public/application/utils/state_management/style_slice.ts similarity index 89% rename from src/plugins/wizard/public/application/utils/state_management/style_slice.ts rename to src/plugins/vis_builder/public/application/utils/state_management/style_slice.ts index 9fb0cdedb763..fe4e246ac528 100644 --- a/src/plugins/wizard/public/application/utils/state_management/style_slice.ts +++ b/src/plugins/vis_builder/public/application/utils/state_management/style_slice.ts @@ -4,14 +4,17 @@ */ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { WizardServices } from '../../../types'; +import { VisBuilderServices } from '../../../types'; import { setActiveVisualization } from './shared_actions'; export type StyleState = T; const initialState = {} as StyleState; -export const getPreloadedState = async ({ types, data }: WizardServices): Promise => { +export const getPreloadedState = async ({ + types, + data, +}: VisBuilderServices): Promise => { let preloadedState = initialState; const defaultVisualization = types.all()[0]; diff --git a/src/plugins/wizard/public/application/utils/state_management/visualization_slice.ts b/src/plugins/vis_builder/public/application/utils/state_management/visualization_slice.ts similarity index 96% rename from src/plugins/wizard/public/application/utils/state_management/visualization_slice.ts rename to src/plugins/vis_builder/public/application/utils/state_management/visualization_slice.ts index cbb6c76a0758..47e7e1fb12e7 100644 --- a/src/plugins/wizard/public/application/utils/state_management/visualization_slice.ts +++ b/src/plugins/vis_builder/public/application/utils/state_management/visualization_slice.ts @@ -5,7 +5,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { CreateAggConfigParams } from '../../../../../data/common'; -import { WizardServices } from '../../../types'; +import { VisBuilderServices } from '../../../types'; import { setActiveVisualization } from './shared_actions'; export interface VisualizationState { @@ -25,7 +25,7 @@ const initialState: VisualizationState = { export const getPreloadedState = async ({ types, data, -}: WizardServices): Promise => { +}: VisBuilderServices): Promise => { const preloadedState = { ...initialState }; const defaultVisualization = types.all()[0]; diff --git a/src/plugins/wizard/public/application/utils/use/index.ts b/src/plugins/vis_builder/public/application/utils/use/index.ts similarity index 74% rename from src/plugins/wizard/public/application/utils/use/index.ts rename to src/plugins/vis_builder/public/application/utils/use/index.ts index e8d1087ce0a0..138285148d43 100644 --- a/src/plugins/wizard/public/application/utils/use/index.ts +++ b/src/plugins/vis_builder/public/application/utils/use/index.ts @@ -5,4 +5,4 @@ export { useVisualizationType } from './use_visualization_type'; export { useIndexPatterns } from './use_index_pattern'; -export { useSavedWizardVis } from './use_saved_wizard_vis'; +export { useSavedVisBuilderVis } from './use_saved_vis_builder_vis'; diff --git a/src/plugins/wizard/public/application/utils/use/use_can_save.ts b/src/plugins/vis_builder/public/application/utils/use/use_can_save.ts similarity index 100% rename from src/plugins/wizard/public/application/utils/use/use_can_save.ts rename to src/plugins/vis_builder/public/application/utils/use/use_can_save.ts diff --git a/src/plugins/wizard/public/application/utils/use/use_index_pattern.tsx b/src/plugins/vis_builder/public/application/utils/use/use_index_pattern.tsx similarity index 93% rename from src/plugins/wizard/public/application/utils/use/use_index_pattern.tsx rename to src/plugins/vis_builder/public/application/utils/use/use_index_pattern.tsx index b66c902302ef..0ce64a36b2ba 100644 --- a/src/plugins/wizard/public/application/utils/use/use_index_pattern.tsx +++ b/src/plugins/vis_builder/public/application/utils/use/use_index_pattern.tsx @@ -5,7 +5,7 @@ import { useEffect, useState } from 'react'; import { IndexPattern } from '../../../../../data/public'; import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public'; -import { WizardServices } from '../../../types'; +import { VisBuilderServices } from '../../../types'; import { useTypedSelector } from '../state_management'; export const useIndexPatterns = () => { @@ -15,7 +15,7 @@ export const useIndexPatterns = () => { const [error, setError] = useState(undefined); const { services: { data }, - } = useOpenSearchDashboards(); + } = useOpenSearchDashboards(); let foundSelected: IndexPattern | undefined; if (!loading && !error) { diff --git a/src/plugins/wizard/public/application/utils/use/use_saved_wizard_vis.ts b/src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts similarity index 70% rename from src/plugins/wizard/public/application/utils/use/use_saved_wizard_vis.ts rename to src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts index 36ed26b15d04..d7840b92f8ad 100644 --- a/src/plugins/wizard/public/application/utils/use/use_saved_wizard_vis.ts +++ b/src/plugins/vis_builder/public/application/utils/use/use_saved_vis_builder_vis.ts @@ -12,10 +12,10 @@ import { SavedObjectNotFound, } from '../../../../../opensearch_dashboards_utils/public'; import { EDIT_PATH, PLUGIN_ID } from '../../../../common'; -import { WizardServices } from '../../../types'; +import { VisBuilderServices } from '../../../types'; import { MetricOptionsDefaults } from '../../../visualizations/metric/metric_viz_type'; import { getCreateBreadcrumbs, getEditBreadcrumbs } from '../breadcrumbs'; -import { getSavedWizardVis } from '../get_saved_wizard_vis'; +import { getSavedVisBuilderVis } from '../get_saved_vis_builder_vis'; import { useTypedDispatch, setStyleState, @@ -24,12 +24,12 @@ import { } from '../state_management'; import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public'; import { setEditorState } from '../state_management/metadata_slice'; -import { validateWizardState } from '../wizard_state_validation'; +import { validateVisBuilderState } from '../vis_builder_state_validation'; // This function can be used when instantiating a saved vis or creating a new one // using url parameters, embedding and destroying it in DOM -export const useSavedWizardVis = (visualizationIdFromUrl: string | undefined) => { - const { services } = useOpenSearchDashboards(); +export const useSavedVisBuilderVis = (visualizationIdFromUrl: string | undefined) => { + const { services } = useOpenSearchDashboards(); const [savedVisState, setSavedVisState] = useState(undefined); const dispatch = useTypedDispatch(); @@ -49,27 +49,30 @@ export const useSavedWizardVis = (visualizationIdFromUrl: string | undefined) => text: message, }); }; - const loadSavedWizardVis = async () => { + const loadSavedVisBuilderVis = async () => { try { - const savedWizardVis = await getSavedWizardVis(services, visualizationIdFromUrl); + const savedVisBuilderVis = await getSavedVisBuilderVis(services, visualizationIdFromUrl); - if (savedWizardVis.id) { - chrome.setBreadcrumbs(getEditBreadcrumbs(savedWizardVis.title, navigateToApp)); - chrome.docTitle.change(savedWizardVis.title); + if (savedVisBuilderVis.id) { + chrome.setBreadcrumbs(getEditBreadcrumbs(savedVisBuilderVis.title, navigateToApp)); + chrome.docTitle.change(savedVisBuilderVis.title); } else { chrome.setBreadcrumbs(getCreateBreadcrumbs(navigateToApp)); } - if (savedWizardVis.styleState !== '{}' && savedWizardVis.visualizationState !== '{}') { - const styleState = JSON.parse(savedWizardVis.styleState); - const vizStateWithoutIndex = JSON.parse(savedWizardVis.visualizationState); + if ( + savedVisBuilderVis.styleState !== '{}' && + savedVisBuilderVis.visualizationState !== '{}' + ) { + const styleState = JSON.parse(savedVisBuilderVis.styleState); + const vizStateWithoutIndex = JSON.parse(savedVisBuilderVis.visualizationState); const visualizationState: VisualizationState = { searchField: vizStateWithoutIndex.searchField, activeVisualization: vizStateWithoutIndex.activeVisualization, - indexPattern: savedWizardVis.searchSourceFields.index, + indexPattern: savedVisBuilderVis.searchSourceFields.index, }; - const validateResult = validateWizardState({ styleState, visualizationState }); + const validateResult = validateVisBuilderState({ styleState, visualizationState }); if (!validateResult.valid) { const err = validateResult.errors; if (err) { @@ -82,13 +85,13 @@ export const useSavedWizardVis = (visualizationIdFromUrl: string | undefined) => dispatch(setVisualizationState(visualizationState)); } - setSavedVisState(savedWizardVis); + setSavedVisState(savedVisBuilderVis); dispatch(setEditorState({ state: 'clean' })); } catch (error) { const managementRedirectTarget = { [PLUGIN_ID]: { app: 'management', - path: `opensearch-dashboards/objects/savedWizard/${visualizationIdFromUrl}`, + path: `opensearch-dashboards/objects/savedVisBuilder/${visualizationIdFromUrl}`, }, }; @@ -113,7 +116,7 @@ export const useSavedWizardVis = (visualizationIdFromUrl: string | undefined) => } }; - loadSavedWizardVis(); + loadSavedVisBuilderVis(); }, [dispatch, services, visualizationIdFromUrl]); return savedVisState; diff --git a/src/plugins/wizard/public/application/utils/use/use_visualization_type.ts b/src/plugins/vis_builder/public/application/utils/use/use_visualization_type.ts similarity index 87% rename from src/plugins/wizard/public/application/utils/use/use_visualization_type.ts rename to src/plugins/vis_builder/public/application/utils/use/use_visualization_type.ts index 002c83759b3c..2785f51a924d 100644 --- a/src/plugins/wizard/public/application/utils/use/use_visualization_type.ts +++ b/src/plugins/vis_builder/public/application/utils/use/use_visualization_type.ts @@ -5,14 +5,14 @@ import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public'; import { VisualizationType } from '../../../services/type_service/visualization_type'; -import { WizardServices } from '../../../types'; +import { VisBuilderServices } from '../../../types'; import { useTypedSelector } from '../state_management'; export const useVisualizationType = (): VisualizationType => { const { activeVisualization } = useTypedSelector((state) => state.visualization); const { services: { types }, - } = useOpenSearchDashboards(); + } = useOpenSearchDashboards(); const visualizationType = types.get(activeVisualization?.name ?? ''); diff --git a/src/plugins/wizard/public/application/utils/validate_schema_state.ts b/src/plugins/vis_builder/public/application/utils/validate_schema_state.ts similarity index 100% rename from src/plugins/wizard/public/application/utils/validate_schema_state.ts rename to src/plugins/vis_builder/public/application/utils/validate_schema_state.ts diff --git a/src/plugins/wizard/public/application/utils/wizard_state_validation.test.ts b/src/plugins/vis_builder/public/application/utils/vis_builder_state_validation.test.ts similarity index 77% rename from src/plugins/wizard/public/application/utils/wizard_state_validation.test.ts rename to src/plugins/vis_builder/public/application/utils/vis_builder_state_validation.test.ts index 6b02d9707438..c2d6d41a834f 100644 --- a/src/plugins/wizard/public/application/utils/wizard_state_validation.test.ts +++ b/src/plugins/vis_builder/public/application/utils/vis_builder_state_validation.test.ts @@ -3,9 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { validateWizardState } from './wizard_state_validation'; +import { validateVisBuilderState } from './vis_builder_state_validation'; -describe('wizard state validation', () => { +describe('visBuilder state validation', () => { const validStyleState = { addLegend: true, addTooltip: true, @@ -21,8 +21,8 @@ describe('wizard state validation', () => { searchField: '', }; describe('correct return when validation suceeds', () => { - test('with correct wizard state', () => { - const validationResult = validateWizardState({ + test('with correct visBuilder state', () => { + const validationResult = validateVisBuilderState({ styleState: validStyleState, visualizationState: validVisualizationState, }); @@ -32,7 +32,7 @@ describe('wizard state validation', () => { }); describe('correct return with errors when validation fails', () => { test('with non object type styleStyle', () => { - const validationResult = validateWizardState({ + const validationResult = validateVisBuilderState({ styleState: [], visualizationState: validVisualizationState, }); diff --git a/src/plugins/vis_builder/public/application/utils/vis_builder_state_validation.ts b/src/plugins/vis_builder/public/application/utils/vis_builder_state_validation.ts new file mode 100644 index 000000000000..9a601e82594d --- /dev/null +++ b/src/plugins/vis_builder/public/application/utils/vis_builder_state_validation.ts @@ -0,0 +1,19 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import Ajv from 'ajv'; +import visBuilderStateSchema from './schema.json'; + +const ajv = new Ajv(); +const validateState = ajv.compile(visBuilderStateSchema); + +export const validateVisBuilderState = (visBuilderState) => { + const isVisBuilderStateValid = validateState(visBuilderState); + + return { + valid: isVisBuilderStateValid, + errors: validateState.errors, + }; +}; diff --git a/src/plugins/wizard/public/assets/fields_bg.svg b/src/plugins/vis_builder/public/assets/fields_bg.svg similarity index 100% rename from src/plugins/wizard/public/assets/fields_bg.svg rename to src/plugins/vis_builder/public/assets/fields_bg.svg diff --git a/src/plugins/wizard/public/assets/hand_field.svg b/src/plugins/vis_builder/public/assets/hand_field.svg similarity index 100% rename from src/plugins/wizard/public/assets/hand_field.svg rename to src/plugins/vis_builder/public/assets/hand_field.svg diff --git a/src/plugins/wizard/public/assets/wizard_icon.svg b/src/plugins/vis_builder/public/assets/vis_builder_icon.svg similarity index 100% rename from src/plugins/wizard/public/assets/wizard_icon.svg rename to src/plugins/vis_builder/public/assets/vis_builder_icon.svg diff --git a/src/plugins/wizard/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/wizard/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/wizard/public/embeddable/disabled_embeddable.tsx b/src/plugins/vis_builder/public/embeddable/disabled_embeddable.tsx similarity index 69% rename from src/plugins/wizard/public/embeddable/disabled_embeddable.tsx rename to src/plugins/vis_builder/public/embeddable/disabled_embeddable.tsx index 5f55859156d0..6fc07deb74d8 100644 --- a/src/plugins/wizard/public/embeddable/disabled_embeddable.tsx +++ b/src/plugins/vis_builder/public/embeddable/disabled_embeddable.tsx @@ -8,13 +8,13 @@ import ReactDOM from 'react-dom'; import { Embeddable, EmbeddableOutput } from '../../../embeddable/public'; import { DisabledVisualization } from './disabled_visualization'; -import { WizardInput, WIZARD_EMBEDDABLE } from './wizard_embeddable'; +import { VisBuilderInput, VISBUILDER_EMBEDDABLE } from './vis_builder_embeddable'; -export class DisabledEmbeddable extends Embeddable { +export class DisabledEmbeddable extends Embeddable { private domNode?: HTMLElement; - public readonly type = WIZARD_EMBEDDABLE; + public readonly type = VISBUILDER_EMBEDDABLE; - constructor(private readonly title: string, initialInput: WizardInput) { + constructor(private readonly title: string, initialInput: VisBuilderInput) { super(initialInput, { title }); } diff --git a/src/plugins/wizard/public/embeddable/disabled_visualization.scss b/src/plugins/vis_builder/public/embeddable/disabled_visualization.scss similarity index 100% rename from src/plugins/wizard/public/embeddable/disabled_visualization.scss rename to src/plugins/vis_builder/public/embeddable/disabled_visualization.scss diff --git a/src/plugins/wizard/public/embeddable/disabled_visualization.tsx b/src/plugins/vis_builder/public/embeddable/disabled_visualization.tsx similarity index 100% rename from src/plugins/wizard/public/embeddable/disabled_visualization.tsx rename to src/plugins/vis_builder/public/embeddable/disabled_visualization.tsx diff --git a/src/plugins/vis_builder/public/embeddable/index.ts b/src/plugins/vis_builder/public/embeddable/index.ts new file mode 100644 index 000000000000..8b2bd225b03c --- /dev/null +++ b/src/plugins/vis_builder/public/embeddable/index.ts @@ -0,0 +1,7 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './vis_builder_embeddable'; +export * from './vis_builder_embeddable_factory'; diff --git a/src/plugins/wizard/public/embeddable/wizard_component.tsx b/src/plugins/vis_builder/public/embeddable/vis_builder_component.tsx similarity index 63% rename from src/plugins/wizard/public/embeddable/wizard_component.tsx rename to src/plugins/vis_builder/public/embeddable/vis_builder_component.tsx index 675baf28796a..9364f1ada0b2 100644 --- a/src/plugins/wizard/public/embeddable/wizard_component.tsx +++ b/src/plugins/vis_builder/public/embeddable/vis_builder_component.tsx @@ -6,16 +6,16 @@ import React from 'react'; import { SavedObjectEmbeddableInput, withEmbeddableSubscription } from '../../../embeddable/public'; -import { WizardEmbeddable, WizardOutput } from './wizard_embeddable'; +import { VisBuilderEmbeddable, VisBuilderOutput } from './vis_builder_embeddable'; import { getReactExpressionRenderer } from '../plugin_services'; interface Props { - embeddable: WizardEmbeddable; + embeddable: VisBuilderEmbeddable; input: SavedObjectEmbeddableInput; - output: WizardOutput; + output: VisBuilderOutput; } -function WizardEmbeddableComponentInner({ embeddable, input: {}, output: { error } }: Props) { +function VisBuilderEmbeddableComponentInner({ embeddable, input: {}, output: { error } }: Props) { const { expression } = embeddable; const ReactExpressionRenderer = getReactExpressionRenderer(); @@ -31,8 +31,8 @@ function WizardEmbeddableComponentInner({ embeddable, input: {}, output: { error ); } -export const WizardEmbeddableComponent = withEmbeddableSubscription< +export const VisBuilderEmbeddableComponent = withEmbeddableSubscription< SavedObjectEmbeddableInput, - WizardOutput, - WizardEmbeddable ->(WizardEmbeddableComponentInner); + VisBuilderOutput, + VisBuilderEmbeddable +>(VisBuilderEmbeddableComponentInner); diff --git a/src/plugins/wizard/public/embeddable/wizard_embeddable.tsx b/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx similarity index 84% rename from src/plugins/wizard/public/embeddable/wizard_embeddable.tsx rename to src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx index 706b562ca8b3..3a57c56931a5 100644 --- a/src/plugins/wizard/public/embeddable/wizard_embeddable.tsx +++ b/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable.tsx @@ -7,7 +7,7 @@ import { cloneDeep, isEqual } from 'lodash'; import ReactDOM from 'react-dom'; import { merge, Subscription } from 'rxjs'; -import { PLUGIN_ID, WizardSavedObjectAttributes, WIZARD_SAVED_OBJECT } from '../../common'; +import { PLUGIN_ID, VisBuilderSavedObjectAttributes, VISBUILDER_SAVED_OBJECT } from '../../common'; import { Embeddable, EmbeddableOutput, @@ -32,10 +32,10 @@ import { getExpressionLoader, getTypeService } from '../plugin_services'; import { PersistedState } from '../../../visualizations/public'; // Apparently this needs to match the saved object type for the clone and replace panel actions to work -export const WIZARD_EMBEDDABLE = WIZARD_SAVED_OBJECT; +export const VISBUILDER_EMBEDDABLE = VISBUILDER_SAVED_OBJECT; -export interface WizardEmbeddableConfiguration { - savedWizard: WizardSavedObjectAttributes; +export interface VisBuilderEmbeddableConfiguration { + savedVisBuilder: VisBuilderSavedObjectAttributes; // TODO: add indexPatterns as part of configuration // indexPatterns?: IIndexPattern[]; editPath: string; @@ -43,18 +43,18 @@ export interface WizardEmbeddableConfiguration { editable: boolean; } -export interface WizardOutput extends EmbeddableOutput { +export interface VisBuilderOutput extends EmbeddableOutput { /** - * Will contain the saved object attributes of the Wizard Saved Object that matches + * Will contain the saved object attributes of the VisBuilder Saved Object that matches * `input.savedObjectId`. If the id is invalid, this may be undefined. */ - savedWizard?: WizardSavedObjectAttributes; + savedVisBuilder?: VisBuilderSavedObjectAttributes; } type ExpressionLoader = InstanceType; -export class WizardEmbeddable extends Embeddable { - public readonly type = WIZARD_EMBEDDABLE; +export class VisBuilderEmbeddable extends Embeddable { + public readonly type = VISBUILDER_EMBEDDABLE; private handler?: ExpressionLoader; private timeRange?: TimeRange; private query?: Query; @@ -64,13 +64,13 @@ export class WizardEmbeddable extends Embeddable { const { visualizationState: visualization = '{}', styleState: style = '{}' } = - this.savedWizard || {}; + this.savedVisBuilder || {}; return { visualization, style, @@ -124,7 +124,7 @@ export class WizardEmbeddable extends Embeddable; -export class WizardEmbeddableFactoryDefinition +export class VisBuilderEmbeddableFactoryDefinition implements EmbeddableFactoryDefinition< SavedObjectEmbeddableInput, - WizardOutput | EmbeddableOutput, - WizardEmbeddable | DisabledEmbeddable, - WizardSavedObjectAttributes + VisBuilderOutput | EmbeddableOutput, + VisBuilderEmbeddable | DisabledEmbeddable, + VisBuilderSavedObjectAttributes > { - public readonly type = WIZARD_EMBEDDABLE; + public readonly type = VISBUILDER_EMBEDDABLE; public readonly savedObjectMetaData = { // TODO: Update to include most vis functionality name: PLUGIN_NAME, includeFields: ['visualizationState'], - type: WIZARD_SAVED_OBJECT, - getIconForSavedObject: () => wizardIcon, + type: VISBUILDER_SAVED_OBJECT, + getIconForSavedObject: () => visBuilderIcon, }; // TODO: Would it be better to explicitly declare start service dependencies? constructor() {} public canCreateNew() { - // Because wizard creation starts with the visualization modal, no need to have a separate entry for wizard until it's separate + // Because VisBuilder creation starts with the visualization modal, no need to have a separate entry for VisBuilder until it's separate return false; } @@ -68,9 +77,9 @@ export class WizardEmbeddableFactoryDefinition savedObjectId: string, input: Partial & { id: string }, parent?: IContainer - ): Promise { + ): Promise { try { - const savedWizard = await getSavedWizardLoader().get(savedObjectId); + const savedVisBuilder = await getSavedVisBuilderLoader().get(savedObjectId); const editPath = `${EDIT_PATH}/${savedObjectId}`; const editUrl = getHttp().basePath.prepend(`/app/${PLUGIN_ID}${editPath}`); const isLabsEnabled = getUISettings().get(VISUALIZE_ENABLE_LABS_SETTING); @@ -79,10 +88,10 @@ export class WizardEmbeddableFactoryDefinition return new DisabledEmbeddable(PLUGIN_NAME, input); } - return new WizardEmbeddable( + return new VisBuilderEmbeddable( getTimeFilter(), { - savedWizard, + savedVisBuilder, editUrl, editPath, editable: true, diff --git a/src/plugins/wizard/public/index.ts b/src/plugins/vis_builder/public/index.ts similarity index 63% rename from src/plugins/wizard/public/index.ts rename to src/plugins/vis_builder/public/index.ts index 713e9448b933..57beb3e4e513 100644 --- a/src/plugins/wizard/public/index.ts +++ b/src/plugins/vis_builder/public/index.ts @@ -4,11 +4,11 @@ */ import { PluginInitializerContext } from '../../../core/public'; -import { WizardPlugin } from './plugin'; +import { VisBuilderPlugin } from './plugin'; // This exports static code and TypeScript types, // as well as, OpenSearch Dashboards Platform `plugin()` initializer. export function plugin(initializerContext: PluginInitializerContext) { - return new WizardPlugin(initializerContext); + return new VisBuilderPlugin(initializerContext); } -export { WizardServices, WizardPluginStartDependencies, WizardStart } from './types'; +export { VisBuilderServices, VisBuilderPluginStartDependencies, VisBuilderStart } from './types'; diff --git a/src/plugins/wizard/public/plugin.test.ts b/src/plugins/vis_builder/public/plugin.test.ts similarity index 70% rename from src/plugins/wizard/public/plugin.test.ts rename to src/plugins/vis_builder/public/plugin.test.ts index 6dafa46c86ff..f5fac728420b 100644 --- a/src/plugins/wizard/public/plugin.test.ts +++ b/src/plugins/vis_builder/public/plugin.test.ts @@ -4,18 +4,18 @@ */ import { coreMock, savedObjectsServiceMock } from '../../../core/public/mocks'; -import { dashboardPluginMock } from '../../../plugins/dashboard/public/mocks'; -import { dataPluginMock } from '../../../plugins/data/public/mocks'; -import { embeddablePluginMock } from '../../../plugins/embeddable/public/mocks'; -import { navigationPluginMock } from '../../../plugins/navigation/public/mocks'; -import { visualizationsPluginMock } from '../../../plugins/visualizations/public/mocks'; +import { dashboardPluginMock } from '../../dashboard/public/mocks'; +import { dataPluginMock } from '../../data/public/mocks'; +import { embeddablePluginMock } from '../../embeddable/public/mocks'; +import { navigationPluginMock } from '../../navigation/public/mocks'; +import { visualizationsPluginMock } from '../../visualizations/public/mocks'; import { PLUGIN_ID, PLUGIN_NAME } from '../common'; -import { WizardPlugin } from './plugin'; +import { VisBuilderPlugin } from './plugin'; -describe('WizardPlugin', () => { +describe('VisBuilderPlugin', () => { describe('setup', () => { it('initializes the plugin correctly and registers it as an alias visualization', () => { - const plugin = new WizardPlugin(coreMock.createPluginInitializerContext()); + const plugin = new VisBuilderPlugin(coreMock.createPluginInitializerContext()); const pluginStartContract = { data: dataPluginMock.createStartContract(), savedObject: savedObjectsServiceMock.createStartContract(), diff --git a/src/plugins/wizard/public/plugin.ts b/src/plugins/vis_builder/public/plugin.ts similarity index 70% rename from src/plugins/wizard/public/plugin.ts rename to src/plugins/vis_builder/public/plugin.ts index 500f8f05c5ff..8e90a04784cd 100644 --- a/src/plugins/wizard/public/plugin.ts +++ b/src/plugins/vis_builder/public/plugin.ts @@ -13,43 +13,54 @@ import { PluginInitializerContext, } from '../../../core/public'; import { - WizardPluginSetupDependencies, - WizardPluginStartDependencies, - WizardServices, - WizardSetup, - WizardStart, + VisBuilderPluginSetupDependencies, + VisBuilderPluginStartDependencies, + VisBuilderServices, + VisBuilderSetup, + VisBuilderStart, } from './types'; -import { WizardEmbeddableFactoryDefinition, WIZARD_EMBEDDABLE } from './embeddable'; -import wizardIconSecondaryFill from './assets/wizard_icon_secondary_fill.svg'; -import wizardIcon from './assets/wizard_icon.svg'; -import { EDIT_PATH, PLUGIN_ID, PLUGIN_NAME, WIZARD_SAVED_OBJECT } from '../common'; +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 { TypeService } from './services/type_service'; import { getPreloadedStore } from './application/utils/state_management'; import { setSearchService, setIndexPatterns, setHttp, - setSavedWizardLoader, + setSavedVisBuilderLoader, setExpressionLoader, setTimeFilter, setUISettings, setTypeService, setReactExpressionRenderer, } from './plugin_services'; -import { createSavedWizardLoader } from './saved_visualizations'; +import { createSavedVisBuilderLoader } from './saved_visualizations'; import { registerDefaultTypes } from './visualizations'; import { ConfigSchema } from '../config'; -export class WizardPlugin +export class VisBuilderPlugin implements - Plugin { + Plugin< + VisBuilderSetup, + VisBuilderStart, + VisBuilderPluginSetupDependencies, + VisBuilderPluginStartDependencies + > { private typeService = new TypeService(); constructor(public initializerContext: PluginInitializerContext) {} public setup( - core: CoreSetup, - { embeddable, visualizations }: WizardPluginSetupDependencies + core: CoreSetup, + { embeddable, visualizations }: VisBuilderPluginSetupDependencies ) { const typeService = this.typeService; registerDefaultTypes(typeService.setup()); @@ -76,7 +87,7 @@ export class WizardPlugin // Register Default Visualizations - const services: WizardServices = { + const services: VisBuilderServices = { ...coreStart, toastNotifications: coreStart.notifications.toasts, data, @@ -86,7 +97,7 @@ export class WizardPlugin history: params.history, setHeaderActionMenu: params.setHeaderActionMenu, types: typeService.start(), - savedWizardLoader: selfStart.savedWizardLoader, + savedVisBuilderLoader: selfStart.savedVisBuilderLoader, embeddable: pluginsStart.embeddable, scopedHistory: params.history, }; @@ -102,34 +113,34 @@ export class WizardPlugin // Register embeddable // TODO: investigate simplification via getter a la visualizations: // const start = createStartServicesGetter(core.getStartServices)); - // const embeddableFactory = new WizardEmbeddableFactoryDefinition({ start }); - const embeddableFactory = new WizardEmbeddableFactoryDefinition(); - embeddable.registerEmbeddableFactory(WIZARD_EMBEDDABLE, embeddableFactory); + // const embeddableFactory = new VisBuilderEmbeddableFactoryDefinition({ start }); + const embeddableFactory = new VisBuilderEmbeddableFactoryDefinition(); + embeddable.registerEmbeddableFactory(VISBUILDER_EMBEDDABLE, embeddableFactory); // Register the plugin as an alias to create visualization visualizations.registerAlias({ 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: wizardIconSecondaryFill, + 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, editUrl: `${EDIT_PATH}/${encodeURIComponent(id)}`, - icon: wizardIcon, + icon: visBuilderIcon, id, - savedObjectType: WIZARD_SAVED_OBJECT, + savedObjectType: VISBUILDER_SAVED_OBJECT, stage: 'experimental', title: attributes?.title, - typeTitle: PLUGIN_NAME, + typeTitle: VIS_BUILDER_CHART_TYPE, updated_at: updatedAt, }), }, @@ -141,10 +152,13 @@ export class WizardPlugin }; } - public start(core: CoreStart, { data, expressions }: WizardPluginStartDependencies): WizardStart { + public start( + core: CoreStart, + { data, expressions }: VisBuilderPluginStartDependencies + ): VisBuilderStart { const typeService = this.typeService.start(); - const savedWizardLoader = createSavedWizardLoader({ + const savedVisBuilderLoader = createSavedVisBuilderLoader({ savedObjectsClient: core.savedObjects.client, indexPatterns: data.indexPatterns, search: data.search, @@ -158,14 +172,14 @@ export class WizardPlugin setReactExpressionRenderer(expressions.ReactExpressionRenderer); setHttp(core.http); setIndexPatterns(data.indexPatterns); - setSavedWizardLoader(savedWizardLoader); + setSavedVisBuilderLoader(savedVisBuilderLoader); setTimeFilter(data.query.timefilter.timefilter); setTypeService(typeService); setUISettings(core.uiSettings); return { ...typeService, - savedWizardLoader, + savedVisBuilderLoader, }; } diff --git a/src/plugins/wizard/public/plugin_services.ts b/src/plugins/vis_builder/public/plugin_services.ts similarity index 87% rename from src/plugins/wizard/public/plugin_services.ts rename to src/plugins/vis_builder/public/plugin_services.ts index b2cedc41c99f..f979f3a22b11 100644 --- a/src/plugins/wizard/public/plugin_services.ts +++ b/src/plugins/vis_builder/public/plugin_services.ts @@ -5,7 +5,7 @@ import { createGetterSetter } from '../../opensearch_dashboards_utils/common'; import { DataPublicPluginStart, TimefilterContract } from '../../data/public'; -import { SavedWizardLoader } from './saved_visualizations'; +import { SavedVisBuilderLoader } from './saved_visualizations'; import { HttpStart, IUiSettingsClient } from '../../../core/public'; import { ExpressionsStart } from '../../expressions/public'; import { TypeServiceStart } from './services/type_service'; @@ -28,9 +28,9 @@ export const [getIndexPatterns, setIndexPatterns] = createGetterSetter< DataPublicPluginStart['indexPatterns'] >('data.indexPatterns'); -export const [getSavedWizardLoader, setSavedWizardLoader] = createGetterSetter( - 'SavedWizardLoader' -); +export const [getSavedVisBuilderLoader, setSavedVisBuilderLoader] = createGetterSetter< + SavedVisBuilderLoader +>('SavedVisBuilderLoader'); export const [getTimeFilter, setTimeFilter] = createGetterSetter('TimeFilter'); diff --git a/src/plugins/wizard/public/saved_visualizations/_saved_vis.ts b/src/plugins/vis_builder/public/saved_visualizations/_saved_vis.ts similarity index 72% rename from src/plugins/wizard/public/saved_visualizations/_saved_vis.ts rename to src/plugins/vis_builder/public/saved_visualizations/_saved_vis.ts index d269642bd8bc..53ccc7a9d7d0 100644 --- a/src/plugins/wizard/public/saved_visualizations/_saved_vis.ts +++ b/src/plugins/vis_builder/public/saved_visualizations/_saved_vis.ts @@ -7,16 +7,16 @@ import { createSavedObjectClass, SavedObjectOpenSearchDashboardsServices, } from '../../../saved_objects/public'; -import { EDIT_PATH, PLUGIN_ID, WIZARD_SAVED_OBJECT } from '../../common'; +import { EDIT_PATH, PLUGIN_ID, VISBUILDER_SAVED_OBJECT } from '../../common'; import { injectReferences } from './saved_visualization_references'; -export function createSavedWizardVisClass(services: SavedObjectOpenSearchDashboardsServices) { +export function createSavedVisBuilderVisClass(services: SavedObjectOpenSearchDashboardsServices) { const SavedObjectClass = createSavedObjectClass(services); - class SavedWizardVis extends SavedObjectClass { - public static type = WIZARD_SAVED_OBJECT; + class SavedVisBuilderVis extends SavedObjectClass { + public static type = VISBUILDER_SAVED_OBJECT; - // if type:wizard has no mapping, we push this mapping into OpenSearch + // if type:visBuilder has no mapping, we push this mapping into OpenSearch public static mapping = { title: 'text', description: 'text', @@ -31,8 +31,8 @@ export function createSavedWizardVisClass(services: SavedObjectOpenSearchDashboa // ID is optional, without it one will be generated on save. constructor(id: string) { super({ - type: SavedWizardVis.type, - mapping: SavedWizardVis.mapping, + type: SavedVisBuilderVis.type, + mapping: SavedVisBuilderVis.mapping, injectReferences, // if this is null/undefined then the SavedObject will be assigned the defaults @@ -52,5 +52,5 @@ export function createSavedWizardVisClass(services: SavedObjectOpenSearchDashboa } } - return SavedWizardVis; + return SavedVisBuilderVis; } diff --git a/src/plugins/wizard/public/saved_visualizations/index.ts b/src/plugins/vis_builder/public/saved_visualizations/index.ts similarity index 100% rename from src/plugins/wizard/public/saved_visualizations/index.ts rename to src/plugins/vis_builder/public/saved_visualizations/index.ts diff --git a/src/plugins/wizard/public/saved_visualizations/saved_visualization_references.ts b/src/plugins/vis_builder/public/saved_visualizations/saved_visualization_references.ts similarity index 83% rename from src/plugins/wizard/public/saved_visualizations/saved_visualization_references.ts rename to src/plugins/vis_builder/public/saved_visualizations/saved_visualization_references.ts index 81a2a54a01c6..8a897b35ccda 100644 --- a/src/plugins/wizard/public/saved_visualizations/saved_visualization_references.ts +++ b/src/plugins/vis_builder/public/saved_visualizations/saved_visualization_references.ts @@ -4,11 +4,11 @@ */ import { SavedObjectReference } from '../../../../core/public'; -import { WizardVisSavedObject } from '../types'; +import { VisBuilderVisSavedObject } from '../types'; import { injectSearchSourceReferences } from '../../../data/public'; export function injectReferences( - savedObject: WizardVisSavedObject, + savedObject: VisBuilderVisSavedObject, references: SavedObjectReference[] ) { if (savedObject.searchSourceFields) { diff --git a/src/plugins/vis_builder/public/saved_visualizations/saved_visualizations.ts b/src/plugins/vis_builder/public/saved_visualizations/saved_visualizations.ts new file mode 100644 index 000000000000..324290c1da7d --- /dev/null +++ b/src/plugins/vis_builder/public/saved_visualizations/saved_visualizations.ts @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { + SavedObjectLoader, + SavedObjectOpenSearchDashboardsServices, +} from '../../../saved_objects/public'; +import { createSavedVisBuilderVisClass } from './_saved_vis'; + +export type SavedVisBuilderLoader = ReturnType; +export function createSavedVisBuilderLoader(services: SavedObjectOpenSearchDashboardsServices) { + const { savedObjectsClient } = services; + const SavedVisBuilderVisClass = createSavedVisBuilderVisClass(services); + + return new SavedObjectLoader(SavedVisBuilderVisClass, savedObjectsClient); +} diff --git a/src/plugins/wizard/public/saved_visualizations/transforms.test.ts b/src/plugins/vis_builder/public/saved_visualizations/transforms.test.ts similarity index 91% rename from src/plugins/wizard/public/saved_visualizations/transforms.test.ts rename to src/plugins/vis_builder/public/saved_visualizations/transforms.test.ts index df2fd7f1d197..3fb5b7ff7bda 100644 --- a/src/plugins/wizard/public/saved_visualizations/transforms.test.ts +++ b/src/plugins/vis_builder/public/saved_visualizations/transforms.test.ts @@ -4,10 +4,10 @@ */ import { coreMock } from '../../../../core/public/mocks'; -import { getStubIndexPattern } from '../../../../plugins/data/public/test_utils'; +import { getStubIndexPattern } from '../../../data/public/test_utils'; import { IndexPattern } from '../../../data/public'; import { RootState } from '../application/utils/state_management'; -import { WizardVisSavedObject } from '../types'; +import { VisBuilderVisSavedObject } from '../types'; import { saveStateToSavedObject } from './transforms'; const getConfig = (cfg: any) => cfg; @@ -21,7 +21,7 @@ describe('transforms', () => { beforeEach(() => { TEST_INDEX_PATTERN_ID = 'test-pattern'; - savedObject = {} as WizardVisSavedObject; + savedObject = {} as VisBuilderVisSavedObject; rootState = { metadata: { editor: { state: 'loading', validity: {} } }, style: '', diff --git a/src/plugins/wizard/public/saved_visualizations/transforms.ts b/src/plugins/vis_builder/public/saved_visualizations/transforms.ts similarity index 86% rename from src/plugins/wizard/public/saved_visualizations/transforms.ts rename to src/plugins/vis_builder/public/saved_visualizations/transforms.ts index 9772decbbafc..672f80111076 100644 --- a/src/plugins/wizard/public/saved_visualizations/transforms.ts +++ b/src/plugins/vis_builder/public/saved_visualizations/transforms.ts @@ -6,13 +6,13 @@ import produce from 'immer'; import { IndexPattern } from '../../../data/public'; import { RootState, VisualizationState } from '../application/utils/state_management'; -import { WizardVisSavedObject } from '../types'; +import { VisBuilderVisSavedObject } from '../types'; export const saveStateToSavedObject = ( - obj: WizardVisSavedObject, + obj: VisBuilderVisSavedObject, state: RootState, indexPattern: IndexPattern -): WizardVisSavedObject => { +): VisBuilderVisSavedObject => { if (state.visualization.indexPattern !== indexPattern.id) throw new Error('indexPattern id should match the value in redux state'); diff --git a/src/plugins/wizard/public/services/type_service/index.ts b/src/plugins/vis_builder/public/services/type_service/index.ts similarity index 100% rename from src/plugins/wizard/public/services/type_service/index.ts rename to src/plugins/vis_builder/public/services/type_service/index.ts diff --git a/src/plugins/wizard/public/services/type_service/type_service.test.ts b/src/plugins/vis_builder/public/services/type_service/type_service.test.ts similarity index 100% rename from src/plugins/wizard/public/services/type_service/type_service.test.ts rename to src/plugins/vis_builder/public/services/type_service/type_service.test.ts diff --git a/src/plugins/wizard/public/services/type_service/type_service.ts b/src/plugins/vis_builder/public/services/type_service/type_service.ts similarity index 100% rename from src/plugins/wizard/public/services/type_service/type_service.ts rename to src/plugins/vis_builder/public/services/type_service/type_service.ts diff --git a/src/plugins/wizard/public/services/type_service/types.ts b/src/plugins/vis_builder/public/services/type_service/types.ts similarity index 100% rename from src/plugins/wizard/public/services/type_service/types.ts rename to src/plugins/vis_builder/public/services/type_service/types.ts diff --git a/src/plugins/wizard/public/services/type_service/visualization_type.tsx b/src/plugins/vis_builder/public/services/type_service/visualization_type.tsx similarity index 100% rename from src/plugins/wizard/public/services/type_service/visualization_type.tsx rename to src/plugins/vis_builder/public/services/type_service/visualization_type.tsx diff --git a/src/plugins/wizard/public/types.ts b/src/plugins/vis_builder/public/types.ts similarity index 78% rename from src/plugins/wizard/public/types.ts rename to src/plugins/vis_builder/public/types.ts index 8745a6bfbe18..131c9cc1f6bb 100644 --- a/src/plugins/wizard/public/types.ts +++ b/src/plugins/vis_builder/public/types.ts @@ -15,16 +15,16 @@ import { TypeServiceSetup, TypeServiceStart } from './services/type_service'; import { SavedObjectLoader } from '../../saved_objects/public'; import { AppMountParameters, CoreStart, ToastsStart, ScopedHistory } from '../../../core/public'; -export type WizardSetup = TypeServiceSetup; -export interface WizardStart extends TypeServiceStart { - savedWizardLoader: SavedObjectLoader; +export type VisBuilderSetup = TypeServiceSetup; +export interface VisBuilderStart extends TypeServiceStart { + savedVisBuilderLoader: SavedObjectLoader; } -export interface WizardPluginSetupDependencies { +export interface VisBuilderPluginSetupDependencies { embeddable: EmbeddableSetup; visualizations: VisualizationsSetup; } -export interface WizardPluginStartDependencies { +export interface VisBuilderPluginStartDependencies { embeddable: EmbeddableStart; navigation: NavigationPublicPluginStart; data: DataPublicPluginStart; @@ -33,9 +33,9 @@ export interface WizardPluginStartDependencies { expressions: ExpressionsStart; } -export interface WizardServices extends CoreStart { +export interface VisBuilderServices extends CoreStart { setHeaderActionMenu: AppMountParameters['setHeaderActionMenu']; - savedWizardLoader: WizardStart['savedWizardLoader']; + savedVisBuilderLoader: VisBuilderStart['savedVisBuilderLoader']; toastNotifications: ToastsStart; savedObjectsPublic: SavedObjectsStart; navigation: NavigationPublicPluginStart; @@ -56,4 +56,4 @@ export interface ISavedVis { version?: number; } -export interface WizardVisSavedObject extends SavedObject, ISavedVis {} +export interface VisBuilderVisSavedObject extends SavedObject, ISavedVis {} diff --git a/src/plugins/wizard/public/visualizations/common/expression_helpers.ts b/src/plugins/vis_builder/public/visualizations/common/expression_helpers.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/common/expression_helpers.ts rename to src/plugins/vis_builder/public/visualizations/common/expression_helpers.ts diff --git a/src/plugins/wizard/public/visualizations/index.ts b/src/plugins/vis_builder/public/visualizations/index.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/index.ts rename to src/plugins/vis_builder/public/visualizations/index.ts diff --git a/src/plugins/wizard/public/visualizations/metric/components/metric_viz_options.tsx b/src/plugins/vis_builder/public/visualizations/metric/components/metric_viz_options.tsx similarity index 100% rename from src/plugins/wizard/public/visualizations/metric/components/metric_viz_options.tsx rename to src/plugins/vis_builder/public/visualizations/metric/components/metric_viz_options.tsx diff --git a/src/plugins/wizard/public/visualizations/metric/index.ts b/src/plugins/vis_builder/public/visualizations/metric/index.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/metric/index.ts rename to src/plugins/vis_builder/public/visualizations/metric/index.ts diff --git a/src/plugins/wizard/public/visualizations/metric/metric_viz_type.ts b/src/plugins/vis_builder/public/visualizations/metric/metric_viz_type.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/metric/metric_viz_type.ts rename to src/plugins/vis_builder/public/visualizations/metric/metric_viz_type.ts diff --git a/src/plugins/wizard/public/visualizations/metric/to_expression.ts b/src/plugins/vis_builder/public/visualizations/metric/to_expression.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/metric/to_expression.ts rename to src/plugins/vis_builder/public/visualizations/metric/to_expression.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/area/area_vis_type.ts b/src/plugins/vis_builder/public/visualizations/vislib/area/area_vis_type.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/area/area_vis_type.ts rename to src/plugins/vis_builder/public/visualizations/vislib/area/area_vis_type.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/area/components/area_vis_options.tsx b/src/plugins/vis_builder/public/visualizations/vislib/area/components/area_vis_options.tsx similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/area/components/area_vis_options.tsx rename to src/plugins/vis_builder/public/visualizations/vislib/area/components/area_vis_options.tsx diff --git a/src/plugins/wizard/public/visualizations/vislib/area/index.ts b/src/plugins/vis_builder/public/visualizations/vislib/area/index.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/area/index.ts rename to src/plugins/vis_builder/public/visualizations/vislib/area/index.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/area/to_expression.ts b/src/plugins/vis_builder/public/visualizations/vislib/area/to_expression.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/area/to_expression.ts rename to src/plugins/vis_builder/public/visualizations/vislib/area/to_expression.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/common/basic_vis_options.tsx b/src/plugins/vis_builder/public/visualizations/vislib/common/basic_vis_options.tsx similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/common/basic_vis_options.tsx rename to src/plugins/vis_builder/public/visualizations/vislib/common/basic_vis_options.tsx diff --git a/src/plugins/wizard/public/visualizations/vislib/common/create_vis.ts b/src/plugins/vis_builder/public/visualizations/vislib/common/create_vis.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/common/create_vis.ts rename to src/plugins/vis_builder/public/visualizations/vislib/common/create_vis.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/common/get_pipeline_params.ts b/src/plugins/vis_builder/public/visualizations/vislib/common/get_pipeline_params.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/common/get_pipeline_params.ts rename to src/plugins/vis_builder/public/visualizations/vislib/common/get_pipeline_params.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/common/get_value_axes.ts b/src/plugins/vis_builder/public/visualizations/vislib/common/get_value_axes.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/common/get_value_axes.ts rename to src/plugins/vis_builder/public/visualizations/vislib/common/get_value_axes.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/common/index.ts b/src/plugins/vis_builder/public/visualizations/vislib/common/index.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/common/index.ts rename to src/plugins/vis_builder/public/visualizations/vislib/common/index.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/common/types.ts b/src/plugins/vis_builder/public/visualizations/vislib/common/types.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/common/types.ts rename to src/plugins/vis_builder/public/visualizations/vislib/common/types.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/histogram/components/histogram_vis_options.tsx b/src/plugins/vis_builder/public/visualizations/vislib/histogram/components/histogram_vis_options.tsx similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/histogram/components/histogram_vis_options.tsx rename to src/plugins/vis_builder/public/visualizations/vislib/histogram/components/histogram_vis_options.tsx diff --git a/src/plugins/wizard/public/visualizations/vislib/histogram/histogram_vis_type.ts b/src/plugins/vis_builder/public/visualizations/vislib/histogram/histogram_vis_type.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/histogram/histogram_vis_type.ts rename to src/plugins/vis_builder/public/visualizations/vislib/histogram/histogram_vis_type.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/histogram/index.ts b/src/plugins/vis_builder/public/visualizations/vislib/histogram/index.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/histogram/index.ts rename to src/plugins/vis_builder/public/visualizations/vislib/histogram/index.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/histogram/to_expression.ts b/src/plugins/vis_builder/public/visualizations/vislib/histogram/to_expression.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/histogram/to_expression.ts rename to src/plugins/vis_builder/public/visualizations/vislib/histogram/to_expression.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/index.ts b/src/plugins/vis_builder/public/visualizations/vislib/index.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/index.ts rename to src/plugins/vis_builder/public/visualizations/vislib/index.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/line/components/line_vis_options.tsx b/src/plugins/vis_builder/public/visualizations/vislib/line/components/line_vis_options.tsx similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/line/components/line_vis_options.tsx rename to src/plugins/vis_builder/public/visualizations/vislib/line/components/line_vis_options.tsx diff --git a/src/plugins/wizard/public/visualizations/vislib/line/index.ts b/src/plugins/vis_builder/public/visualizations/vislib/line/index.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/line/index.ts rename to src/plugins/vis_builder/public/visualizations/vislib/line/index.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/line/line_vis_type.ts b/src/plugins/vis_builder/public/visualizations/vislib/line/line_vis_type.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/line/line_vis_type.ts rename to src/plugins/vis_builder/public/visualizations/vislib/line/line_vis_type.ts diff --git a/src/plugins/wizard/public/visualizations/vislib/line/to_expression.ts b/src/plugins/vis_builder/public/visualizations/vislib/line/to_expression.ts similarity index 100% rename from src/plugins/wizard/public/visualizations/vislib/line/to_expression.ts rename to src/plugins/vis_builder/public/visualizations/vislib/line/to_expression.ts diff --git a/src/plugins/wizard/server/capabilities_provider.ts b/src/plugins/vis_builder/server/capabilities_provider.ts similarity index 91% rename from src/plugins/wizard/server/capabilities_provider.ts rename to src/plugins/vis_builder/server/capabilities_provider.ts index 9bbede2d53a9..c810efabdfe5 100644 --- a/src/plugins/wizard/server/capabilities_provider.ts +++ b/src/plugins/vis_builder/server/capabilities_provider.ts @@ -4,7 +4,7 @@ */ export const capabilitiesProvider = () => ({ - wizard: { + 'visualization-visbuilder': { // TODO: investigate which capabilities we need to provide // createNew: true, // createShortUrl: true, diff --git a/src/plugins/wizard/server/index.ts b/src/plugins/vis_builder/server/index.ts similarity index 77% rename from src/plugins/wizard/server/index.ts rename to src/plugins/vis_builder/server/index.ts index cd5e3aa3a30e..417e6d2e317f 100644 --- a/src/plugins/wizard/server/index.ts +++ b/src/plugins/vis_builder/server/index.ts @@ -5,16 +5,16 @@ import { PluginConfigDescriptor, PluginInitializerContext } from '../../../core/server'; import { ConfigSchema, configSchema } from '../config'; -import { WizardPlugin } from './plugin'; +import { VisBuilderPlugin } from './plugin'; // This exports static code and TypeScript types, // as well as the OpenSearch Dashboards Platform `plugin()` initializer. export function plugin(initializerContext: PluginInitializerContext) { - return new WizardPlugin(initializerContext); + return new VisBuilderPlugin(initializerContext); } -export { WizardPluginSetup, WizardPluginStart } from './types'; +export { VisBuilderPluginSetup, VisBuilderPluginStart } from './types'; export const config: PluginConfigDescriptor = { exposeToBrowser: { diff --git a/src/plugins/wizard/server/plugin.ts b/src/plugins/vis_builder/server/plugin.ts similarity index 65% rename from src/plugins/wizard/server/plugin.ts rename to src/plugins/vis_builder/server/plugin.ts index 25b7f27c1f81..d250c21f14ad 100644 --- a/src/plugins/wizard/server/plugin.ts +++ b/src/plugins/vis_builder/server/plugin.ts @@ -11,11 +11,11 @@ import { Logger, } from '../../../core/server'; -import { WizardPluginSetup, WizardPluginStart } from './types'; +import { VisBuilderPluginSetup, VisBuilderPluginStart } from './types'; import { capabilitiesProvider } from './capabilities_provider'; -import { wizardSavedObjectType } from './saved_objects'; +import { visBuilderSavedObjectType } from './saved_objects'; -export class WizardPlugin implements Plugin { +export class VisBuilderPlugin implements Plugin { private readonly logger: Logger; constructor(initializerContext: PluginInitializerContext) { @@ -23,10 +23,10 @@ export class WizardPlugin implements Plugin) => title, + getTitle: ({ attributes: { title } }: SavedObject) => 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: wizardSavedObjectTypeMigrations, + migrations: {}, mappings: { properties: { title: { diff --git a/src/plugins/wizard/server/types.ts b/src/plugins/vis_builder/server/types.ts similarity index 76% rename from src/plugins/wizard/server/types.ts rename to src/plugins/vis_builder/server/types.ts index 69f9ea0996d3..8899e4be8ac0 100644 --- a/src/plugins/wizard/server/types.ts +++ b/src/plugins/vis_builder/server/types.ts @@ -5,6 +5,6 @@ // We need to export plugin server types, even if empty // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface WizardPluginSetup {} +export interface VisBuilderPluginSetup {} // eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface WizardPluginStart {} +export interface VisBuilderPluginStart {} diff --git a/src/plugins/wizard/tsconfig.json b/src/plugins/vis_builder/tsconfig.json similarity index 98% rename from src/plugins/wizard/tsconfig.json rename to src/plugins/vis_builder/tsconfig.json index ab8821948be5..3af8638d980c 100644 --- a/src/plugins/wizard/tsconfig.json +++ b/src/plugins/vis_builder/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "baseUrl": "./src/plugins/wizard", + "baseUrl": "./src/plugins/vis_builder", "paths": { // Allows for importing from `opensearch-dashboards` package for the exported types. "opensearch-dashboards": ["./opensearch_dashboards"], diff --git a/src/plugins/visualize/public/application/components/visualize_listing.scss b/src/plugins/visualize/public/application/components/visualize_listing.scss index 13c2be619247..3cb24d7940ba 100644 --- a/src/plugins/visualize/public/application/components/visualize_listing.scss +++ b/src/plugins/visualize/public/application/components/visualize_listing.scss @@ -11,7 +11,7 @@ .visListingTable__experimentalIcon { width: $euiSizeL; - vertical-align: baseline; + vertical-align: middle; padding: 0 $euiSizeS; margin-left: $euiSizeS; } diff --git a/src/plugins/visualize/public/application/utils/get_table_columns.tsx b/src/plugins/visualize/public/application/utils/get_table_columns.tsx index 33c847dbd833..02917cf2b903 100644 --- a/src/plugins/visualize/public/application/utils/get_table_columns.tsx +++ b/src/plugins/visualize/public/application/utils/get_table_columns.tsx @@ -60,7 +60,10 @@ const getBadge = (item: VisualizationListItem) => { return ( { - const { savedWizardLoader } = services; - if (!savedWizardLoader) { - return {}; - } - const savedWizardVis = await savedWizardLoader.get(wizardVisId); - - return savedWizardVis; -}; diff --git a/src/plugins/wizard/public/application/utils/wizard_state_validation.ts b/src/plugins/wizard/public/application/utils/wizard_state_validation.ts deleted file mode 100644 index 6bcdf973e371..000000000000 --- a/src/plugins/wizard/public/application/utils/wizard_state_validation.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import Ajv from 'ajv'; -import wizardStateSchema from './schema.json'; - -const ajv = new Ajv(); -const validateState = ajv.compile(wizardStateSchema); - -export const validateWizardState = (wizardState) => { - const isWizardStateValid = validateState(wizardState); - - return { - valid: isWizardStateValid, - errors: validateState.errors, - }; -}; diff --git a/src/plugins/wizard/public/embeddable/index.ts b/src/plugins/wizard/public/embeddable/index.ts deleted file mode 100644 index d0137757e0ab..000000000000 --- a/src/plugins/wizard/public/embeddable/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -export * from './wizard_embeddable'; -export * from './wizard_embeddable_factory'; diff --git a/src/plugins/wizard/public/saved_visualizations/saved_visualizations.ts b/src/plugins/wizard/public/saved_visualizations/saved_visualizations.ts deleted file mode 100644 index f07dfd940312..000000000000 --- a/src/plugins/wizard/public/saved_visualizations/saved_visualizations.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import { - SavedObjectLoader, - SavedObjectOpenSearchDashboardsServices, -} from '../../../saved_objects/public'; -import { createSavedWizardVisClass } from './_saved_vis'; - -export type SavedWizardLoader = ReturnType; -export function createSavedWizardLoader(services: SavedObjectOpenSearchDashboardsServices) { - const { savedObjectsClient } = services; - const SavedWizardVisClass = createSavedWizardVisClass(services); - - return new SavedObjectLoader(SavedWizardVisClass, savedObjectsClient); -} diff --git a/src/plugins/wizard/server/saved_objects/wizard_migration.test.ts b/src/plugins/wizard/server/saved_objects/wizard_migration.test.ts deleted file mode 100644 index 0e9248e1951f..000000000000 --- a/src/plugins/wizard/server/saved_objects/wizard_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 { wizardSavedObjectTypeMigrations } from './wizard_migration'; - -const savedObjectMigrationContext = (null as unknown) as SavedObjectMigrationContext; - -describe('2.3.0', () => { - const migrate = (doc: any) => - wizardSavedObjectTypeMigrations['2.3.0']( - doc as Parameters[0], - savedObjectMigrationContext - ); - - it('should return original doc if visualizationState is not found', () => { - const migratedDoc = migrate({ - type: 'wizard', - attributes: {}, - }); - - expect(migratedDoc).toEqual({ - type: 'wizard', - attributes: {}, - }); - }); - - it('should return original doc if indexPattern is not found within visualizationState', () => { - const migratedDoc = migrate({ - type: 'wizard', - attributes: { - visualizationState: { - searchSource: '', - activeVisualization: {}, - }, - }, - }); - - expect(migratedDoc).toEqual({ - type: 'wizard', - attributes: { - visualizationState: { - searchSource: '', - activeVisualization: {}, - }, - }, - }); - }); - - it('should return original doc if references is not an array', () => { - const migratedDoc = migrate({ - type: 'wizard', - attributes: { - visualizationState: {}, - }, - references: {}, - }); - - expect(migratedDoc).toEqual({ - type: 'wizard', - attributes: { - visualizationState: {}, - }, - references: {}, - }); - }); - - it('should migrate the old version wizard saved object to new version wizard saved object', () => { - const migratedDoc = migrate({ - type: 'wizard', - attributes: { - visualizationState: JSON.stringify({ - searchFields: {}, - activeVisualization: {}, - indexPattern: 'indexPatternId', - }), - version: 1, - }, - references: [], - }); - - expect(migratedDoc).toEqual({ - type: 'wizard', - 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/wizard/server/saved_objects/wizard_migration.ts b/src/plugins/wizard/server/saved_objects/wizard_migration.ts deleted file mode 100644 index dcbaf8252218..000000000000 --- a/src/plugins/wizard/server/saved_objects/wizard_migration.ts +++ /dev/null @@ -1,51 +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; - } -}; - -export const wizardSavedObjectTypeMigrations = { - '2.3.0': flow(migrateIndexPattern), -}; diff --git a/test/common/config.js b/test/common/config.js index 26abcc2fa586..0ad9dc042c5b 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`, + `--vis_builder.enabled=true`, ], }, services, diff --git a/test/functional/apps/wizard/_base.ts b/test/functional/apps/vis_builder/_base.ts similarity index 59% rename from test/functional/apps/wizard/_base.ts rename to test/functional/apps/vis_builder/_base.ts index 819a67a628f5..60dd1068347c 100644 --- a/test/functional/apps/wizard/_base.ts +++ b/test/functional/apps/vis_builder/_base.ts @@ -7,44 +7,44 @@ import expect from '@osd/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['visualize', 'wizard', 'visChart']); + const PageObjects = getPageObjects(['visualize', 'visBuilder', 'visChart']); const testSubjects = getService('testSubjects'); const log = getService('log'); const retry = getService('retry'); - describe('Basic tests for wizard app ', function () { + describe('Basic tests for visBuilder app ', function () { before(async () => { - 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 65% rename from test/functional/apps/wizard/_experimental_vis.ts rename to test/functional/apps/vis_builder/_experimental_vis.ts index e36c0254e22a..1743d4882281 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'); - expect(wizardVisTypeExists).to.be(true); + // Try to find the visBuilder Vis type. + const visBuilderVisTypeExists = await PageObjects.visualize.hasVisType('vis-builder'); + expect(visBuilderVisTypeExists).to.be(true); // Create a new visualization - await PageObjects.visualize.clickVisType('wizard'); + await PageObjects.visualize.clickVisType('vis-builder'); // 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('vis-builder'); + 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/apps/visualize/_chart_types.ts b/test/functional/apps/visualize/_chart_types.ts index 63538541e813..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', - 'Wizard', // TODO: Update to final name when ready + 'VisBuilder', ]; if (!isOss) { expectedChartTypes.push('Maps', 'Lens'); 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..81ad2f15fe53 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('vis-builder'); await header.waitUntilLoadingHasFinished(); } @@ -124,5 +124,5 @@ export function WizardPageProvider({ getService, getPageObjects }: FtrProviderCo } } - return new WizardPage(); + return new VisBuilderPage(); }