Skip to content

Commit a1c19b0

Browse files
committed
Update Browser.react.js
1 parent 070b352 commit a1c19b0

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/dashboard/Data/Browser/Browser.react.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,13 +1262,13 @@ class Browser extends DashboardView {
12621262
const className = this.props.params.className;
12631263
const query = new Parse.Query(className);
12641264

1265-
if (!rows["*"]) {
1265+
if (!rows['*']) {
12661266
// Export selected
12671267
const objectIds = [];
12681268
for (const objectId in this.state.rowsToExport) {
12691269
objectIds.push(objectId);
12701270
}
1271-
query.containedIn("objectId", objectIds);
1271+
query.containedIn('objectId', objectIds);
12721272
query.limit(objectIds.length);
12731273
}
12741274

@@ -1286,8 +1286,8 @@ class Browser extends DashboardView {
12861286
className
12871287
).filter((column) => column.visible);
12881288

1289-
if (type === ".json") {
1290-
const element = document.createElement("a");
1289+
if (type === '.json') {
1290+
const element = document.createElement('a');
12911291
const file = new Blob(
12921292
[
12931293
JSON.stringify(
@@ -1300,7 +1300,7 @@ class Browser extends DashboardView {
13001300
indentation ? 2 : null,
13011301
),
13021302
],
1303-
{ type: "application/json" }
1303+
{ type: 'application/json' }
13041304
);
13051305
element.href = URL.createObjectURL(file);
13061306
element.download = `${className}.json`;
@@ -1310,41 +1310,41 @@ class Browser extends DashboardView {
13101310
return;
13111311
}
13121312

1313-
let csvString = columns.map((column) => column.name).join(",") + "\n";
1313+
let csvString = columns.map((column) => column.name).join(',') + '\n';
13141314
for (const object of objects) {
13151315
const row = columns
13161316
.map((column) => {
13171317
const type = columnsObject[column.name].type;
1318-
if (column.name === "objectId") {
1318+
if (column.name === 'objectId') {
13191319
return object.id;
1320-
} else if (type === "Relation" || type === "Pointer") {
1320+
} else if (type === 'Relation' || type === 'Pointer') {
13211321
if (object.get(column.name)) {
13221322
return object.get(column.name).id;
13231323
} else {
1324-
return "";
1324+
return '';
13251325
}
13261326
} else {
13271327
let colValue;
1328-
if (column.name === "ACL") {
1328+
if (column.name === 'ACL') {
13291329
colValue = object.getACL();
13301330
} else {
13311331
colValue = object.get(column.name);
13321332
}
13331333
// Stringify objects and arrays
13341334
if (
13351335
Object.prototype.toString.call(colValue) ===
1336-
"[object Object]" ||
1337-
Object.prototype.toString.call(colValue) === "[object Array]"
1336+
'[object Object]' ||
1337+
Object.prototype.toString.call(colValue) === '[object Array]'
13381338
) {
13391339
colValue = JSON.stringify(colValue);
13401340
}
1341-
if (typeof colValue === "string") {
1341+
if (typeof colValue === 'string') {
13421342
if (colValue.includes('"')) {
13431343
// Has quote in data, escape and quote
13441344
// If the value contains both a quote and delimiter, adding quotes and escaping will take care of both scenarios
13451345
colValue = colValue.split('"').join('""');
13461346
return `"${colValue}"`;
1347-
} else if (colValue.includes(",")) {
1347+
} else if (colValue.includes(',')) {
13481348
// Has delimiter in data, surround with quote (which the value doesn't already contain)
13491349
return `"${colValue}"`;
13501350
} else {
@@ -1353,27 +1353,27 @@ class Browser extends DashboardView {
13531353
}
13541354
} else if (colValue === undefined) {
13551355
// Export as empty CSV field
1356-
return "";
1356+
return '';
13571357
} else {
13581358
return `${colValue}`;
13591359
}
13601360
}
13611361
})
1362-
.join(",");
1363-
csvString += row + "\n";
1362+
.join(',');
1363+
csvString += row + '\n';
13641364
}
13651365

13661366
// Deliver to browser to download file
1367-
const element = document.createElement("a");
1368-
const file = new Blob([csvString], { type: "text/csv" });
1367+
const element = document.createElement('a');
1368+
const file = new Blob([csvString], { type: 'text/csv' });
13691369
element.href = URL.createObjectURL(file);
13701370
element.download = `${className}.csv`;
13711371
document.body.appendChild(element); // Required for this to work in FireFox
13721372
element.click();
13731373
document.body.removeChild(element);
13741374
};
13751375

1376-
if (!rows["*"]) {
1376+
if (!rows['*']) {
13771377
const objects = await query.find({ useMasterKey: true });
13781378
processObjects(objects);
13791379
this.setState({ exporting: false, exportingCount: objects.length });

0 commit comments

Comments
 (0)