[Time to Visualize] Unifying feature flag config for visualize editor and dashboard (#75408) (#75524)
* Unifying feature flag config for visualize/dashboard * Removing unused import * Adding missing comma
This commit is contained in:
parent
e3644b2263
commit
866d8ada33
|
@ -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<typeof configSchema>;
|
|
@ -10,6 +10,7 @@
|
|||
"savedObjects",
|
||||
"visualizations",
|
||||
"embeddable",
|
||||
"dashboard",
|
||||
"uiActions"
|
||||
],
|
||||
"optionalPlugins": ["home", "share"],
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<void, void, VisualizePluginSetupDependencies, VisualizePluginStartDependencies> {
|
||||
|
@ -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<FeatureFlagConfig>(),
|
||||
dashboard: pluginsStart.dashboard,
|
||||
};
|
||||
|
||||
params.element.classList.add('visAppWrapper');
|
||||
|
|
|
@ -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<ConfigSchema> = {
|
||||
exposeToBrowser: {
|
||||
showNewVisualizeFlow: true,
|
||||
},
|
||||
schema: configSchema,
|
||||
};
|
||||
|
||||
export const plugin = (initContext: PluginInitializerContext) =>
|
||||
new VisualizeServerPlugin(initContext);
|
||||
|
|
|
@ -37,7 +37,6 @@ export default async function ({ readConfigFile }) {
|
|||
...commonConfig.get('kbnTestServer.serverArgs'),
|
||||
'--oss',
|
||||
'--telemetry.optIn=false',
|
||||
'--visualize.showNewVisualizeFlow=true',
|
||||
],
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue