@isoftdata/utility-dashboard-backend 1.2.0 → 1.2.2

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.
Files changed (2) hide show
  1. package/index.js +4 -19
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -31,32 +31,16 @@ const handleChartTypeSpecificQuirks = (chartType, resultSet) => {
31
31
  return resultSet
32
32
  }
33
33
 
34
- const loadChartData = async(mysqlConnection, { name, query: queryObject, formatting, chartWrapper, multiSeries, parameters, table, ...theRest }) => { // needs database connection
35
- // let { results: queryResultSet, fields } = (queryObject && queryObject.sql) ? await queryWithFields(mysqlConnection, queryObject) : { fields: [], results: [] }
36
- // let data = handleChartTypeSpecificQuirks(chartWrapper.chartType, queryResultSet)
34
+ const loadChartData = async(mysqlConnection, { name, query: queryObject, formatting, chartWrapper, multiSeries, parameters, ...theRest }) => { // needs database connection
37
35
  const dataTable = await loadDataTable(mysqlConnection, { query: queryObject, multiSeries, formatting, chartType: chartWrapper.chartType })
38
- // if (multiSeries) {
39
- // ({ data, formatting, fields } = getMultiSeriesData({
40
- // data,
41
- // seriesOptions: multiSeries,
42
- // formatting,
43
- // fields,
44
- // }))
45
- // }
46
36
 
47
37
  const proccessedFormatting = handleFormattingTemplates(formatting)
48
38
 
49
- // let dataTable = getDataTableFormat(data, fields, multiSeries) //per the Google Charts docs, the DataTable object literal format is the most performant, so we'll turn it into that format before returning
50
-
51
- // if (chartWrapper.chartType == 'AreaChart') {
52
- // dataTable = makeDataCumulative(dataTable)
53
- // }
54
-
55
39
  if (chartWrapper.chartType === 'Table') {
56
40
  return {
57
41
  ...theRest,
58
42
  chartWrapper,
59
- table: { ...table, ...dataTable },
43
+ table: dataTable,
60
44
  formatting: proccessedFormatting,
61
45
  }
62
46
  }
@@ -72,12 +56,13 @@ const loadChartData = async(mysqlConnection, { name, query: queryObject, formatt
72
56
  /*
73
57
  * Returns only the data needed to render out the chart. If chartType is 'Table', it will return it in the format consumed by the ractive table component.
74
58
  * Otherwise, it will return data in the google chart Datatable object literal format.
59
+ * multiSeries, formatting properties should be deconstructed from the chart object, chartType should be deconstructed from the chart's chartWrapper property
75
60
  */
76
61
  const loadDataTable = async(mysqlConnection, { query: queryObject, multiSeries, formatting, chartType }) => {
77
62
  let { results: queryResultSet, fields } = (queryObject && queryObject.sql) ? await queryWithFields(mysqlConnection, queryObject) : { fields: [], results: [] }
78
63
  let data = handleChartTypeSpecificQuirks(chartType, queryResultSet)
79
64
 
80
- if (chartType === 'Table') {
65
+ if (chartType.toLowerCase() === 'table') {
81
66
  return getRactiveTableDataFormat(data, fields, formatting)
82
67
  }
83
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoftdata/utility-dashboard-backend",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
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": {