[Engine-devel] UI plugins crash course part two (for plugin developers)

Vojtech Szocs vszocs at redhat.com
Mon Nov 19 14:49:38 UTC 2012


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




More information about the Devel mailing list