vSphere Client JavaScript API: Application Interface

The app interface provides context object information and helps your plug-in navigate and control the vSphere Client user interface.

app.ApiEndpoints type

Description

Holds a nested object that contains the parsed elements of the plug-in URL.

Name

Type

Required?

Notes

uiApiEndpoint

app.UiApiEndpoint

info only

Used by: app.getApiEndpoints() method

app.ClientInfo type

Description

Documents type and version of vSphere Client.

Name

Type

Required?

Notes

type

string

info only

The vSphere Client type (must be HTML).

version

string

info only

The vSphere Client version string.

Used by: app.getClientInfo() method

app.ClientViewNavigationOptions type

Description

Specifies a destination view that is owned by the vSphere Client.

Name

Type

Required?

Notes

targetviewid

string

no

Navigation ID of the destination view. (Only valid value is administration.ceip.)

objectid

string

no

ID of any object associated with the view. (For a global view, this field is not required.).

Used by app.navigateToClientView() method

App.formatDateTime() method

Signature

app.formatDateTime(instant:number, options:app.PluginDateTimeFormatOptions):string

Description

Returns a formatted string that contains a human-readable representation of the instant parameter. The instant parameter holds the number of milliseconds since the start of 1 January 1970 UTC.

app.getApiEndpoints() method

Signature

app.getApiEndpoints():app.ApiEndpoints

Description

Returns the URLs of the vsphere-ui service API endpoints available to plug-ins. For an example, see the sample remote plug-ins available in the vSphere Client SDK.

app.getClientInfo() method

Signature

app.getClientInfo():app.ClientInfo

Description

Returns type and version info for the vSphere Client.

app.getClientLocale() method

Signature

app.getClientLocale():string

Description

Returns the current locale of the vSphere Client.

app.getContextObjects() method

Signature

app.getContextObjects():any[]

Description

Returns the IDs of the current context objects, depending on the view or dialog from which the method is called.

Return value:

for global view

Returns empty array. Global views have no associated vSphere objects.

for vSphere object

Returns a context item for the associated vSphere object.

for dialog opened by modal.open()

If dialog opened by htmlClientSdk.modal.open(configObj), returns value of configObj.contextObjects (or empty array, if contextObjects undefined)

for dialog opened by plugin.json actions

If dialog opened by action defined in plugin.json, returns an array of action targets.

A context item is a JavaScript object containing a single property, id:string. This is the ID of the associated vSphere object.

app.getNavigationData() method

Signature

app.getNavigationData():any

Description

Returns the custom data passed to the view by the app.navigateTo() method. (If no custom data passed, returns null.)

app.getPluginBackendInfo() method

Signature

app.getPluginBackendInfo(callback:function):void

Description

Creates listings of service endpoints registered for the running plug-in instance, enabling plug-in front ends to use the vCenter Server ExtensionManager as a service registry.

The callback function must have the following signature:

Function callback(backendInfo:app.PluginBackendInfo):void

If the method throws an exception, the callback parameter will be null.

For an example of using this method, see the vSphere Client SDK samples.

app.getRemotePluginNavigationMap() method

Signature

app.getRemotePluginNavigationMap(targetPluginId:string, callback:function):void

Description

Returns view IDs that belong to a plug-in specified by the targetPluginId parameter. If the targetPluginId is not the ID of the caller, the method returns IDs of only the public views for the target plug-in. Returns information for all vCenter Server instances where the target plug-in is registered and enabled.

The callback function must have the following signature:

function callback(navigationInfo:app.RemotePluginNavigationMap):void

If the method throws an exception, the callback parameter will be null.

app.getSessionInfo() method

Signature

app.getSessionInfo(callback:function):void

Description

Retrieves and processes information about the client's authentication session.

The callback function must have the following signature:

function callback(info:app.SessionInfo):void

If the method throws an exception, the callback parameter will be null.

app.getTheme() method

Signature

app.getTheme():app.PluginTheme

Description

Retrieves information about the UI theme that is currently selected.

app.navigateTo() method

Signature

app.navigateTo(configObj:app.NavigationOptions):void

Description

Navigates to a specified view, and optionally passes custom data to the view.

Parameter: configObj

Specifies the destination view and custom data.

app.navigateToClientView() method

Signature

app.navigateTo(configObj:app.ClientViewNavigationOptions):void

Description

Navigates to a specified vSphere Client view.

Parameter: configObj

Specifies the destination view.

app.navigateToRemotePluginView() method

Signature

app.navigateTo(configObj:app.RemotePluginViewNavigationOptions):void

Description

Navigates to a view implemented by another remote plug-in, or by another instance of the same plug-in deployed by a different vCenter Server instance. Optionally passes custom data to the view.

Parameter: configObj

Specifies the destination view and custom data.

Note:

A best practice is to call app.getRemotePluginViewNavigationMap() before this procedure, to ensure that the navigation target is registered and enabled.

app.NavigationOptions type

Description

Specifies a destination view and custom data for the view.

Name

Type

Required?

Notes

targetViewId

string

no

Navigation ID of the destination view. (For a remote plug-in, this property must identify a view created by the same plug-in.) Omit this to navigate to the last-used view of the object specified by objectId.

objectId

string

no

ID of any object associated with the view. Omit this to navigate to a global view.

customData

any

no

A custom data structure passed to the view.

Used by: app.navigateTo() method

app.PluginBackendInfo type

Description

Contains two objects that list endpoint descriptors available to a given plug-in instance.

Name

Type

Required?

Notes

allPluginBackendServers

Array<app.PluginBackendServerInfo>

info only

A list of plug-in server endpoint descriptors registered for a given plug-in instance. The list includes all registrations within the same link group. The list is unordered and contains no duplicates.

backendServersPerVc

{[vcGuid:string]:Array<app.PluginBackendServerInfo>}

info only

A one-to-many mapping: vCenter Server GUID to a list of plug-in server endpoint descriptors registered with the vCenter Server instance on behalf of the running plug-in instance.

Used by: app.getPluginBackendInfo() method

app.PluginBackendServerInfo type

Description

A descriptor for a plug-in server endpoint registered for a plug-in instance. Choose the server by the type value, then form a resource URL from the endpoint descriptor. To access a resource belonging to the server, prefix the proxiedBaseUrl value to the root-relative path of the resource on the plug-in server: /<proxiedBaseUrl>/<path to resource from server root>

Name

Type

Required?

Notes

proxiedBaseUrl

string

info only

The path component of the server root URL, as seen on the reverse proxy service port.

type

string

info only

The type of the server, as specified in its registration record (Extension data object) with a vCenter Server instance. Plug-ins can use this property to identify auxiliary servers that are part of the same plug-in instance. For more information, see Using Auxiliary Plug-in Servers.

Used by: app.PluginBackendInfo type

app.PluginDateTimeFormatOptions type

Description

Specifies which part of a timestamp to format.

Name

Type

Required?

Notes

format

string

no

(default: DATE_AND_TIME)

Possible values:

  • DATE

  • TIME

  • DATE_AND_TIME

Used by: App.formatDateTime() method

app.PluginTheme type

Description

Indicates a choice of UI theme.

Name

Type

Required?

Notes

name

string

info only

Possible values: light or dark.

Used by: app.getTheme() method

app.QueryParam type

Description

Holds a single query parameter of a URL.

Name

Type

Required?

Notes

name

string

info only

Name of query parameter, as in ?name=value.

value

string

info only

Value of query parameter, as in ?name=value.

Used by: app.UiApiEndpoint type

app.RemotePluginNavigationMap type

Description

Lists remote plug-in destination views, belonging to a single vCenter Server instance, that are exposed by plug-ins using the isPublic property in the plug-in manifest. Use the map key as the value of the vcGuid property in the parameter to navigateToRemotePluginView() navigateToRemotePluginView().

Name

Type

Required?

Notes

navigationInfoByVcGuid

Map<string, app.RemotePluginVcNavigationInfo>

info only

A one-to-many mapping of vCenter Server instances to view IDs that are served by a specified plug-in instance registered with each vCenter Server instance. Each map entry contains the GUID of a vCenter Server instance within the same link group, and a corresponding list of view descriptors.

Used by: app.getRemotePluginNavigationMap() method

app.RemotePluginVcNavigationInfo type

Description

Descriptor for views served by a given plug-in. Use a view ID as the value of the targetViewId property in the parameter to navigateToRemotePluginView()

Name

Type

Required?

Notes

pluginVersion

string

info only

The version of a plug-in instance registered with a given vCenter Server instance.

viewIds

string[]

info only

All the view IDs, served by a given plug-in instance, that are accessible to the current plug-in instance.

Used by: app.RemotePluginNavigationMap type

app.RemotePluginViewNavigationOptions type

Description

Specifies a destination view served by a different plug-in instance, and custom data for the view.

Name

Type

Required?

Notes

pluginId

string

yes

ID of the plug-in that owns the destination view.

targetViewId

string

yes

Navigation ID of the destination view. Use only values returned by htmlClientSdk.app.getRemotePluginNavigationMap() in the viewsIds array.

vcGuid

string

yes

The GUID of the vCenter Server instance that determines the context for the target view. If objectId is specified, the object must be managed by the specified vCenter Server instance.

objectId

string

no

ID of any object associated with the view. (For a global view, this field is not required.)

customData

any

no

A custom data structure passed to the view.

Used by: app.navigateToRemotePluginView() method

app.SessionInfo type

Description

Holds information about the current session of the vSphere Client.

Name

Type

Required?

Notes

sessionToken

string

info only

Identifier of the plug-in authentication session with vCenter Server.

nodeId

string

Info only

Reserved for internal use only.

Used by: app.getSessionInfo() method

app.UiApiEndpoint type

Description

Holds the parsed elements of a plug-in URL.

Name

Type

Required?

Notes

origin

string

info only

<protocol>://<hostname><port>

pathname

string

info only

queryParams

Array<app.QueryParam>

info only

<name>=<value>

fullUrl

string

info only

<origin>/<pathname>?<queryParams>

Used by: app.ApiEndpoints type