mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 16:31:13 +00:00
repair histroy-setting bug
This commit is contained in:
@@ -41,6 +41,9 @@ class LibHistorySetting extends React.Component {
|
|||||||
|
|
||||||
submit = () => {
|
submit = () => {
|
||||||
let days = this.state.keepDays;
|
let days = this.state.keepDays;
|
||||||
|
if (this.state.autoHistory) {
|
||||||
|
days = this.state.expireDays;
|
||||||
|
}
|
||||||
let repoID = this.props.repoID;
|
let repoID = this.props.repoID;
|
||||||
let reg = /^-?\d+$/;
|
let reg = /^-?\d+$/;
|
||||||
let flag = reg.test(days);
|
let flag = reg.test(days);
|
||||||
@@ -48,11 +51,9 @@ class LibHistorySetting extends React.Component {
|
|||||||
let message = gettext('Successfully set library history.');
|
let message = gettext('Successfully set library history.');
|
||||||
seafileAPI.setRepoHistoryLimit(repoID, days).then(res => {
|
seafileAPI.setRepoHistoryLimit(repoID, days).then(res => {
|
||||||
toaster.success(message);
|
toaster.success(message);
|
||||||
this.setState({
|
this.setState({keepDays: res.data.keep_days});
|
||||||
keepDays: res.data.keep_days
|
this.props.toggleDialog();
|
||||||
});
|
|
||||||
});
|
});
|
||||||
this.props.toggleDialog();
|
|
||||||
} else {
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
errorInfo: gettext('Please enter a non-negative integer'),
|
errorInfo: gettext('Please enter a non-negative integer'),
|
||||||
@@ -95,34 +96,32 @@ class LibHistorySetting extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<Modal isOpen={true} centered={true}>
|
<Modal isOpen={true} centered={true}>
|
||||||
<ModalHeader toggle={this.props.toggleDialog}>
|
<ModalHeader toggle={this.props.toggleDialog}>
|
||||||
<span className="sf-font" title={itemName}>{itemName}</span>{' '}{gettext('History Setting')}
|
<span className="sf-font" title={itemName}>{itemName}</span>{gettext(' History Setting')}
|
||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<Form>
|
<Form>
|
||||||
<FormGroup check>
|
<FormGroup check>
|
||||||
<Label check>
|
<Input type="radio" name="radio1" checked={this.state.allHistory} onChange={() => {this.setLimitDays('allHistory')}}/>
|
||||||
<Input type="radio" name="radio1" checked={this.state.allHistory} onChange={() => {this.setLimitDays('allHistory')}}/>{' '}{gettext('Keep full history')}
|
<Label>{gettext(' Keep full history')}</Label>
|
||||||
</Label>
|
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup check>
|
<FormGroup check>
|
||||||
<Label check>
|
<Input type="radio" name="radio1" checked={this.state.noHistory} onChange={() =>{this.setLimitDays('noHistory')}}/>
|
||||||
<Input type="radio" name="radio1" checked={this.state.noHistory} onChange={() =>{this.setLimitDays('noHistory')}}/>{' '}{gettext('Don\'t keep history')}
|
<Label>{gettext(' Don\'t keep history')}</Label>
|
||||||
</Label>
|
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup check>
|
<FormGroup check>
|
||||||
<Label check>
|
<Input type="radio" name="radio1" checked={this.state.autoHistory} onChange={() =>{this.setLimitDays('autoHistory')}}/>
|
||||||
<Input type="radio" name="radio1" checked={this.state.autoHistory} onChange={() =>{this.setLimitDays('autoHistory')}}/>{' '}{gettext('Only keep a period of history:')}
|
<Label>{gettext(' Only keep a period of history:')}</Label>
|
||||||
<Input className="expire-input" type="text"
|
<Input
|
||||||
value={this.state.expireDays}
|
type="text"
|
||||||
onChange={this.onChange}
|
className="expire-input"
|
||||||
disabled={this.state.disabled}
|
value={this.state.expireDays}
|
||||||
/>
|
onChange={this.onChange}
|
||||||
<span>{gettext('days')}</span>
|
disabled={this.state.disabled}
|
||||||
</Label>
|
/>
|
||||||
|
<Label><span>{gettext(' days')}</span></Label>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<Label className="err-message">{this.state.errorInfo}</Label>
|
<Label className="err-message">{this.state.errorInfo}</Label><br />
|
||||||
<br />
|
<Button color="primary" onClick={this.submit}>{gettext('Submit')}</Button>
|
||||||
<Button onClick={this.submit}>{gettext('Submit')}</Button>
|
|
||||||
</Form>
|
</Form>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@@ -83,7 +83,7 @@ class TransferDialog extends React.Component {
|
|||||||
isClearable classNamePrefix
|
isClearable classNamePrefix
|
||||||
inputId={'react-select-transfer-input'}
|
inputId={'react-select-transfer-input'}
|
||||||
/><br />
|
/><br />
|
||||||
<Button onClick={this.submit}>{gettext('Submit')}</Button>
|
<Button color="primary" onClick={this.submit}>{gettext('Submit')}</Button>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user