You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by kl...@apache.org on 2017/11/10 14:05:20 UTC

[2/3] mesos git commit: Linted JavaScript files.

Linted JavaScript files.

Review: https://reviews.apache.org/r/63703/


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

Branch: refs/heads/master
Commit: af8404e7bf49201d7f3a0a563f43d767539558f0
Parents: f03e75c
Author: Armand Grillet <ag...@mesosphere.io>
Authored: Fri Nov 10 14:52:43 2017 +0100
Committer: Kevin Klues <kl...@gmail.com>
Committed: Fri Nov 10 15:04:38 2017 +0100

----------------------------------------------------------------------
 src/webui/master/static/js/app.js           |  4 ++--
 src/webui/master/static/js/controllers.js   | 26 +++++++++++++-----------
 src/webui/master/static/js/jquery.pailer.js | 13 +++++++++---
 src/webui/master/static/js/services.js      | 12 +++++------
 4 files changed, 32 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/af8404e7/src/webui/master/static/js/app.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/app.js b/src/webui/master/static/js/app.js
index 39f66d2..463c563 100644
--- a/src/webui/master/static/js/app.js
+++ b/src/webui/master/static/js/app.js
@@ -189,7 +189,7 @@
         scope: true,
         template: '<i class="glyphicon glyphicon-file"></i>',
 
-        link: function(scope, element, attrs) {
+        link: function(scope, element, _attrs) {
           var clip = new Clipboard(element[0]);
 
           element.on('mouseenter', function() {
@@ -241,7 +241,7 @@
         scope: {
           value: '@'
         },
-        link: function($scope, element, attrs) {
+        link: function($scope, _element, _attrs) {
           $scope.longDate = JSON.parse(
             localStorage.getItem('longDate') || false);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/af8404e7/src/webui/master/static/js/controllers.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/controllers.js b/src/webui/master/static/js/controllers.js
index e753709..5966586 100644
--- a/src/webui/master/static/js/controllers.js
+++ b/src/webui/master/static/js/controllers.js
@@ -292,10 +292,11 @@
 
       _.each(framework.tasks, function(task) {
         switch (task.state) {
-            case "TASK_STAGING": framework.staging_tasks++; break;
-            case "TASK_STARTING": framework.starting_tasks++; break;
-            case "TASK_RUNNING": framework.running_tasks++; break;
-            case "TASK_KILLING": framework.killing_tasks++; break;
+            case "TASK_STAGING": framework.staging_tasks += 1; break;
+            case "TASK_STARTING": framework.starting_tasks += 1; break;
+            case "TASK_RUNNING": framework.running_tasks += 1; break;
+            case "TASK_KILLING": framework.killing_tasks += 1; break;
+            default: break;
         }
       })
 
@@ -306,10 +307,11 @@
 
       _.each(framework.completed_tasks, function(task) {
         switch (task.state) {
-            case "TASK_FINISHED": framework.finished_tasks++; break;
-            case "TASK_KILLED": framework.killed_tasks++; break;
-            case "TASK_FAILED": framework.failed_tasks++; break;
-            case "TASK_LOST": framework.lost_tasks++; break;
+            case "TASK_FINISHED": framework.finished_tasks += 1; break;
+            case "TASK_KILLED": framework.killed_tasks += 1; break;
+            case "TASK_FAILED": framework.failed_tasks += 1; break;
+            case "TASK_LOST": framework.lost_tasks += 1; break;
+            default: break;
         }
       })
 
@@ -548,7 +550,7 @@
 
 
   mesosApp.controller('HomeCtrl', function($dialog, $scope) {
-    $scope.log = function($event) {
+    $scope.log = function(_$event) {
       if (!$scope.state.external_log_file && !$scope.state.log_dir) {
         $dialog.messageBox(
           'Logging to a file is not enabled',
@@ -656,7 +658,7 @@
 
       var agent = $scope.agents[$routeParams.agent_id];
 
-      $scope.log = function($event) {
+      $scope.log = function(_$event) {
         if (!$scope.state.external_log_file && !$scope.state.log_dir) {
           $dialog.messageBox(
             'Logging to a file is not enabled',
@@ -929,7 +931,7 @@
                 task.healthy = lastStatus.healthy;
               }
             })
-          };
+          }
 
           // Look for the executor; it's either active or completed.
           $scope.executor =
@@ -1080,7 +1082,7 @@
             .search({path: sandboxDirectory})
             .replace();
         })
-        .error(function(response) {
+        .error(function(_response) {
           $alert.danger({
             bullets: [
              "The agent is not accessible",

http://git-wip-us.apache.org/repos/asf/mesos/blob/af8404e7/src/webui/master/static/js/jquery.pailer.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/jquery.pailer.js b/src/webui/master/static/js/jquery.pailer.js
index 6c68383..93ff04b 100644
--- a/src/webui/master/static/js/jquery.pailer.js
+++ b/src/webui/master/static/js/jquery.pailer.js
@@ -52,6 +52,8 @@
 //    });
 
 (function($) {
+  'use strict';
+
   // Helper for escaping html, based on _.escape from underscore.js.
   function escapeHTML(string) {
     if (string == null) {
@@ -85,8 +87,13 @@
     this_.paging = false;
     this_.tailing = true;
 
-    page_size || $.error('Expecting page_size to be defined');
-    truncate_length || $.error('Expecting truncate_length to be defined');
+    if (page_size) {
+        $.error('Expecting page_size to be defined')
+    }
+
+    if (truncate_length) {
+        $.error('Expecting truncate_length to be defined')
+    }
 
     this_.page_size = page_size;
     this_.truncate_length = truncate_length;
@@ -133,7 +140,7 @@
         this_.element.html('');
         setTimeout(function() { this_.tail(); }, 0);
       })
-      .fail(function(response, msg, code) {
+      .fail(function(response, _msg, _code) {
         if ([401, 403].indexOf(response.status) > -1) {
           // Unauthorized user.
           this_.indicate('YOU ARE UNAUTHORIZED TO ACCESS THIS CONTENT');

http://git-wip-us.apache.org/repos/asf/mesos/blob/af8404e7/src/webui/master/static/js/services.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/services.js b/src/webui/master/static/js/services.js
index 12d3b4b..5e83996 100644
--- a/src/webui/master/static/js/services.js
+++ b/src/webui/master/static/js/services.js
@@ -98,7 +98,7 @@
           ];
         }
 
-        var ModalCtrl = function($scope, $modalInstance) {
+        var ModalCtrl = function($scope, _$modalInstance) {
           $scope.title = title;
           $scope.message = message;
           $scope.buttons = buttons;
@@ -229,7 +229,7 @@
   };
 
   Top.prototype.parseResponse = function(response) {
-    var that = this;
+    var this_ = this;
     var monitor = {
       frameworks: {},
       statistics: new Statistics()
@@ -242,10 +242,10 @@
         Statistics.parseJSON(executor.statistics);
 
       // Compute CPU usage if possible.
-      if (that.scope.monitor &&
-          that.scope.monitor.frameworks[framework_id] &&
-          that.scope.monitor.frameworks[framework_id].executors[executor_id]) {
-        var previous = that.scope.monitor.frameworks[framework_id].executors[executor_id].statistics;
+      if (this_.scope.monitor &&
+          this_.scope.monitor.frameworks[framework_id] &&
+          this_.scope.monitor.frameworks[framework_id].executors[executor_id]) {
+        var previous = this_.scope.monitor.frameworks[framework_id].executors[executor_id].statistics;
         current.diffUsage(previous);
       }