import { i18n } from '@kbn/i18n' ; import React from 'react' ; import { CreateSourceEditor } from './create_source_editor' ; import { ESGeoGridSource , heatmapTitle } from './es_geo_grid_source' ; import { LayerWizard , RenderWizardArguments } from '../../layers' ; import { HeatmapLayer } from '../../layers/heatmap_layer' ; import { ESGeoGridSourceDescriptor } from '../../../../common/descriptor_types' ; import { GRID_RESOLUTION , LAYER_WIZARD_CATEGORY , RENDER_AS } from '../../../../common/constants' ; import { HeatmapLayerIcon } from '../../layers/wizards/icons/heatmap_layer_icon' ; export const heatmapLayerWizardConfig = { order : 10 , categories : [ LAYER_WIZARD_CATEGORY . ELASTICSEARCH ] , description : i18n . translate ( 'xpack.maps.source.esGridHeatmapDescription' , { defaultMessage : 'Geospatial data grouped in grids to show density' , } ) , icon : HeatmapLayerIcon , renderWizard : ( { previewLayers } ) => { const onSourceConfigChange = ( sourceConfig ) => { if ( ! sourceConfig ) { previewLayers ( [ ] ) ; return ; } const layerDescriptor = HeatmapLayer . createDescriptor ( { sourceDescriptor : ESGeoGridSource . createDescriptor ( { ... sourceConfig , resolution : GRID_RESOLUTION . SUPER_FINE , } ) , } ) ; previewLayers ( [ layerDescriptor ] ) ; } ; return ( < CreateSourceEditor requestType = { RENDER_AS . HEATMAP } onSourceConfigChange = { onSourceConfigChange } / > ) ; } , title : heatmapTitle , } ;