[ZEPPELIN-2202] Disable personalized mode btn when note is running (branch-0.7)

### What is this PR for?

Disable the personalized mode button when a note is running.

- The same fix with https://github.com/apache/zeppelin/pull/2108 for branch-0.7
- CI failure might be related with https://github.com/apache/zeppelin/pull/2103

### What type of PR is it?
[Improvement]

### Todos

NONE

### What is the Jira issue?

[ZEPPELIN-2202](https://issues.apache.org/jira/browse/ZEPPELIN-2202)

### How should this be tested?

Refer the screenshot below.

### Screenshots (if appropriate)

![2202](https://cloud.githubusercontent.com/assets/4968473/23661339/c45dcd9e-038f-11e7-9551-6cde925aa5f4.gif)

### Questions:
* Does the licenses files need update? - NO
* Is there breaking changes for older versions? - NO
* Does this needs documentation? - NO

Author: 1ambda <1am...@gmail.com>

Closes #2115 from 1ambda/disable-person-mode-btn-when-note-is-running-for-070 
and squashes the following commits:

5e0f0b0 [1ambda] feat: disable person mode btn when running


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

Branch: refs/heads/branch-0.7
Commit: a90004b272f6e7c13571cf6ffee6793c295729b8
Parents: aca96c3
Author: 1ambda <1am...@gmail.com>
Authored: Thu Mar 9 18:11:14 2017 +0900
Committer: Jongyoul Lee <jongy...@apache.org>
Committed: Tue Mar 14 11:51:16 2017 +0900

----------------------------------------------------------------------
 zeppelin-web/src/app/notebook/notebook-actionBar.html | 2 ++
 zeppelin-web/src/app/notebook/notebook.controller.js  | 9 ++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a90004b2/zeppelin-web/src/app/notebook/notebook-actionBar.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/notebook-actionBar.html 
b/zeppelin-web/src/app/notebook/notebook-actionBar.html
index 99d7d7a..7fa6d74 100644
--- a/zeppelin-web/src/app/notebook/notebook-actionBar.html
+++ b/zeppelin-web/src/app/notebook/notebook-actionBar.html
@@ -74,6 +74,7 @@ limitations under the License.
 
       <button type="button"
               class="btn btn-primary btn-xs"
+              ng-class="isNoteRunning() ? 'disabled' : ''"
               ng-if="ticket.principal && ticket.principal !== 'anonymous'"
               ng-hide="viewOnly || note.config.personalizedMode !== 'true'"
               ng-click="toggleNotePersonalizedMode()"
@@ -83,6 +84,7 @@ limitations under the License.
       </button>
       <button type="button"
               class="btn btn-default btn-xs"
+              ng-class="isNoteRunning() ? 'disabled' : ''"
               ng-if="ticket.principal && ticket.principal !== 'anonymous'"
               ng-hide="viewOnly || note.config.personalizedMode === 'true'"
               ng-click="toggleNotePersonalizedMode()"

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a90004b2/zeppelin-web/src/app/notebook/notebook.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js 
b/zeppelin-web/src/app/notebook/notebook.controller.js
index 63a0130..9f27d7d 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.js
@@ -358,15 +358,14 @@ function NotebookCtrl($scope, $route, $routeParams, 
$location, $rootScope,
   };
 
   $scope.isNoteRunning = function() {
-    var running = false;
     if (!$scope.note) { return false; }
     for (var i = 0; i < $scope.note.paragraphs.length; i++) {
-      if ($scope.note.paragraphs[i].status === 'PENDING' || 
$scope.note.paragraphs[i].status === 'RUNNING') {
-        running = true;
-        break;
+      const status = $scope.note.paragraphs[i].status;
+      if (status === 'PENDING' || status === 'RUNNING') {
+        return true;
       }
     }
-    return running;
+    return false;
   };
 
   $scope.killSaveTimer = function() {

Reply via email to