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:
@@ -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;
|
||||
|
@@ -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));
|
||||
}
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user