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
app.ApiEndpoints
Description | Holds a nested object that contains the parsed elements of the plug-in URL. |
Property | Type | Required? | Notes |
---|---|---|---|
Used by: app.getApiEndpoints()
app.ClientInfo
app.ClientInfo
Description | Documents type and version of vSphere Client. |
Property | 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()
app.ClientViewNavigationOptions
app.ClientViewNavigationOptions
Description | Specifies a destination view that is owned by the vSphere Client. |
Property | Type | Required? | Notes |
---|---|---|---|
targetviewid | string | no | Navigation ID of the destination view.
|
objectid | string | no | ID of any object associated with the view. (For a global view, this field is not required.). |
Used by app.navigateToClientView()
app.formatDateTime()
app.formatDateTime()
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()
app.getApiEndpoints()
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()
app.getClientInfo()
Signature | app.getClientInfo():app.ClientInfo |
Description | Returns type and version info for the vSphere Client. |
app.getClientLocale()
app.getClientLocale()
Signature | app.getClientLocale():string |
Description | Returns the current locale of the vSphere Client. |
app.getContextObjects()
app.getContextObjects()
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: |
A context item is a JavaScript object containing a single property, id:string . This is the ID of the associated vSphere object. |
app.getNavigationData()
app.getNavigationData()
Signature | app.getNavigationData():any |
Description | Returns the custom data passed to the view by the . (If no custom data passed, returns null .) |
app.getPluginBackendInfo()
app.getPluginBackendInfo()
Applies to remote plug-ins only.
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:
If the method throws an exception, the callback parameter will be null . |
app.getRemotePluginNavigationMap()
app.getRemotePluginNavigationMap()
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:
If the method throws an exception, the callback parameter will be null . |
app.getSessionInfo()
app.getSessionInfo()
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:
If the method throws an exception, the callback parameter will be null . |
app.getTheme()
app.getTheme()
Signature | app.getTheme():app.PluginTheme |
Description | Retrieves information about the UI theme that is currently selected. |
app.navigateTo()
app.navigateTo()
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()
app.navigateToClientView()
Signature | app.navigateTo(configObj:app.ClientViewNavigationOptions):void |
Description | Navigates to a specified vSphere Client view. |
Parameter: configObj | Specifies the destination view. |
app.navigateToRemotePluginView()
app.navigateToRemotePluginView()
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. |
A best practice is to call app.getRemotePluginViewNavigationMap() before this procedure, to ensure that the navigation target is registered and enabled.
app.NavigationOptions
app.NavigationOptions
Description | Specifies a destination view and custom data for the view. |
Property | 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()
app.PluginBackendInfo
app.PluginBackendInfo
Applies to remote plug-ins only.
Description | Contains two objects that list endpoint descriptors available to a given plug-in instance. |
Property | 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()
app.PluginBackendServerInfo
app.PluginBackendServerInfo
Applies to remote plug-ins only.
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> |
Property | 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
app.PluginDateTimeFormatOptions
app.PluginDateTimeFormatOptions
Description | Specifies which part of a timestamp to format. |
Property | Type | Required? | Notes |
---|---|---|---|
format | string | no (default: DATE_AND_TIME) | Possible values:
|
Used by: app.formatDateTime()
app.PluginTheme
app.PluginTheme
Description | Indicates a choice of UI theme. |
Property | Type | Required? | Notes |
---|---|---|---|
name | string | info only | Possible values: light or dark . |
Used by: app.getTheme()
app.QueryParam
app.QueryParam
Description | Holds a single query parameter of a URL. |
Property | 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
app.refreshPluginItemsState()
app.refreshPluginItemsState()
Signature | app.refreshPluginItemsState():void |
Description | Triggers the refresh of all dynamic UI content hosted by the current plug-in. For example, the plug-in introduces a view that is dynamically filtered based on a property value of some object. If the property value is changed by the plug-in using the public vSphere APIs, then the plug-in must call this API to signal the UI to re-evaluate the state of the initiator's plug-in related items. |
app.RemotePluginNavigationMap
app.RemotePluginNavigationMap
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 . |
Property | 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()
app.RemotePluginVcNavigationInfo
app.RemotePluginVcNavigationInfo
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 |
Property | 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
app.RemotePluginViewNavigationOptions
app.RemotePluginViewNavigationOptions
Description | Specifies a destination view served by a different plug-in instance, and custom data for the view. |
Property | 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()
app.SessionInfo
app.SessionInfo
Description | Holds information about the current session of the vSphere Client . |
Property | 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()
app.UiApiEndpoint
app.UiApiEndpoint
Description | Holds the parsed elements of a plug-in URL. |
Property | Type | Required? | Notes |
---|---|---|---|
origin | string | info only | <protocol>://<hostname><port> |
pathname | string | info only | |
fullUrl | string | info only | <origin>/<pathname>?<queryParams> |
Used by: app.ApiEndpoints