From 2a86cffc8e855bea1d4201e9f0f57de18bff96cb Mon Sep 17 00:00:00 2001 From: Chris Matzenbach Date: Tue, 9 Apr 2024 12:24:08 -0500 Subject: [PATCH] [FE-17686] Human-readable missing hit test cols error string (#665) * Replace heavydb error string with human-readable error display * Formatting, make constant uppercase * Prettier fixes * Fix conditional * Empty space --------- Co-authored-by: Chris Matzenbach --- src/charts/heatmap.js | 2 +- src/charts/row-chart.js | 2 +- src/mixins/cap-mixin.js | 2 +- src/mixins/coordinate-grid-mixin.js | 4 ++-- src/mixins/coordinate-grid-raster-mixin.js | 4 ++-- src/mixins/d3.box.js | 4 ++-- src/mixins/raster-layer.js | 8 +++++++- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/charts/heatmap.js b/src/charts/heatmap.js index 6d96d6009..3ce75cf4c 100644 --- a/src/charts/heatmap.js +++ b/src/charts/heatmap.js @@ -492,7 +492,7 @@ export default function heatMap(parent, chartGroup) { rows = _rowScale.domain(rows) cols = _colScale.domain(cols) _chart.dockedAxesSize(_chart.getAxisSizes(cols.domain(), rows.domain())) - let rowCount = rows.domain().length, + const rowCount = rows.domain().length, colCount = cols.domain().length, availWidth = _chart.width() - _dockedAxesSize.left, availHeight = _chart.height() - _dockedAxesSize.bottom, diff --git a/src/charts/row-chart.js b/src/charts/row-chart.js index daa339019..b60a4150d 100644 --- a/src/charts/row-chart.js +++ b/src/charts/row-chart.js @@ -560,7 +560,7 @@ export default function rowChart(parent, chartGroup) { /* --------------------------------------------------------------------------*/ function translateX(d) { - let x = _x(_chart.cappedValueAccessor(d)), + const x = _x(_chart.cappedValueAccessor(d)), x0 = rootValue(), s = x > x0 ? x0 : x return "translate(" + s + ",0)" diff --git a/src/mixins/cap-mixin.js b/src/mixins/cap-mixin.js index e955bf511..61d6b5faf 100644 --- a/src/mixins/cap-mixin.js +++ b/src/mixins/cap-mixin.js @@ -21,7 +21,7 @@ export default function capMixin(_chart) { let _othersLabel = "Others" let _othersGrouper = function(topRows) { - let topRowsSum = d3.sum(topRows, _chart.valueAccessor()), + const topRowsSum = d3.sum(topRows, _chart.valueAccessor()), allRows = _chart.group().all(), allRowsSum = d3.sum(allRows, _chart.valueAccessor()), topKeys = topRows.map(_chart.keyAccessor()), diff --git a/src/mixins/coordinate-grid-mixin.js b/src/mixins/coordinate-grid-mixin.js index 936808120..3d8f23dfe 100644 --- a/src/mixins/coordinate-grid-mixin.js +++ b/src/mixins/coordinate-grid-mixin.js @@ -723,7 +723,7 @@ export default function coordinateGridMixin (_chart) { if (_y === undefined) { _y = d3.scale.linear() } - let min = _chart.yAxisMin() || 0, + const min = _chart.yAxisMin() || 0, max = _chart.yAxisMax() || 0 _y.domain([min, max]).rangeRound([_chart.yAxisHeight(), 0]) } @@ -1363,7 +1363,7 @@ export default function coordinateGridMixin (_chart) { // borrowed from Crossfilter example _chart.resizeHandlePath = function (d) { - let e = Number(d === "e"), + const e = Number(d === "e"), x = e ? 1 : -1, y = brushHeight() / 3 return ( diff --git a/src/mixins/coordinate-grid-raster-mixin.js b/src/mixins/coordinate-grid-raster-mixin.js index 56aed5aed..4cb0a020e 100644 --- a/src/mixins/coordinate-grid-raster-mixin.js +++ b/src/mixins/coordinate-grid-raster-mixin.js @@ -214,7 +214,7 @@ export default function coordinateGridRasterMixin (_chart, _mapboxgl, browser) { } _chart.unproject = function (pt) { - let xscale = _chart.x(), + const xscale = _chart.x(), yscale = _chart.y() const x = (xscale ? xscale.invert(pt.x) : 0) const y = (yscale ? yscale.invert(pt.y) : 0) @@ -1404,7 +1404,7 @@ axis in dc.js is simply an instance of a [d3 axis // borrowed from Crossfilter example _chart.resizeHandlePath = function (d) { - let e = Number(d === "e"), + const e = Number(d === "e"), x = e ? 1 : -1, y = brushHeight() / 3 return "M" + (0.5 * x) + "," + y + "A6,6 0 0 " + e + " " + (6.5 * x) + "," + (y + 6) + "V" + (2 * y - 6) + "A6,6 0 0 " + e + " " + (0.5 * x) + "," + (2 * y) + "Z" + "M" + (2.5 * x) + "," + (y + 8) + "V" + (2 * y - 8) + "M" + (4.5 * x) + "," + (y + 8) + "V" + (2 * y - 8) diff --git a/src/mixins/d3.box.js b/src/mixins/d3.box.js index 366ad8607..69dad05d1 100644 --- a/src/mixins/d3.box.js +++ b/src/mixins/d3.box.js @@ -17,7 +17,7 @@ import d3 from "d3" function box(g) { g.each(function(d, i) { d = d.map(value).sort(d3.ascending) - let g = d3.select(this), + const g = d3.select(this), n = d.length, min = d[0], max = d[n - 1] @@ -26,7 +26,7 @@ import d3 from "d3" const quartileData = (d.quartiles = quartiles(d)) // Compute whiskers. Must return exactly 2 elements, or null. - let whiskerIndices = whiskers && whiskers.call(this, d, i), + const whiskerIndices = whiskers && whiskers.call(this, d, i), whiskerData = whiskerIndices && whiskerIndices.map(i => d[i]) // Compute outliers. If no whiskers are specified, all data are 'outliers'. diff --git a/src/mixins/raster-layer.js b/src/mixins/raster-layer.js index ecbcaf401..d1f94472b 100644 --- a/src/mixins/raster-layer.js +++ b/src/mixins/raster-layer.js @@ -27,6 +27,8 @@ const validLayerTypes = [ ] const { getImageSize, replaceAsync, parseUrlParts } = utils +const MISSING_HIT_TEST_COLUMN_ERROR = + "$HEAVYAI_ERROR_COLUMN_NOT_FOUND_IN_HIT_TEST_CACHE$" export default function rasterLayer(layerType) { const _layerType = layerType @@ -355,7 +357,11 @@ export default function rasterLayer(layerType) { const columnSet = new Set(popupColumns) for (const key in data) { if (columnSet.has(key)) { - newData[key] = data[key] + // check for missing hit test cache columns and substitute readable message + newData[key] = + data[key] === MISSING_HIT_TEST_COLUMN_ERROR + ? "Column Not Found" + : data[key] data[key] instanceof Date ? moment(data[key]).utc() : data[key] if (typeof chart.useLonLat === "function" && chart.useLonLat()) {