@bento-core/table 1.0.1-ccdihub.71 → 1.0.1-ccdihub.72

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.
@@ -60,7 +60,7 @@ function convertToCSV(jsonse, keysToInclude, header) {
60
60
  } else {
61
61
  line += entry[keyName] !== null ? "\"".concat(entry[keyName], "\"") : ' ';
62
62
  }
63
- } else if (keyName === 'last_known_survival_status' || keyName === 'sample_id') {
63
+ } else if (keyName === 'last_known_survival_status' || keyName === 'sample_id' || keyName === 'data_category') {
64
64
  if (!entry[keyName] || entry[keyName] === '[]') {
65
65
  line += '';
66
66
  } else if (entry[keyName].toString().charAt(0) === '[' && entry[keyName].toString().charAt(entry[keyName].toString().length - 1) === ']') {
@@ -150,6 +150,7 @@ function downloadJson(tableData, table, downloadFileName) {
150
150
  formatDataVal = formatDataVal.map(entry => {
151
151
  let survivalStatus = entry.last_known_survival_status;
152
152
  let sampleId = entry.sample_id;
153
+ let dataCategory = entry.data_category;
153
154
  if (!survivalStatus || survivalStatus === '[]') {
154
155
  survivalStatus = '';
155
156
  } else if (survivalStatus.toString().charAt(0) === '[' && survivalStatus.toString().charAt(survivalStatus.toString().length - 1) === ']') {
@@ -160,9 +161,15 @@ function downloadJson(tableData, table, downloadFileName) {
160
161
  } else if (sampleId.toString().charAt(0) === '[' && sampleId.toString().charAt(sampleId.toString().length - 1) === ']') {
161
162
  sampleId = sampleId.toString().substring(1, sampleId.length - 1);
162
163
  }
164
+ if (!dataCategory || dataCategory === '[]') {
165
+ dataCategory = '';
166
+ } else if (dataCategory.toString().charAt(0) === '[' && dataCategory.toString().charAt(dataCategory.toString().length - 1) === ']') {
167
+ dataCategory = dataCategory.toString().substring(1, dataCategory.length - 1);
168
+ }
163
169
  return _objectSpread(_objectSpread({}, entry), {}, {
164
170
  last_known_survival_status: survivalStatus,
165
- sample_id: sampleId
171
+ sample_id: sampleId,
172
+ data_category: dataCategory
166
173
  });
167
174
  });
168
175
  filterColumns.forEach(column => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-ccdihub.71",
3
+ "version": "1.0.1-ccdihub.72",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
@@ -46,7 +46,7 @@ export function convertToCSV(jsonse, keysToInclude, header) {
46
46
  } else {
47
47
  line += entry[keyName] !== null ? `"${entry[keyName]}"` : ' ';
48
48
  }
49
- } else if (keyName === 'last_known_survival_status' || keyName === 'sample_id') {
49
+ } else if (keyName === 'last_known_survival_status' || keyName === 'sample_id' || keyName === 'data_category') {
50
50
  if (!entry[keyName] || entry[keyName] === '[]') {
51
51
  line += '';
52
52
  } else if (entry[keyName].toString().charAt(0) === '[' && entry[keyName].toString().charAt(entry[keyName].toString().length - 1) === ']') {
@@ -99,6 +99,8 @@ export function downloadJson(tableData, table, downloadFileName) {
99
99
  formatDataVal = formatDataVal.map((entry) => {
100
100
  let survivalStatus = entry.last_known_survival_status;
101
101
  let sampleId = entry.sample_id;
102
+ let dataCategory = entry.data_category;
103
+
102
104
  if (!survivalStatus || survivalStatus === '[]') {
103
105
  survivalStatus = '';
104
106
  } else if (survivalStatus.toString().charAt(0) === '[' && survivalStatus.toString().charAt(survivalStatus.toString().length - 1) === ']') {
@@ -110,7 +112,18 @@ export function downloadJson(tableData, table, downloadFileName) {
110
112
  } else if (sampleId.toString().charAt(0) === '[' && sampleId.toString().charAt(sampleId.toString().length - 1) === ']') {
111
113
  sampleId = sampleId.toString().substring(1, sampleId.length - 1);
112
114
  }
113
- return { ...entry, last_known_survival_status: survivalStatus, sample_id: sampleId };
115
+
116
+ if (!dataCategory || dataCategory === '[]') {
117
+ dataCategory = '';
118
+ } else if (dataCategory.toString().charAt(0) === '[' && dataCategory.toString().charAt(dataCategory.toString().length - 1) === ']') {
119
+ dataCategory = dataCategory.toString().substring(1, dataCategory.length - 1);
120
+ }
121
+ return {
122
+ ...entry,
123
+ last_known_survival_status: survivalStatus,
124
+ sample_id: sampleId,
125
+ data_category: dataCategory,
126
+ };
114
127
  });
115
128
  filterColumns.forEach((column) => {
116
129
  formatDataVal = JSON.parse(