diff --git a/src/plugins/visualize/config.ts b/src/plugins/visualize/config.ts deleted file mode 100644 index ee79a37717f26..0000000000000 --- a/src/plugins/visualize/config.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { schema, TypeOf } from '@kbn/config-schema'; - -export const configSchema = schema.object({ - showNewVisualizeFlow: schema.boolean({ defaultValue: false }), -}); - -export type ConfigSchema = TypeOf; diff --git a/src/plugins/visualize/kibana.json b/src/plugins/visualize/kibana.json index a6cc8d8f8af60..29fcd30184cb2 100644 --- a/src/plugins/visualize/kibana.json +++ b/src/plugins/visualize/kibana.json @@ -10,6 +10,7 @@ "savedObjects", "visualizations", "embeddable", + "dashboard", "uiActions" ], "optionalPlugins": ["home", "share"], diff --git a/src/plugins/visualize/public/application/types.ts b/src/plugins/visualize/public/application/types.ts index 65b88485b2f06..0a12dbc22a744 100644 --- a/src/plugins/visualize/public/application/types.ts +++ b/src/plugins/visualize/public/application/types.ts @@ -44,7 +44,7 @@ import { SharePluginStart } from 'src/plugins/share/public'; import { SavedObjectsStart, SavedObject } from 'src/plugins/saved_objects/public'; import { EmbeddableStart } from 'src/plugins/embeddable/public'; import { KibanaLegacyStart } from 'src/plugins/kibana_legacy/public'; -import { ConfigSchema } from '../../config'; +import { DashboardStart } from '../../../dashboard/public'; export type PureVisState = SavedVisState; @@ -111,7 +111,7 @@ export interface VisualizeServices extends CoreStart { createVisEmbeddableFromObject: VisualizationsStart['__LEGACY']['createVisEmbeddableFromObject']; restorePreviousUrl: () => void; scopedHistory: ScopedHistory; - featureFlagConfig: ConfigSchema; + dashboard: DashboardStart; } export interface SavedVisInstance { diff --git a/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx b/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx index 87a6437192aa9..43121f2cffc41 100644 --- a/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx +++ b/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx @@ -75,7 +75,7 @@ export const getTopNavConfig = ( toastNotifications, visualizeCapabilities, i18n: { Context: I18nContext }, - featureFlagConfig, + dashboard, }: VisualizeServices ) => { const { vis, embeddableHandler } = visInstance; @@ -212,7 +212,7 @@ export const getTopNavConfig = ( }; if ( originatingApp === 'dashboards' && - featureFlagConfig.showNewVisualizeFlow && + dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables && !savedVis ) { return createVisReference(); @@ -292,7 +292,7 @@ export const getTopNavConfig = ( const isSaveAsButton = anchorElement.classList.contains('saveAsButton'); if ( originatingApp === 'dashboards' && - featureFlagConfig.showNewVisualizeFlow && + dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables && !isSaveAsButton ) { createVisReference(); diff --git a/src/plugins/visualize/public/plugin.ts b/src/plugins/visualize/public/plugin.ts index 1bde6ac87ddd7..d7222d771a108 100644 --- a/src/plugins/visualize/public/plugin.ts +++ b/src/plugins/visualize/public/plugin.ts @@ -48,6 +48,7 @@ import { VisualizeServices } from './application/types'; import { DEFAULT_APP_CATEGORIES } from '../../../core/public'; import { SavedObjectsStart } from '../../saved_objects/public'; import { EmbeddableStart } from '../../embeddable/public'; +import { DashboardStart } from '../../dashboard/public'; import { UiActionsStart, VISUALIZE_FIELD_TRIGGER } from '../../ui_actions/public'; import { setUISettings, @@ -67,6 +68,7 @@ export interface VisualizePluginStartDependencies { embeddable: EmbeddableStart; kibanaLegacy: KibanaLegacyStart; savedObjects: SavedObjectsStart; + dashboard: DashboardStart; uiActions: UiActionsStart; } @@ -77,10 +79,6 @@ export interface VisualizePluginSetupDependencies { share?: SharePluginSetup; } -export interface FeatureFlagConfig { - showNewVisualizeFlow: boolean; -} - export class VisualizePlugin implements Plugin { @@ -171,7 +169,6 @@ export class VisualizePlugin * this should be replaced to use only scoped history after moving legacy apps to browser routing */ const history = createHashHistory(); - const services: VisualizeServices = { ...coreStart, history, @@ -198,7 +195,7 @@ export class VisualizePlugin savedObjectsPublic: pluginsStart.savedObjects, scopedHistory: params.history, restorePreviousUrl, - featureFlagConfig: this.initializerContext.config.get(), + dashboard: pluginsStart.dashboard, }; params.element.classList.add('visAppWrapper'); diff --git a/src/plugins/visualize/server/index.ts b/src/plugins/visualize/server/index.ts index 6da0a513b1475..5cebef71d8d22 100644 --- a/src/plugins/visualize/server/index.ts +++ b/src/plugins/visualize/server/index.ts @@ -17,17 +17,8 @@ * under the License. */ -import { PluginInitializerContext, PluginConfigDescriptor } from 'kibana/server'; +import { PluginInitializerContext } from 'kibana/server'; import { VisualizeServerPlugin } from './plugin'; -import { ConfigSchema, configSchema } from '../config'; - -export const config: PluginConfigDescriptor = { - exposeToBrowser: { - showNewVisualizeFlow: true, - }, - schema: configSchema, -}; - export const plugin = (initContext: PluginInitializerContext) => new VisualizeServerPlugin(initContext); diff --git a/test/new_visualize_flow/config.js b/test/new_visualize_flow/config.js index a6440d16481d5..c4790a35404c9 100644 --- a/test/new_visualize_flow/config.js +++ b/test/new_visualize_flow/config.js @@ -37,7 +37,6 @@ export default async function ({ readConfigFile }) { ...commonConfig.get('kbnTestServer.serverArgs'), '--oss', '--telemetry.optIn=false', - '--visualize.showNewVisualizeFlow=true', ], },