1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-29 00:27:37 +00:00

fix code format (#6365)

This commit is contained in:
Michael An
2024-07-18 11:58:42 +08:00
committed by GitHub
parent c5d02b33b2
commit 67210c7363
450 changed files with 2425 additions and 2385 deletions

View File

@@ -54,7 +54,7 @@ class GenerateUploadLink extends React.Component {
seafileAPI.getUploadLink(repoID, path).then((res) => {
if (res.data.length !== 0) {
let sharedUploadInfo = new UploadLink(res.data[0]);
this.setState({sharedUploadInfo: sharedUploadInfo});
this.setState({ sharedUploadInfo: sharedUploadInfo });
}
}).catch((err) => {
let errMsg = Utils.getErrorMsg(err, true);
@@ -109,7 +109,7 @@ class GenerateUploadLink extends React.Component {
generateUploadLink = () => {
let isValid = this.validateParamsInput();
if (isValid) {
this.setState({errorInfo: ''});
this.setState({ errorInfo: '' });
let { itemPath, repoID } = this.props;
let { password, isExpireChecked, expType, expireDays, expDate } = this.state;
@@ -125,7 +125,7 @@ class GenerateUploadLink extends React.Component {
seafileAPI.createUploadLink(repoID, itemPath, password, expirationTime).then((res) => {
let sharedUploadInfo = new UploadLink(res.data);
this.setState({sharedUploadInfo: sharedUploadInfo});
this.setState({ sharedUploadInfo: sharedUploadInfo });
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);
@@ -139,19 +139,19 @@ class GenerateUploadLink extends React.Component {
// check password params
if (showPasswordInput) {
if (password.length === 0) {
this.setState({errorInfo: gettext('Please enter a password.')});
this.setState({ errorInfo: gettext('Please enter a password.') });
return false;
}
if (password.length < shareLinkPasswordMinLength) {
this.setState({errorInfo: gettext('The password is too short.')});
this.setState({ errorInfo: gettext('The password is too short.') });
return false;
}
if (password !== passwordnew) {
this.setState({errorInfo: gettext('Passwords don\'t match')});
this.setState({ errorInfo: gettext('Passwords don\'t match') });
return false;
}
if (Utils.getStrengthLevel(password) < shareLinkPasswordStrengthLevel) {
this.setState({errorInfo: gettext('The password is too weak. It should include at least {passwordStrengthLevel} of the following: number, upper letter, lower letter and other symbols.').replace('{passwordStrengthLevel}', shareLinkPasswordStrengthLevel)});
this.setState({ errorInfo: gettext('The password is too weak. It should include at least {passwordStrengthLevel} of the following: number, upper letter, lower letter and other symbols.').replace('{passwordStrengthLevel}', shareLinkPasswordStrengthLevel) });
return false;
}
}
@@ -159,7 +159,7 @@ class GenerateUploadLink extends React.Component {
if (isExpireChecked) {
if (expType == 'by-date') {
if (!expDate) {
this.setState({errorInfo: gettext('Please select an expiration time')});
this.setState({ errorInfo: gettext('Please select an expiration time') });
return false;
}
return true;
@@ -167,20 +167,20 @@ class GenerateUploadLink extends React.Component {
let reg = /^\d+$/;
if (!expireDays) {
this.setState({errorInfo: gettext('Please enter days')});
this.setState({ errorInfo: gettext('Please enter days') });
return false;
}
if (!reg.test(expireDays)) {
this.setState({errorInfo: gettext('Please enter a non-negative integer')});
this.setState({ errorInfo: gettext('Please enter a non-negative integer') });
return false;
}
this.setState({expireDays: parseInt(expireDays)});
this.setState({ expireDays: parseInt(expireDays) });
}
return true;
};
onExpireChecked = (e) => {
this.setState({isExpireChecked: e.target.checked});
this.setState({ isExpireChecked: e.target.checked });
};
setExpType = (e) => {
@@ -197,7 +197,7 @@ class GenerateUploadLink extends React.Component {
onExpireDaysChanged = (e) => {
let day = e.target.value.trim();
this.setState({expireDays: day});
this.setState({ expireDays: day });
};
onCopyUploadLink = () => {
@@ -208,15 +208,15 @@ class GenerateUploadLink extends React.Component {
};
handleMouseOverExpirationEditIcon = () => {
this.setState({isExpirationEditIconShow: true});
this.setState({ isExpirationEditIconShow: true });
};
handleMouseOutExpirationEditIcon = () => {
this.setState({isExpirationEditIconShow: false});
this.setState({ isExpirationEditIconShow: false });
};
editExpirationToggle = () => {
this.setState({isEditingExpiration: !this.state.isEditingExpiration});
this.setState({ isEditingExpiration: !this.state.isEditingExpiration });
};
updateExpiration = (e) => {
@@ -305,8 +305,9 @@ class GenerateUploadLink extends React.Component {
aria-label={this.state.storedPasswordVisible ? gettext('Hide') : gettext('Show')}
onKeyDown={this.onIconKeyDown}
onClick={this.toggleStoredPasswordVisible}
className={`eye-icon sf3-font sf3-font-eye${this.state.storedPasswordVisible ? '': '-slash'}`}
></span>
className={`eye-icon sf3-font sf3-font-eye${this.state.storedPasswordVisible ? '' : '-slash'}`}
>
</span>
</div>
</dd>
</FormGroup>
@@ -316,7 +317,7 @@ class GenerateUploadLink extends React.Component {
<FormGroup className="mb-0">
<dt className="text-secondary font-weight-normal">{gettext('Expiration Date:')}</dt>
{!this.state.isEditingExpiration &&
<dd style={{width:'250px'}} onMouseEnter={this.handleMouseOverExpirationEditIcon} onMouseLeave={this.handleMouseOutExpirationEditIcon}>
<dd style={{ width: '250px' }} onMouseEnter={this.handleMouseOverExpirationEditIcon} onMouseLeave={this.handleMouseOutExpirationEditIcon}>
{moment(sharedUploadInfo.expire_date).format('YYYY-MM-DD HH:mm:ss')}
{this.state.isExpirationEditIconShow && (
<a href="#"
@@ -385,11 +386,11 @@ class GenerateUploadLink extends React.Component {
<FormGroup>
<Label for="passwd">{gettext('Password')}</Label>
<span className="tip">{passwordLengthTip}</span>
<InputGroup style={{width: inputWidth}}>
<Input id="passwd" type={this.state.passwordVisible ? 'text':'password'} value={this.state.password || ''} onChange={this.inputPassword} />
<InputGroup style={{ width: inputWidth }}>
<Input id="passwd" type={this.state.passwordVisible ? 'text' : 'password'} value={this.state.password || ''} onChange={this.inputPassword} />
<InputGroupAddon addonType="append">
<Button onClick={this.togglePasswordVisible}>
<i className={`link-operation-icon sf3-font sf3-font-eye${this.state.passwordVisible ? '': '-slash'}`}></i>
<i className={`link-operation-icon sf3-font sf3-font-eye${this.state.passwordVisible ? '' : '-slash'}`}></i>
</Button>
<Button onClick={this.generatePassword}>
<i className="link-operation-icon sf3-font sf3-font-magic"></i>
@@ -399,7 +400,7 @@ class GenerateUploadLink extends React.Component {
</FormGroup>
<FormGroup>
<Label for="passwd-again">{gettext('Password again')}</Label>
<Input id="passwd-again" style={{width: inputWidth}} type={this.state.passwordVisible ? 'text' : 'password'} value={this.state.passwordnew || ''} onChange={this.inputPasswordNew} />
<Input id="passwd-again" style={{ width: inputWidth }} type={this.state.passwordVisible ? 'text' : 'password'} value={this.state.passwordnew || ''} onChange={this.inputPasswordNew} />
</FormGroup>
</div>
}