aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [06/50] [abbrv] git commit: Now setting page title correctly.
Date Sat, 05 Apr 2014 00:04:52 GMT
Now setting page title correctly.


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

Branch: refs/heads/mansu/job_page
Commit: b6aca8d34752b2556b30c0c43192c5a4487ab188
Parents: 4c0e6e1
Author: Suman Karumuri <skarumuri@twitter.com>
Authored: Wed Mar 26 15:50:16 2014 -0700
Committer: Suman Karumuri <skarumuri@twitter.com>
Committed: Wed Mar 26 15:57:12 2014 -0700

----------------------------------------------------------------------
 .../aurora/scheduler/http/ui/js/controllers.js  |   7 +-
 .../aurora/scheduler/http/ui/js/services.js     | 112 ++++++++++---------
 2 files changed, 62 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b6aca8d3/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 4853a75..848d136 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
@@ -13,7 +13,7 @@ var globalTableConfig = {
 };
 
 auroraUIControllers.controller('RoleSummaryController',
-  function ($scope, $window, auroraClient) {
+  function ($scope, auroraClient) {
     $scope.title = 'Scheduled Jobs Summary';
 
     $scope.error = false;
@@ -33,9 +33,6 @@ auroraUIControllers.controller('RoleSummaryController',
         return [];
       }
 
-      // Not the best way to set the page title, but this works on all browsers.
-      $window.document.title = response.pageTitle;
-
       // TODO(Suman Karumuri): Replace sort with defaultSortColumn once it lands
       // https://github.com/lorenzofox3/Smart-Table/pull/61
       return response.summaries.sort(function (a, b) {
@@ -132,7 +129,7 @@ auroraUIControllers.controller('JobSummaryController',
             environment: summary.job.key.environment,
             jobName: summary.job.taskConfig.jobName,
             tasks: summary.job.instanceCount,
-            // TODO(Suman Karumuri): Interpret the cron schedule for better readability.
+            // TODO(Suman Karumuri): Convert the cron schedule into text for better readability.
             schedule: summary.job.cronSchedule,
             nextCronRun: summary.nextCronRunMs,
             collisionPolicy: getCronCollisionPolicy(summary.job.cronCollisionPolicy),

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b6aca8d3/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 c087ae1..82758d5 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
@@ -2,56 +2,64 @@
 
 auroraUI.factory(
   'auroraClient',
-  function () {
-    return {
-      getRoleSummary: function () {
-        var response = this.getSchedulerClient().getRoleSummary();
-        return {
-          error: response.responseCode !== 1,
-          errorMsg: response.message,
-          summaries: response.result !== null ? response.result.roleSummaryResult.summaries
: [],
-          pageTitle: this.getPageTitle(response.serverInfo)
-        }
-      },
-
-      getJobSummary: function (role) {
-        var response = this.getSchedulerClient().getJobSummary(role);
-        return {
-          error: response.responseCode !== 1,
-          errorMsg: response.message,
-          jobs: response.result !== null ? response.result.jobSummaryResult.summaries : []
-        };
-      },
-
-      getQuota: function (role) {
-        var response = this.getSchedulerClient().getQuota(role);
-        return {
-          error: response.responseCode !== 1,
-          errorMsg: response.message,
-          quota: response.result !== null ? response.result.getQuotaResult : []
-        }
-      },
-
-      // TODO(Suman Karumuri): Make schedulerClient a service
-      schedulerClient: null,
-
-      getSchedulerClient: function () {
-        if (!this.schedulerClient) {
-          var transport = new Thrift.Transport("/api/");
-          var protocol = new Thrift.Protocol(transport);
-          this.schedulerClient = new ReadOnlySchedulerClient(protocol);
-          return this.schedulerClient;
-        } else {
-          return this.schedulerClient;
+  ['$window',
+    function ($window) {
+      return {
+        getRoleSummary: function () {
+          var response = this.getSchedulerClient().getRoleSummary();
+          var result = this.processResponse(response);
+          result.summaries = response.result !== null
+            ? response.result.roleSummaryResult.summaries : [];
+          return result;
+        },
+
+        getJobSummary: function (role) {
+          var response = this.getSchedulerClient().getJobSummary(role);
+          var result = this.processResponse(response);
+          result.jobs = response.result !== null ? response.result.jobSummaryResult.summaries
: [];
+          return result;
+        },
+
+        getQuota: function (role) {
+          var response = this.getSchedulerClient().getQuota(role);
+          var result = this.processResponse(response);
+          result.quota = response.result !== null ? response.result.getQuotaResult : [];
+          return result;
+        },
+
+        // TODO(Suman Karumuri): Make schedulerClient a service
+        schedulerClient: null,
+
+        getSchedulerClient: function () {
+          if (!this.schedulerClient) {
+            var transport = new Thrift.Transport("/api/");
+            var protocol = new Thrift.Protocol(transport);
+            this.schedulerClient = new ReadOnlySchedulerClient(protocol);
+            return this.schedulerClient;
+          } else {
+            return this.schedulerClient;
+          }
+        },
+
+        processResponse: function (response) {
+          this.setPageTitle(response.serverInfo);
+          return {
+            error: response.responseCode !== 1,
+            errorMsg: response.message
+          }
+        },
+
+        getPageTitle: function (info) {
+          var title = "Aurora UI";
+          return _.isNull(info) || info.error || typeof info.clusterName === "undefined"
+            ? title
+            : info.clusterName + " " + title;
+        },
+
+        // Not the best way to set the page title, but this works on all browsers.
+        setPageTitle: function (serverInfo) {
+          $window.document.title = this.getPageTitle(serverInfo);
         }
-      },
-
-      getPageTitle: function (info) {
-        var title = "Aurora UI";
-        return _.isNull(info) || info.error || typeof info.clusterName === "undefined"
-                 ? title
-                 : info.clusterName + " " + title;
-      }
-    };
-  }
-);
+      };
+    }
+  ]);


Mime
View raw message