diff --git a/src/dashboard/Data/Browser/Browser.react.js b/src/dashboard/Data/Browser/Browser.react.js index ba7d1ec8c..2b1e18692 100644 --- a/src/dashboard/Data/Browser/Browser.react.js +++ b/src/dashboard/Data/Browser/Browser.react.js @@ -2049,14 +2049,16 @@ class Browser extends DashboardView { const element = document.createElement('a'); const file = new Blob( [ - JSON.stringify( - objects.map(obj => { + JSON.stringify({ + results: objects.map(obj => { const json = obj._toFullJSON(); delete json.__type; + delete json.className return json; - }), - null, - indentation ? 2 : null + }) + }, + null, + indentation ? 2 : null ), ], { type: 'application/json' } @@ -2520,6 +2522,7 @@ class Browser extends DashboardView { this.setState({ showImportDialog: false })} + showNote={this.showNote} onConfirm={(file) => this.importClass(className, file)} /> ); } else if (this.state.showImportRelationDialog) { diff --git a/src/dashboard/Data/Browser/ImportDialog.react.js b/src/dashboard/Data/Browser/ImportDialog.react.js index ed627d0a9..78e4f2372 100644 --- a/src/dashboard/Data/Browser/ImportDialog.react.js +++ b/src/dashboard/Data/Browser/ImportDialog.react.js @@ -15,12 +15,11 @@ import Label from 'components/Label/Label.react'; export default class ImportDialog extends React.Component { constructor() { - super(); - this.state = { - file: undefined, - startedImport: false, - errorMessage: null - }; + super(); + this.state = { + file: undefined, + startedImport: false + }; } valid() { @@ -41,14 +40,17 @@ export default class ImportDialog extends React.Component { disabled={!this.valid()} onCancel={this.props.onCancel} onConfirm={() => { + this.setState({ startedImport: true }) this.props.onConfirm(this.state.file) .then((res) => { if (res.error) { this.setState({ errorMessage: res.message }); + this.props.showNote(`Import Request failed with the following error: "${res.error }".`) } else { this.props.onCancel(); + this.props.showNote('We are importing your data. You will be notified by e-mail once it is completed.') } - }); + }).finally(() => this.setState({ startedImport: false, file: undefined })); }}> {this.setState({ file: file });}} /> + onChange={(file) => {this.setState({ file: file });}} accept=".csv,.json" /> } /> - {this.state.startedImport ? -
We are importing your data. You will be notified by e-mail once it is completed.
: null } - {this.state.errorMessage ? -
Import Request failed with the following error: "{ this.state.errorMessage }".
: null } ); diff --git a/src/dashboard/Data/Browser/ImportRelationDialog.react.js b/src/dashboard/Data/Browser/ImportRelationDialog.react.js index 141daac31..67604101c 100644 --- a/src/dashboard/Data/Browser/ImportRelationDialog.react.js +++ b/src/dashboard/Data/Browser/ImportRelationDialog.react.js @@ -71,7 +71,7 @@ export default class ImportRelationDialog extends React.Component { input={
{this.setState({ file: file });}} /> + onChange={(file) => {this.setState({ file: file });}} accept=".csv,.json" />
} />