Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[D&D] Add a flag in the YAML config to enable and disable the D&D plugin #1889

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,7 @@
# Set the value of this setting to false to suppress search usage telemetry
# for reducing the load of OpenSearch cluster.
# data.search.usageTelemetry.enabled: false

# Set the value of this setting to true to start exploring wizard
# functionality in Visualization.
# wizard.enabled: true
12 changes: 12 additions & 0 deletions src/plugins/wizard/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { schema, TypeOf } from '@osd/config-schema';

export const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: true }),
});

export type ConfigSchema = TypeOf<typeof configSchema>;
3 changes: 2 additions & 1 deletion src/plugins/wizard/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ import { getPreloadedStore } from './application/utils/state_management';
import { setAggService, setIndexPatterns } from './plugin_services';
import { createSavedWizardLoader } from './saved_visualizations';
import { registerDefaultTypes } from './visualizations';
import { ConfigSchema } from '../config';

export class WizardPlugin
implements
Plugin<WizardSetup, WizardStart, WizardPluginSetupDependencies, WizardPluginStartDependencies> {
private typeService = new TypeService();

constructor(public initializerContext: PluginInitializerContext) {}
constructor(public initializerContext: PluginInitializerContext<ConfigSchema>) {}

public setup(
core: CoreSetup<WizardPluginStartDependencies, WizardStart>,
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/wizard/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { PluginInitializerContext } from '../../../core/server';
import { PluginConfigDescriptor, PluginInitializerContext } from '../../../core/server';
import { ConfigSchema, configSchema } from '../config';
import { WizardPlugin } from './plugin';

// This exports static code and TypeScript types,
Expand All @@ -14,3 +15,10 @@ export function plugin(initializerContext: PluginInitializerContext) {
}

export { WizardPluginSetup, WizardPluginStart } from './types';

export const config: PluginConfigDescriptor<ConfigSchema> = {
exposeToBrowser: {
enabled: true,
},
schema: configSchema,
};