From 55d4e4deb120607ed6f92620c8e5c6069b0a9db9 Mon Sep 17 00:00:00 2001 From: Manasvini B Suryanarayana Date: Tue, 12 Jul 2022 22:15:11 +0000 Subject: [PATCH] [D&D] Add a flag in the YAML config to enable and disable the D&D plugin Resolves Issue - https://github.com/opensearch-project/OpenSearch-Dashboards/issues/1877 Signed-off-by: Manasvini B Suryanarayana --- config/opensearch_dashboards.yml | 4 ++++ src/plugins/wizard/config.ts | 12 ++++++++++++ src/plugins/wizard/public/plugin.ts | 3 ++- src/plugins/wizard/server/index.ts | 10 +++++++++- 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/plugins/wizard/config.ts diff --git a/config/opensearch_dashboards.yml b/config/opensearch_dashboards.yml index 3ece0fd3b612..7757ba6761ad 100644 --- a/config/opensearch_dashboards.yml +++ b/config/opensearch_dashboards.yml @@ -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 diff --git a/src/plugins/wizard/config.ts b/src/plugins/wizard/config.ts new file mode 100644 index 000000000000..b6be3f718eea --- /dev/null +++ b/src/plugins/wizard/config.ts @@ -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; diff --git a/src/plugins/wizard/public/plugin.ts b/src/plugins/wizard/public/plugin.ts index 7af37ccf61b6..8d9ebb406a0f 100644 --- a/src/plugins/wizard/public/plugin.ts +++ b/src/plugins/wizard/public/plugin.ts @@ -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 { private typeService = new TypeService(); - constructor(public initializerContext: PluginInitializerContext) {} + constructor(public initializerContext: PluginInitializerContext) {} public setup( core: CoreSetup, diff --git a/src/plugins/wizard/server/index.ts b/src/plugins/wizard/server/index.ts index e995ea17b4a7..811998b8a954 100644 --- a/src/plugins/wizard/server/index.ts +++ b/src/plugins/wizard/server/index.ts @@ -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, @@ -14,3 +15,10 @@ export function plugin(initializerContext: PluginInitializerContext) { } export { WizardPluginSetup, WizardPluginStart } from './types'; + +export const config: PluginConfigDescriptor = { + exposeToBrowser: { + enabled: true, + }, + schema: configSchema, +};