On Monday, February 26, 2018 9:50:37 AM EST Zip wrote:
> Thanks Alexander,
> 
> This works:
> 
> api.addMainTab('oVirtTab', 'ovirt-tab', ‘http://www.something.com',
> {priority: 5});
> 
> Can you advise how to get the api.addSubTab to work?
> 
> api.addSubTab('ovirt-tab', 'Test 123', 'test-123', '#’);
> 
> I tried the above and many other combinations, no errors, just doesnt work.
> Maybe I am wrong on what it does?
> 
> I am looking to add a submenu – same as the current 4.2.1 UI shows Network
> and then(Vnic Profiles) (Networks) as submenus.
> 
> Thanks
> 
> Zip
> 

So api.addSubTab works on adding a 'detail' tab, aka when you click on lets 
say the VMs name, and go to the detail view, addSubTab will add another tab in 
there.

What you want to do, is currently NOT possible. I have a TODO in my long list 
of items to add that capability to the UI plugin API. When the API was 
designed the secondary menus like Networks didn't exist, it was all main tabs 
or sub tabs. The primary and secondary menus are just a way to organize the 
main views instead of having a giant list of menu items. For now I would just 
put it in a primary menu until I get a chance to update the api to allow for 
you to add it to a secondary menu.

> > 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=e
> >>  n_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 <aw...@redhat.com>
> >>>  > Date:  Monday, February 19, 2018 at 7:54 AM
> >>>  > To:  "users@ovirt.org" <users@ovirt.org>
> >>>  > Cc:  Preston <pl...@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_Interfa
> >>>> c
> >>>> 
> >>>>  >>  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


_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users

Reply via email to