> is there a clear list of all APIs supported now? Not yet, unfortunately, this should be part of "for plugin developers" wiki that is planned to be written in upcoming weeks.
Vojtech ----- Original Message ----- From: "Itamar Heim" <[email protected]> To: "Vojtech Szocs" <[email protected]> Cc: "engine-devel" <[email protected]> Sent: Friday, November 16, 2012 4:33:23 PM Subject: Re: [Engine-devel] UI Plugins: PoC patch revision 7 is here On 11/15/2012 06:11 PM, Vojtech Szocs wrote: > Hi guys, > > the latest revision of UI Plugins proof-of-concept patch is now > available for you to experiment with. I've split revision 7 changes > apart from revision 6 to make it easier to review new features that were > added into revision 7. > > You can download and apply UI Plugins patches from oVirt Gerrit code > review system: > > 1. revision 6 - http://gerrit.ovirt.org/#/c/8120/ > 2. revision 7 - http://gerrit.ovirt.org/#/c/9250/ > > Please read on to learn what's new in this revision. If you have any > comments, questions or ideas, please let me know! > > ------------------------------------------------------------------------ > > *Engine REST API integration* > > /UiInit/ is not the only event handler function anymore! :) > > UI plugin infrastructure now integrates with Engine REST API by > acquiring new REST API session [1] upon successful user authentication. > > REST API session ID is provided to plugins via RestApiSessionAcquired > event handler function. For example: > > api.register({ > RestApiSessionAcquired: function(sessionId) { > // Do something with newly acquired session ID > } > }); > > Note that UiInit function is still the first function to be invoked on > the given plugin. Plugins can therefore expect RestApiSessionAcquired > function to be called shortly after UiInit function. > > For now, UI plugin infrastructure guarantees that acquired Engine REST > API session will be valid while the user stays authenticated in > WebAdmin. This is done by keeping REST API session alive via periodic > heartbeats (HTTP requests) in the background. This also means that it's > safe to store and use REST API session ID until RestApiSessionAcquired > function is called again with new value. In future, we might consider > dropping this kind of guarantee to avoid the keep-alive heartbeat, and > use some kind of "is session valid" query to determine if the REST API > session is still valid. > > After the user signs out of WebAdmin, Engine REST API session will be > closed, as per [1]. After signing in again, the process of acquiring new > REST API session and calling RestApiSessionAcquired function repeats > with new session ID value. > > Engine REST API integration also works seamlessly with auto login - if > the user is already logged in on the backend, running WebAdmin in new > window (tab) will take him directly to the main (authenticated) section > of the application. In this case, UI plugin infrastructure remembers the > currently valid REST API session ID using HTML5 local storage (or cookie > if the browser doesn't support it). > > ------------------------------------------------------------------------ > > New API function: showDialog > > It's now possible to open custom dialogs using showDialog function. For > example: > > api.register({ > UiInit: function() { > api.addMainTabActionButton('Host', 'Show Test Dialog', { > onClick: function() { > api.showDialog('Test Dialog', 'http://www.ovirt.org/', 600, 400); > } > }); > } > }); > > The signature of showDialog function is following: > > showDialog(title, contentUrl, width, height) > > For now, dialogs are shown using window.open API (non-modal browser > popups). This will be changed in future, providing close integration > with GWTP / WebAdmin dialog infrastructure. > > ------------------------------------------------------------------------ > > New API function: setMainTabContentUrl > > It's now possible to update content URL of the given custom main tab > using setMainTabContentUrl function. For example: > > api.register({ > UiInit: function() { > // Use 'about:blank' URL to display empty content > api.addMainTab('Custom Tab', 'custom-tab', 'about:blank'); > }, > RestApiSessionAcquired: function(sessionId) { > var url = 'http://www.ovirt.org/?s=' + encodeURIComponent(sessionId); > api.setMainTabContentUrl('custom-tab', url); > } > }); > > In the above example, we first add an empty custom main tab. We do this > in UiInit event handler function because we know that it's the best > place for one-time UI initialization :) As soon as we receive REST API > session ID, we update the URL of the custom main tab. This is just an > example how REST API session ID can be sent over to your server as part > of main tab content URL. > > The signature of setMainTabContentUrl function is following: > > setMainTabContentUrl(historyToken, contentUrl) > > Note that historyToken essentially identifies the custom main tab. > > ------------------------------------------------------------------------ > > That's it for now, let me know what you think! > > Regards, > Vojtech > > > [1] http://wiki.ovirt.org/wiki/Features/RESTSessionManagement > > > > _______________________________________________ > Engine-devel mailing list > [email protected] > http://lists.ovirt.org/mailman/listinfo/engine-devel > is there a clear list of all APIs supported now? _______________________________________________ Engine-devel mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-devel
