Loading

×Sorry to interrupt
Uncaught ReferenceError: addCTracking is not defined
throws at https://kb.vmware.com/resource/KM_TealiumTrackingJS?v=0.5:100:1

Refresh

Cookie Preference Center

General Information on cookies

When you visit our website, we use cookies to ensure that we give you the best experience. This information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies by clicking on the different category headings to find out more and change your settings. However, blocking some types of cookies may impact your experience on the site and the services we are able to offer. Further information can be found in our

Cookie Policy.

Strictly Necessary

Strictly Necessary

Always Active

Strictly Necessary

Strictly necessary cookies are always enabled since they are essential for our website to function. They enable core functionality such as security, network management, and website accessibility. You can set your browser to block or alert you about these cookies, but this may affect how the website functions. For more information please visit www.aboutcookies.org or www.allaboutcookies.org.

Cookie Details‎

Performance

Performance

Performance

Performance cookies are used to analyze the user experience to improve our website by collecting and reporting information on how you use it. They allow us to know which pages are the most and least popular, see how visitors move around the site, optimize our website and make it easier to navigate.

Cookie Details‎

Please confirm your settings by refreshing the page.

Functional

Functional

Functional

Functional cookies help us keep track of your past browsing choices so we can improve usability and customize your experience. These cookies enable the website to remember your preferred settings, language preferences, location and other customizable elements such as font or text size. If you do not allow these cookies, then some or all of these services may not function properly.

Cookie Details‎

Advertising

Advertising

Advertising

Advertising cookies are used to send you relevant advertising and promotional information. They may be set through our site by third parties to build a profile of your interests and show you relevant advertisements on other sites. These cookies do not directly store personal information, but their function is based on uniquely identifying your browser and internet device.

Cookie Details‎

Advertising Cookies

Consent Leg.Interest

Select All Vendors

Select All Vendors

Select All Hosts

Select All

Clear Filters

Information storage and access

Apply

Confirm My Choices Reject All Allow All

My Subscriptions

Loading

Knowledge Base

Upgrading JavaScript API calls for vSphere Client SDK version 6.7 (54985)

Last Updated: 8/14/2018Categories: InformationalTotal Views: 3258Language:
English

Subscribe to get an email
newsletter with new updates

Please provide article feedback:

Symptoms

The existing JavaScript API is deprecated as of vSphere 6.7, and partners who use the existing JavaScript API need to start converting their code, testing, and preparing for distribution to their customers using the new API.
Failure to prepare will mean their customers might get errors at a certain point in the future when they migrate to newer versions of the vSphere Client.

Purpose

This Knowledge Base article shows the mapping of method calls between the current API and the new API introduced with vSphere 6.7.

Cause

The current API is deprecated, as of the vSphere 6.7 release. Partners who plan to maintain compatibility with the vSphere Client SDK in future releases need to transition their code to use the new API.

Resolution

The vSphere Client SDK version 6.7 introduces a new JavaScript API that simplifies plug-in development.
The JS APIs are divided into namespaces/segments based on the H5C areas they are related to, namely:

Modals

Applications

Events

Note: Old APIs are no longer needed. Check the new HTML SDK sample for instructions on how to use the current set of APIs and additional libraries to achieve the same results.

To get/use the new APIs:
Usage: window.frameElement.htmlClientSdk.<namespace>.<api>

Modal JS API

Old JS API

New JS API

Comments

openModalDialog(title, url, width, height, objectId)

modal.open(configObj: ModalConfig): void

Opens an application modal. Where configObj is of type

ModalConfig:{
url: string
title?: string,
size?: {width:number, height:number},
closable? boolean,
onClosed?: callbackFn,
customData?: any,
contextObjects?: any[]
}
Note: The size should be in pixels.

closeDialog()

modal.close(data: any): void

Closes the modal. The modal is the one corresponding to the iframe this API was called from.
If data has been provided it will be passed to onClose callback function if such was specified in modal.open

setDialogSize(width,height)

setDialogTitle(title)

modal.setOptions(options: DynamicModalOptions): void

Sets options to the modal. The modal is the one corresponding to the iframe this API was called from options is of type
DynamicModalConfig
{
title?: string,
height?: number
}

modal.getCustomData(): any

Returns the customData that was provided upon opening the modal or null.

Client Application JS API

Old JS API

New JS API

Comments

getObjectId()
getActionTargets()

app.getContextObjects(): any[]

Returns current context objects:

• In global views, the result is empty because global views are not associated with any vSphere object

• In views that are associated with a particular vSphere object,  the result contains a JavaScript object with a field named 'id' - the ID of the selected vSphere object

• In modals opened through a SDK call to htmlSdk.modal.open(configObj)  the result is the value of configObj.contextObjects  or an empty array if configObj.contextObjects is undefined

• In modals opened through actions defined in the plugin.xml file the result is an array of context objects representing the targets of the invoked action. Each context object is a JavaScript object that contains a field named 'id' which is the id of the corresponding target object.
Note: The result will be an empty array if there are no target objects.

sendNavigationRequest(targetViewId, objectId)

app.navigateTo(options: NavigationOptions): void

Navigates to a specified view with an optional custom data which will be passed to the view. Where options is of type

NavigationOptions
{
targetViewId: string,
objectId?: string,
customData?: any
}

When navigating to a global view, the "objectId" property can be skipped.

app.getNavigationData(): any

Retrieves the navigation data passed to the current view by the navigateTo() API.

If you have called:

htmlSdk.app.navigateTo({
targetViewId: "com.vmware.samples.chassisa.summary",
objectId: "urn:vri:samples:ChassisA:chassis-3",
customData: {name: "test", filter: true}
});

Then, you can use:
htmlSdk.app.getNavigationData();

and you will get: {name: "test", filter: true}

getClientType()

getClientVersion()

app.getClientInfo(): ClientInfo

Returns the type and version of H5 Client.

The returned object is of type

ClientInfo
{
type: string,
version: string
}

getLocale()

app.getClientLocale(): string

Returns the current locale of H5 Client.

Event JS API

Old JS API

New JS API

Comments

setGlobalRefreshHandler(callbackFn)

event.onGlobalRefresh(pluginCallBackFunc: function)

Registers a global refresh handler. The plugin callback function is called when the Global Refresh button of H5 Client is clicked.

The following old JS APIs do not have a counterpart in the new JS APIs since their usage is handled in another way or no longer supported:

getString() - Use the getClientLocale() API to retrieve the current client locale. Then use a framework of choice to localize your plug-in. Refer to HTML Sample plug-in for an example.

getUserSession() - Use the getUserSession() JAVA API to retrieve the current user session.

callActionsController() - No longer needed, you can just make GET/POST requests to your controller.

sendModelChangeEvent() - No longer supported.

Detectable by VMware SkylineTM

Actions

Copy

link to clipboard
copied!

Print

Language:
English

Attachments

Additional Resources

No results for undefined

Ask The Community

Get answers quickly from VMware experts in the community

Post Subject

CONTINUE IN COMMUNITIES

Related Products:

VMware vSphere Client

VMware vSphere

Related Versions:

VMware vSphere Client 6.5.x

Take Our Survey

Support Assistant