Skip to content

Commit c77eee4

Browse files
Fix/table export (#781)
* Fixed issue where dashboards were marked as draft incorrectly on selection change * fixing comma escaping in csv export * fixing utf-8 charset encoding for csv * removing console.log * Opening card settings does not mark a dashboard as draft anymore * Fixed alignment for download CSV button --------- Co-authored-by: Niels de Jong <[email protected]> Co-authored-by: Alfred Rubin <[email protected]>
1 parent 844b2fa commit c77eee4

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/application/ApplicationReducer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import {
66
HARD_RESET_CARD_SETTINGS,
7+
TOGGLE_CARD_SETTINGS,
78
UPDATE_ALL_SELECTIONS,
89
UPDATE_FIELDS,
910
UPDATE_SCHEMA,
@@ -86,6 +87,7 @@ export const applicationReducer = (state = initialState, action: { type: any; pa
8687
UPDATE_ALL_SELECTIONS,
8788
UPDATE_FIELDS,
8889
SET_DASHBOARD_UUID,
90+
TOGGLE_CARD_SETTINGS,
8991
UPDATE_SELECTION,
9092
];
9193

src/chart/ChartUtils.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,12 @@ export const downloadCSV = (rows) => {
167167
if (value && value.low) {
168168
value = value.low;
169169
}
170-
csv += JSON.stringify(value).replaceAll(',', ';');
171-
csv += headers.indexOf(header) < headers.length - 1 ? ', ' : '';
170+
csv += `${JSON.stringify(value)}`;
171+
csv += headers.indexOf(header) < headers.length - 1 ? ',' : '';
172172
});
173173
csv += '\n';
174174
});
175-
176-
const file = new Blob([csv], { type: 'text/plain' });
175+
const file = new Blob([csv], { type: 'text/plain;charset=utf8' });
177176
element.href = URL.createObjectURL(file);
178177
element.download = 'table.csv';
179178
document.body.appendChild(element); // Required for this to work in FireFox

src/chart/table/TableChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export const NeoTableChart = (props: ChartProps) => {
249249
downloadCSV(rows);
250250
}}
251251
aria-label='download csv'
252-
className='n-absolute n-z-10 n-bottom-7 n-left-1'
252+
className='n-absolute n-z-10 n-bottom-2 n-left-1'
253253
clean
254254
>
255255
<CloudArrowDownIconOutline />

0 commit comments

Comments
 (0)