Repository: zeppelin
Updated Branches:
  refs/heads/master dcf2c7a2c -> 36e5f6b08


[ZEPPELIN-2215] Progress bar for Spell execution

### What is this PR for?

Add progress bar for spell execution.

- Used `RUNNING` state to display progress bar
- Decided not to display `{number}%` for spell, since we can't calculate in 
advance.

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

### Todos

NONE

### What is the Jira issue?

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

### How should this be tested?

- Install any spell what you want. However, I suggest 
[zeppelin-echo-spell1.0.6](https://www.npmjs.com/package/zeppelin-echo-spell) 
because it allow you to [get delayed 
result](https://github.com/1ambda/zeppelin-echo-spell/blob/master/index.js#L23-#L25)
 (default delay is 1000 millisecond.)
- Execute the spell

### Screenshots (if appropriate)

![2215](https://cloud.githubusercontent.com/assets/4968473/23655669/4f514424-0379-11e7-8557-8b8d24521a7e.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 #2105 from 1ambda/ZEPPELIN-2215/progress-bar-for-spell and squashes the 
following commits:

e913eff [1ambda] fix: Remove duplicated line
79e63d4 [1ambda] feat: Don't display '%' for spell'


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

Branch: refs/heads/master
Commit: 36e5f6b08c8e8d61671a998415c6313e06148845
Parents: dcf2c7a
Author: 1ambda <1am...@gmail.com>
Authored: Thu Mar 16 10:33:19 2017 +0900
Committer: ahyoungryu <ahyoung...@apache.org>
Committed: Fri Mar 17 13:22:07 2017 +0900

----------------------------------------------------------------------
 .../src/app/notebook/paragraph/paragraph-control.html     |  2 +-
 .../src/app/notebook/paragraph/paragraph.controller.js    | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/36e5f6b0/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html 
b/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html
index 1411725..f81ccee 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html
@@ -38,7 +38,7 @@ limitations under the License.
     {{paragraph.status}}
   </span>
 
-  <span ng-if="paragraph.status=='RUNNING'">
+  <span ng-if="paragraph.status === 'RUNNING' && paragraph.executor !== 
'SPELL'">
     {{getProgress()}}%
   </span>
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/36e5f6b0/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js 
b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
index 0f752fe..75d565b 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -17,6 +17,12 @@ import {
   ParagraphStatus, isParagraphRunning,
 } from './paragraph.status';
 
+const ParagraphExecutor = {
+  SPELL: 'SPELL',
+  INTERPRETER: 'INTERPRETER',
+  NONE: '', /** meaning `DONE` */
+};
+
 angular.module('zeppelinWebApp').controller('ParagraphCtrl', ParagraphCtrl);
 
 function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, 
$location,
@@ -277,6 +283,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, 
$routeParams, $locat
 
   $scope.cleanupSpellTransaction = function() {
     const status = ParagraphStatus.FINISHED;
+    $scope.paragraph.executor = ParagraphExecutor.NONE;
     $scope.paragraph.status = status;
     $scope.paragraph.results.code = status;
 
@@ -295,8 +302,9 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, 
$routeParams, $locat
 
   $scope.runParagraphUsingSpell = function(paragraphText,
                                            magic, digestRequired, propagated) {
+    $scope.paragraph.status = 'RUNNING';
+    $scope.paragraph.executor = ParagraphExecutor.SPELL;
     $scope.paragraph.results = {};
-    $scope.paragraph.status = ParagraphStatus.RUNNING;
     $scope.paragraph.errorMessage = '';
     if (digestRequired) { $scope.$digest(); }
 

Reply via email to