Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Fixed #163
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Sep 17, 2020
1 parent 5ca03be commit 32a4672
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion frontend/src/views/Detail/Detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,27 @@ const Detail = (props) => {

const onDownload = () => {
const element = document.createElement("a");
const file = new Blob([JSON.stringify(data, null, 4)], {type: 'text/plain'});

// Alter the data so that the download is correct.
// Re-arrange the object to ensure the proper field order.
var downloadable = {};

// Set the header keys.
downloadable['object_id'] = data['Object ID'];
downloadable['spec_version'] = data['Spec Version'];
downloadable['etag'] = data['eTag'];

// Set the main keys.
downloadable['description_domain'] = data['Description Domain'];
downloadable['error_domain'] = data['Error Domain'];
downloadable['execution_domain'] = data['Execution Domain'];
downloadable['extension_domain'] = data['Extension Domain'];
downloadable['io_domain'] = data['IO Domain'];
downloadable['parametric_domain'] = data['Parametric Domain'];
downloadable['provenance_domain'] = data['Provenance Domain'];
downloadable['usability_domin'] = data['Usability Domain'];

const file = new Blob([JSON.stringify(downloadable, null, 4)], {type: 'text/plain'});
element.href = URL.createObjectURL(file);
element.download = `bco_${id}.txt`;
document.body.appendChild(element); // Required for this to work in FireFox
Expand Down

0 comments on commit 32a4672

Please sign in to comment.