From 9b6325c6c60fa7507b1ce70b1a7fe06b80110839 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 13:45:08 -0700 Subject: [PATCH] [VisBuilder] Change VisBuilder from experimental to production (#6436) (#6971) * [VisBuilder] Change VisBuilder from experimental to production Issue Resolve https://github.com/opensearch-project/OpenSearch-Dashboards/issues/6435 * Changeset file for PR #6436 created/updated --------- (cherry picked from commit 75e60874b68d2158cf6100c0b4e56d93d3997065) Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> --- changelogs/fragments/6436.yml | 2 + .../components/experimental_info.tsx | 41 --------------- .../application/components/workspace.scss | 2 +- .../application/components/workspace.tsx | 8 +-- .../public/embeddable/disabled_embeddable.tsx | 34 ------------- .../embeddable/disabled_visualization.scss | 12 ----- .../embeddable/disabled_visualization.tsx | 31 ----------- .../vis_builder_embeddable_factory.tsx | 19 ++----- src/plugins/vis_builder/public/plugin.test.ts | 1 - src/plugins/vis_builder/public/plugin.ts | 2 - .../public/services/type_service/types.ts | 2 +- .../type_service/visualization_type.tsx | 2 +- .../apps/vis_builder/_experimental_vis.ts | 51 ------------------- test/functional/apps/vis_builder/index.ts | 1 - 14 files changed, 9 insertions(+), 199 deletions(-) create mode 100644 changelogs/fragments/6436.yml delete mode 100644 src/plugins/vis_builder/public/application/components/experimental_info.tsx delete mode 100644 src/plugins/vis_builder/public/embeddable/disabled_embeddable.tsx delete mode 100644 src/plugins/vis_builder/public/embeddable/disabled_visualization.scss delete mode 100644 src/plugins/vis_builder/public/embeddable/disabled_visualization.tsx delete mode 100644 test/functional/apps/vis_builder/_experimental_vis.ts diff --git a/changelogs/fragments/6436.yml b/changelogs/fragments/6436.yml new file mode 100644 index 000000000000..5877e0562d6f --- /dev/null +++ b/changelogs/fragments/6436.yml @@ -0,0 +1,2 @@ +feat: +- [VisBuilder] Change VisBuilder from experimental to production ([#6436](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6436)) \ No newline at end of file diff --git a/src/plugins/vis_builder/public/application/components/experimental_info.tsx b/src/plugins/vis_builder/public/application/components/experimental_info.tsx deleted file mode 100644 index ea341e1e8873..000000000000 --- a/src/plugins/vis_builder/public/application/components/experimental_info.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import React, { memo } from 'react'; -import { EuiCallOut, EuiLink } from '@elastic/eui'; -import { FormattedMessage } from '@osd/i18n/react'; -import { i18n } from '@osd/i18n'; - -export const InfoComponent = () => { - return ( - - - the GitHub issue - - ), - }} - /> - - ); -}; - -export const ExperimentalInfo = memo(InfoComponent); diff --git a/src/plugins/vis_builder/public/application/components/workspace.scss b/src/plugins/vis_builder/public/application/components/workspace.scss index 09285ab14985..70bb078b927e 100644 --- a/src/plugins/vis_builder/public/application/components/workspace.scss +++ b/src/plugins/vis_builder/public/application/components/workspace.scss @@ -11,7 +11,7 @@ $keyframe-multiplier: calc(1 / $animation-multiplier); .vbWorkspace { display: grid; -ms-grid-rows: auto $euiSizeM 1fr; - grid-template-rows: auto 1fr; + grid-template-rows: 1fr; grid-area: workspace; grid-gap: $euiSizeM; padding: $euiSizeM; diff --git a/src/plugins/vis_builder/public/application/components/workspace.tsx b/src/plugins/vis_builder/public/application/components/workspace.tsx index 31880e93bb7f..295ed5284342 100644 --- a/src/plugins/vis_builder/public/application/components/workspace.tsx +++ b/src/plugins/vis_builder/public/application/components/workspace.tsx @@ -4,7 +4,7 @@ */ import { i18n } from '@osd/i18n'; -import { EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, EuiIcon, EuiPanel } from '@elastic/eui'; +import { EuiEmptyPrompt, EuiFlexItem, EuiIcon, EuiPanel } from '@elastic/eui'; import React, { useState, useMemo, useEffect, useLayoutEffect } from 'react'; import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public'; import { IExpressionLoaderParams } from '../../../../expressions/public'; @@ -18,7 +18,6 @@ import hand_field from '../../assets/hand_field.svg'; import fields_bg from '../../assets/fields_bg.svg'; import './workspace.scss'; -import { ExperimentalInfo } from './experimental_info'; import { handleVisEvent } from '../utils/handle_vis_event'; export const WorkspaceUI = () => { @@ -105,11 +104,6 @@ export const WorkspaceUI = () => { return (
- - - - - {expression ? ( { - private domNode?: HTMLElement; - public readonly type = VISBUILDER_EMBEDDABLE; - - constructor(private readonly title: string, initialInput: VisBuilderInput) { - super(initialInput, { title }); - } - - public reload() {} - public render(domNode: HTMLElement) { - if (this.title) { - this.domNode = domNode; - ReactDOM.render(, domNode); - } - } - - public destroy() { - if (this.domNode) { - ReactDOM.unmountComponentAtNode(this.domNode); - } - } -} diff --git a/src/plugins/vis_builder/public/embeddable/disabled_visualization.scss b/src/plugins/vis_builder/public/embeddable/disabled_visualization.scss deleted file mode 100644 index 825ff4d73223..000000000000 --- a/src/plugins/vis_builder/public/embeddable/disabled_visualization.scss +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ -.vbDisabledVisualization { - width: 100%; - display: grid; - grid-gap: $euiSize; - place-content: center; - place-items: center; - text-align: center; -} diff --git a/src/plugins/vis_builder/public/embeddable/disabled_visualization.tsx b/src/plugins/vis_builder/public/embeddable/disabled_visualization.tsx deleted file mode 100644 index 30b5dd5ffa3f..000000000000 --- a/src/plugins/vis_builder/public/embeddable/disabled_visualization.tsx +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import { EuiIcon } from '@elastic/eui'; -import { FormattedMessage } from '@osd/i18n/react'; -import React from 'react'; - -import './disabled_visualization.scss'; - -export function DisabledVisualization({ title }: { title: string }) { - return ( -
- -
- {title} }} - /> -
-
- -
-
- ); -} diff --git a/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable_factory.tsx b/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable_factory.tsx index 3c0bf0337369..52cc74c82e0c 100644 --- a/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable_factory.tsx +++ b/src/plugins/vis_builder/public/embeddable/vis_builder_embeddable_factory.tsx @@ -11,7 +11,6 @@ import { IContainer, SavedObjectEmbeddableInput, } from '../../../embeddable/public'; -import { VISUALIZE_ENABLE_LABS_SETTING } from '../../../visualizations/public'; import { EDIT_PATH, PLUGIN_ID, @@ -19,7 +18,6 @@ import { VisBuilderSavedObjectAttributes, VISBUILDER_SAVED_OBJECT, } from '../../common'; -import { DisabledEmbeddable } from './disabled_embeddable'; import { VisBuilderEmbeddable, VisBuilderInput, @@ -27,12 +25,7 @@ import { VISBUILDER_EMBEDDABLE, } from './vis_builder_embeddable'; import { getStateFromSavedObject } from '../saved_visualizations/transforms'; -import { - getHttp, - getSavedVisBuilderLoader, - getTimeFilter, - getUISettings, -} from '../plugin_services'; +import { getHttp, getSavedVisBuilderLoader, getTimeFilter } from '../plugin_services'; import { StartServicesGetter } from '../../../opensearch_dashboards_utils/public'; import { VisBuilderPluginStartDependencies } from '../types'; @@ -45,7 +38,7 @@ export class VisBuilderEmbeddableFactory EmbeddableFactoryDefinition< SavedObjectEmbeddableInput, VisBuilderOutput | EmbeddableOutput, - VisBuilderEmbeddable | DisabledEmbeddable, + VisBuilderEmbeddable, VisBuilderSavedObjectAttributes > { public readonly type = VISBUILDER_EMBEDDABLE; @@ -75,17 +68,11 @@ export class VisBuilderEmbeddableFactory savedObjectId: string, input: VisBuilderInput, parent?: IContainer - ): Promise { + ): Promise { try { const savedObject = 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); - - if (!isLabsEnabled) { - return new DisabledEmbeddable(PLUGIN_NAME, input); - } - const savedVis = getStateFromSavedObject(savedObject); const indexPatternService = this.deps.start().plugins.data.indexPatterns; const indexPattern = await indexPatternService.get( diff --git a/src/plugins/vis_builder/public/plugin.test.ts b/src/plugins/vis_builder/public/plugin.test.ts index 35e17865649a..f6f3a8a6e830 100644 --- a/src/plugins/vis_builder/public/plugin.test.ts +++ b/src/plugins/vis_builder/public/plugin.test.ts @@ -39,7 +39,6 @@ describe('VisBuilderPlugin', () => { title: PLUGIN_NAME, aliasPath: '#/', aliasApp: PLUGIN_ID, - stage: 'experimental', }) ); }); diff --git a/src/plugins/vis_builder/public/plugin.ts b/src/plugins/vis_builder/public/plugin.ts index fefd3107be66..b0378bffd073 100644 --- a/src/plugins/vis_builder/public/plugin.ts +++ b/src/plugins/vis_builder/public/plugin.ts @@ -192,7 +192,6 @@ export class VisBuilderPlugin defaultMessage: 'Create visualizations using the new VisBuilder', }), icon: 'visBuilder', - stage: 'experimental', aliasApp: PLUGIN_ID, aliasPath: '#/', appExtensions: { @@ -205,7 +204,6 @@ export class VisBuilderPlugin icon: 'visBuilder', id, savedObjectType: VISBUILDER_SAVED_OBJECT, - stage: 'experimental', title: attributes?.title, typeTitle: VIS_BUILDER_CHART_TYPE, updated_at: updatedAt, diff --git a/src/plugins/vis_builder/public/services/type_service/types.ts b/src/plugins/vis_builder/public/services/type_service/types.ts index edcc0b659fc7..bc0a5cfe6c61 100644 --- a/src/plugins/vis_builder/public/services/type_service/types.ts +++ b/src/plugins/vis_builder/public/services/type_service/types.ts @@ -22,7 +22,7 @@ export interface VisualizationTypeOptions { readonly title: string; readonly description?: string; readonly icon: IconType; - readonly stage?: 'experimental' | 'production'; + readonly stage?: 'production'; readonly ui: { containerConfig: { data: DataTabConfig; diff --git a/src/plugins/vis_builder/public/services/type_service/visualization_type.tsx b/src/plugins/vis_builder/public/services/type_service/visualization_type.tsx index 2f863316435e..0c2fadf3cf38 100644 --- a/src/plugins/vis_builder/public/services/type_service/visualization_type.tsx +++ b/src/plugins/vis_builder/public/services/type_service/visualization_type.tsx @@ -14,7 +14,7 @@ export class VisualizationType implements IVisualizationType { public readonly title: string; public readonly description: string; public readonly icon: IconType; - public readonly stage: 'experimental' | 'production'; + public readonly stage: 'production'; public readonly ui: IVisualizationType['ui']; public readonly toExpression: ( state: RenderState, diff --git a/test/functional/apps/vis_builder/_experimental_vis.ts b/test/functional/apps/vis_builder/_experimental_vis.ts deleted file mode 100644 index 1743d4882281..000000000000 --- a/test/functional/apps/vis_builder/_experimental_vis.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import expect from '@osd/expect'; -import { VISUALIZE_ENABLE_LABS_SETTING } from '../../../../src/plugins/visualizations/common/constants'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['visualize', 'visBuilder']); - const log = getService('log'); - const opensearchDashboardsServer = getService('opensearchDashboardsServer'); - - 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 visBuilder Vis type. - const visBuilderVisTypeExists = await PageObjects.visualize.hasVisType('vis-builder'); - expect(visBuilderVisTypeExists).to.be(true); - - // Create a new visualization - await PageObjects.visualize.clickVisType('vis-builder'); - - // Check that the experimental banner is there and state that this is experimental - const info = await PageObjects.visBuilder.getExperimentalInfo(); - expect(await info.getVisibleText()).to.contain('experimental'); - }); - - it('should not be available in the picker when disabled', async () => { - log.debug('navigateToApp visualize'); - await opensearchDashboardsServer.uiSettings.replace({ - [VISUALIZE_ENABLE_LABS_SETTING]: false, - }); - await PageObjects.visualize.navigateToNewVisualization(); - await PageObjects.visualize.waitForVisualizationSelectPage(); - - // Try to find the visBuilder Vis type. - const visBuilderVisTypeExists = await PageObjects.visualize.hasVisType('vis-builder'); - expect(visBuilderVisTypeExists).to.be(false); - }); - - after(async () => { - // unset the experimental ui setting - await opensearchDashboardsServer.uiSettings.unset(VISUALIZE_ENABLE_LABS_SETTING); - }); - }); -} diff --git a/test/functional/apps/vis_builder/index.ts b/test/functional/apps/vis_builder/index.ts index c0e7b9c35c77..67b333deb5d6 100644 --- a/test/functional/apps/vis_builder/index.ts +++ b/test/functional/apps/vis_builder/index.ts @@ -34,6 +34,5 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { }); loadTestFile(require.resolve('./_base')); - loadTestFile(require.resolve('./_experimental_vis')); }); }