diff --git a/js/components/ascribe_forms/form_register_piece.js b/js/components/ascribe_forms/form_register_piece.js index 3d97eb06..4b3ebe81 100644 --- a/js/components/ascribe_forms/form_register_piece.js +++ b/js/components/ascribe_forms/form_register_piece.js @@ -174,7 +174,7 @@ let FileUploader = React.createClass({ } }} multiple={false} - localHashing={false} /> + enableLocalHashing={true} /> ); } }); diff --git a/js/components/ascribe_uploader/file_drag_and_drop.js b/js/components/ascribe_uploader/file_drag_and_drop.js index 6e6feac1..9606f552 100644 --- a/js/components/ascribe_uploader/file_drag_and_drop.js +++ b/js/components/ascribe_uploader/file_drag_and_drop.js @@ -30,7 +30,7 @@ let FileDragAndDrop = React.createClass({ areAssetsDownloadable: React.PropTypes.bool, areAssetsEditable: React.PropTypes.bool, - localHashing: React.PropTypes.bool, + enableLocalHashing: React.PropTypes.bool, // triggers a FileDragAndDrop-global spinner hashingProgress: React.PropTypes.number, @@ -82,6 +82,10 @@ let FileDragAndDrop = React.createClass({ event.stopPropagation(); let files; + if(this.props.dropzoneInactive) { + return; + } + // handle Drag and Drop if(event.dataTransfer && event.dataTransfer.files.length > 0) { files = event.dataTransfer.files; @@ -157,7 +161,7 @@ let FileDragAndDrop = React.createClass({

{getLangText('Computing hash(es)... This may take a few minutes.')}

{Math.ceil(this.props.hashingProgress)}% - {getLangText('Cancel hashing')} + {getLangText('Cancel hashing')}

@@ -177,7 +181,7 @@ let FileDragAndDrop = React.createClass({ multipleFiles={this.props.multiple} hasFiles={hasFiles} onClick={this.handleOnClick} - localHashing={this.props.localHashing}/> + enableLocalHashing={this.props.enableLocalHashing}/> file.status !== 'deleted' && file.status !== 'canceled' && file.size !== -1); + let queryParams = this.getQuery(); + + if((this.props.enableLocalHashing && !queryParams.method) || !this.props.areAssetsEditable || !this.props.multiple && filesToDisplay.length > 0) { + return true; + } else { + return false; + } + + }, render() { return ( @@ -702,9 +722,9 @@ var ReactS3FineUploader = React.createClass({ multiple={this.props.multiple} areAssetsDownloadable={this.props.areAssetsDownloadable} areAssetsEditable={this.props.areAssetsEditable} - dropzoneInactive={!this.props.areAssetsEditable || !this.props.multiple && this.state.filesToUpload.filter((file) => file.status !== 'deleted' && file.status !== 'canceled' && file.size !== -1).length > 0} + dropzoneInactive={this.isDropzoneInactive()} hashingProgress={this.state.hashingProgress} - localHashing={this.props.localHashing} /> + enableLocalHashing={this.props.enableLocalHashing} /> ); }