aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject aurora git commit: Showing all resource consumption details in the UI
Date Fri, 11 Sep 2015 21:29:29 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 3f1e44d62 -> ec02a49df


Showing all resource consumption details in the UI

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


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

Branch: refs/heads/master
Commit: ec02a49df98980ed81673220d986cfd8fca7f1e0
Parents: 3f1e44d
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Fri Sep 11 14:29:18 2015 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Fri Sep 11 14:29:18 2015 -0700

----------------------------------------------------------------------
 .../scheduler/assets/js/controllers.js          | 45 ++++++--------------
 src/main/resources/scheduler/assets/role.html   |  2 +-
 2 files changed, 15 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/ec02a49d/src/main/resources/scheduler/assets/js/controllers.js
----------------------------------------------------------------------
diff --git a/src/main/resources/scheduler/assets/js/controllers.js b/src/main/resources/scheduler/assets/js/controllers.js
index 511f5c3..85ae8ce 100644
--- a/src/main/resources/scheduler/assets/js/controllers.js
+++ b/src/main/resources/scheduler/assets/js/controllers.js
@@ -161,26 +161,12 @@
 
       auroraClient.getQuota($scope.role).then(function (quotaResponse) {
         $scope.resources = getQuota(quotaResponse);
-
-        var consumption = quotaResponse.quota;
-        var columns = [
-          {label: 'Resource', map: 'resource'},
-          {label: 'Quota', map: 'quota'},
-          {label: 'Quota Consumption', map: 'prodSharedConsumption'},
-          {label: 'Production Dedicated Consumption', map: 'prodDedicatedConsumption'},
-          {label: 'Non-Production Consumption', map: 'nonProdSharedConsumption'},
-          {label: 'Non-Production Dedicated Consumption', map: 'nonProdDedicatedConsumption'}
+        $scope.resourcesTableColumns = [
+          {label: '', map: 'resource'},
+          {label: 'CPU', map: 'numCpus'},
+          {label: 'RAM', map: 'ramMb'},
+          {label: 'Disk', map: 'diskMb'}
         ];
-
-        columns = _.filter(columns, function (column) {
-          var vector = consumption[column.map];
-          return !vector || vector.numCpus > 0 || vector.ramMb > 0 || vector.diskMb
> 0;
-        });
-        $scope.resourcesTableColumns = columns;
-
-        // Assuming the max column count of 6. Revisit this approach if that's no longer
the case.
-        $scope.resourceClass = 'col-md-' + (columns.length * 2);
-
       });
 
       function getQuota(quotaResponse) {
@@ -190,25 +176,22 @@
           return [];
         }
 
-        function addResourceVector(name, filterSpec, vector) {
+        function addResourceVector(name, vector) {
           var consumption = quotaResponse.quota;
           return {
             resource: name,
-            quota: $filter(filterSpec)(consumption.quota[vector]),
-            prodSharedConsumption: $filter(filterSpec)(consumption.prodSharedConsumption[vector]),
-            prodDedicatedConsumption:
-              $filter(filterSpec)(consumption.prodDedicatedConsumption[vector]),
-            nonProdSharedConsumption:
-              $filter(filterSpec)(consumption.nonProdSharedConsumption[vector]),
-            nonProdDedicatedConsumption:
-              $filter(filterSpec)(consumption.nonProdDedicatedConsumption[vector])
+            numCpus: $filter('toCores')(consumption[vector].numCpus),
+            ramMb: $filter('scaleMb')(consumption[vector].ramMb),
+            diskMb: $filter('scaleMb')(consumption[vector].diskMb)
           };
         }
 
         return [
-          addResourceVector('CPU', 'toCores', 'numCpus'),
-          addResourceVector('RAM', 'scaleMb', 'ramMb'),
-          addResourceVector('Disk', 'scaleMb', 'diskMb')
+          addResourceVector('Quota', 'quota'),
+          addResourceVector('Quota Consumption', 'prodSharedConsumption'),
+          addResourceVector('Production Dedicated Consumption', 'prodDedicatedConsumption'),
+          addResourceVector('Non-Production Consumption', 'nonProdSharedConsumption'),
+          addResourceVector('Non-Production Dedicated Consumption', 'nonProdDedicatedConsumption')
         ];
       }
     }

http://git-wip-us.apache.org/repos/asf/aurora/blob/ec02a49d/src/main/resources/scheduler/assets/role.html
----------------------------------------------------------------------
diff --git a/src/main/resources/scheduler/assets/role.html b/src/main/resources/scheduler/assets/role.html
index d3a4c7d..21580e6 100644
--- a/src/main/resources/scheduler/assets/role.html
+++ b/src/main/resources/scheduler/assets/role.html
@@ -21,7 +21,7 @@
 
     <div class='row' ng-show='!environment'>
       <div ng-controller="QuotaController">
-        <div class={{resourceClass}}>
+        <div class='col-md-5'>
           <div>
             <h4>Resource consumption</h4>
             <smart-table config='resourcesTableConfig'


Mime
View raw message