vSphere

 View Only
  • 1.  Help with use of NavigationRequest in the UI

    Posted Dec 22, 2013 11:42 PM

    Hi,

    I would like to understand the use of NavigationRequest - I saw this example in the vmware samples where we can create custom links whose click can navigate to object specific pages

    /////////////////////////////////////////////////////////////////////////////////////////////

    private function onLinkButtonClick(click:MouseEvent):void {

          // Jump to the Settings view

          var event:NavigationRequest = new NavigationRequest();

          event.targetViewUid = "com.vmware.samples.chassisCollection3.domainView"

          //event.context = ?????

          dispatchEvent(event);

       }

    /////////////////////////////////////////////////////////////////////////////////////////////

    The above navigation results in the global page - https://localhost:9443/vsphere-client/#extensionId=com.vmware.samples.chassisCollection3.domainView

    However, there are other specific pages to which we would like navigation links. For example, in the above example, if we wanted to navigate to a specific context (say the chassis => summary page) like the following "https://localhost:9443/vsphere-client/#extensionId=com.vmware.samples.chassis.summary;context=com.vmware.core.model%3A%3…", then setting up the NavigationRequest seems to be tricky. It appears that it involves setting up the "event.context" to the "right" IResourceReference object.

    My question is => How does one get access to the IResourceReference reference to a custom object in a view which does not carry the reference to the custom object. Can one derive the IResourceReference from the URI of a custom object? Please highlight the possibilities here.

    Any help is appreciated.

    Thank you



  • 2.  RE: Help with use of NavigationRequest in the UI

    Broadcom Employee
    Posted Dec 23, 2013 03:21 AM

    Right, in order to navigate to a particular object's page event.context must be set to that object reference.

    You either have cached that object reference somewhere else, or you can get it from the URI using a server call to ObjectReferenceService as explained in this older post:

    Re: Providing Navigation to vSphere objects



  • 3.  RE: Help with use of NavigationRequest in the UI

    Posted Dec 24, 2013 03:10 AM

    Hi laurentsd,

    Thank you for the answer. I am still a bit stuck on the object reference and how it is connected to things like ModelObjectUriResolver. What is "Uri" and what is this "context object reference" and how are these 2 entities connected in the vsphere environment? While creating a custom object (assuming we have a unique identifier from our end for every custom object that we create), what are the different things that we need to do in order to behave well like a native vsphere object - Things like getReference (which creates a new reference for the custom object as the DOC says), createUri (also creates a new reference for our object).

    My apologies if my question is unclear because my understanding here is really clouded.

    After implementing the navigation request, I am finding that I do get back a nice context object from the service layer but it looks different from the context object that I see through one of the mediators for the same object (clearly suggesting that the internal references are somehow not right)

    This is how our object looks when I click on the object from our "Objects" list view - fvp:CustomObject;urn:fvp:fvp:CustomObject:server1/CustomObject-ffad21f5-47d7-4861-8c6b-73b5dc7cb860

    This is how our object looks when I do a getReference service call - fvp:CustomObject;urn:vri:fvp:CustomObject:1F99EE73-6FD5-471F-ABB5-3F90787EB76D/CustomObject-ffad21f5-47d7-4861-8c6b-73b5dc7cb860!_1F99EE73-6FD5-471F-ABB5-3F90787EB76D

    Any help is appreciated.

    Thank you.



  • 4.  RE: Help with use of NavigationRequest in the UI

    Posted Dec 24, 2013 06:54 PM

    Hi laurentsd,

    Essentially, I think my question is how do I convert a URI to an IResourceReference in the UI code?

    Thank you



  • 5.  RE: Help with use of NavigationRequest in the UI
    Best Answer

    Broadcom Employee
    Posted Dec 24, 2013 07:34 PM

    That's what is explained in the other thread: Re: Providing Navigation to vSphere objects

    You need to call the ObjectReferenceService to do that conversion.



  • 6.  RE: Help with use of NavigationRequest in the UI

    Posted Dec 24, 2013 09:41 PM

    Hi laurentsd,

    That worked after I put my custom object in the "vri" namespace (our own namespace was making our custom object not be returned through the vimObjectReferenceService.getReference()). That was not very obvious to me.

    Thank you.



  • 7.  RE: Help with use of NavigationRequest in the UI

    Broadcom Employee
    Posted Dec 25, 2013 01:18 AM

    You shouldn't need to use the vri namespace, see the chassis-app samples which use "urn:cr".



  • 8.  RE: Help with use of NavigationRequest in the UI

    Posted Dec 24, 2014 02:38 PM

    I am still not able to figure out how we should implement getReference for custom object? If vimObjectReference.getReference is applicable for vsphere objects only, then how one should implement getReference for custom object.