1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 00:43:53 +00:00

update repo history setting

This commit is contained in:
ilearnit
2018-12-17 08:58:43 +00:00
parent 3b4b1e9afe
commit 3edb83ee9f
4 changed files with 12 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { gettext } from '../../utils/constants';
import { gettext, enableRepoHistorySetting } from '../../utils/constants';
import toaster from '../toast';
import { Button, Modal, ModalHeader, ModalBody, Form, FormGroup, Label, Input } from 'reactstrap';
import { seafileAPI } from '../../utils/seafile-api.js';
@@ -101,16 +101,21 @@ class LibHistorySetting extends React.Component {
</ModalHeader>
<ModalBody>
<Form>
{!enableRepoHistorySetting &&
<FormGroup>
<Label className="error">{gettext('Setting library history is disabled by Admin.')}</Label>
</FormGroup>
}
<FormGroup check>
<Input type="radio" name="radio1" checked={this.state.allHistory} onChange={() => {this.setLimitDays('allHistory')}}/>{' '}
<Input type="radio" name="radio1" checked={this.state.allHistory} disabled={!enableRepoHistorySetting} onChange={() => {this.setLimitDays('allHistory')}}/>{' '}
<Label>{gettext('Keep full history')}</Label>
</FormGroup>
<FormGroup check>
<Input type="radio" name="radio1" checked={this.state.noHistory} onChange={() =>{this.setLimitDays('noHistory')}}/>{' '}
<Input type="radio" name="radio1" checked={this.state.noHistory} disabled={!enableRepoHistorySetting} onChange={() =>{this.setLimitDays('noHistory')}}/>{' '}
<Label>{gettext('Don\'t keep history')}</Label>
</FormGroup>
<FormGroup check>
<Input type="radio" name="radio1" checked={this.state.autoHistory} onChange={() =>{this.setLimitDays('autoHistory')}}/>{' '}
<Input type="radio" name="radio1" checked={this.state.autoHistory} disabled={!enableRepoHistorySetting} onChange={() =>{this.setLimitDays('autoHistory')}}/>{' '}
<Label>{gettext('Only keep a period of history:')}</Label>
<Input
type="text"

View File

@@ -30,6 +30,7 @@ export const shareLinkExpireDaysMax = window.app.pageOptions.shareLinkExpireDays
export const maxFileName = window.app.pageOptions.maxFileName;
export const enableWiki = window.app.pageOptions.enableWiki;
export const enableEncryptedLibrary = window.app.pageOptions.enableEncryptedLibrary === '1';
export const enableRepoHistorySetting = window.app.pageOptions.enableRepoHistorySetting === '1';
// wiki
export const slug = window.wiki ? window.wiki.config.slug : '';

View File

@@ -64,6 +64,7 @@
maxFileName: "{{ max_file_name }}",
enableWiki: {% if enable_wiki %} true {% else %} false {% endif %},
enableEncryptedLibrary: '{{ enable_encrypted_library }}',
enableRepoHistorySetting: '{{ enable_repo_history_setting }}',
}
};
</script>

View File

@@ -719,6 +719,7 @@ def libraries(request):
'share_link_expire_days_min': SHARE_LINK_EXPIRE_DAYS_MIN,
'share_link_expire_days_max': SHARE_LINK_EXPIRE_DAYS_MAX,
'enable_encrypted_library': config.ENABLE_ENCRYPTED_LIBRARY,
'enable_repo_history_setting': config.ENABLE_REPO_HISTORY_SETTING,
})
return render(request, 'libraries.html', {