1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-30 13:41:57 +02:00

Remove all occurrences of inactivity mgmt of ReactS3Fineuploader

This commit is contained in:
Tim Daubenschütz 2015-12-02 12:37:21 +01:00
parent 8b3060d613
commit fe24a5e15a
8 changed files with 15 additions and 80 deletions

View File

@ -26,7 +26,6 @@ let RegisterPieceForm = React.createClass({
isFineUploaderActive: React.PropTypes.bool, isFineUploaderActive: React.PropTypes.bool,
isFineUploaderEditable: React.PropTypes.bool, isFineUploaderEditable: React.PropTypes.bool,
enableLocalHashing: React.PropTypes.bool, enableLocalHashing: React.PropTypes.bool,
onLoggedOut: React.PropTypes.func,
// For this form to work with SlideContainer, we sometimes have to disable it // For this form to work with SlideContainer, we sometimes have to disable it
disabled: React.PropTypes.bool, disabled: React.PropTypes.bool,
@ -116,7 +115,6 @@ let RegisterPieceForm = React.createClass({
setIsUploadReady={this.setIsUploadReady} setIsUploadReady={this.setIsUploadReady}
isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile} isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile}
isFineUploaderActive={this.props.isFineUploaderActive} isFineUploaderActive={this.props.isFineUploaderActive}
onLoggedOut={this.props.onLoggedOut}
disabled={!this.props.isFineUploaderEditable} disabled={!this.props.isFineUploaderEditable}
enableLocalHashing={enableLocalHashing} enableLocalHashing={enableLocalHashing}
uploadMethod={this.props.location.query.method} /> uploadMethod={this.props.location.query.method} />

View File

@ -38,7 +38,6 @@ const InputFineUploader = React.createClass({
// a user is actually not logged in already to prevent him from droping files // a user is actually not logged in already to prevent him from droping files
// before login in // before login in
isFineUploaderActive: bool, isFineUploaderActive: bool,
onLoggedOut: func,
enableLocalHashing: bool, enableLocalHashing: bool,
uploadMethod: string, uploadMethod: string,
@ -51,7 +50,10 @@ const InputFineUploader = React.createClass({
fileClassToUpload: shape({ fileClassToUpload: shape({
singular: string, singular: string,
plural: string plural: string
}) }),
// Provided by `Property`
onChange: React.PropTypes.func
}, },
getDefaultProps() { getDefaultProps() {
@ -101,16 +103,16 @@ const InputFineUploader = React.createClass({
setIsUploadReady, setIsUploadReady,
isReadyForFormSubmission, isReadyForFormSubmission,
areAssetsDownloadable, areAssetsDownloadable,
onLoggedOut,
enableLocalHashing, enableLocalHashing,
uploadMethod,
fileClassToUpload, fileClassToUpload,
location } = this.props; disabled } = this.props;
let editable = this.props.isFineUploaderActive; let editable = this.props.isFineUploaderActive;
// if disabled is actually set by property, we want to override // if disabled is actually set by property, we want to override
// isFineUploaderActive // isFineUploaderActive
if(typeof this.props.disabled !== 'undefined') { if(typeof disabled !== 'undefined') {
editable = !this.props.disabled; editable = !disabled;
} }
return ( return (
@ -139,10 +141,9 @@ const InputFineUploader = React.createClass({
'X-CSRFToken': getCookie(AppConstants.csrftoken) 'X-CSRFToken': getCookie(AppConstants.csrftoken)
} }
}} }}
onInactive={this.props.onLoggedOut} enableLocalHashing={enableLocalHashing}
enableLocalHashing={this.props.enableLocalHashing} uploadMethod={uploadMethod}
uploadMethod={this.props.uploadMethod} fileClassToUpload={fileClassToUpload} />
fileClassToUpload={this.props.fileClassToUpload} />
); );
} }
}); });

View File

@ -15,7 +15,6 @@ let FileDragAndDrop = React.createClass({
className: React.PropTypes.string, className: React.PropTypes.string,
onDrop: React.PropTypes.func.isRequired, onDrop: React.PropTypes.func.isRequired,
onDragOver: React.PropTypes.func, onDragOver: React.PropTypes.func,
onInactive: React.PropTypes.func,
filesToUpload: React.PropTypes.array, filesToUpload: React.PropTypes.array,
handleDeleteFile: React.PropTypes.func, handleDeleteFile: React.PropTypes.func,
handleCancelFile: React.PropTypes.func, handleCancelFile: React.PropTypes.func,
@ -63,11 +62,6 @@ let FileDragAndDrop = React.createClass({
let files; let files;
if(this.props.dropzoneInactive) { if(this.props.dropzoneInactive) {
// if there is a handle function for doing stuff
// when the dropzone is inactive, then call it
if(this.props.onInactive) {
this.props.onInactive();
}
return; return;
} }
@ -119,9 +113,6 @@ let FileDragAndDrop = React.createClass({
if(this.props.dropzoneInactive) { if(this.props.dropzoneInactive) {
// if there is a handle function for doing stuff // if there is a handle function for doing stuff
// when the dropzone is inactive, then call it // when the dropzone is inactive, then call it
if(this.props.onInactive) {
this.props.onInactive();
}
return; return;
} }

View File

@ -99,7 +99,6 @@ let ReactS3FineUploader = React.createClass({
areAssetsDownloadable: React.PropTypes.bool, areAssetsDownloadable: React.PropTypes.bool,
areAssetsEditable: React.PropTypes.bool, areAssetsEditable: React.PropTypes.bool,
defaultErrorMessage: React.PropTypes.string, defaultErrorMessage: React.PropTypes.string,
onInactive: React.PropTypes.func,
// We encountered some cases where people had difficulties to upload their // We encountered some cases where people had difficulties to upload their
// works to ascribe due to a slow internet connection. // works to ascribe due to a slow internet connection.
@ -891,7 +890,6 @@ let ReactS3FineUploader = React.createClass({
multiple, multiple,
areAssetsDownloadable, areAssetsDownloadable,
areAssetsEditable, areAssetsEditable,
onInactive,
enableLocalHashing, enableLocalHashing,
fileClassToUpload, fileClassToUpload,
fileInputElement: FileInputElement, fileInputElement: FileInputElement,
@ -901,7 +899,6 @@ let ReactS3FineUploader = React.createClass({
multiple, multiple,
areAssetsDownloadable, areAssetsDownloadable,
areAssetsEditable, areAssetsEditable,
onInactive,
enableLocalHashing, enableLocalHashing,
uploadMethod, uploadMethod,
fileClassToUpload, fileClassToUpload,

View File

@ -45,10 +45,7 @@ let RegisterPiece = React.createClass( {
UserStore.getState(), UserStore.getState(),
WhitelabelStore.getState(), WhitelabelStore.getState(),
PieceListStore.getState(), PieceListStore.getState(),
{ );
selectedLicense: 0,
isFineUploaderActive: false
});
}, },
componentDidMount() { componentDidMount() {
@ -66,13 +63,6 @@ let RegisterPiece = React.createClass( {
onChange(state) { onChange(state) {
this.setState(state); this.setState(state);
if(this.state.currentUser && this.state.currentUser.email) {
// we should also make the fineuploader component editable again
this.setState({
isFineUploaderActive: true
});
}
}, },
handleSuccess(response){ handleSuccess(response){
@ -117,7 +107,7 @@ let RegisterPiece = React.createClass( {
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}> <Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
<RegisterPieceForm <RegisterPieceForm
{...this.props} {...this.props}
isFineUploaderActive={this.state.isFineUploaderActive} isFineUploaderActive={true}
handleSuccess={this.handleSuccess} handleSuccess={this.handleSuccess}
location={this.props.location}> location={this.props.location}>
{this.props.children} {this.props.children}

View File

@ -53,8 +53,6 @@ let CylandRegisterPiece = React.createClass({
PieceStore.getState(), PieceStore.getState(),
WhitelabelStore.getState(), WhitelabelStore.getState(),
{ {
selectedLicense: 0,
isFineUploaderActive: false,
step: 0 step: 0
}); });
}, },
@ -90,13 +88,6 @@ let CylandRegisterPiece = React.createClass({
onChange(state) { onChange(state) {
this.setState(state); this.setState(state);
if(this.state.currentUser && this.state.currentUser.email) {
// we should also make the fineuploader component editable again
this.setState({
isFineUploaderActive: true
});
}
}, },
handleRegisterSuccess(response){ handleRegisterSuccess(response){
@ -167,11 +158,6 @@ let CylandRegisterPiece = React.createClass({
} }
}, },
// basically redirects to the second slide (index: 1), when the user is not logged in
onLoggedOut() {
this.history.pushState(null, '/login');
},
render() { render() {
let today = new Moment(); let today = new Moment();
@ -197,9 +183,8 @@ let CylandRegisterPiece = React.createClass({
enableLocalHashing={false} enableLocalHashing={false}
headerMessage={getLangText('Submit to Cyland Archive')} headerMessage={getLangText('Submit to Cyland Archive')}
submitMessage={getLangText('Submit')} submitMessage={getLangText('Submit')}
isFineUploaderActive={this.state.isFineUploaderActive} isFineUploaderActive={true}
handleSuccess={this.handleRegisterSuccess} handleSuccess={this.handleRegisterSuccess}
onLoggedOut={this.onLoggedOut}
location={this.props.location}/> location={this.props.location}/>
</Col> </Col>
</Row> </Row>

View File

@ -85,13 +85,6 @@ let IkonotvRegisterPiece = React.createClass({
onChange(state) { onChange(state) {
this.setState(state); this.setState(state);
if(this.state.currentUser && this.state.currentUser.email) {
// we should also make the fineuploader component editable again
this.setState({
isFineUploaderActive: true
});
}
}, },
@ -157,19 +150,6 @@ let IkonotvRegisterPiece = React.createClass({
); );
}, },
changeSlide() {
// only transition to the login store, if user is not logged in
// ergo the currentUser object is not properly defined
if(this.state.currentUser && !this.state.currentUser.email) {
this.onLoggedOut();
}
},
// basically redirects to the second slide (index: 1), when the user is not logged in
onLoggedOut() {
this.history.pushState(null, '/login');
},
canSubmit() { canSubmit() {
let currentUser = this.state.currentUser; let currentUser = this.state.currentUser;
return currentUser && currentUser.acl && currentUser.acl.acl_wallet_submit; return currentUser && currentUser.acl && currentUser.acl.acl_wallet_submit;
@ -260,9 +240,8 @@ let IkonotvRegisterPiece = React.createClass({
enableLocalHashing={false} enableLocalHashing={false}
headerMessage={getLangText('Register work')} headerMessage={getLangText('Register work')}
submitMessage={getLangText('Register')} submitMessage={getLangText('Register')}
isFineUploaderActive={this.state.isFineUploaderActive} isFineUploaderActive={true}
handleSuccess={this.handleRegisterSuccess} handleSuccess={this.handleRegisterSuccess}
onLoggedOut={this.onLoggedOut}
location={this.props.location}/> location={this.props.location}/>
</Col> </Col>
</Row> </Row>

View File

@ -106,11 +106,6 @@ let MarketRegisterPiece = React.createClass({
); );
}, },
// basically redirects to the second slide (index: 1), when the user is not logged in
onLoggedOut() {
this.history.pushState(null, '/login');
},
render() { render() {
setDocumentTitle(getLangText('Register a new piece')); setDocumentTitle(getLangText('Register a new piece'));
@ -133,7 +128,6 @@ let MarketRegisterPiece = React.createClass({
submitMessage={getLangText('Proceed to additional details')} submitMessage={getLangText('Proceed to additional details')}
isFineUploaderActive={true} isFineUploaderActive={true}
handleSuccess={this.handleRegisterSuccess} handleSuccess={this.handleRegisterSuccess}
onLoggedOut={this.onLoggedOut}
location={this.props.location}> location={this.props.location}>
<Property <Property
name="num_editions" name="num_editions"