VMware {code} Community
ryantodd
Contributor
Contributor

Use sendNavigationRequest to navigate to native vsphere views using htmlbridge?

Taking a look at the htmlBridge chassis sample, there are the references to something like:

WEB_PLATFORM.sendNavigationRequest("com.vmware.samples.chassisb.SummaryView", objectId);

used to navigate to extension points within the HTMLBridge plugin. However, it doesn't seem that navigating to built in views, such as the host summary view, seem to work. Is there a way to internally navigate from an HTML view back to a view with or without the same objectID?

10 Replies
laurentsd
VMware Employee
VMware Employee

If you have the host's objectId then the same call should work to navigate to a host view extension.  What have you tried?

0 Kudos
ryantodd
Contributor
Contributor

We tried one of our other html-bridge view extension points, which did work. We were trying to navigate from a custom html-bridge view to a VM summary view. We tried to use vsphere.core.host.summarySectionViews and vsphere.core.vm.summarySectionViews to test which did not work. I suspect that these were probably the incorrect id/point to use, and should probably be something like vsphere.core.host.summaryView or something like that.

0 Kudos
laurentsd
VMware Employee
VMware Employee

An easy way to find the extension id is to navigate to the page and look at it in the URL, like the one below for a VM summary page:

https ://IP/vsphere-client/#extensionId=vsphere.core.vm.summary;context=com.vmware.core.model%3A%3AServerObjectRef~21319706-C4B4-4F16-AB97-C908C638F3D1%3AVirtualMachine%3Avm-18~core

ryantodd
Contributor
Contributor

Ah, hahaha. Well, that is too easy. Thanks! Will give it a shot and get back to you here if there is still a problem.

0 Kudos
nklein1
Contributor
Contributor

How should we format an Object's ID if we're trying to link to that object's summary (or other) view?

For example, if I'm trying to link to the following datastore object summary view...

https://blahblahblah#extensionId=vsphere.core.datastore.summary;context=com.vmware.core.model::Serve...

...In my code, all of the following links (which require an object ID) do not work:

<a onclick="WEB_PLATFORM.sendNavigationRequest('vsphere.core.datastore.summary', 'datastore-17')" href="#">datastore1</a>
<a onclick="WEB_PLATFORM.sendNavigationRequest('vsphere.core.datastore.summary', 'datastore-17:913C774C-6F46-456C-9F10-9A13BE18C612')" href="#">datastore1</a>
<a onclick="WEB_PLATFORM.sendNavigationRequest('vsphere.core.datastore.summary', 'Datastore:datastore-17:913C774C-6F46-456C-9F10-9A13BE18C612')" href="#">datastore1</a>
<a onclick="WEB_PLATFORM.sendNavigationRequest('vsphere.core.datastore.summary', 'context=com.vmware.core.model::ServerObjectRef~913C774C-6F46-456C-9F10-9A13BE18C612:Datastore:datastore-17~core')" href="#">datastore1</a>

Each time any of the above anchor links  are clicked, the following line appears in the vsphere_client_virgo log, but no route change occurs:

[2015-05-04 16:53:17.890] [INFO ] http-bio-9443-exec-194       70002904 100001 200001 org.springframework.flex.servlet.MessageBrokerHandlerAdapter      Channel endpoint secure-amf received request. 

Just to note, the following generated link (which links to the datastore list view and therefore doesn't need an object ID) works correctly when substituted for any of the above anchor links in my code:

<a onclick="WEB_PLATFORM.sendNavigationRequest('vsphere.core.viDatastores.domainView')" href="#">datastore1</a>
0 Kudos
HarryDee
Contributor
Contributor

I'm seeing a similar problem!

It appears the WEB_PLATFORM.sendNavigationRequest is broken if the plugin is built and packaged using 5.5 SDK and deployed in a 6.0 environment.


ryantodd
Contributor
Contributor

We are seeing the same issue. However, there are times when the navigation to a specific object in our plugin will work, while most of the time it doesn't. It seems like navigating to, for example, a host via vsphere and then navigating to our html plugin page for the host, and then navigating using sendNavigationRequest from another page to any host works for a short period of time. (or something is changing that causes it to cease working again at least...)

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

Try this one as second parameter to the sendNavigationRequest function:

var MOREF_UID_PREFIX = "urn:vmomi";

var type = 'Datastore';

var value = 'datastore-17';

var serverGuid = '913C774C-6F46-456C-9F10-9A13BE18C612';

var objectId = MOREF_UID_PREFIX + ':' + type + ':' + value + ":" + serverGuid;

0 Kudos
ryantodd
Contributor
Contributor

I can't speak for nklein1, but that is what we are doing, which works in 5.5. In 6.0, however, the navigation works sporadically.

0 Kudos
HarryDee
Contributor
Contributor

Here are the steps to repro. this issue in-house:

1) Pick one of the 5.5 html-bridge samples and deploy it in a 6.0 server (virgo)

2) Launch vSphere UI and navigate to the sample plugin

3) Open Javascript console and try calling sendNavigationRequest from the console with a known objectId

Expected: vSphere UI should navigate correctly to the object with the matching objectId

Actual: Well nothing happens!

0 Kudos