[Engine-devel] UI Plugins: PoC patch revision 7 update 2 is now available

Vojtech Szocs vszocs at redhat.com
Thu Dec 6 23:50:17 UTC 2012


Hi guys, 

an updated version of UI Plugins proof-of-c on cept patch is now available for you to experiment with. It's basically revision 7 with new features, driven mostly by the feedback received so far. 

You can download and apply latest UI Plugins patches from oVirt Gerrit code review system: 

    * rev is ion 6 - http://gerrit.ovirt.org/#/c/8120/ 
    * rev is ion 7 update 2 - http://gerrit.ovirt.org/#/c/9250/ 

Please read on to learn what's new. If you have any comments, questi on s or ideas, please let me know! 



Engine REST API integration 

UI plugin infrastructure no longer closes current REST API session upon WebAdmin user logout. 

Since REST API session management uses JSESSIONID cookie to transmit session ID from client to server, the cookie will be present even after user signs out of WebAdmin. Upon subsequent login, this cookie will be sent as part of another "acquire REST API session" request, which means REST API will potentially reuse existing session based on JSESSIONID cookie value. 

Known limitation: due to REST API integration requiring WebAdmin user password when acquiring session, RestApiSessionAcquired function will NOT be called in case of auto login. This happens when the user signs into WebAdmin, closes the browser window (tab) without signing out, and opens it again - WebAdmin signs the user in automatically. In this case, there is no way (yet) to query for user password, which is required when acquiring REST API session. To work around this limitation, just sign out and sign in again. We're planning to address this limitation in future update. 

Other than that, REST API integration works the same as before, calling RestApiSessionAcquired function on plugins each time new or existing session is acquired, and keeping the session alive through heartbeat requests while the user stays authenticated. It is therefore guaranteed that RestApiSessionAcquired function will be called each time the user signs into WebAdmin. 



New API function: addSubTab 

It's now possible to add custom sub tabs under existing main tabs. 

For example, to add custom sub tab under Host main tab: 

api.addSubTab('Host', 'My Host Sub Tab', 'my-host-sub-tab', 'http://www.ovirt.org/'); 

The signature of addSubTab function is following: 

addSubTab(entityTypeName, label, historyToken, contentUrl) 

entityTypeName indicates the main tab entity type, i.e. under which main tab the sub tab should be added. See org.ovirt.engine.ui.webadmin.plugin.entity.EntityType enum for supported values. 

label , historyToken and contentUrl have same semantics as in addMainTab function. 



New API function: setTabContentUrl 

Use this function to update custom main or sub tab content URL, for example: 

api.setTabContentUrl( 'my-host-sub-tab' , 'http://www.example.org/' ); 



New API function: setTabAccessible 

Use this function to control access to custom main or sub tab, for example: 

api.setTabAccessible( 'my-host-sub-tab' , false); 

In the example above, the custom tab is set as not accessible. In practice, this means two things: 

    * corresponding tab header will be hidden on GUI 
    * any attempt to navigate to this tab (e.g. by modifying URL with token representing the tab) will be denied by the plugin infrastructure 



New events: UserLogin and UserLogout 

Plugins can now be notified when user logs into or out of WebAdmin GUI. 

For example: 

api.register({ 
UserLogin: function(userName, userId) { 
... 
}, 
UserLogout: function() { 
... 
} 
}); 



New events: {EntityTypeName}SelectionChange 

Plugins can now be notified whenever existing main tab selection changes . 

For example, a plugin could listen to Host main tab selection change like so: 

api.register({ 
HostSelectionChange: function() { 
var hostsSelected = arguments.length; 
var firstHostId = arguments[0].entityId; 
} 
}); 

For each supported entity type, {EntityTypeName}SelectionChange event is defined: ClusterSelectionChange, DataCenterSelectionChange, DiskSelectionChange, HostSelectionChange, StorageSelectionChange, TemplateSelectionChange, VirtualMachineSelectionChange. 

Note that each {EntityTypeName}SelectionChange event handler function receives currently selected items as arguments. 



Minor improvements 

Browser popup window triggered via showDialog API function now shows scrollbars if the content doesn't fit the window. 

Note on showDialog function implementation: we're planning to replace the current (browser-based) popup implementation with one that properly integrates with WebAdmin dialog infrastructure. This is something that's still on my TODO list, planning to do this in near future. 



Regards, 
Vojtech 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/engine-devel/attachments/20121206/adc39b0d/attachment.html>


More information about the Engine-devel mailing list