aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmclaugh...@apache.org
Subject git commit: Fix some bugs in the Update UI.
Date Mon, 22 Sep 2014 18:45:29 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 20fd9987f -> 8984fce34


Fix some bugs in the Update UI.

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


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

Branch: refs/heads/master
Commit: 8984fce34186b263890b7f97b44cfab808cd8461
Parents: 20fd998
Author: David McLaughlin <david@dmclaughlin.com>
Authored: Mon Sep 22 11:40:33 2014 -0700
Committer: David McLaughlin <dmclaughlin@twitter.com>
Committed: Mon Sep 22 11:40:33 2014 -0700

----------------------------------------------------------------------
 .../aurora/scheduler/http/ui/js/controllers.js  |  4 +-
 .../aurora/scheduler/http/ui/js/directives.js   | 79 +++++++++++---------
 .../aurora/scheduler/http/ui/js/services.js     |  6 +-
 .../storage/db/JobUpdateDetailsMapper.xml       |  2 +-
 .../storage/db/DBJobUpdateStoreTest.java        | 16 ++--
 5 files changed, 60 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8984fce3/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 bcb094a..ded175a 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
@@ -242,6 +242,8 @@
       $scope.environment = $routeParams.environment;
       $scope.job = $routeParams.job;
 
+      $scope.instanceSummary = [];
+
       var getUpdateProgress = function () {
         auroraClient.getJobUpdateDetails(updateId).then(function (response) {
           $scope.update = response.details;
@@ -421,7 +423,7 @@
 
             $scope.updateStats = updateUtil.getUpdateStats($scope.updateInProgress);
 
-            if (updateUtil.isInProgress($scope.updateInProgress.state.status)) {
+            if (updateUtil.isInProgress($scope.updateInProgress.update.summary.state.status))
{
               // Poll for updates as long as this update is in progress.
               $timeout(function () {
                 getUpdateInProgress();

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8984fce3/src/main/resources/org/apache/aurora/scheduler/http/ui/js/directives.js
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/directives.js b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/directives.js
index 8b7fc06..4e67c4e 100644
--- a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/directives.js
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/directives.js
@@ -95,25 +95,27 @@
       },
       replace: true,
       link: function (scope) {
-        scope.visibleGroups = scope.visibleGroups || [];
-
-        scope.toggleVisibleGroup = function (index) {
-          var i = _.indexOf(scope.visibleGroups, index, true);
-          if (i > -1) {
-            scope.visibleGroups.splice(i, 1);
-          } else {
-            scope.visibleGroups.push(index);
-            scope.visibleGroups.sort();
-          }
-        };
-
-        scope.showAllGroups = function () {
-          scope.visibleGroups = _.range(scope.groups.length);
-        };
-
-        scope.hideAllGroups = function () {
-          scope.visibleGroups = [];
-        };
+        scope.$watch('visibleGroups', function () {
+          scope.visibleGroups = scope.visibleGroups || [];
+
+          scope.toggleVisibleGroup = function (index) {
+            var i = _.indexOf(scope.visibleGroups, index, true);
+            if (i > -1) {
+              scope.visibleGroups.splice(i, 1);
+            } else {
+              scope.visibleGroups.push(index);
+              scope.visibleGroups.sort();
+            }
+          };
+
+          scope.showAllGroups = function () {
+            scope.visibleGroups = _.range(scope.groups.length);
+          };
+
+          scope.hideAllGroups = function () {
+            scope.visibleGroups = [];
+          };
+        });
       }
     };
   });
@@ -158,23 +160,30 @@
         'stats': '='
       },
       link: function (scope, element, attrs) {
-        var list = angular.element('<ul class="instance-grid ' + scope.size + '"></ul>');
-
-        scope.instances.forEach(function (i, n) {
-          list.append('<li class="' + i.className + '" tooltip="INSTANCE ' + n +
-            ': ' + i.className.toUpperCase() + '"><span class="instance-id">' +
n +
-            '</span></li>');
+        scope.$watch('instances', function () {
+          var parent = angular.element('<div></div>');
+          if (!scope.instances || scope.instances.length === 0) {
+            return;
+          }
+          var list = angular.element('<ul class="instance-grid ' + scope.size + '"></ul>');
+
+          scope.instances.forEach(function (i, n) {
+            list.append('<li class="' + i.className + '" tooltip="INSTANCE ' + n +
+              ': ' + i.className.toUpperCase() + '"><span class="instance-id">'
+ n +
+              '</span></li>');
+          });
+
+          var title = angular.element('<div class="instance-summary-title"></div>');
+          title.append('<span class="instance-title">Instance Status</span>');
+          title.append('<span class="instance-progress">' + scope.stats.instancesUpdatedSoFar
+
+            ' / ' + scope.stats.totalInstancesToBeUpdated + ' (' + scope.stats.progress +
+            '%)<div>');
+
+          parent.append(title);
+          parent.append(list);
+          element.html(parent.html());
+          $compile(list)(scope);
         });
-
-        var title = angular.element('<div class="instance-summary-title"></div>');
-        title.append('<span class="instance-title">Instance Status</span>');
-        title.append('<span class="instance-progress">' + scope.stats.instancesUpdatedSoFar
+
-          ' / ' + scope.stats.totalInstancesToBeUpdated + ' (' + scope.stats.progress +
-          '%)<div>');
-
-        element.append(title);
-        element.append(list);
-        $compile(list)(scope);
       }
     };
   });

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8984fce3/src/main/resources/org/apache/aurora/scheduler/http/ui/js/services.js
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/services.js b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/services.js
index 8a719f8..f65cb5e 100644
--- a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/services.js
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/services.js
@@ -241,7 +241,8 @@
         JobUpdateStatus.ROLLED_FORWARD,
         JobUpdateStatus.ROLLED_BACK,
         JobUpdateStatus.ABORTED,
-        JobUpdateStatus.ERROR
+        JobUpdateStatus.ERROR,
+        JobUpdateStatus.FAILED
       ]);
 
       var INSTANCE_SUCCESSFUL = toSet([
@@ -385,7 +386,8 @@
           // max of those two numbers is the number of instances to be updated
           var totalInstancesToBeUpdated = Math.max(oldInstanceCount, newInstanceCount);
 
-          if (details.update.instructions.settings.updateOnlyTheseInstances) {
+          if (details.update.instructions.settings.updateOnlyTheseInstances &&
+            details.update.instructions.settings.updateOnlyTheseInstances.length > 0)
{
             newInstanceCount = updateUtil.instanceCountFromRanges(
               details.update.instructions.settings.updateOnlyTheseInstances
             );

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8984fce3/src/main/resources/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.xml
b/src/main/resources/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.xml
index ad877ed..8053543 100644
--- a/src/main/resources/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.xml
+++ b/src/main/resources/org/apache/aurora/scheduler/storage/db/JobUpdateDetailsMapper.xml
@@ -272,7 +272,7 @@
         </if>
       </if>
     </if>
-    ORDER BY max_ts.timestamp_ms
+    ORDER BY max_ts.timestamp_ms DESC
     <if test="limit != 0">LIMIT #{limit}</if>
     <if test="offset != 0">OFFSET #{offset}</if>
   </select>

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8984fce3/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
b/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
index 1cbb7ab..aa7feb9 100644
--- a/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/storage/db/DBJobUpdateStoreTest.java
@@ -432,14 +432,14 @@ public class DBJobUpdateStoreTest {
         saveSummary(job5, "u5", 1235L, ROLLING_FORWARD, "user4", Optional.of("lock5"));
 
     // Test empty query returns all.
-    assertEquals(ImmutableList.of(s1, s2, s4, s5, s3), getSummaries(new JobUpdateQuery()));
+    assertEquals(ImmutableList.of(s3, s5, s4, s2, s1), getSummaries(new JobUpdateQuery()));
 
     // Test query by updateId.
     assertEquals(ImmutableList.of(s1), getSummaries(new JobUpdateQuery().setUpdateId("u1")));
 
     // Test query by role.
     assertEquals(
-        ImmutableList.of(s1, s2, s4, s3),
+        ImmutableList.of(s3, s4, s2, s1),
         getSummaries(new JobUpdateQuery().setRole(role1)));
 
     // Test query by job key.
@@ -448,30 +448,30 @@ public class DBJobUpdateStoreTest {
         getSummaries(new JobUpdateQuery().setJobKey(job5.newBuilder())));
 
     // Test query by user.
-    assertEquals(ImmutableList.of(s1, s2), getSummaries(new JobUpdateQuery().setUser("user")));
+    assertEquals(ImmutableList.of(s2, s1), getSummaries(new JobUpdateQuery().setUser("user")));
 
     // Test query by one status.
     assertEquals(ImmutableList.of(s3), getSummaries(new JobUpdateQuery().setUpdateStatuses(
         ImmutableSet.of(ERROR))));
 
     // Test query by multiple statuses.
-    assertEquals(ImmutableList.of(s1, s2, s3), getSummaries(new JobUpdateQuery().setUpdateStatuses(
+    assertEquals(ImmutableList.of(s3, s2, s1), getSummaries(new JobUpdateQuery().setUpdateStatuses(
         ImmutableSet.of(ERROR, ABORTED, ROLLED_BACK))));
 
     // Test query by empty statuses.
     assertEquals(
-        ImmutableList.of(s1, s2, s4, s5, s3),
+        ImmutableList.of(s3, s5, s4, s2, s1),
         getSummaries(new JobUpdateQuery().setUpdateStatuses(ImmutableSet.<JobUpdateStatus>of())));
 
     // Test paging.
     assertEquals(
-        ImmutableList.of(s1, s2),
+        ImmutableList.of(s3, s5),
         getSummaries(new JobUpdateQuery().setLimit(2).setOffset(0)));
     assertEquals(
-        ImmutableList.of(s4, s5),
+        ImmutableList.of(s4, s2),
         getSummaries(new JobUpdateQuery().setLimit(2).setOffset(2)));
     assertEquals(
-        ImmutableList.of(s3),
+        ImmutableList.of(s1),
         getSummaries(new JobUpdateQuery().setLimit(2).setOffset(4)));
 
     // Test no match.


Mime
View raw message