Skip to content

Utilities for Angular Display system#591

Closed
Leemoonsoo wants to merge 13 commits into
apache:masterfrom
Leemoonsoo:display_utils
Closed

Utilities for Angular Display system#591
Leemoonsoo wants to merge 13 commits into
apache:masterfrom
Leemoonsoo:display_utils

Conversation

@Leemoonsoo
Copy link
Copy Markdown
Member

What is this PR for?

Angular display system provides way to Interpreter interact with front-end.

However, the api was pretty much low level and not very much intuitive, it was difficult to make readable code. This PR provides simple intuitive API for using angular display system by leveraging scala.xml. Following is usage

Import

// notebook scope
import org.apache.zeppelin.display.angular.notebookscope._
import AngularElem._

or

// paragraph scope
import org.apache.zeppelin.display.angular.paragraphscope._
import AngularElem._

Display element

// automatically convert to string and print with %angular display system directive in front.
<div><div>.display

Event handler

// on click
<div></div>.onClick(() => {
   my callback routine
}).display

// on change
<div></div>.onChange(() => {
  my callback routine
}).display

// arbitrary event
<div></div>.onEvent("ng-click", () => {
  my callback routine
}).display

Bind model

// bind model
<div></div>.model("myModel").display

// bind model with initial value
<div></div>.model("myModel", initialValue).display 

Interact with model

// read model
AngularModel("myModel")()

// update model
AngularModel("myModel", "newValue")

What type of PR is it?

Feature

Todos

Is there a relevant Jira issue?

How should this be tested?

See usage and screenshot

Screenshots (if appropriate)

Example of basic usage
image

Example of string converter
display_util

Questions:

  • Does the licenses files need update? no
  • Is there breaking changes for older versions? no
  • Does this needs documentation? documentation will follow

@Leemoonsoo Leemoonsoo force-pushed the display_utils branch 2 times, most recently from 5ed4ffa to e0ce18f Compare January 3, 2016 04:45
@Leemoonsoo
Copy link
Copy Markdown
Member Author

Please review this PR

Comment thread zeppelin-display/pom.xml
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be from the parent pom?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zeppelin submodule can have different scala.version dependency, especially for interpreter. While one interpreter uses scala 2.10, the other uses scala 2.11. So i think it's better not having scala.version in root pom file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it makes sense. Wouldn't the display module running in the Spark interpreter process and would need to match scala build to work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, If there're interpreter that uses scala 2.11 for example, then display module may add support for scala 2.11.

@felixcheung
Copy link
Copy Markdown
Member

looks good, could you follow up with updating the doc http://zeppelin.incubator.apache.org/docs/0.6.0-incubating-SNAPSHOT/displaysystem/angular.html or similar?

@doanduyhai
Copy link
Copy Markdown
Contributor

@Leemoonsoo Can you provide a screen capture/code sample to show how we can use those utilities function to update an Angular object server-side from the front-end ?

My intention is to have a paragraph with %angular interpreter that "pushes" a value to the angular object repository server-side and to be re-used by another interpreter in another paragraph. Example:

-------- paragraph1 --------
%angular

//Some manual Bootstrap form
Login : <input onClick="pushToBackEnd('login')">....</input> ...

-------- paragraph2 --------
%cassandra

SELECT * FROM users WHERE login={{login}};

The pushToBackEnd() method will be responsible for that feature.

Can this PR meet the feature above ?

@Leemoonsoo
Copy link
Copy Markdown
Member Author

@doanduyhai The examples in this PR's description can be run on %spark interpreter.
Currently, push new angular object from front-end is not possible. I think that's useful feature to have and can be handled in the different PR, while this PR trying to provide some convenient utility function for existing angular object.

@doanduyhai
Copy link
Copy Markdown
Contributor

Thanks for the clarifications @Leemoonsoo. I'll try to push a small PR for the front-end angular value push

@Leemoonsoo
Copy link
Copy Markdown
Member Author

I've made small change after #588 merged.
Now it provides two packages org.apache.zeppelin.display.angular.notebookscope and org.apache.zeppelin.display.angular.paragraphscope. One work in notebook scope and the other work in paragraph scope.

Usage now slightly changed, when import these utilities.

When you want to work in notebook scope

import org.apache.zeppelin.display.angular.notebookscope._
import AngularElem._

When you want to work in paragraph scope

import org.apache.zeppelin.display.angular.paragraphscope._
import AngularElem._

@corneadoug
Copy link
Copy Markdown
Contributor

#650 needs to be updated too then

@AhyoungRyu
Copy link
Copy Markdown
Contributor

#650 is updated.

@Leemoonsoo
Copy link
Copy Markdown
Member Author

Merge #591 and #650 if there're no more discussions.

@asfgit asfgit closed this in 602a1e7 Feb 1, 2016
asfgit pushed a commit that referenced this pull request Feb 1, 2016
### What is this PR for?
This PR is related #591 created by Leemoonsoo. I just added a section explaining the **Utilities for Angular Display System** to `docs/angular.md`.

### What type of PR is it?
Documentation

### Todos
* [x] - Add a section for explaining Utilities for Angular Display System to angular.md

### Is there a relevant Jira issue?
No. But there is a related PR:  #591 (and maybe #588)
### How should this be tested?
Just apply this PR and checkout the `Display System -> Angular` tab in Zeppelin web site.

### Screenshots (if appropriate)

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

Author: Ryu Ah young <fbdkdud93@hanmail.net>

Closes #650 from AhyoungRyu/display_utils_docs and squashes the following commits:

6923400 [Ryu Ah young] (Documentation): Add package import information
280b846 [Ryu Ah young] (Documentation): Fix some grammar errors in angular.md
13330d0 [Ryu Ah young] (Documentation): Fix some sentences
a7cf9ac [Ryu Ah young] (Documentation): Utilities for Angular Display System
asfgit pushed a commit that referenced this pull request Feb 1, 2016
### What is this PR for?
Master branch build failure after merging #655 #591

### What type of PR is it?
Hot Fix

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

Author: Lee moon soo <moon@apache.org>

Closes #680 from Leemoonsoo/ZEPPELIN-619_followup and squashes the following commits:

beac930 [Lee moon soo] Fix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants