import { i18n } from '@kbn/i18n' ; import { schema } from '@kbn/config-schema' ; import { VISUALIZE_ENABLE_LABS_SETTING } from '../common/constants' ; import { visualizationSavedObjectType } from './saved_objects' ; import { registerVisualizationsCollector } from './usage_collector' ; import { capabilitiesProvider } from './capabilities_provider' ; import type { VisualizationsPluginSetup , VisualizationsPluginStart } from './types' ; import type { PluginInitializerContext , CoreSetup , CoreStart , Plugin , Logger , } from '../../../core/server' ; import type { UsageCollectionSetup } from '../../usage_collection/server' ; import type { EmbeddableSetup } from '../../embeddable/server' ; import { visualizeEmbeddableFactory } from './embeddable/visualize_embeddable_factory' ; export class VisualizationsPlugin implements Plugin < VisualizationsPluginSetup , VisualizationsPluginStart > { private readonly logger : Logger ; constructor ( initializerContext ) { this . logger = initializerContext . logger . get ( ) ; } public setup ( core , plugins ) { this . logger . debug ( 'visualizations: Setup' ) ; core . savedObjects . registerType ( visualizationSavedObjectType ) ; core . capabilities . registerProvider ( capabilitiesProvider ) ; core . uiSettings . register ( { [ VISUALIZE_ENABLE_LABS_SETTING ] : { name : i18n . translate ( 'visualizations.advancedSettings.visualizeEnableLabsTitle' , { defaultMessage : 'Enable experimental visualizations' , } ) , value : true , description : i18n . translate ( 'visualizations.advancedSettings.visualizeEnableLabsText' , { defaultMessage : `Allows users to create, view, and edit experimental visualizations. If disabled,
            only visualizations that are considered production-ready are available to the user.` , } ) , category : [ 'visualization' ] , schema : schema . boolean ( ) , } , } ) ; if ( plugins . usageCollection ) { registerVisualizationsCollector ( plugins . usageCollection ) ; } plugins . embeddable . registerEmbeddableFactory ( visualizeEmbeddableFactory ( ) ) ; return { } ; } public start ( core ) { this . logger . debug ( 'visualizations: Started' ) ; return { } ; } public stop ( ) { } }