VMware {code} Community
dharmeshj
Enthusiast
Enthusiast

How to Filter Property Constraint in HTML5 Plugin Implementation

Hi Folks,

I am trying to filter extension by Property Value using the "com.vmware.data.query.PropertyConstraint" <nestedConstraint> tag in "plugin.xml",

where a PropertyProviderAdapter is being implemented which returns the Property Value as boolean and matches the Property Name as String,

based on that the extension needs to be rendered, but in HTML5 these doesn't seem to work, please suggest any plausible ways to implement the

extension filter in HTML5 plugin.

Here is an sample example.

<extension id="com.vmware.samples.actions.vmActionSet">

           <extendedPoint>vise.actions.sets</extendedPoint>

                <object>

                     <actions>

                          <com.vmware.actionsfw.ActionSpec>

                               <uid>com.vmware.samples.actions.myVmAction1</uid>

                               <label>#{action1.label}</label>

                               <command className="com.vmware.samples.actions.VmActionCommand"/>

                          </com.vmware.actionsfw.ActionSpec>

                     </actions>

                </object>

           <metadata>

                     <objectType>Datastore</objectType>

                          <propertyConditions>

                               <com.vmware.data.query.CompositeConstraint>

                               <nestedConstraints>

                             

                                  <com.vmware.data.query.PropertyConstraint>

                                         <propertyName>summary.type</propertyName>

                                         <comparator>EQUALS</comparator>

                                 <comparableValue>

                                         <String>VMFS</String>

                                   </comparableValue>

                               </com.vmware.data.query.PropertyConstraint>

                               <com.vmware.data.query.PropertyConstraint>

                                    <propertyName>sampleDatastore</propertyName>

                                               <comparator>EQUALS</comparator>

                                         <comparableValue>

                                              <String>true</String>

                                         </comparableValue>

                               </com.vmware.data.query.PropertyConstraint>

                     </nestedConstraints>

                <conjoiner>AND</conjoiner>

           </com.vmware.data.query.CompositeConstraint>

      </propertyConditions>

   </metadata>

</extension>

Here sampleDatastore Returning true but filter is not working. Please provide some guidance.

Thanks in advance 🙂

11 Replies
Denis_Chorbadzh
VMware Employee
VMware Employee

Hi,

 

I think you should use:

<Boolean>true</Boolean> instead of <String>true</String>

 

Please check this out and share if things are not working so that we can investigate further.

 

Best Regards,

Denis

kumartade
Enthusiast
Enthusiast

We had verified with the suggested type. Still it is not working.

Please check out once.

We had tested on vSphere Client: 6.5U2

Reply
0 Kudos
kumartade
Enthusiast
Enthusiast

We are waiting for the solution here.

Please look into this.

Reply
0 Kudos
stoevm
VMware Employee
VMware Employee

Hi all,

Have you tested that the action ais working without the propertyConstration(i.e. if the filtering functionality is droped) ?
Also can you share with us which documentation are you using ? 

Best,
Martin

Reply
0 Kudos
kumartade
Enthusiast
Enthusiast

Hi Martin,

Yes.

The action/summaryPortlets are working without custom Property Constraint.

But if I use the custom property constraint as shown below it is not working.

<com.vmware.data.query.PropertyConstraint>

     <propertyName>sampleDatastoreProperty</propertyName>

     <comparator>EQUALS</comparator>

     <comparableValue>

          <Boolean>true</Boolean>

      </comparableValue>

</com.vmware.data.query.PropertyConstraint>

(or)

<com.vmware.data.query.PropertyConstraint>

     <propertyName>sampleDatastoreProperty</propertyName>

     <comparator>EQUALS</comparator>

     <comparableValue>

          <String>true</String>

      </comparableValue>

</com.vmware.data.query.PropertyConstraint>

and it is also working with the vSphere native property as a constraint as well.

<com.vmware.data.query.PropertyConstraint>

   <propertyName>summary.type</propertyName>

      <comparator>EQUALS</comparator>

      <comparableValue>

           <String>VMFS</String>

       </comparableValue>

</com.vmware.data.query.PropertyConstraint>

We are following vSphere SDK only

vSphere 6.5U2: Online Documentation - vSphere Client SDK Developer Guide - VMware {code}

VSphere 6.7 SDK: Online Documentation - Developing Local Plug-ins with the vSphere Client SDK - VMware {code}

I don't think VMWare had provided a detailed documentation for latest release also.

Some of the available documentation needs to be updated, one documentation update missing example is SummaryViews Extension Height &amp; Width of Portlet is not Reflecting in Plugin Mode  query.

Does VMWare provided any other documentation other than the above one???? If so please share us.

NOTE: All these constraints(custom property/vmware property/both) are used to work in flex client with flex SDK.

Regards,

Kumar T.

Reply
0 Kudos
stoevm
VMware Employee
VMware Employee

Hi Kumar,

This might be a bug in our code base. 
But to be able to debug it i will have to reproduce it.
Can you reproduce this fast in some of the vSphere Client SDK samples, since it will take me some time ? 

That is the offical SDK documentation and thanks for the documentation feedback, we are working on documentation improvements.

Best,
Martin

Reply
0 Kudos
kumartade
Enthusiast
Enthusiast

Hi Martin,

Sorry to say this. We don't have ready sample to share.

This is pretty straight forward case to code by yourselves and verify.

Please provide us a solution/workaround for this.

If this is a bug we need to know the effected vSphere Client versions.

Regards,

Kumar T.

Reply
0 Kudos
_vladi_
VMware Employee
VMware Employee

Hi Kumar,

We just verified PropertyConstraints based on custom properties work as expected on the HTML Client so this does not look like a Client bug.

The 6.5 U1 and earlier SDKs contain a WSSDK sample with the exact same action use case demonstrated. There are also 2 proposed implementations: one based on PropertyConstraint and another on conditionalProperty. Both work with custom and predefined properties.

Indeed, documentation on these is not ideal but we are continuously improving it. That said, extension filtering is supported but no longer recommended for UX and performance reasons (preferred way is to have the element available and display a warning if not applicable).

In your case most likely there are issues with your property provider or the definition of your property. Unfortunately, the provided data is insufficient for us to help you.

Let me now make some general notes:

This is a free forum and commenting VMware engineers have no Legal right to disclose code samples here. If what you are after is official support, SLAs, code workarounds, etc. better file a DCPN support case.

This forum is great if you want to share feedback and get help from a very responsive community. Hence, if you claim there is a bug it is best to provide the required info and reproduction scenario to facilitate troubleshooting. Usually, this includes some relevant code, logs, Client version(s) on which it is reproducible, etc.

Normally, folks also reproduce the bug using one of the existing SDK samples to make their point. This helps a lot in untangling whether the problem lies in the plugin code or the SDK/platform which is in everyone's best interest.

In this instance you have provided a piece of xml without indication of how you test it, whether you have a PropertyProviderAdapter, whether it is registered properly and no testing if it ever gets called. If the problem is how providers work - detailed documentation on this exists in the links you specified (section "Extending the Data Service with a Data Service Adapter") and any SDK contains at least one sample of Property or Data providers.

I believe this is the minimal effort & information required by anyone to help so let's dig into these technicalities together than jump to conclusions.

Cheers,

Vladi

Reply
0 Kudos
kumartade
Enthusiast
Enthusiast

Thanks Vladi for the confirmation. I understand the concerns and limitations here. We though it would be some simple mistake like SummaryViews Extension Height &amp; Width of Portlet is not Reflecting in Plugin Mode

We got a suggestion from one of the community user like "<Boolean>true</Boolean> instead of <String>true</String>". Hence, we assumed this would be simple error and provided extension snippet.

The adapter is being called and we can see the log statement of adapter in vSphere client log.

We will provide the logs and psuedo code of property adapter  where the adapter is being called.

If feasible to reproduce, we will provide a sample as well

Thanks,

Kumar T.

Reply
0 Kudos
_vladi_
VMware Employee
VMware Employee

Cool, I understand. Let's do it the way you specified.

If there is any piece of code that contains sensitive information you can also send it over personal message.

Cheers,

Vladi

Reply
0 Kudos
kumartade
Enthusiast
Enthusiast

Thanks Vladi.

We are able to resolve the issue and property constraint is working as expected.