From 70ad86534d5a58b6c40f4624372c7db31d13ede5 Mon Sep 17 00:00:00 2001 From: Benedict Aas Date: Tue, 1 Aug 2017 22:34:13 +0100 Subject: [PATCH] feat(GUI): make size units closest relative (#1539) We make the size units used the closest relative unit through a new filter `closestUnit` replacing the old `gigabyte` filter. Changelog-Entry: Round byte sizes to the more appropriate unit. * remove filters folder * new shrinkwrap, add to package.json * test --- .../templates/drive-selector-modal.tpl.html | 2 +- lib/gui/pages/main/templates/main.tpl.html | 4 +- lib/gui/utils/byte-size/byte-size.js | 2 +- .../{filters/gigabyte.js => filter.js} | 10 ++-- lib/shared/units.js | 48 +++++++++---------- npm-shrinkwrap.json | 46 ++++++------------ package.json | 1 + tests/gui/utils/byte-size.spec.js | 10 ++-- tests/shared/units.spec.js | 35 ++++++++++++-- 9 files changed, 85 insertions(+), 73 deletions(-) rename lib/gui/utils/byte-size/{filters/gigabyte.js => filter.js} (76%) diff --git a/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html b/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html index 35d4e965..5a741966 100644 --- a/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html +++ b/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html @@ -11,7 +11,7 @@ ng-click="modal.toggleDrive(drive)">

{{ drive.description }} - - {{ drive.size | gigabyte | number:1 }} GB + {{ drive.size | closestUnit }}

{{ drive.displayName }}

diff --git a/lib/gui/pages/main/templates/main.tpl.html b/lib/gui/pages/main/templates/main.tpl.html index a1b9de54..24908deb 100644 --- a/lib/gui/pages/main/templates/main.tpl.html +++ b/lib/gui/pages/main/templates/main.tpl.html @@ -25,7 +25,7 @@ class="step-image step-name" ng-bind="main.selection.getImageName() || image.getImageBasename() | middleEllipses:20" uib-tooltip="{{ image.getImageBasename() }}"> - {{ main.selection.getImageSize() | gigabyte | number:1 }} GB + {{ main.selection.getImageSize() | closestUnit }}