Spell Helium plugin

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Spell Helium plugin

Marek Ganko

Hi,


I'm testing my Helium Spell plugin written in angular - I'm using Zeppelin from current master unreleased version.

How can I trigger my angular component from the Helium plugin?

I tried to attach my module like this:


    angular.module('zeppelinWebApp').requires.push('myPlugin');


and launch it in many different ways, but I didn't managed to actually run it.

I achieved to compile my component using angular and pass the result as a promise to SpellResult class, but it resolves as a string instead of html.


Thanks,

Marek

Reply | Threaded
Open this post in threaded view
|

Re: Spell Helium plugin

Park Hoon
Hi. Thanks for sharing your problem while using Spell.


Could you share the exact use case? 

On Mon, Jun 19, 2017 at 5:51 PM, Ganko, Marek (Nokia - PH/Quezon City) <[hidden email]> wrote:

Hi,


I'm testing my Helium Spell plugin written in angular - I'm using Zeppelin from current master unreleased version.

How can I trigger my angular component from the Helium plugin?

I tried to attach my module like this:


    angular.module('zeppelinWebApp').requires.push('myPlugin');


and launch it in many different ways, but I didn't managed to actually run it.

I achieved to compile my component using angular and pass the result as a promise to SpellResult class, but it resolves as a string instead of html.


Thanks,

Marek


Reply | Threaded
Open this post in threaded view
|

Odp.: Spell Helium plugin

Marek Ganko

Hi Park,


My general use case is to have possibility to export and import notes on my internal git repository (push and pull) as a main storage and authorization layer for further notes sharing. 

I wanted to explore the way to achieve that using Helium spell plugin so I created angular plugin which is listing the notes and runs git commit+push or git pull to import one.


This is my current piece of code to run it:

import {
SpellBase,
SpellResult,
DefaultDisplayType,
} from 'zeppelin-spell';


angular
.module('myModule', [])
.component('myComponent', {
template: `<div>It works!</div>`
});

angular.module('zeppelinWebApp').requires.push('myModule');

export default class MyPlugin extends SpellBase {
constructor() {
super('%myplugin');
}

interpret() {
const promise = new Promise(resolve => {
angular.injector(['ng', 'myModule']).invoke(($rootScope, $compile) => {
const element = $compile(`<my-component></my-component>`)($rootScope);
$rootScope.$digest();
resolve(element.html());
});
});

return new SpellResult(promise, DefaultDisplayType.HTML);
}
}
Thing is that type "DefaultDisplayType.HTML" is not properly handled for functions, objects and promises (it sets DefaultDisplayType.TEXT as a default one) 

I already fixed that in the zeppelin-spell/spell-result.js file - I will add a PR shortly.



Overall I think the best solution would be to either add possibility to share the notes between the users or add functionality to run your scripts on pre and post import/export actions.

I found one improvement requestwhich could be achieved using pre-import script: https://issues.apache.org/jira/browse/ZEPPELIN-1793

issues.apache.org
As a user doing data analytics in Notebook environment, I would like not to be locked up with a single notebook implementation. Right now, Apache Zeppelin has it's ...

Thanks,
Marek




Od: Park Hoon <[hidden email]>
Wysłane: 19 czerwca 2017 18:41:03
Do: [hidden email]
Temat: Re: Spell Helium plugin
 
Hi. Thanks for sharing your problem while using Spell.


Could you share the exact use case? 

On Mon, Jun 19, 2017 at 5:51 PM, Ganko, Marek (Nokia - PH/Quezon City) <[hidden email]> wrote:

Hi,


I'm testing my Helium Spell plugin written in angular - I'm using Zeppelin from current master unreleased version.

How can I trigger my angular component from the Helium plugin?

I tried to attach my module like this:


    angular.module('zeppelinWebApp').requires.push('myPlugin');


and launch it in many different ways, but I didn't managed to actually run it.

I achieved to compile my component using angular and pass the result as a promise to SpellResult class, but it resolves as a string instead of html.


Thanks,

Marek