VMware {code} Community
mheidemeyer
Contributor
Contributor

HTML plugin: htmlClientSdk.app.getContextObjects is not a function in vSphere 6.7

I'm looking at the HTML sample that is using Angular:

When opening the edit dialog, it's passing the Chassis-to-be-edited as a ContextObject:

config.contextObjects = this.selectedChassis.map((value) => {

return Object.assign(new Chassis(), value);
});

this.chassisService.htmlClientSdk.modal.open(config);

In the create-edit component the sample is then setting this Chassis object via:

if (this.isEditAction()) {

  (<any>Object).assign(this.chassis,
   this.chassisService.htmlClientSdk.app.getContextObjects()[0]);
}

We're trying to follow the exact same workflow, however it looks like the htmlClientSdk has changed in 6.7. When opening the modal, I'm seeing the following error in the console:

core.es5.js:1020 ERROR Error: Uncaught (in promise): TypeError: this.htmlClientSdkService.htmlClientSdk.app.getContextObjects is not a function

TypeError: this.htmlClientSdkService.htmlClientSdk.app.getContextObjects is not a function

When looking at the sources of htmlClientSdk.app, in I can see that the JavaScript API (the methods available under htmlClientSdk.app) has changed. These are the available methods I see in h5SdkApplicationService.ts:

public navigateTo: (options: NavigationOptions) => void;

      /**

       * returns the user session data

       * provided by the user session service

       * @see {@link UserSessionService}

       * @returns {IPromise<any>}

       */

      public getUserSession: () => IPromise<any>;

      /**

       * Returns specific information about the client

       * @returns {{type: string, version: string}}

       */

      public getClientInfo: () => ClientInfo;

      /**

       * Returns the context object id of the current object

       * @returns string representing the current context object

       */

      public getContextObjectId: () => string | null;

      /** Returns the current vSphere Client locale

       * @returns string the client locale

       */

      public getClientLocale:() => string;

Where is getContextObjects?

0 Kudos
2 Replies
Denis_Chorbadzh
VMware Employee
VMware Employee

Hi,

 

Thank you for your feedback.

Looking at the vSphere 6.7 GA HTML Client, there is a "getContextObjects" function in the htmlClietSdk object.

Can you please share the exact version of the vSphere Client that you are using?

 

Best Regards,

Denis

0 Kudos
mheidemeyer
Contributor
Contributor

This is what I see under Help -> About VMware vSphere:

Version 6.7.0.1150

0 Kudos