@isoftdata/utility-dashboard-backend 1.4.4 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/chart-helper.js CHANGED
@@ -154,7 +154,7 @@ module.exports = {
154
154
  const rowWithValidValue = data.find(row => row[columnProp] !== null)
155
155
  let nullReplacement = ''
156
156
 
157
- if ((destinationType && destinationType === 'number') || (typeof rowWithValidValue[columnProp] === 'number')) {
157
+ if ((destinationType && destinationType === 'number') || (rowWithValidValue && typeof rowWithValidValue[columnProp] === 'number')) {
158
158
  nullReplacement = 0
159
159
  }
160
160
 
@@ -237,12 +237,13 @@ module.exports = {
237
237
  return {
238
238
  property: field,
239
239
  name: field,
240
- class: 'text-right',
240
+ class: 'text-right border-top-0',
241
241
  }
242
242
  }
243
243
  return {
244
244
  property: field,
245
245
  name: field,
246
+ class: 'border-top-0',
246
247
  }
247
248
  })
248
249
  return {
package/index.js CHANGED
@@ -21,6 +21,9 @@ const handleChartTypeSpecificQuirks = (chartType, resultSet) => {
21
21
  case 'TreeMap':
22
22
  //tree charts need the 2nd columns to be not null
23
23
  resultSet = coerceNullColumn(Object.keys(resultSet[0])[1], resultSet)
24
+ if (resultSet.length === 1) {
25
+ resultSet[0].id = 'No Data'
26
+ }
24
27
  break
25
28
  default:
26
29
  //all charts need the first column to be not null
@@ -31,14 +34,14 @@ const handleChartTypeSpecificQuirks = (chartType, resultSet) => {
31
34
  return resultSet
32
35
  }
33
36
 
34
- const loadChartData = async(mysqlConnection, { name, query: queryObject, formatting, chartWrapper, multiSeries, parameters, ...theRest }) => { // needs database connection
37
+ const loadChartData = async(mysqlConnection, { name, query: queryObject, formatting, chartWrapper, multiSeries, table, parameters, ...theRest }) => { // needs database connection
35
38
  const { dataTable, processedFormatting } = await loadDataTableAndProcessedFormatting(mysqlConnection, { query: queryObject, multiSeries, formatting, chartType: chartWrapper.chartType })
36
39
 
37
40
  if (chartWrapper.chartType === 'Table') {
38
41
  return {
39
42
  ...theRest,
40
43
  chartWrapper,
41
- table: dataTable,
44
+ table: { ...table, ...dataTable }, // combine the data and any table setting overrides
42
45
  formatting: processedFormatting,
43
46
  }
44
47
  }
@@ -99,9 +102,14 @@ const loadOptionList = async(mysqlConnection, optionListQuery, optionList = [])
99
102
  ]
100
103
  }
101
104
 
102
- const loadOutputParameterValues = async(mysqlConnection, { definitionList, selectionList = [], forClient = false }) => {
105
+ const loadOutputParameterValues = async(mysqlConnection, { definitionList = [], selectionList = [], forClient = false }) => {
103
106
  let parameterValues = []
104
107
 
108
+ // If definitionList is not an Array, there are no parameters, so just return []
109
+ if (!(definitionList instanceof Array)) {
110
+ return []
111
+ }
112
+
105
113
  for (const definition of definitionList) {
106
114
  const matchingParameterSelection = selectionList.find(param => param.name === definition.name)
107
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoftdata/utility-dashboard-backend",
3
- "version": "1.4.4",
3
+ "version": "1.4.6",
4
4
  "description": "A utility for formatting chart and report data to be usable by the frontend dashboard component.",
5
5
  "main": "index.js",
6
6
  "scripts": {