1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 07:08:55 +00:00

update sysinfo page

This commit is contained in:
lian
2017-01-07 10:12:17 +08:00
parent 9a9b6eb9e1
commit 38a06be960
8 changed files with 90 additions and 9 deletions

View File

@@ -903,6 +903,34 @@ define([
}
},
quotaSizeFormat: function(bytes, precision) {
var kilobyte = 1000;
var megabyte = kilobyte * 1000;
var gigabyte = megabyte * 1000;
var terabyte = gigabyte * 1000;
var precision = precision || 0;
if ((bytes >= 0) && (bytes < kilobyte)) {
return bytes + ' B';
} else if ((bytes >= kilobyte) && (bytes < megabyte)) {
return (bytes / kilobyte).toFixed(precision) + ' KB';
} else if ((bytes >= megabyte) && (bytes < gigabyte)) {
return (bytes / megabyte).toFixed(precision) + ' MB';
} else if ((bytes >= gigabyte) && (bytes < terabyte)) {
return (bytes / gigabyte).toFixed(precision) + ' GB';
} else if (bytes >= terabyte) {
return (bytes / terabyte).toFixed(precision) + ' TB';
} else {
return bytes + ' B';
}
},
groupId2Name: function(group_id) {
var group_name;
var groups = app.pageOptions.groups;

View File

@@ -61,7 +61,9 @@ define([
reset: function() {
this.$loadingTip.hide();
this.$sysinfo.html(this.template(this.sysinfo.toJSON()));
var json_data = this.sysinfo.toJSON();
json_data['formatted_storage'] = Common.quotaSizeFormat(json_data['total_storage'], 1)
this.$sysinfo.html(this.template(json_data));
}
});