From fcdb292a47653c97291f703da3c24ad756c5628e Mon Sep 17 00:00:00 2001 From: OpenShift Cherrypick Robot Date: Tue, 13 Jun 2023 20:39:18 +0000 Subject: [PATCH] [redhat-3.9] ui: display sizes as base 2 (PROJQUAY-5524) (#1970) * displaying tag sizes as MB instead of MiB * adding newline to end of file * updating sizes from base 1000 to 1024 --------- Co-authored-by: bcaton --- static/js/directives/filters/bytes.js | 4 ++-- static/js/directives/ui/manage-user-tab.js | 8 ++++---- static/js/directives/ui/quota-management-view.js | 8 ++++---- static/js/directives/ui/repo-list-table.js | 8 ++++---- static/js/pages/org-view.js | 8 ++++---- static/js/pages/superuser.js | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/static/js/directives/filters/bytes.js b/static/js/directives/filters/bytes.js index fe0602d84..2bc8b8d0f 100644 --- a/static/js/directives/filters/bytes.js +++ b/static/js/directives/filters/bytes.js @@ -5,8 +5,8 @@ angular.module('quay').filter('bytes', function() { return function(bytes, precision) { if (!bytes || isNaN(parseFloat(bytes)) || !isFinite(bytes)) return 'Unknown'; if (typeof precision === 'undefined') precision = 1; - var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'], + var units = ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'], number = Math.floor(Math.log(bytes) / Math.log(1024)); return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number]; } -}); \ No newline at end of file +}); diff --git a/static/js/directives/ui/manage-user-tab.js b/static/js/directives/ui/manage-user-tab.js index 6d2d443b1..5a7c3e70d 100644 --- a/static/js/directives/ui/manage-user-tab.js +++ b/static/js/directives/ui/manage-user-tab.js @@ -31,10 +31,10 @@ angular.module('quay').directive('manageUserTab', function () { 'page': 0 }; $scope.disk_size_units = { - 'KB': 1000, - 'MB': 1000**2, - 'GB': 1000**3, - 'TB': 1000**4, + 'KiB': 1024, + 'MiB': 1024**2, + 'GiB': 1024**3, + 'TiB': 1024**4, }; $scope.quotaUnits = Object.keys($scope.disk_size_units); diff --git a/static/js/directives/ui/quota-management-view.js b/static/js/directives/ui/quota-management-view.js index f9c78267f..c008a358a 100644 --- a/static/js/directives/ui/quota-management-view.js +++ b/static/js/directives/ui/quota-management-view.js @@ -25,10 +25,10 @@ angular.module('quay').directive('quotaManagementView', function () { $scope.defer = null; $scope.disk_size_units = { - 'KB': 1000, - 'MB': 1000 ** 2, - 'GB': 1000 ** 3, - 'TB': 1000 ** 4, + 'KiB': 1024, + 'MiB': 1024 ** 2, + 'GiB': 1024 ** 3, + 'TiB': 1024 ** 4, }; $scope.quotaUnits = Object.keys($scope.disk_size_units); $scope.rejectLimitType = 'Reject'; diff --git a/static/js/directives/ui/repo-list-table.js b/static/js/directives/ui/repo-list-table.js index de106cf0f..3db672b88 100644 --- a/static/js/directives/ui/repo-list-table.js +++ b/static/js/directives/ui/repo-list-table.js @@ -30,10 +30,10 @@ angular.module('quay').directive('repoListTable', function () { 'page': 0 }; $scope.disk_size_units = { - 'KB': 1000, - 'MB': 1000**2, - 'GB': 1000**3, - 'TB': 1000**4, + 'KiB': 1024, + 'MiB': 1024**2, + 'GiB': 1024**3, + 'TiB': 1024**4, }; $scope.quotaUnits = Object.keys($scope.disk_size_units); diff --git a/static/js/pages/org-view.js b/static/js/pages/org-view.js index 47f366047..3773ae47c 100644 --- a/static/js/pages/org-view.js +++ b/static/js/pages/org-view.js @@ -33,10 +33,10 @@ 'organizationEmail': '' }; $scope.disk_size_units = { - 'KB': 1000, - 'MB': 1000**2, - 'GB': 1000**3, - 'TB': 1000**4, + 'KiB': 1024, + 'MiB': 1024**2, + 'GiB': 1024**3, + 'TiB': 1024**4, }; $scope.quotaUnits = Object.keys($scope.disk_size_units); diff --git a/static/js/pages/superuser.js b/static/js/pages/superuser.js index d0141626c..d70af22ea 100644 --- a/static/js/pages/superuser.js +++ b/static/js/pages/superuser.js @@ -42,10 +42,10 @@ 'page': 0, } $scope.disk_size_units = { - 'KB': 1000, - 'MB': 1000**2, - 'GB': 1000**3, - 'TB': 1000**4, + 'KiB': 1024, + 'MiB': 1024**2, + 'GiB': 1024**3, + 'TiB': 1024**4, }; $scope.quotaUnits = Object.keys($scope.disk_size_units); $scope.registryQuota = null;