
On Sunday, February 25, 2018 1:11:08 AM EST Zip wrote:
Hi Alexander,
If I try the following:
<!DOCTYPE html> <html> <head> <script> var api = parent.pluginApi('HelloWorld'); api.register({ UiInit: function () { api.addMainTab('FooTab','xtab123','http://foo.com/'); } }); api.ready(); </script> </head> <body></body> </html>
I get the error in my browser console:
Sun Feb 25 00:03:56 GMT-600 2018 org.ovirt.engine.ui.webadmin.plugin.PluginManager SEVERE: Exception caught while invoking event handler function [UiInit] for plugin [HelloWorld]: Error: java.lang.IndexOutOfBoundsException webadmin:1:13517 <https://ovirtmgmt.intricatenetworks.com/ovirt-engine/webadmin/?locale=en_US #dashboard-main>
Sun Feb 25 00:03:56 GMT-600 2018 org.ovirt.engine.ui.webadmin.plugin.PluginManager WARNING: Plugin [HelloWorld] removed from service due to failure
However if I remove the line:
api.addMainTab('FooTab','xtab123','http://foo.com/);
And replace it with something simple like:
alert(Test 123¹);
There are no errors and the alert fires as it should.
Any ideas of what I might be missing?
I am running oVirt 4.2.1 on CentOS Hosted Engine setup with 1 host for testing.
Thanks
Zip
Well you found a bug, I will be posting a patch soon. To bypass the problem add the following: api.addMainTab('FooTab','xtab123','http://foo.com/, {priority: N}); Where N is a number between 0 and 5 This will determine where the new menu item will show up in the menu, 0 being at the top below the dashboard, and 5 being right above Events. Normally it is supposed to simply add to the end, however due to the bug it won't.
From: Alexander Wels <awels@redhat.com> Date: Monday, February 19, 2018 at 7:54 AM To: "users@ovirt.org" <users@ovirt.org> Cc: Preston <plord@inetx.ca> Subject: Re: [ovirt-users] oVirt 4.2 WebUI Plugin API Docs?
On Friday, February 16, 2018 6:31:10 PM EST Zip wrote:
Are there any updated docs for the WebUI Plugins API?
Unfortunately no, I haven't had a chance to create updated documentation. However the first two links are mostly still accurate as we haven't done any major changes to the API.
Some things to note that are different from the API documentation in https:// www.ovirt.org/develop/release-management/features/ux/uiplugins/ for 4.2:
- alignRight no longer has any effect, as the UI in 4.2 no longer respects it. - none of the systemTreeNode selection code does anything (since there is no more system tree) - As noted in the documentation itself the RestApiSessionAcquired is no longer available as we have a proper SSO mechanism that you can utilize at this point. - Main Tabs are now called Main Views (but the api still calls them main tabs, so use the apis described). And sub tabs are now called detail tabs, but the same thing the API hasn't changed the naming convention so use subTabs. - mainTabActionButton location property no longer has any meaning and is ignored.
That is it I think, we tried to make it so existing plugins would remain working even if some options no longer mean anything.
I have found the following which all appear to be old and no longer working?
https://www.ovirt.org/documentation/admin-guide/appe-oVirt_User_Interfac e_Pl ugins/ https://www.ovirt.org/develop/release-management/features/ux/uiplugins/ http://resources.ovirt.org/old-site-files/UI_Plugins_at_oVirt_Workshop_S unny vale_2013.pdf
Thanks
Zip