aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmclaugh...@apache.org
Subject aurora git commit: Add resource units to config summary
Date Mon, 30 Oct 2017 15:42:59 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 3fe5d5907 -> 448e6d4cc


Add resource units to config summary

Reviewed at https://reviews.apache.org/r/63375/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/448e6d4c
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/448e6d4c
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/448e6d4c

Branch: refs/heads/master
Commit: 448e6d4cceac3e3fac958c9a204244a26eb69477
Parents: 3fe5d59
Author: David McLaughlin <david@dmclaughlin.com>
Authored: Mon Oct 30 08:37:19 2017 -0700
Committer: David McLaughlin <david@dmclaughlin.com>
Committed: Mon Oct 30 08:37:19 2017 -0700

----------------------------------------------------------------------
 ui/src/main/js/components/RoleQuota.js         | 8 +-------
 ui/src/main/js/components/TaskConfigSummary.js | 5 +++--
 ui/src/main/js/utils/Quota.js                  | 6 ++++++
 3 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/448e6d4c/ui/src/main/js/components/RoleQuota.js
----------------------------------------------------------------------
diff --git a/ui/src/main/js/components/RoleQuota.js b/ui/src/main/js/components/RoleQuota.js
index bb1b6e7..2af2563 100644
--- a/ui/src/main/js/components/RoleQuota.js
+++ b/ui/src/main/js/components/RoleQuota.js
@@ -1,6 +1,7 @@
 import React from 'react';
 
 import { isNully } from 'utils/Common';
+import { formatMb } from 'utils/Quota';
 
 const QUOTA_TYPE_ORDER = [
   'quota',
@@ -19,13 +20,6 @@ export const QUOTA_TYPE_MAP = {
   'nonProdDedicatedConsumption': 'Non-Production Dedicated'
 };
 
-const UNITS = ['MiB', 'GiB', 'TiB', 'PiB', 'EiB'];
-
-function formatMb(sizeInMb) {
-  const unitIdx = (sizeInMb > 0) ? Math.floor(Math.log(sizeInMb) / Math.log(1024)) : 0;
-  return (sizeInMb / Math.pow(1024, unitIdx)).toFixed(2) + '' + UNITS[unitIdx];
-}
-
 const CONVERSIONS = {
   diskMb: formatMb,
   ramMb: formatMb

http://git-wip-us.apache.org/repos/asf/aurora/blob/448e6d4c/ui/src/main/js/components/TaskConfigSummary.js
----------------------------------------------------------------------
diff --git a/ui/src/main/js/components/TaskConfigSummary.js b/ui/src/main/js/components/TaskConfigSummary.js
index b1cf5a9..01902cd 100644
--- a/ui/src/main/js/components/TaskConfigSummary.js
+++ b/ui/src/main/js/components/TaskConfigSummary.js
@@ -3,6 +3,7 @@ import React from 'react';
 
 import { RelativeTime } from 'components/Time';
 
+import { formatMb } from 'utils/Quota';
 import { constraintToString, getResource, getResources, instanceRangeToString } from 'utils/Task';
 import { COLLISION_POLICY } from 'utils/Thrift';
 
@@ -16,11 +17,11 @@ function Resources({ config }) {
   </tr>,
   <tr>
     <td>ram</td>
-    <td>{getResource(config.resources, 'ramMb').ramMb}</td>
+    <td>{formatMb(getResource(config.resources, 'ramMb').ramMb)}</td>
   </tr>,
   <tr>
     <td>disk</td>
-    <td>{getResource(config.resources, 'diskMb').diskMb}</td>
+    <td>{formatMb(getResource(config.resources, 'diskMb').diskMb)}</td>
   </tr>,
   <tr>
     <td>ports</td>

http://git-wip-us.apache.org/repos/asf/aurora/blob/448e6d4c/ui/src/main/js/utils/Quota.js
----------------------------------------------------------------------
diff --git a/ui/src/main/js/utils/Quota.js b/ui/src/main/js/utils/Quota.js
new file mode 100644
index 0000000..8f54ba8
--- /dev/null
+++ b/ui/src/main/js/utils/Quota.js
@@ -0,0 +1,6 @@
+const UNITS = ['MiB', 'GiB', 'TiB', 'PiB', 'EiB'];
+
+export function formatMb(sizeInMb) {
+  const unitIdx = (sizeInMb > 0) ? Math.floor(Math.log(sizeInMb) / Math.log(1024)) : 0;
+  return (sizeInMb / Math.pow(1024, unitIdx)).toFixed(2) + '' + UNITS[unitIdx];
+}


Mime
View raw message