Hi Vojtech,
This is great!
Would you be interested in writing this up as a tutorial series (working
through a real-life example) for publication on the oVirt website? I
think it's the kind of article which would be very useful in promoting
the plug-in API.
Cheers,
Dave.
On 11/19/2012 03:49 PM, Vojtech Szocs wrote:
Hi guys,
this is a follow-up on the quick "crash course" for writing simple UI plugin.
Before we proceed, please keep in mind that:
- api.register() must be called exactly once, subsequent calls "overwrite"
previous ones
- api.register() must be called before api.ready(), otherwise your plugin will not work
- you don't have to define all supported event handler functions in api.register(),
just the ones your plugin is interested in (e.g. UiInit)
Level 4 - Let's make things configurable
========================================
1. Specify default plugin configuration (optional)
$ vim /usr/share/ovirt-engine/ui-plugins/hello-ui-world.json
[hello-ui-world.json]
...
"config": { "testLink": "http://www.example.com/" }
...
[/hello-ui-world.json]
2. Override default plugin configuration (optional)
$ mkdir -p /etc/ovirt-engine/ui-plugins
$ vim /etc/ovirt-engine/ui-plugins/hello-ui-world-config.json
[hello-ui-world-config.json]
{
"config": { "testLink":
"http://www.another-example.com/" }
}
[/hello-ui-world-config.json]
3. Use plugin configuration that has been merged together
$ vim /usr/share/ovirt-engine/ui-plugins/hello-world-files/start.html
[start.html]
...
# Anywhere within event handler function code (e.g. UiInit)
var conf = api.configObject();
api.showDialog('Test Dialog', conf.testLink, 600, 400);
...
[/start.html]
Regards,
Vojtech
_______________________________________________
Engine-devel mailing list
Engine-devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-devel
--
Dave Neary - Community Action and Impact
Open Source and Standards, Red Hat -
http://community.redhat.com
Ph: +33 9 50 71 55 62 / Cell: +33 6 77 01 92 13