Skip to content

Commit

Permalink
[Time to Visualize] Unifying feature flag config for visualize editor…
Browse files Browse the repository at this point in the history
… and dashboard (#75408)

* Unifying feature flag config for visualize/dashboard

* Removing unused import

* Adding missing comma
  • Loading branch information
Maja Grubic authored Aug 20, 2020
1 parent f124807 commit be0724d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 48 deletions.
26 changes: 0 additions & 26 deletions src/plugins/visualize/config.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/plugins/visualize/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"savedObjects",
"visualizations",
"embeddable",
"dashboard",
"uiActions"
],
"optionalPlugins": ["home", "share"],
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/visualize/public/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -111,7 +111,7 @@ export interface VisualizeServices extends CoreStart {
createVisEmbeddableFromObject: VisualizationsStart['__LEGACY']['createVisEmbeddableFromObject'];
restorePreviousUrl: () => void;
scopedHistory: ScopedHistory;
featureFlagConfig: ConfigSchema;
dashboard: DashboardStart;
}

export interface SavedVisInstance {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const getTopNavConfig = (
toastNotifications,
visualizeCapabilities,
i18n: { Context: I18nContext },
featureFlagConfig,
dashboard,
}: VisualizeServices
) => {
const { vis, embeddableHandler } = visInstance;
Expand Down Expand Up @@ -212,7 +212,7 @@ export const getTopNavConfig = (
};
if (
originatingApp === 'dashboards' &&
featureFlagConfig.showNewVisualizeFlow &&
dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables &&
!savedVis
) {
return createVisReference();
Expand Down Expand Up @@ -292,7 +292,7 @@ export const getTopNavConfig = (
const isSaveAsButton = anchorElement.classList.contains('saveAsButton');
if (
originatingApp === 'dashboards' &&
featureFlagConfig.showNewVisualizeFlow &&
dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables &&
!isSaveAsButton
) {
createVisReference();
Expand Down
9 changes: 3 additions & 6 deletions src/plugins/visualize/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -67,6 +68,7 @@ export interface VisualizePluginStartDependencies {
embeddable: EmbeddableStart;
kibanaLegacy: KibanaLegacyStart;
savedObjects: SavedObjectsStart;
dashboard: DashboardStart;
uiActions: UiActionsStart;
}

Expand All @@ -77,10 +79,6 @@ export interface VisualizePluginSetupDependencies {
share?: SharePluginSetup;
}

export interface FeatureFlagConfig {
showNewVisualizeFlow: boolean;
}

export class VisualizePlugin
implements
Plugin<void, void, VisualizePluginSetupDependencies, VisualizePluginStartDependencies> {
Expand Down Expand Up @@ -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,
Expand All @@ -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');
Expand Down
11 changes: 1 addition & 10 deletions src/plugins/visualize/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
1 change: 0 additions & 1 deletion test/new_visualize_flow/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default async function ({ readConfigFile }) {
...commonConfig.get('kbnTestServer.serverArgs'),
'--oss',
'--telemetry.optIn=false',
'--visualize.showNewVisualizeFlow=true',
],
},

Expand Down

0 comments on commit be0724d

Please sign in to comment.