You can display data for a particular vCenter Server instance for a global view extension by using the vCenter Server selector feature of the HTMLView object class.
To use the vCenter Server selector, you must create a global view by using the com.vmware.vsphere.client.htmlbridge.HtmlView object. In the plugin.xml manifest file, define the properties of the extension object and add the <showVCenterSelector> property with value set to true.
When enabled, the vCenter Server selector displays a drop-down menu that contains all vCenter Server instances that the vSphere Client is connected to. You can easily switch between the data specific for the different vCenter Server systems by using the selector.
The JavaScript code for the extension makes an Ajax GET request that contains the following parameters:
■
| |
■
| |
■
|
You can use the vSphere Web Services SDK and pass these parameters to a Java service to access data about a specific vCenter Server instance.
The sample demonstrates how you can create a global view extension and enable the vCenter Server selector to display specific properties for the selected vCenter Server system.
<!-- Global app vCenter view --> <extension id="com.vmware.samples.h5.globalview.vcView"> <extendedPoint>vise.global.views</extendedPoint> <object> <name>#{app.vcView}</name> <componentClass className="com.vmware.vsphere.client.htmlbridge.HtmlView"> <object> <root> <url>/vsphere-client/globalview/resources/vcView.html</url> <showVCenterSelector>true</showVCenterSelector> </root> </object> </componentClass> </object> </extension>