File tree Expand file tree Collapse file tree
x-pack/plugins/lens/public/heatmap_visualization Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88import React from 'react' ;
99import { render } from 'react-dom' ;
1010import { i18n } from '@kbn/i18n' ;
11- import { I18nProvider } from '@kbn/i18n/react' ;
11+ import { FormattedMessage , I18nProvider } from '@kbn/i18n/react' ;
1212import { Ast } from '@kbn/interpreter/common' ;
1313import { Position } from '@elastic/charts' ;
1414import { PaletteRegistry } from '../../../../../src/plugins/charts/public' ;
@@ -386,4 +386,30 @@ export const getHeatmapVisualization = ({
386386
387387 return errors . length ? errors : undefined ;
388388 } ,
389+
390+ getWarningMessages ( state , frame ) {
391+ if ( ! state ?. layerId || ! frame . activeData || ! state . valueAccessor ) {
392+ return ;
393+ }
394+
395+ const rows = frame . activeData [ state . layerId ] && frame . activeData [ state . layerId ] . rows ;
396+ if ( ! rows ) {
397+ return ;
398+ }
399+
400+ const hasArrayValues = rows . some ( ( row ) => Array . isArray ( row [ state . valueAccessor ! ] ) ) ;
401+
402+ const datasource = frame . datasourceLayers [ state . layerId ] ;
403+ const operation = datasource . getOperationForColumnId ( state . valueAccessor ) ;
404+
405+ return hasArrayValues
406+ ? [
407+ < FormattedMessage
408+ id = "xpack.lens.heatmapVisualization.arrayValuesWarningMessage"
409+ defaultMessage = "{label} contains array values. Your visualization may not render as expected."
410+ values = { { label : < strong > { operation ?. label } </ strong > } }
411+ /> ,
412+ ]
413+ : undefined ;
414+ } ,
389415} ) ;
You can’t perform that action at this time.
0 commit comments