From d8583237eaf11311b7c794d9bb08a1d6fd4819d3 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Thu, 11 Aug 2022 17:57:01 -0400 Subject: [PATCH] [v8.5.x] Geomap: Revert temporary fix for markers coloring (#53611) (#53630) (cherry picked from commit 1f93216f1d16c1903adf3df210684745a7778e48) Co-authored-by: Adela Almasan <88068998+adela-almasan@users.noreply.github.com> --- .../app/plugins/panel/geomap/GeomapPanel.tsx | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/public/app/plugins/panel/geomap/GeomapPanel.tsx b/public/app/plugins/panel/geomap/GeomapPanel.tsx index 5a88d817a97..df25af01ade 100644 --- a/public/app/plugins/panel/geomap/GeomapPanel.tsx +++ b/public/app/plugins/panel/geomap/GeomapPanel.tsx @@ -95,28 +95,6 @@ export class GeomapPanel extends Component { componentDidMount() { this.panelContext = this.context as PanelContext; - // TODO: Clean this approach up / potentially support multiple marker layers? - // See https://github.com/grafana/grafana/issues/51185 for more details. - setTimeout(() => { - for (const layer of this.layers) { - if (layer.options.type === MARKERS_LAYER_ID) { - const colorField = layer.options.config.style.color.field; - const colorFieldData = this.props.data.series[0].fields.find((field) => field.name === colorField); - // initialize (not override) Standard Options min/max value with color field calc min/max - if (colorFieldData) { - this.props.onFieldConfigChange({ - ...this.props.fieldConfig, - defaults: { - min: colorFieldData.state?.calcs?.min, - max: colorFieldData.state?.calcs?.max, - ...this.props.fieldConfig.defaults, - }, - }); - break; - } - } - } - }, 50); } shouldComponentUpdate(nextProps: Props) { @@ -265,31 +243,6 @@ export class GeomapPanel extends Component { console.log('Controls changed'); this.initControls(options.controls ?? { showZoom: true, showAttribution: true }); } - - // TODO: Clean this approach up / potentially support multiple marker layers? - // See https://github.com/grafana/grafana/issues/51185 for more details. - for (const layer of options.layers) { - if (layer.type === MARKERS_LAYER_ID) { - const oldLayer = this.props.options.layers.find((lyr) => lyr.name === layer.name); - const newLayerColorField = layer.config.style.color.field; - const oldLayerColorField = oldLayer?.config.style.color.field; - if (layer.config.style.color.field && newLayerColorField !== oldLayerColorField) { - const colorFieldData = this.props.data.series[0].fields.find((field) => field.name === newLayerColorField); - if (colorFieldData) { - // override Standard Options min/max value with color field calc min/max - this.props.onFieldConfigChange({ - ...this.props.fieldConfig, - defaults: { - ...this.props.fieldConfig.defaults, - min: colorFieldData.state?.calcs?.min, - max: colorFieldData.state?.calcs?.max, - }, - }); - break; - } - } - } - } } /**