VMware {code} Community
SravanKumar1234
Contributor
Contributor

Issue with Global refresh event(DataRefreshInvocationEvent) when using for Global view extensions

Hi,

We have a couple of global view extensions (vise.global.views) with global refresh event(DataRefreshInvocationEvent) extended.

Method onGlobalRefreshRequest will be called even if the view is not active. As per  laurentsd​ answer in Re: Inventory Refresh or Global Refresh event on webclient UI  thread. we need to check for _contextObject null value to avoid this.

But problem is global views wouldn't have any context. Even if we implement the IContextObjectHolder interface, web client framework won't set context objects for global view extensions.

So how could we check of the view is active or not?

It seems this is a design short-come or a memory leak.

NOTE: Our plugin is flex based one and using vSphere client sdk v6.0.

Thanks,

Sravan

0 Kudos
4 Replies
laurentsd
VMware Employee
VMware Employee

It is not possible to check if a global view is visible. If it is no longer visible it will be removed eventually by the garbage collector.  The fact that it still receives the DataRefreshInvocationEvent when if it is not visible anymore but still active should not be a problem.  Or else, please describe your exact use case, thanks.

0 Kudos
SravanKumar1234
Contributor
Contributor

Sorry for my late response.

Why I'm asking is i have a global view (lets say a dashboard) which will have the global refresh extended, when I navigate to  other vsphere view (say datastore summary) and click on global refresh.

The dashboard global refresh also getting called which is a heavy call. so user is seeing the dashboard loading message popup, even the user is in datastore page.

So this needs to be handled to avoid unnecessary calls for the data which we don't need.

0 Kudos
_vladi_
VMware Employee
VMware Employee

Hi Sravan,

Unfortunately, there is no API to unregister EventHandlers of Flex plugins. For HTML plugins this is possible with the setGlobalRefreshHandler.

The Web Client SDK is frozen with regards to its Flex part so it is supported but not going to be extended further.

To workaround the loading message popup you could implement it inside the view (not as a popup). This is also the recommended way to do it - please check how loading indicators for other vSphere objects/views work.

To workaround the unnecessary calls you could try tracking the visible property by the "hide" event handler of your component but I am not sure if this would work.

Cheers,

Vladi

0 Kudos
SravanKumar1234
Contributor
Contributor

>>To workaround the unnecessary calls you could try tracking the visible property by the "hide" event handler of your component but I am not sure if this would work.

Do you have any code? can you provide any sample code on how to track hide event of a view?

0 Kudos