Fix prettyDiskSize to use 1000 instead of 1024
This commit is contained in:
+3
-2
@@ -295,11 +295,12 @@ app.filter('prettyMailSize', function () {
|
||||
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]; };
|
||||
});
|
||||
|
||||
// df -H style (si) output
|
||||
app.filter('prettyDiskSize', function () {
|
||||
return function (size) {
|
||||
if (!size) return 'Not available yet';
|
||||
var i = Math.floor(Math.log(size) / Math.log(1024));
|
||||
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]; };
|
||||
var i = Math.floor(Math.log(size) / Math.log(1000));
|
||||
return (size / Math.pow(1000, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]; };
|
||||
});
|
||||
|
||||
app.filter('installationActive', function () {
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
</div>
|
||||
<div class="row" ng-repeat="disk in disks" style="margin-bottom: 20px;">
|
||||
<div class="col-md-12">
|
||||
<h3>{{ disk.filesystem }} <small>mounted at</small> {{ disk.mountpoint }} <span class="pull-right small"><b>{{ disk.available | prettyDiskSize }}</b> of <b>{{ disk.size | prettyDiskSize }}</b> still available</span></h3>
|
||||
<h3>{{ disk.filesystem }} <small>mounted at</small> {{ disk.mountpoint }} <span class="pull-right small"><b>{{ disk.available | prettyDiskSize }}</b> of <b>{{ disk.size | prettyDiskSize }}</b> available</span></h3>
|
||||
<div class="progress">
|
||||
<div class="progress-bar" ng-repeat="content in disk.contains" style="width: {{ content.usage / disk.size * 100 }}%; background-color: {{ content.color }};" uib-tooltip="{{ content.label + ' ' + (content.usage | prettyDiskSize) }}"></div>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -175,7 +175,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
|
||||
});
|
||||
});
|
||||
|
||||
$scope.disks = result.disks;
|
||||
$scope.disks = result.disks; // [ { filesystem, type, size, used, available, capacity, mountpoint }]
|
||||
|
||||
// lazy fetch graphite data
|
||||
$scope.disks.forEach(function (disk) {
|
||||
@@ -221,7 +221,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
|
||||
usageOther -= tmp;
|
||||
});
|
||||
|
||||
// add content container for other non tracked data
|
||||
// add content container for other non tracked data.
|
||||
disk.contains.push({
|
||||
label: 'Ubuntu',
|
||||
id: 'other',
|
||||
|
||||
Reference in New Issue
Block a user