Skip to content

Commit

Permalink
[D&D] Add a flag in the YAML config to enable and disable the D&D plu…
Browse files Browse the repository at this point in the history
…gin (opensearch-project#1889)

Resolves Issue - opensearch-project#1877

Signed-off-by: Manasvini B Suryanarayana <manasvis@amazon.com>
  • Loading branch information
manasvinibs authored and kavilla committed Jul 28, 2022
1 parent 0ef458f commit 51bceb7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
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,
};

0 comments on commit 51bceb7

Please sign in to comment.