You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by doanduyhai <gi...@git.apache.org> on 2016/02/23 16:16:51 UTC

[GitHub] incubator-zeppelin pull request: [ZEPPELIN-695] Add AngularJS z.ru...

GitHub user doanduyhai opened a pull request:

    https://github.com/apache/incubator-zeppelin/pull/742

    [ZEPPELIN-695] Add AngularJS z.runParagraph()

    ### What is this PR for?
    Add AngularJS `z.runParagraph()` and `z.runParagraphs()` methods
    
    @corneadoug 
    On the client-side, inside the scope of a paragraph, we cannot access to the list of all existing paragraphs for the current note. In my previous implementation, I was using the following trick:
    
    ```
    var paragraphDiv = angular.element('#' + paragraphId +
                                    '_paragraphColumn_main[ng-controller="ParagraphCtrl"]');
    
    var paragraph = paragraphDiv.scope().paragraph;
    ```
    
    This is **dirty** and can be broken if we change the CSS style tomorrow for paragraph.
    
    For the current implementation, what I did is to **inject** a reference to the `note` object into the `$scope` of paragraph so that we can access the current list of paragraph **programmatically**: 
    
    ```javascript
            $scope.$broadcast('updateParagraph', {
              note: $scope.note, // pass the note object to paragraph scope
              paragraph: note.paragraphs[index]});
    ```
    
    _This is a sub-task of epic **[ZEPPELIN-635]**_
    
    ### What type of PR is it?
    [Improvement### Todos
    * [ ] - Code Review
    * [ ] - Simple Test
    
    ### Is there a relevant Jira issue?
    **[ZEPPELIN-695]**
    
    ### How should this be tested?
    * Create a new note
    * In the first paragraph, put the following code
    
    ```html
    %angular
    
    <form class="form-inline">
      <div class="form-group">
        <label for="paragraphId">Paragraph Id: </label>
        <input type="text" class="form-control" id="paragraphId" placeholder="Paragraph Id ..." ng-model="paragraph"></input>
      </div>
      <button type="submit" class="btn btn-primary" ng-click="z.runParagraph(paragraph)"> Run Paragraph</button>
    </form>
    ```
    * Create a second paragraph with the following code:
    
    ```scala
    z.getInterpreterContext().getParagraphId()
    println("Date "+new java.util.Date().toString)
    ```
    * Execute the second paragraph to retrieve its paragraph id
    * In the first paragraph, put the paragraph id in the input text and click on the **Run Paragraph** button, it should trigger execution of the second paragraph
    
    ### Screenshots (if appropriate)
    ![angularrunparagraph](https://cloud.githubusercontent.com/assets/1532977/13255885/8ff5c604-da48-11e5-9e1c-3216074fbb17.gif)
    
    ### Questions:
    * Does the licenses files need update? --> **No**
    * Is there breaking changes for older versions? --> **No**
    * Does this needs documentation? --> **Yes**
    
    [ZEPPELIN-635]: https://issues.apache.org/jira/browse/ZEPPELIN-635
    [ZEPPELIN-695]: https://issues.apache.org/jira/browse/ZEPPELIN-695

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/doanduyhai/incubator-zeppelin ZEPPELIN-695

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-zeppelin/pull/742.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #742
    
----
commit b6501c77d9eb63a91e4a772acf6703603f9751a5
Author: DuyHai DOAN <do...@gmail.com>
Date:   2016-02-23T10:11:40Z

    [ZEPPELIN-689] Add Thrift RPC method angularRegistryPush()

commit a4b5f7c3a56e96271328f05e436e6b60b3017262
Author: DuyHai DOAN <do...@gmail.com>
Date:   2016-02-22T16:45:34Z

    [ZEPPELIN-689] Make AngularObject constructor public because of serialization issue

commit 5746cb73452f139d18df02bf310f3b622dbe20c5
Author: DuyHai DOAN <do...@gmail.com>
Date:   2016-02-22T22:28:11Z

    [ZEPPELIN-689] ZeppelinContext angular() method should look for variable using the paragraph scope then note scope

commit b78d12db1b5d80bdca8d5c146c77c4f4f9ec9758
Author: DuyHai DOAN <do...@gmail.com>
Date:   2016-02-23T10:01:31Z

    [ZEPPELIN-689] Implement z.angularBind() function

commit f0f6f89d34a3ad123ded30179f182bf6fdb1e35b
Author: DuyHai DOAN <do...@gmail.com>
Date:   2016-02-23T14:20:46Z

    [ZEPPELIN-693] Add AngularJS z.angularUnbind()

commit c3a857a3d8379188c65e41edf013ebb3b826bb49
Author: DuyHai DOAN <do...@gmail.com>
Date:   2016-02-23T15:07:36Z

    [ZEPPELIN-695] Add AngularJS z.runParagraph()

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-zeppelin pull request: [ZEPPELIN-695] Add AngularJS z.ru...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-zeppelin/pull/742


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-zeppelin pull request: [ZEPPELIN-695] Add AngularJS z.ru...

Posted by doanduyhai <gi...@git.apache.org>.
Github user doanduyhai commented on the pull request:

    https://github.com/apache/incubator-zeppelin/pull/742#issuecomment-200391701
  
    @Leemoonsoo 
    
     Just rebased from master, can be merged quickly, only JS code change


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-zeppelin pull request: [ZEPPELIN-695] Add AngularJS z.ru...

Posted by doanduyhai <gi...@git.apache.org>.
Github user doanduyhai commented on the pull request:

    https://github.com/apache/incubator-zeppelin/pull/742#issuecomment-201580195
  
    @Leemoonsoo  Done, I have added `ZeppelinIT.testAngularRunParagraph()`. The PR can be merged if no more remark/question


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-zeppelin pull request: [ZEPPELIN-695] Add AngularJS z.ru...

Posted by doanduyhai <gi...@git.apache.org>.
Github user doanduyhai commented on the pull request:

    https://github.com/apache/incubator-zeppelin/pull/742#issuecomment-201930893
  
    @deepakas as soon as this PR will be merged, you can start playing with it by building the master yourself


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-zeppelin pull request: [ZEPPELIN-695] Add AngularJS z.ru...

Posted by doanduyhai <gi...@git.apache.org>.
Github user doanduyhai commented on the pull request:

    https://github.com/apache/incubator-zeppelin/pull/742#issuecomment-198716831
  
    @Leemoonsoo 
    
    This PR too is straight forward, only JS changes


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-zeppelin pull request: [ZEPPELIN-695] Add AngularJS z.ru...

Posted by deepakas <gi...@git.apache.org>.
Github user deepakas commented on the pull request:

    https://github.com/apache/incubator-zeppelin/pull/742#issuecomment-201929498
  
    Is this feature going to available in 0.6 snapshot soon. I am using the click button example  from the doc and z.run("20160326-184416_217725826" ) in click function. But for some reason the click works only once. 
    
    https://zeppelin.incubator.apache.org/docs/0.6.0-incubating-SNAPSHOT/displaysystem/angular.html
    
    My code is here. https://github.com/deepakas/zeppelin-gallery/tree/master/wikigraphvis/notebook


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-zeppelin pull request: [ZEPPELIN-695] Add AngularJS z.ru...

Posted by Leemoonsoo <gi...@git.apache.org>.
Github user Leemoonsoo commented on the pull request:

    https://github.com/apache/incubator-zeppelin/pull/742#issuecomment-200434942
  
    Tested and working well. 
    
    Do you mind add a test? 
    Like existing test for angular display system https://github.com/apache/incubator-zeppelin/blob/master/zeppelin-server/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java#L71. to make sure future front-end change doesn't break this new API.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-zeppelin pull request: [ZEPPELIN-695] Add AngularJS z.ru...

Posted by Leemoonsoo <gi...@git.apache.org>.
Github user Leemoonsoo commented on the pull request:

    https://github.com/apache/incubator-zeppelin/pull/742#issuecomment-201618592
  
    @doanduyhai Great. LGTM and merge if there're no more discussions.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---