[Engine-devel] oVirt UI Plugins feature: Ready for review

Costea, George George.Costea at netapp.com
Mon Jun 25 19:11:33 UTC 2012


Thanks Vojtech.

Since the plugins are embedded into the WebAdmin HTML page, that seems to simplify things; no external web service is needed.  This approach ties into the issue over the freedom to decide which technology to use when developing a plugin.  While I agree that jQuery is best for simple dialogs, a wizard-driven workflow is easier to develop in GWT.  

For example, if I want to step a user through the process of creating a new storage domain I would like to provide a workflow to select a storage array, provide credentials, and configure the details of the NFS export.  This workflow could presumably have a GWT-RPC mechanism that relies on some additional libraries on the backend (libraries that allow me to communicate with the storage array).  Using the GWT-Exporter, I could export the classes that would display the workflow which would then get launched as my extension is selected.  You said that I would have my oVirt UI plugin depend on my compiled 'plugin support application'.  My compiled plugin support application would normally be a war file containing my compiled GWT code and a web-inf folder containing my libraries.  Is the plugin depending on the war file?  Is that what I specify?

-George

-----Original Message-----
From: Vojtech Szocs [mailto:vszocs at redhat.com] 
Sent: Monday, June 25, 2012 1:12 PM
To: Costea, George; engine-devel at ovirt.org
Cc: Schoenbrun, Dustin; Hopper, Ricky; Itamar Heim
Subject: Re: oVirt UI Plugins feature: Ready for review

Hi George,

thanks for your feedback. Please find my answers below.


> 1) Are the plugins hosted by the same jboss server that hosts the engine?  It would appear the answer is yes and that no separate container is required for the plugins.

In short, yes.

Plugins, along with their configuration and 3rd party dependencies, are meant to be embedded into final WebAdmin HTML page, see [http://www.ovirt.org/wiki/Features/UIPlugins#Plugin_lifecycle] step #5. 
JBoss AS instance serves WebAdmin HTML page (WebadminDynamicHostingServlet), along with providing GWT RPC and REST endpoints that delegate to Engine business logic through EJB BackendLocal interface.

However, plugins are not 'hosted' in a typical sense - WebadminDynamicHostingServlet reads and embeds all plugin data directly into final WebAdmin HTML page.


> 2) Does each plugin map to a unique extension within WebAdmin?  Your example shows that I can extend the VM table to have a "Show VM name and edit VM" context-sensitive extension.  This is named pluginApi.plugins.myPlugin.  Can I safely assume that this is per extension?  I would have pluginApi.plugins.myPlugin2 for extending a storage domain?

Extension points are represented by application events, triggered by WebAdmin and consumed by plugins. For example, 'tableContextMenu' event gets triggered when a table context menu is about to be shown to the user, which gives plugins the ability to do something custom with the context menu before it's shown.

There can be multiple plugins handling the same event (extension point). You can have two plugins, say 'pluginApi.plugins.One' and 'pluginApi.plugins.Two', each providing 'tableContextMenu' function for handling the above mentioned event. WebAdmin will invoke all plugins for the given event.

To answer your question, in order to handle X events (extension points), you don't need to write X plugins. You can write one plugin that handles X events.


> 3) Instead of launching a jQuery dialog, can I point to a compiled GWT html file to display a dialog that fits my needs?

You can do anything you want in your plugin event handler function. Show a jQuery UI dialog, make oVirt REST API request, call arbitrary remote server using cross-domain technique like JSONP [1] or CORS [2], etc. Plugin authors are free to decide if they want to rely on 3rd party JavaScript libraries, or if they want to write entire plugin code by themselves.

In my opinion, tools like jQuery are far more elegant for handling simple things such as UI dialogs. But if you really want to use GWT for this purpose, I suggest following approach:

a, develop a 'plugin support application' in GWT, which implements the necessary dialog functionality b, export its main (e.g. dialog handling) classes for use in native JavaScript through gwt-exporter [3] c, have your oVirt UI plugin depend on your compiled 'plugin support application' (this will cause your 'plugin support application' to be called during WebAdmin startup) d, in your oVirt UI plugin, invoke 'plugin support application' functionality through exported classes (plugin -> GWT delegate pattern)


> 4) Is session info passed into the plugin so that I can invoke APIs into the engine?  To power on a VM for instance?  Or to mount a new NFS storage domain?

Yes, this should be part of [http://www.ovirt.org/wiki/Features/UIPlugins#Global_API_functions] "Plugin utility functions" (global API).

Your plugin might access user session information in the following way: pluginApi.util().userInfo().* (replace * with id(), name(), domain(), etc.)

As you pointed out, this could be used to authenticate oVirt REST API requests made from your plugin code.


> BTW, the link to the original design notes on the wiki doesn't work.

This is strange, [http://rhevmf.pad.engineering.redhat.com/68] has its visibility set to "Public (Allow Internet guests)" ... Does anybody know why this doesn't work?


Vojtech


[1] http://en.wikipedia.org/wiki/JSONP
[2] http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
[3] http://code.google.com/p/gwt-exporter/


----- Original Message -----
From: "George Costea" <George.Costea at netapp.com>
To: "Vojtech Szocs" <vszocs at redhat.com>, engine-devel at ovirt.org
Cc: "Dustin Schoenbrun" <Dustin.Schoenbrun at netapp.com>, "Ricky Hopper" <Ricky.Hopper at netapp.com>
Sent: Monday, June 25, 2012 3:09:43 PM
Subject: RE: oVirt UI Plugins feature: Ready for review

Hi Vojtech,

I have a few questions on this feature.

1) Are the plugins hosted by the same jboss server that hosts the engine?  It would appear the answer is yes and that no separate container is required for the plugins.
2) Does each plugin map to a unique extension within WebAdmin?  Your example shows that I can extend the VM table to have a "Show VM name and edit VM" context-sensitive extension.  This is named pluginApi.plugins.myPlugin.  Can I safely assume that this is per extension?  I would have pluginApi.plugins.myPlugin2 for extending a storage domain?
3) Instead of launching a jQuery dialog, can I point to a compiled GWT html file to display a dialog that fits my needs?
4) Is session info passed into the plugin so that I can invoke APIs into the engine?  To power on a VM for instance?  Or to mount a new NFS storage domain?

BTW, the link to the original design notes on the wiki doesn't work.

Thanks,
George

-----Original Message-----
From: Vojtech Szocs [mailto:vszocs at redhat.com]
Sent: Thursday, June 21, 2012 11:03 AM
To: engine-devel at ovirt.org
Cc: Schoenbrun, Dustin; Costea, George; Hopper, Ricky
Subject: oVirt UI Plugins feature: Ready for review

Hi guys,

I wrote a wiki page describing UI Plugins, a feature planned for oVirt web administration (WebAdmin) application:
http://www.ovirt.org/wiki/Features/UIPlugins

Feature design is finished and ready for review. Please feel free to add comments, ask questions or reach me directly on #ovirt channel.

Cheers,
Vojtech


More information about the Devel mailing list