Thank you Chris :)
I'd like to incorporate your ideas into upcoming PoC patch, which will be focused on
server-side components of UI plugin infrastructure:
1) servlet that serves plugin-related static resources (plugin host page, actual plugin
code, any 3rd party JavaScript libraries, CSS, etc.) from local filesystem
2) class responsible for parsing/validating/caching plugin descriptor information from
local filesystem
Regarding the comment in WebadminDynamicHostingServlet that says "FIXME: do we load
this everytime, or just once?": maybe we could use the same approach as in servlet
containers, which use 'date last modified' attribute of JSP files to trigger
recompilation of corresponding servlets. For example, each time WebAdmin host page gets
requested through WebadminDynamicHostingServlet, we could iterate over plugin descriptor
files (in /usr/share/ovirt-engine/ui-plugins), looking at 'date last modified'
attribute, parsing/validating plugin meta-data, and caching it using pluginName +
dateLastModified (compound cache key). We also need to synchronize the access to plugin
meta-data. What do you think?
After the upcoming PoC patch (focused on server-side components) gets released, UI plugin
infrastructure should be pretty much stable and we can focus on adding particular
features, such as:
* adding custom sub-tabs
* adding custom context-menu items
* making REST API calls through plugin API
* investigating cross-origin plugin scenario (plugin gets loaded from page sitting on
different origin than Engine JBoss instance)
Let me know what you think.
Cheers,
Vojtech
----- Original Message -----
From: "Chris Frantz" <Chris.Frantz(a)hp.com>
To: "Vojtech Szocs" <vszocs(a)redhat.com>
Cc: "engine-devel" <engine-devel(a)ovirt.org>
Sent: Thursday, August 30, 2012 10:03:02 PM
Subject: RE: UI Plugins configuration
Vojtech,
Here is my patch against WIP-UI-Plugins-PoC-revision-4. I’ve also included 2 dummy plugins
in sample.tar.gz.
--Chris
From: engine-devel-bounces(a)ovirt.org [mailto:engine-devel-bounces@ovirt.org] On Behalf Of
Frantz, Chris
Sent: Thursday, August 30, 2012 1:06 PM
To: Vojtech Szocs
Cc: engine-devel
Subject: Re: [Engine-devel] UI Plugins configuration
Vojtech,
I agree with your formalized names:
Plugin Descriptor is the JSON file containing plugin meta-data. The plugin descriptor may
also contain the default configuration data. It is located in $DATADIR/ui-plugins.
Plugin Configuration is the JSON file containing optional plugin configuration info. It is
located in $CONFIGDIR/ui-plugins (unless the Plugin Descriptor contains an absolute path).
Plugin Definition is the JavaScript object used by WebAdmin. In the current
implementation, the Plugin Definition contains both the Plugin Descriptor and the Plugin
Configuraion.
Plugin Source Page is the HTML page used to invoke the plugin code and shall be referenced
by the plugin descriptor’s “url” attribute.
I’ve implemented the config merging you’ve suggested: the structure in configFile gets
merged with the structure of “config”, with the data in configFile winning in the case of
duplicate key names.
BTW, the patch is against ovirt-engine + 0001-WIP-UI-Plugins-PoC-revision-2.
Let me know what you think,
--Chris