You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2017/01/01 14:50:05 UTC

zeppelin git commit: [ ZEPPELIN-531 ] execute and stop note in job menu

Repository: zeppelin
Updated Branches:
  refs/heads/master 1980240fe -> f86f0ec3e


[ ZEPPELIN-531 ] execute and stop note in job menu

### What is this PR for?
We can note start and stop in job menu.

### What type of PR is it?
Improvement

### Todos
- [x] - add feature for run/stop

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-968

### How should this be tested?
Click to a note start or stop button in job menu.

### Screenshots (if appropriate)
![executenote](https://cloud.githubusercontent.com/assets/10525473/20823821/ec8a39c8-b89a-11e6-91f2-0eddc4bcffd9.gif)

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

Author: CloverHearts <cl...@gmail.com>
Author: cloverhearts <cl...@gmail.com>

Closes #1716 from cloverhearts/jobm/executeNote and squashes the following commits:

b12d61f [cloverhearts] Merge branch 'master' into jobm/executeNote
a71ae16 [CloverHearts] Merge branch 'master' into jobm/executeNote
f00b738 [CloverHearts] Merge branch 'master' into jobm/executeNote
b6fb381 [CloverHearts] change string check style
e00f9ce [CloverHearts] apply code style
b7f2051 [CloverHearts] remove whitespace
24d7ced [CloverHearts] Merge branch 'master' into jobm/executeNote
d3bd76e [CloverHearts] change `if` syntanx style
f40b12f [CloverHearts] Merge branch 'master' into jobm/executeNote
23abb3a [CloverHearts] execute and stop note in job menu


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

Branch: refs/heads/master
Commit: f86f0ec3ec0bcfe220df2c68abadb76da2cf78cc
Parents: 1980240
Author: CloverHearts <cl...@gmail.com>
Authored: Wed Dec 28 21:41:30 2016 -0800
Committer: Lee moon soo <mo...@apache.org>
Committed: Sun Jan 1 06:50:00 2017 -0800

----------------------------------------------------------------------
 .../src/app/jobmanager/jobs/job-control.html    | 21 ++++--
 .../src/app/jobmanager/jobs/job.controller.js   | 67 +++++++++++++++++++-
 2 files changed, 81 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/f86f0ec3/zeppelin-web/src/app/jobmanager/jobs/job-control.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/jobmanager/jobs/job-control.html b/zeppelin-web/src/app/jobmanager/jobs/job-control.html
index e800521..8c9edb7 100644
--- a/zeppelin-web/src/app/jobmanager/jobs/job-control.html
+++ b/zeppelin-web/src/app/jobmanager/jobs/job-control.html
@@ -17,15 +17,26 @@ limitations under the License.
     {{lastExecuteTime(notebookJob.unixTimeLastRun)}}
   </span>
   <span>
-    <span ng-if="notebookJob.isRunningJob === true">
-      Note is RUNNING
+    <span ng-if="notebookJob.isRunningJob">
+      RUNNING
     </span>
-    <span ng-if="notebookJob.isRunningJob === false">
-      Note is READY
+    <span ng-if="!notebookJob.isRunningJob">
+      READY
     </span>
   </span>
 
-  <span ng-if="notebookJob.isRunningJob === true">
+  <span ng-if="notebookJob.isRunningJob">
     {{getProgress()}}%
   </span>
+  <!-- Run / Cancel button -->
+  <span
+    ng-if="!notebookJob.isRunningJob"
+    class="icon-control-play" style="cursor:pointer;color:#3071A9" tooltip-placement="left" tooltip="START ALL Job"
+    ng-click="runNotebookJob(notebookJob.noteId)">
+  </span>
+  <span
+    ng-if="notebookJob.isRunningJob"
+    class="icon-control-pause" style="cursor:pointer;color:#3071A9" tooltip-placement="left" tooltip="STOP ALL Job"
+    ng-click="stopNotebookJob(notebookJob.noteId)">
+  </span>
 </div>

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/f86f0ec3/zeppelin-web/src/app/jobmanager/jobs/job.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/jobmanager/jobs/job.controller.js b/zeppelin-web/src/app/jobmanager/jobs/job.controller.js
index 55f7cb3..c2155ab 100644
--- a/zeppelin-web/src/app/jobmanager/jobs/job.controller.js
+++ b/zeppelin-web/src/app/jobmanager/jobs/job.controller.js
@@ -15,9 +15,9 @@
 
   angular.module('zeppelinWebApp').controller('JobCtrl', JobCtrl);
 
-  JobCtrl.$inject = ['$scope'];
+  JobCtrl.$inject = ['$scope', '$http', 'baseUrlSrv'];
 
-  function JobCtrl($scope) {
+  function JobCtrl($scope, $http, baseUrlSrv) {
     $scope.init = function(jobInformation) {
       $scope.progressValue = 0;
     };
@@ -37,6 +37,69 @@
       return isNaN(result) ? 0 : result;
     };
 
+    $scope.runNotebookJob = function(notebookId) {
+      BootstrapDialog.confirm({
+        closable: true,
+        title: '',
+        message: 'Run all paragraphs?',
+        callback: function(result) {
+          if (result) {
+            $http({
+              method: 'POST',
+              url: baseUrlSrv.getRestApiBase() + '/notebook/job/' + notebookId,
+              headers: {
+                'Content-Type': 'application/x-www-form-urlencoded'
+              }
+            }).then(function successCallback(response) {
+              // success
+            }, function errorCallback(errorResponse) {
+              var errorText = 'SERVER ERROR';
+              if (!!errorResponse.data.message) {
+                errorText = errorResponse.data.message;
+              }
+              BootstrapDialog.alert({
+                closable: true,
+                title: 'Execution Failure',
+                message: errorText
+              });
+            });
+          }
+        }
+      });
+    };
+
+    $scope.stopNotebookJob = function(notebookId) {
+      BootstrapDialog.confirm({
+        closable: true,
+        title: '',
+        message: 'Stop all paragraphs?',
+        callback: function(result) {
+          if (result) {
+            $http({
+              method: 'DELETE',
+              url: baseUrlSrv.getRestApiBase() + '/notebook/job/' + notebookId,
+              headers: {
+                'Content-Type': 'application/x-www-form-urlencoded'
+              }
+            }).then(function successCallback(response) {
+              // success
+            }, function errorCallback(errorResponse) {
+              var errorText = 'SERVER ERROR';
+              if (!!errorResponse.data.message) {
+
+                errorText = errorResponse.data.message;
+              }
+              BootstrapDialog.alert({
+                closable: true,
+                title: 'Stop Failure',
+                message: errorText
+              });
+            });
+          }
+        }
+      });
+    };
+
     $scope.lastExecuteTime = function(unixtime) {
       return moment.unix(unixtime / 1000).fromNow();
     };