diff --git a/frontend/src/components/dialog/sysadmin-dialog/set-quota.js b/frontend/src/components/dialog/sysadmin-dialog/set-quota.js index a722d83399..f19da5e590 100644 --- a/frontend/src/components/dialog/sysadmin-dialog/set-quota.js +++ b/frontend/src/components/dialog/sysadmin-dialog/set-quota.js @@ -24,10 +24,10 @@ class SetQuotaDialog extends React.Component { } handleQuotaChange = (e) => { - const value = e.target.value.trim(); + const value = e.target.value; this.setState({ quota: value, - isSubmitBtnActive: value != '' + isSubmitBtnActive: value.trim() != '' }); } @@ -39,7 +39,7 @@ class SetQuotaDialog extends React.Component { } handleSubmit = () => { - this.props.updateQuota(this.state.quota); + this.props.updateQuota(this.state.quota.trim()); this.toggle(); } diff --git a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-institution-dialog.js b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-institution-dialog.js index 318b06efa8..247841c353 100644 --- a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-institution-dialog.js +++ b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-institution-dialog.js @@ -20,13 +20,10 @@ class SysAdminAddInstitutionDialog extends React.Component { handleChange = (e) => { const value = e.target.value; - if (!value.trim()) { - this.setState({isSubmitBtnActive: false}); - } else { - this.setState({isSubmitBtnActive: true}); - } - - this.setState({value: value}); + this.setState({ + value: value, + isSubmitBtnActive: value.trim() != '' + }); } handleSubmit = () => { diff --git a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-org-dialog.js b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-org-dialog.js index eee5479fe8..d52e6bf376 100644 --- a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-org-dialog.js +++ b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-org-dialog.js @@ -24,10 +24,10 @@ class SysAdminAddOrgDialog extends React.Component { checkSubmitBtnActive = () => { const { name, email, password, passwordAgain } = this.state; let btnActive = true; - if (name !='' && - email != '' && - password != '' && - passwordAgain != '') { + if (name.trim() !='' && + email.trim() != '' && + password.trim() != '' && + passwordAgain.trim() != '') { btnActive = true; } else { btnActive = false; @@ -42,28 +42,28 @@ class SysAdminAddOrgDialog extends React.Component { } inputPassword = (e) => { - let passwd = e.target.value.trim(); + let passwd = e.target.value; this.setState({ password: passwd }, this.checkSubmitBtnActive); } inputPasswordAgain = (e) => { - let passwd = e.target.value.trim(); + let passwd = e.target.value; this.setState({ passwordAgain: passwd }, this.checkSubmitBtnActive); } inputEmail = (e) => { - let email = e.target.value.trim(); + let email = e.target.value; this.setState({ email: email }, this.checkSubmitBtnActive); } inputName = (e) => { - let name = e.target.value.trim(); + let name = e.target.value; this.setState({ name: name }, this.checkSubmitBtnActive); @@ -76,9 +76,9 @@ class SysAdminAddOrgDialog extends React.Component { return; } const data = { - orgName: name, - ownerEmail: email, - password: password + orgName: name.trim(), + ownerEmail: email.trim(), + password: password.trim() }; this.props.addOrg(data); this.toggle(); diff --git a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-repo-dialog.js b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-repo-dialog.js index 3cefd3018f..b04031799c 100644 --- a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-repo-dialog.js +++ b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-repo-dialog.js @@ -81,7 +81,7 @@ class AddRepoDialog extends React.Component { /> - { this.state.errMessage &&

{this.state.errMessage}

} + {this.state.errMessage &&

{this.state.errMessage}

} diff --git a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-sys-notification-dialog.js b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-sys-notification-dialog.js index 066f8931f0..b0d69457ad 100644 --- a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-sys-notification-dialog.js +++ b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-add-sys-notification-dialog.js @@ -20,13 +20,10 @@ class SysAdminAddSysNotificationDialog extends React.Component { handleChange = (e) => { const value = e.target.value; - if (!value.trim()) { - this.setState({isSubmitBtnActive: false}); - } else { - this.setState({isSubmitBtnActive: true}); - } - - this.setState({value: value}); + this.setState({ + value: value, + isSubmitBtnActive: value.trim() != '' + }); } handleSubmit = () => { diff --git a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-create-repo-dialog.js b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-create-repo-dialog.js index 3bf676ea4c..3f2d4ca090 100644 --- a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-create-repo-dialog.js +++ b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-create-repo-dialog.js @@ -23,13 +23,11 @@ class SysAdminCreateRepoDialog extends React.Component { } handleRepoNameChange = (e) => { - if (!e.target.value.trim()) { - this.setState({isSubmitBtnActive: false}); - } else { - this.setState({isSubmitBtnActive: true}); - } - - this.setState({repoName: e.target.value}); + const value = e.target.value; + this.setState({ + repoName: value, + isSubmitBtnActive: value.trim() + }); } handleSubmit = () => { diff --git a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-set-org-max-user-number-dialog.js b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-set-org-max-user-number-dialog.js index 2e5cb5b6bc..8843d1f5d3 100644 --- a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-set-org-max-user-number-dialog.js +++ b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-set-org-max-user-number-dialog.js @@ -24,10 +24,10 @@ class SysAdminSetOrgMaxUserNumberDialog extends React.Component { } handleInputChange = (e) => { - const value = e.target.value.trim(); + const value = e.target.value; this.setState({ value: value, - isSubmitBtnActive: value != '' + isSubmitBtnActive: value.trim() != '' }); } @@ -39,7 +39,7 @@ class SysAdminSetOrgMaxUserNumberDialog extends React.Component { } handleSubmit = () => { - this.props.updateValue(this.state.value); + this.props.updateValue(this.state.value.trim()); this.toggle(); } diff --git a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-set-org-name-dialog.js b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-set-org-name-dialog.js index a185855ddf..2e75922889 100644 --- a/frontend/src/components/dialog/sysadmin-dialog/sysadmin-set-org-name-dialog.js +++ b/frontend/src/components/dialog/sysadmin-dialog/sysadmin-set-org-name-dialog.js @@ -24,10 +24,10 @@ class SysAdminSetOrgNameDialog extends React.Component { } handleInputChange = (e) => { - const value = e.target.value.trim(); + const value = e.target.value; this.setState({ name: value, - isSubmitBtnActive: value != '' + isSubmitBtnActive: value.trim() != '' }); } @@ -39,7 +39,7 @@ class SysAdminSetOrgNameDialog extends React.Component { } handleSubmit = () => { - this.props.updateName(this.state.name); + this.props.updateName(this.state.name.trim()); this.toggle(); } diff --git a/frontend/src/components/dialog/sysadmin-dialog/update-user.js b/frontend/src/components/dialog/sysadmin-dialog/update-user.js index 67bc735c49..0fc7d21bfe 100644 --- a/frontend/src/components/dialog/sysadmin-dialog/update-user.js +++ b/frontend/src/components/dialog/sysadmin-dialog/update-user.js @@ -21,7 +21,7 @@ class UpdateUser extends React.Component { } handleInputChange = (e) => { - const value = e.target.value.trim(); + const value = e.target.value; this.setState({ value: value }); @@ -35,7 +35,7 @@ class UpdateUser extends React.Component { } handleSubmit = () => { - this.props.updateValue(this.state.value); + this.props.updateValue(this.state.value.trim()); this.props.toggleDialog(); }