diff --git a/web/client/components/file/FileUploader.jsx b/web/client/components/file/FileUploader.jsx index eaf3d2887c..783ba26bad 100644 --- a/web/client/components/file/FileUploader.jsx +++ b/web/client/components/file/FileUploader.jsx @@ -9,7 +9,7 @@ const React = require('react'); const {Message, DateFormat} = require('../I18N/I18N'); const Spinner = require('react-spinkit'); -const {Glyphicon, ProgressBar, Table} = require('react-bootstrap'); +const {Glyphicon, ProgressBar, Table, Alert} = require('react-bootstrap'); const Dropzone = require('react-dropzone'); @@ -25,7 +25,8 @@ const FileUploader = React.createClass({ onUpload: React.PropTypes.func, uploadAdditionalParams: React.PropTypes.oneOfType([React.PropTypes.array, React.PropTypes.object]), // if exists do not run before upload and start directly the upload after drag - allowUpload: React.PropTypes.object + allowUpload: React.PropTypes.object, + error: React.PropTypes.object }, getDefaultProps() { return { @@ -82,6 +83,11 @@ const FileUploader = React.createClass({ ) ) }); }, + renderError() { + if (this.props.error) { + return (There was an error during the upload: {this.props.error.statusText}
{this.props.error.data}
); + } + }, render() { if (this.state && this.state.files) { return (
{this.props.beforeUploadMessage}{this.renderPreview()}
); @@ -93,7 +99,8 @@ const FileUploader = React.createClass({ ); } - return ( - ); + {this.renderError()}); }, humanFileSize(size) { diff --git a/web/client/components/manager/importer/Import.jsx b/web/client/components/manager/importer/Import.jsx index 036770c6a5..d16d4e9bf2 100644 --- a/web/client/components/manager/importer/Import.jsx +++ b/web/client/components/manager/importer/Import.jsx @@ -51,9 +51,7 @@ const Task = React.createClass({ componentDidMount() { if (this.props.import.state === "RUNNING") { // Check if some task is running the update is not needed - if ( this.props.import.tasks && !(this.props.import.tasks.findIndex((task) => task.state === "RUNNING") >= 0)) { - this.interval = setInterval(this.props.loadImport.bind(null, this.props.import.id), this.props.timeout); - } + this.interval = setInterval(this.props.loadImport.bind(null, this.props.import.id), this.props.timeout); } }, diff --git a/web/client/components/manager/importer/Importer.jsx b/web/client/components/manager/importer/Importer.jsx index 9f7a7fc2b3..c9b434dae3 100644 --- a/web/client/components/manager/importer/Importer.jsx +++ b/web/client/components/manager/importer/Importer.jsx @@ -19,6 +19,7 @@ const BreadCrumb = require('./BreadCrumb'); const Importer = React.createClass({ propTypes: { loading: React.PropTypes.bool, + taskCreationError: React.PropTypes.object, error: React.PropTypes.object, defaultPresets: React.PropTypes.string, /** @@ -179,6 +180,7 @@ const Importer = React.createClass({ return (
{breadcrumb} @@ -204,6 +206,7 @@ const Importer = React.createClass({ boxShadow: "0px 0px 25px 14px #d9edf7" }} + error={this.props.taskCreationError} beforeUploadMessage={} dropMessage={} uploading={this.props.uploading} diff --git a/web/client/components/manager/importer/ImportsGrid.jsx b/web/client/components/manager/importer/ImportsGrid.jsx index d5813de77a..1d6ed3f59e 100644 --- a/web/client/components/manager/importer/ImportsGrid.jsx +++ b/web/client/components/manager/importer/ImportsGrid.jsx @@ -14,6 +14,8 @@ const {Table, Glyphicon, Button, Label, OverlayTrigger, Tooltip} = require('reac const ImportsGrid = React.createClass({ propTypes: { loading: React.PropTypes.bool, + timeout: React.PropTypes.number, + loadImports: React.PropTypes.func, loadImport: React.PropTypes.func, deleteImport: React.PropTypes.func, imports: React.PropTypes.array, @@ -25,6 +27,8 @@ const ImportsGrid = React.createClass({ }, getDefaultProps() { return { + timeout: 5000, + loadImports: () => {}, placement: "bottom", deleteAction: , loadImport: () => {}, diff --git a/web/client/components/manager/importer/Task.jsx b/web/client/components/manager/importer/Task.jsx index 4a17af52f6..d69b37ea59 100644 --- a/web/client/components/manager/importer/Task.jsx +++ b/web/client/components/manager/importer/Task.jsx @@ -41,9 +41,6 @@ const Task = React.createClass({ }; }, - componentDidMount() { - // setTimeout(() => {this.props.loadLayer(); }, 500); - }, getbsStyleForState(state) { return ImporterUtils.getbsStyleForState(state); }, diff --git a/web/client/plugins/manager/Importer.jsx b/web/client/plugins/manager/Importer.jsx index 4bead410e0..7d213518c9 100644 --- a/web/client/plugins/manager/Importer.jsx +++ b/web/client/plugins/manager/Importer.jsx @@ -41,6 +41,7 @@ const ImporterPlugin = connect( selectedTask: state.importer && state.importer.selectedTask, selectedTransform: state.importer && state.importer.selectedTransform, error: state.importer && state.importer.loadingError, + taskCreationError: state.importer && state.importer.taskCreationError, workspaces: state.importer && state.importer.workspaces, selectedWorkSpace: state.importer && state.importer.selectedWorkSpace, workspaceCreationStatus: state.importer && state.importer.workspaceCreationStatus diff --git a/web/client/reducers/importer.js b/web/client/reducers/importer.js index 662d581eb0..38dd825bd1 100644 --- a/web/client/reducers/importer.js +++ b/web/client/reducers/importer.js @@ -163,7 +163,7 @@ function importer(state = {}, action) { let selectedImport = assign({}, state.selectedImport, { tasks: [...(state.selectedImport.tasks || []), ...action.tasks] }); - return assign({}, state, {selectedImport}); + return assign({}, state, {taskCreationError: null, selectedImport}); } return state; case IMPORTS_TASK_UPDATED: { @@ -187,7 +187,7 @@ function importer(state = {}, action) { case IMPORTS_TASK_CREATION_ERROR: { return assign({}, state, { uploading: false, - error: action.error + taskCreationError: action.error }); } case TASK_PROGRESS_UPDATED: {