aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [16/50] [abbrv] git commit: Now displaying formatted constraints.
Date Sat, 05 Apr 2014 00:05:02 GMT
Now displaying formatted constraints.


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

Branch: refs/heads/mansu/job_page
Commit: debaa9148b56c335ca8ab791b05fdf10d001676b
Parents: 72052ef
Author: Suman Karumuri <skarumuri@twitter.com>
Authored: Fri Mar 28 14:52:39 2014 -0700
Committer: Suman Karumuri <skarumuri@twitter.com>
Committed: Fri Mar 28 14:52:39 2014 -0700

----------------------------------------------------------------------
 .../aurora/scheduler/http/ui/js/controllers.js  | 35 +++++++++++++++++---
 1 file changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/debaa914/src/main/resources/org/apache/aurora/scheduler/http/ui/js/controllers.js
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/controllers.js b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/controllers.js
index 93a85d2..9e60286 100644
--- a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/controllers.js
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/controllers.js
@@ -455,16 +455,22 @@ auroraUIControllers.controller('JobController',
         numCpus: task.numCpus,
         ramMb: task.ramMb,
         diskMb: task.diskMb,
-        constraints: _.sortBy(task.constraints, function (constraint) {
-          return constraint.name;
-        }),
         isService: task.isService,
         production: task.production,
         ports: _.sortBy(task.requestedPorts),
+        contact: task.contactEmail || '',
+        constraints: _.chain(task.constraints)
+          .sortBy(function (constraint) {
+            return constraint.name;
+          })
+          .map(function (constraint) {
+            return formatConstraint(constraint);
+          })
+          .value()
+          .join(','),
         metadata: _.sortBy(task.metadata, function (metadata) {
           return metadata.key;
-        }),
-        contact: task.contactEmail || ''
+        })
       };
     }
 
@@ -485,5 +491,24 @@ auroraUIControllers.controller('JobController',
       }
       return result;
     }
+
+    function formatConstraint(constraint) {
+      var taskConstraint = constraint.constraint;
+
+      var valueConstraint = '';
+      if (!_.isNull(taskConstraint.value)) {
+        var values = taskConstraint.value.values.join(',');
+        valueConstraint = taskConstraint.value.negated ? "not " + values : values;
+      }
+
+      var limitConstraint = taskConstraint.limit ? JSON.stringify(taskConstraint.limit) :
'';
+
+      if(_.isEmpty(limitConstraint) && _.isEmpty(valueConstraint)) {
+        return '';
+      } else {
+        return constraint.name + ':' +
+          (_.isEmpty(limitConstraint) ? valueConstraint : limitConstraint);
+      }
+    }
   }
 );


Mime
View raw message