Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

BugFix: Corrected the downloaded .csv/.txt files to proper format #50

Merged
merged 2 commits into from
May 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions public/components/QueryResults/QueryResultsBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,34 +175,42 @@ class QueryResultsBody extends React.Component<QueryResultsBodyProps, QueryResul
if (!this.props.queryResultsJSON) {
this.props.getJson(this.props.queries);
}
const jsonObject = JSON.parse(this.props.queryResultsJSON);
const data = JSON.stringify(jsonObject, undefined, 4);
onDownloadFile(data, "json", this.props.selectedTabName + ".json");
setTimeout(() => {
const jsonObject = JSON.parse(this.props.queryResultsJSON);
const data = JSON.stringify(jsonObject, undefined, 4);
onDownloadFile(data, "json", this.props.selectedTabName + ".json");
}, 2000);
};

onDownloadJDBC = (): void => {
if (!this.props.queryResultsJDBC) {
this.props.getJdbc(this.props.queries);
}
const jsonObject = JSON.parse(this.props.queryResultsJDBC);
const data = JSON.stringify(jsonObject, undefined, 4);
onDownloadFile(data, "json", this.props.selectedTabName + ".json");
setTimeout(() => {
const jsonObject = JSON.parse(this.props.queryResultsJDBC);
const data = JSON.stringify(jsonObject, undefined, 4);
onDownloadFile(data, "json", this.props.selectedTabName + ".json");
}, 2000);
};

onDownloadCSV = (): void => {
if (!this.props.queryResultsCSV) {
this.props.getCsv(this.props.queries);
}
const data = this.props.queryResultsCSV;
onDownloadFile(data, "csv", this.props.selectedTabName + ".csv");
setTimeout(() => {
const data = this.props.queryResultsCSV;
onDownloadFile(data, "csv", this.props.selectedTabName + ".csv");
}, 2000);
};

onDownloadText = (): void => {
if (!this.props.queryResultsTEXT) {
this.props.getText(this.props.queries);
}
const data = this.props.queryResultsTEXT;
onDownloadFile(data, "plain", this.props.selectedTabName + ".txt");
setTimeout(() => {
const data = this.props.queryResultsTEXT;
onDownloadFile(data, "plain", this.props.selectedTabName + ".txt");
}, 2000);
};

// Actions for Downloads Button
Expand Down
Loading