mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 23:29:49 +00:00
update upload-license api and info page js code (#3919)
This commit is contained in:
@@ -15,7 +15,8 @@ class Info extends Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
loading: true,
|
loading: true,
|
||||||
errorMsg: '',
|
errorMsg: '',
|
||||||
sysInfo: {}
|
sysInfo: {},
|
||||||
|
with_license: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,7 +24,8 @@ class Info extends Component {
|
|||||||
seafileAPI.getSysInfo().then((res) => {
|
seafileAPI.getSysInfo().then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
sysInfo: res.data
|
sysInfo: res.data,
|
||||||
|
with_license: res.data.with_license
|
||||||
});
|
});
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
@@ -58,7 +60,8 @@ class Info extends Component {
|
|||||||
let info = this.state.sysInfo;
|
let info = this.state.sysInfo;
|
||||||
Object.assign(info, res.data);
|
Object.assign(info, res.data);
|
||||||
this.setState({
|
this.setState({
|
||||||
sysInfo: info
|
sysInfo: info,
|
||||||
|
with_license: true
|
||||||
});
|
});
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
let errMsg = Utils.getErrorMsg(error);
|
let errMsg = Utils.getErrorMsg(error);
|
||||||
@@ -85,11 +88,11 @@ class Info extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let { with_license, license_mode, license_to, license_expiration, org_count,
|
let { license_mode, license_to, license_expiration, org_count,
|
||||||
repos_count, total_files_count, total_storage, total_devices_count,
|
repos_count, total_files_count, total_storage, total_devices_count,
|
||||||
current_connected_devices_count, license_maxusers, multi_tenancy_enabled,
|
current_connected_devices_count, license_maxusers, multi_tenancy_enabled,
|
||||||
active_users_count, users_count, groups_count } = this.state.sysInfo;
|
active_users_count, users_count, groups_count } = this.state.sysInfo;
|
||||||
let { loading, errorMsg } = this.state;
|
let { loading, errorMsg, with_license } = this.state;
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <Loading />;
|
return <Loading />;
|
||||||
|
@@ -63,18 +63,15 @@ class AdminLicense(APIView):
|
|||||||
license_dict = {}
|
license_dict = {}
|
||||||
|
|
||||||
if license_dict:
|
if license_dict:
|
||||||
with_license = True
|
|
||||||
try:
|
try:
|
||||||
max_users = int(license_dict.get('MaxUsers', 3))
|
max_users = int(license_dict.get('MaxUsers', 3))
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
max_users = 0
|
max_users = 0
|
||||||
else:
|
else:
|
||||||
with_license = False
|
|
||||||
max_users = 0
|
max_users = 0
|
||||||
|
|
||||||
license_info = {
|
license_info = {
|
||||||
'with_license': with_license,
|
|
||||||
'license_expiration': license_dict.get('Expiration', ''),
|
'license_expiration': license_dict.get('Expiration', ''),
|
||||||
'license_mode': license_dict.get('Mode', ''),
|
'license_mode': license_dict.get('Mode', ''),
|
||||||
'license_maxusers': max_users,
|
'license_maxusers': max_users,
|
||||||
|
@@ -26,7 +26,6 @@ class AdminLicenseTest(BaseTestCase):
|
|||||||
resp = self.client.post(url, {'license': f})
|
resp = self.client.post(url, {'license': f})
|
||||||
json_resp = json.loads(resp.content)
|
json_resp = json.loads(resp.content)
|
||||||
|
|
||||||
assert json_resp['with_license'] is True
|
|
||||||
assert json_resp['license_expiration'] is not None
|
assert json_resp['license_expiration'] is not None
|
||||||
assert json_resp['license_mode'] is not None
|
assert json_resp['license_mode'] is not None
|
||||||
assert json_resp['license_maxusers'] is not None
|
assert json_resp['license_maxusers'] is not None
|
||||||
|
Reference in New Issue
Block a user