You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by ma...@apache.org on 2014/01/23 20:23:00 UTC

git commit: Show an error message in the UI when scheduler returns an invalid response.

Updated Branches:
  refs/heads/master 911be59dd -> 21673faa1


Show an error message in the UI when scheduler returns an invalid response.

Show an error message when a call to the thrift end point returns an invalid response.

Testing Done:
gradle clean build.

Tested with local scheduler. Scheduler shows an error message (ex: when storage is not ready)

Bugs closed: AURORA-18

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


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

Branch: refs/heads/master
Commit: 21673faa1b3ca142ca223d17f2a21ec246ed7786
Parents: 911be59
Author: Suman Karumuri <ma...@apache.org>
Authored: Thu Jan 23 10:14:12 2014 -0800
Committer: Suman Karumuri <sk...@twitter.com>
Committed: Thu Jan 23 10:14:12 2014 -0800

----------------------------------------------------------------------
 .../apache/aurora/scheduler/http/ui/index.html   | 19 +++++++++++++------
 .../aurora/scheduler/http/ui/js/controllers.js   | 12 +++++++++++-
 .../aurora/scheduler/http/ui/js/services.js      | 15 +++++++--------
 3 files changed, 31 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/21673faa/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 c6706c1..2601da9 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
@@ -9,13 +9,20 @@
 
 <div class='container'>
   <div ng-controller='JobSummaryController'>
-    <div class='page-header'>
-      <h2 class="text-center">{{title}}</h2>
+    <div ng-show="{{error}}">
+      <p class="lead text-center text-warning"> {{reloadMsg}}</p>
+      <p class="text-center text-warning"> {{errorMsg}}</p>
     </div>
-    <div>
-      <smart-table config="globalConfig" columns="columnCollection" rows="rowCollection"
-                   class='table table-striped table-hover table-bordered table-condensed'>
-      </smart-table>
+
+    <div ng-hide="{{error}}">
+      <div class='page-header'>
+        <h2 class="text-center">{{title}}</h2>
+      </div>
+      <div>
+        <smart-table config="globalConfig" columns="columnCollection" rows="rowCollection"
+                     class='table table-striped table-hover table-bordered table-condensed'>
+        </smart-table>
+      </div>
     </div>
   </div>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/21673faa/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 f1333f1..0abd3e7 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
@@ -7,13 +7,23 @@ angular.module('auroraUI.controllers', []).
     function ($scope, $window, auroraClient) {
       $scope.title = 'Scheduled Jobs Summary';
 
+      $scope.error = false;
+      $scope.reloadMsg = "An error occurred when querying the server. Please reload this page.";
+      $scope.errorMsg = "";
+
       $scope.columnCollection = [
         {label : 'Role', map: 'role', cellTemplateUrl: 'roleLink.html'},
         {label : 'Jobs', map: 'jobCount'},
         {label : 'Cron Jobs', map: 'cronJobCount'}
       ];
 
-      $scope.rowCollection = auroraClient.getJobSummary().summaries;
+      $scope.rowCollection = parseResponse(auroraClient.getJobSummary());
+
+      function parseResponse(response) {
+        $scope.error = response.error;
+        $scope.errorMsg = response.errorMsg;
+        return response.summaries;
+      }
 
       $scope.globalConfig = {
         isGlobalSearchActivated: true,

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/21673faa/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 16f22a7..a0385e9 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
@@ -5,14 +5,13 @@ auroraUI.factory(
   function () {
     return {
       getJobSummary: function () {
-        var client = this.makeSchedulerClient();
-
-        var response;
-        console.log("querying server");
-        response = client.getJobSummary();
-        console.log(response);
-        return response.result.jobSummaryResult;
-      },
+        var response = this.makeSchedulerClient().getJobSummary();
+        return {
+          error : response.responseCode !== 1,
+          errorMsg : response.message,
+          summaries : response.result !== null ? response.result.jobSummaryResult.summaries : []
+        }
+     },
 
       makeSchedulerClient: function () {
         var transport = new Thrift.Transport("/api/");