Skip to content

Commit 070b352

Browse files
committed
add indent
1 parent 0226b52 commit 070b352

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ class Browser extends DashboardView {
12571257
});
12581258
}
12591259

1260-
async confirmExportSelectedRows(rows, type) {
1260+
async confirmExportSelectedRows(rows, type, indentation) {
12611261
this.setState({ rowsToExport: null, exporting: true, exportingCount: 0 });
12621262
const className = this.props.params.className;
12631263
const query = new Parse.Query(className);
@@ -1297,7 +1297,7 @@ class Browser extends DashboardView {
12971297
return json;
12981298
}),
12991299
null,
1300-
2
1300+
indentation ? 2 : null,
13011301
),
13021302
],
13031303
{ type: "application/json" }
@@ -1379,10 +1379,9 @@ class Browser extends DashboardView {
13791379
this.setState({ exporting: false, exportingCount: objects.length });
13801380
} else {
13811381
let batch = [];
1382-
let completion = null;
1383-
query.each(
1382+
query.eachBatch(
13841383
(obj) => {
1385-
batch.push(obj);
1384+
batch.push(...obj);
13861385
if (batch.length % 10 === 0) {
13871386
this.setState({ exportingCount: batch.length });
13881387
}
@@ -1394,12 +1393,11 @@ class Browser extends DashboardView {
13941393
processObjects(batch);
13951394
batch = [];
13961395
}
1397-
clearTimeout(completion);
1398-
completion = setTimeout(() => {
1396+
if (obj.length !== 100) {
13991397
processObjects(batch);
14001398
batch = [];
14011399
this.setState({ exporting: false, exportingCount: 0 });
1402-
}, 5000);
1400+
}
14031401
},
14041402
{ useMasterKey: true }
14051403
);
@@ -1817,7 +1815,7 @@ class Browser extends DashboardView {
18171815
className={className}
18181816
selection={this.state.rowsToExport}
18191817
onCancel={this.cancelExportSelectedRows}
1820-
onConfirm={(type) => this.confirmExportSelectedRows(this.state.rowsToExport, type)}
1818+
onConfirm={(type, indentation) => this.confirmExportSelectedRows(this.state.rowsToExport, type, indentation)}
18211819
/>
18221820
);
18231821
}

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@
55
* This source code is licensed under the license found in the LICENSE file in
66
* the root directory of this source tree.
77
*/
8-
import Modal from 'components/Modal/Modal.react';
9-
import React from 'react';
8+
import Modal from 'components/Modal/Modal.react';
9+
import React from 'react';
1010
import Dropdown from 'components/Dropdown/Dropdown.react';
1111
import Field from 'components/Field/Field.react';
1212
import Label from 'components/Label/Label.react';
1313
import Option from 'components/Dropdown/Option.react';
14+
import Toggle from 'components/Toggle/Toggle.react';
1415

1516
export default class ExportSelectedRowsDialog extends React.Component {
1617
constructor() {
1718
super();
1819

1920
this.state = {
2021
confirmation: '',
21-
exportType: '.csv'
22+
exportType: '.csv',
23+
indentation: true,
2224
};
2325
}
2426

@@ -38,7 +40,7 @@ export default class ExportSelectedRowsDialog extends React.Component {
3840
confirmText='Export'
3941
cancelText='Cancel'
4042
onCancel={this.props.onCancel}
41-
onConfirm={() => this.props.onConfirm(this.state.exportType)}>
43+
onConfirm={() => this.props.onConfirm(this.state.exportType, this.state.indentation)}>
4244
<Field
4345
label={<Label text='Select export type' />}
4446
input={
@@ -49,6 +51,10 @@ export default class ExportSelectedRowsDialog extends React.Component {
4951
<Option value='.json'>.json</Option>
5052
</Dropdown>
5153
} />
54+
{this.state.exportType === '.json' && <Field
55+
label={<Label text='Indentation' />}
56+
input={<Toggle value={this.state.indentation} type={Toggle.Types.YES_NO} onChange={(indentation) => {this.setState({indentation})}} />} />
57+
}
5258
</Modal>
5359
);
5460
}

0 commit comments

Comments
 (0)