aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmclaugh...@apache.org
Subject git commit: Expose in progress and recently completed updates in UI
Date Wed, 24 Sep 2014 23:33:58 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 2e822238a -> 72706f4eb


Expose in progress and recently completed updates in UI

Bugs closed: AURORA-745

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


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

Branch: refs/heads/master
Commit: 72706f4eb72b4ca797e63cef13be3e9458e0743f
Parents: 2e82223
Author: David McLaughlin <david@dmclaughlin.com>
Authored: Wed Sep 24 16:28:54 2014 -0700
Committer: David McLaughlin <dmclaughlin@twitter.com>
Committed: Wed Sep 24 16:28:54 2014 -0700

----------------------------------------------------------------------
 .../scheduler/http/JettyServerModule.java       |  5 +++
 .../apache/aurora/scheduler/http/ui/css/app.css |  2 +-
 .../apache/aurora/scheduler/http/ui/index.html  |  6 +++
 .../apache/aurora/scheduler/http/ui/js/app.js   |  3 ++
 .../aurora/scheduler/http/ui/js/controllers.js  | 39 +++++++++++++++--
 .../aurora/scheduler/http/ui/js/directives.js   | 13 +++++-
 .../aurora/scheduler/http/ui/js/services.js     | 25 ++++++++++-
 .../aurora/scheduler/http/ui/latestUpdates.html | 46 ++++++++++++++++++++
 .../aurora/scheduler/http/ui/updateList.html    | 32 ++++++++++++++
 9 files changed, 163 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/72706f4e/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java b/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
index 392b4f7..3656ca0 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
@@ -217,6 +217,9 @@ public class JettyServerModule extends AbstractModule {
     registerAsset("ui/index.html", "/scheduler", true);
     Registration.registerEndpoint(binder(), "/scheduler");
 
+    registerAsset("ui/index.html", "/updates", true);
+    Registration.registerEndpoint(binder(), "/updates");
+
     registerAsset("ui/roleLink.html", "/roleLink.html");
     registerAsset("ui/roleEnvLink.html", "/roleEnvLink.html");
     registerAsset("ui/jobLink.html", "/jobLink.html");
@@ -234,6 +237,8 @@ public class JettyServerModule extends AbstractModule {
     registerAsset("ui/update.html", "/update.html");
     registerAsset("ui/timeDisplay.html", "/timeDisplay.html");
     registerAsset("ui/updateSettings.html", "/updateSettings.html");
+    registerAsset("ui/updateList.html", "/updateList.html");
+    registerAsset("ui/latestUpdates.html", "/latestUpdates.html");
 
     registerAsset("ui/css/app.css", "/css/app.css");
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/72706f4e/src/main/resources/org/apache/aurora/scheduler/http/ui/css/app.css
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/css/app.css b/src/main/resources/org/apache/aurora/scheduler/http/ui/css/app.css
index befd590..509639e 100644
--- a/src/main/resources/org/apache/aurora/scheduler/http/ui/css/app.css
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/css/app.css
@@ -26,7 +26,7 @@ a {
 }
 
 .logo {
-  width: 200px;
+  width: 150px;
 }
 
 .dashboard-url {

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/72706f4e/src/main/resources/org/apache/aurora/scheduler/http/ui/index.html
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/index.html b/src/main/resources/org/apache/aurora/scheduler/http/ui/index.html
index 6434d1b..40617aa 100644
--- a/src/main/resources/org/apache/aurora/scheduler/http/ui/index.html
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/index.html
@@ -26,6 +26,12 @@
     <div class="navbar-header">
       <a href="/scheduler"><img class="logo" src="/images/aurora_logo.png"/></a>
     </div>
+
+    <div class="collapse navbar-collapse">
+      <ul class="nav navbar-nav">
+        <li><a href="/updates">updates</a></li>
+      </ul>
+    </div>
   </div>
 </nav>
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/72706f4e/src/main/resources/org/apache/aurora/scheduler/http/ui/js/app.js
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/app.js b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/app.js
index 082d920..5fe85f8 100644
--- a/src/main/resources/org/apache/aurora/scheduler/http/ui/js/app.js
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/js/app.js
@@ -35,6 +35,9 @@ var auroraUI;
     $routeProvider.when('/scheduler/:role/:environment/:job/:update',
       {templateUrl: '/update.html', controller: 'UpdateController'});
 
+    $routeProvider.when('/updates',
+      {templateUrl: '/updateList.html', controller: 'AllUpdatesController'});
+
     $routeProvider.otherwise({redirectTo: function (location, path) {
       window.location.href = path;
     }});

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/72706f4e/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 ded175a..7b60188 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
@@ -15,8 +15,6 @@
   /* global ScheduleStatus:false, JobUpdateQuery:false, JobKey:false */
   'use strict';
 
-  var AURORA_UPDATE_POLL_MS = 10000;
-
   /* Controllers */
 
   var auroraUIControllers = angular.module('auroraUI.controllers', []);
@@ -35,6 +33,11 @@
     selectionMode: 'none'
   };
 
+  var REFRESH_RATES = {
+    IN_PROGRESS_UPDATE_MS: 15000,
+    COMPLETED_UPDATES_MS: 60000
+  };
+
   auroraUIControllers.controller('RoleSummaryController',
     function ($scope, auroraClient) {
       $scope.title = 'Scheduled Jobs Summary';
@@ -234,6 +237,34 @@
     }
   );
 
+  auroraUIControllers.controller('AllUpdatesController',
+    function ($scope, $timeout, auroraClient, updateUtil) {
+
+      function inProgressUpdates() {
+        // fetch any in progress updates
+        auroraClient.getJobUpdateSummaries(updateUtil.getInProgressQuery())
+          .then(function (response) {
+            $scope.inProgressUpdates = response.summaries;
+            $timeout(function () { inProgressUpdates(); }, REFRESH_RATES.IN_PROGRESS_UPDATE_MS);
+          });
+      }
+
+      function completedUpdates() {
+        // fetch the latest 20 finished updates
+        var finishedQuery = updateUtil.getTerminalQuery();
+        finishedQuery.limit = 20;
+
+        auroraClient.getJobUpdateSummaries(finishedQuery).then(function (response) {
+          $scope.completedUpdates = response.summaries;
+          $timeout(function () { completedUpdates(); }, REFRESH_RATES.COMPLETED_UPDATES_MS);
+        });
+      }
+
+      inProgressUpdates();
+      completedUpdates();
+    }
+  );
+
   auroraUIControllers.controller('UpdateController',
     function ($scope, $routeParams, $timeout, auroraClient, updateUtil) {
       var updateId = $routeParams.update;
@@ -285,7 +316,7 @@
           if ($scope.inProgress) {
             $timeout(function () {
               getUpdateProgress();
-            }, AURORA_UPDATE_POLL_MS);
+            }, REFRESH_RATES.IN_PROGRESS_UPDATE_MS);
           }
         });
       };
@@ -427,7 +458,7 @@
               // Poll for updates as long as this update is in progress.
               $timeout(function () {
                 getUpdateInProgress();
-              }, AURORA_UPDATE_POLL_MS);
+              }, REFRESH_RATES.IN_PROGRESS_UPDATE_MS);
             }
           });
         }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/72706f4e/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 4e67c4e..92c78c2 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
@@ -182,9 +182,20 @@
           parent.append(title);
           parent.append(list);
           element.html(parent.html());
-          $compile(list)(scope);
+          $compile(element)(scope);
         });
       }
     };
   });
+
+  auroraUI.directive('latestUpdates', function () {
+    return {
+      restrict: 'E',
+      scope: {
+        'updates': '=',
+        'message': '@'
+      },
+      templateUrl: '/latestUpdates.html'
+    };
+  });
 })();

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/72706f4e/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 f65cb5e..8ed9573 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
@@ -237,13 +237,23 @@
         return tmp;
       }
 
-      var UPDATE_TERMINAL = toSet([
+      // TODO(dmclaughlin): Make these constants in api.thrift.
+      var UPDATE_TERMINAL_STATUSES = [
         JobUpdateStatus.ROLLED_FORWARD,
         JobUpdateStatus.ROLLED_BACK,
         JobUpdateStatus.ABORTED,
         JobUpdateStatus.ERROR,
         JobUpdateStatus.FAILED
-      ]);
+      ];
+
+      var IN_PROGRESS_STATUSES = [
+        JobUpdateStatus.ROLLING_FORWARD,
+        JobUpdateStatus.ROLLING_BACK,
+        JobUpdateStatus.ROLL_FORWARD_PAUSED,
+        JobUpdateStatus.ROLL_BACK_PAUSED
+      ];
+
+      var UPDATE_TERMINAL = toSet(UPDATE_TERMINAL_STATUSES);
 
       var INSTANCE_SUCCESSFUL = toSet([
         JobUpdateAction.INSTANCE_UPDATED
@@ -283,6 +293,17 @@
 
           return instanceCount;
         },
+        getStatusQuery: function (statuses) {
+          var query = new JobUpdateQuery();
+          query.updateStatuses = statuses;
+          return query;
+        },
+        getTerminalQuery: function () {
+          return updateUtil.getStatusQuery(UPDATE_TERMINAL_STATUSES);
+        },
+        getInProgressQuery: function () {
+          return updateUtil.getStatusQuery(IN_PROGRESS_STATUSES);
+        },
         instanceCountFromConfigs: function (instanceTaskConfigs) {
           var flattenedRanges = [];
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/72706f4e/src/main/resources/org/apache/aurora/scheduler/http/ui/latestUpdates.html
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/latestUpdates.html b/src/main/resources/org/apache/aurora/scheduler/http/ui/latestUpdates.html
new file mode 100644
index 0000000..9844eda
--- /dev/null
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/latestUpdates.html
@@ -0,0 +1,46 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<div ng-if="!updates.length">
+  <em ng-if="message">{{message}}</em>
+  <em ng-if="!message">No updates to show.</em>
+</div>
+
+<table class="table table-bordered table-striped table-hover" ng-if="updates.length">
+  <tr>
+    <th>job</th>
+    <th>user</th>
+    <th>started</th>
+    <th>ended</th>
+    <th>status</th>
+  </tr>
+  <tr ng-repeat="update in updates">
+    <td>
+      <a href="/scheduler/{{update.jobKey.role}}/{{update.jobKey.environment}}/{{update.jobKey.name}}/{{update.updateId}}">
+        {{update.jobKey.role}}/{{update.jobKey.environment}}/{{update.jobKey.name}}
+      </a>
+    </td>
+    <td>
+      {{update.user}}
+    </td>
+    <td>
+      {{update.state.createdTimestampMs | toElapsedTime}} ago
+    </td>
+    <td>
+      {{update.state.lastModifiedTimestampMs | toElapsedTime}} ago
+    </td>
+    <td>
+      {{update.state.status | toNiceStatus}}
+    </td>
+  </tr>
+</table>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/72706f4e/src/main/resources/org/apache/aurora/scheduler/http/ui/updateList.html
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/aurora/scheduler/http/ui/updateList.html b/src/main/resources/org/apache/aurora/scheduler/http/ui/updateList.html
new file mode 100644
index 0000000..0b9f1b9
--- /dev/null
+++ b/src/main/resources/org/apache/aurora/scheduler/http/ui/updateList.html
@@ -0,0 +1,32 @@
+  <!--
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+   -->
+<div class="container-fluid">
+  <breadcrumb></breadcrumb>
+
+  <div class="row">
+    <div class="col-md-12">
+        <h3>Updates In Progress</h3>
+
+        <latest-updates updates="inProgressUpdates" message="No updates currently in progress."></latest-updates>
+    </div>
+  </div>
+
+  <div class="row">
+    <div class="col-md-12">
+        <h3>Recently Completed Updates</h3>
+
+        <latest-updates updates="completedUpdates"></latest-updates>
+    </div>
+  </div>
+</div>
\ No newline at end of file


Mime
View raw message