From 23c3931eba33a3002046360f972d37f3af57c632 Mon Sep 17 00:00:00 2001 From: Kevin Jackson <30411845+KevinJJackson@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:15:25 -0400 Subject: [PATCH] bugfix/uploader-timeseries-id (#236) * fix options that render via fieldmap key instead of from csv data source * filter TS by standard --- package.json | 2 +- src/app-bundles/upload-bundle.js | 4 ++-- src/upload-parsers/inclinometer_measurements.js | 1 + src/upload-parsers/timeseries.js | 1 + src/upload-parsers/timeseries_measurements.js | 3 ++- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c573a22e..57acc488 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hhd-ui", - "version": "0.17.1", + "version": "0.17.2", "private": true, "dependencies": { "@ag-grid-community/client-side-row-model": "^30.0.3", diff --git a/src/app-bundles/upload-bundle.js b/src/app-bundles/upload-bundle.js index 96291525..c3c5a516 100644 --- a/src/app-bundles/upload-bundle.js +++ b/src/app-bundles/upload-bundle.js @@ -395,8 +395,8 @@ const uploadBundle = { ? setAllTo[1] === 'true' : setAllTo[1]; } else { - // If field not mapped, set to null; if required field, push error - const data = row[sourceKey]; + const data = config.useFieldMapKey ? fieldMap[key] : row[sourceKey]; + if (!data) { parsedRow[key] = null; if (config.required) parsedRow.errors.push(key); diff --git a/src/upload-parsers/inclinometer_measurements.js b/src/upload-parsers/inclinometer_measurements.js index 6920a4ed..80ed0f9c 100644 --- a/src/upload-parsers/inclinometer_measurements.js +++ b/src/upload-parsers/inclinometer_measurements.js @@ -33,6 +33,7 @@ const inclinometerMeasurementParser = { type: 'internal', required: true, useFilterComponent: true, + useFieldMapKey: true, provider: state => { return Object.keys(state.instrumentTimeseries) .filter(key => key.charAt(0) !== '_') diff --git a/src/upload-parsers/timeseries.js b/src/upload-parsers/timeseries.js index ee730f02..91d35a7c 100644 --- a/src/upload-parsers/timeseries.js +++ b/src/upload-parsers/timeseries.js @@ -22,6 +22,7 @@ const timeseriesParser = { type: 'internal', required: true, useFilterComponent: true, + useFieldMapKey: true, hideCsvMappings: true, provider: state => ( Object.keys(state.instruments) diff --git a/src/upload-parsers/timeseries_measurements.js b/src/upload-parsers/timeseries_measurements.js index 10893f45..585b29d0 100644 --- a/src/upload-parsers/timeseries_measurements.js +++ b/src/upload-parsers/timeseries_measurements.js @@ -29,9 +29,10 @@ const timeseriesMeasurementParser = { type: 'internal', required: true, useFilterComponent: true, + useFieldMapKey: true, provider: state => { return Object.keys(state.instrumentTimeseries) - .filter(key => key.charAt(0) !== '_') + .filter(key => key.charAt(0) !== '_' && state.instrumentTimeseries[key].type === 'standard') .map(key => ({ value: key, text: `${state.instrumentTimeseries[key].instrument} - ${state.instrumentTimeseries[key].name}`,