VMware {code} Community
abhishekdubey
Enthusiast
Enthusiast

Disable Context menu on VM works in Flex, HTML5 menu itself getting disappeared .

Hi have used meta-data filtering to disable my context menu operation on VM using following constraint:-

-----------------------------------------------------------------------

  <metadata>

<!-- This filters the actions to be visible only on Chassis -->

<objectType>VirtualMachine</objectType>

<propertyConditions>

<com.vmware.data.query.CompositeConstraint>

<nestedConstraints>

<com.vmware.data.query.PropertyConstraint>

<propertyName>mycondition</propertyName>

<comparator>EQUALS</comparator>

<comparableValue>

<Boolean>true</Boolean>

</comparableValue>

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

</nestedConstraints>

<conjoiner>AND</conjoiner>

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

</propertyConditions>

      </metadata>

-----------------------------------------------------------------------

It is working as expected in Flex however in HTML5  context menu itself getting disappeared in case of condition is false.

Is this is a by design behavior for HTML5 or is it a bug..?

Tags (2)
0 Kudos
5 Replies
Denis_Chorbadzh
VMware Employee
VMware Employee

Hi,

It is expected that the action is not visible in the UI.

In addition, it is not recommended to use filtering such as the one demonstrated.

It is better to use <conditionalProperty> if you want to display actions based on a condition.

You can see the "vsphere-wssdk-sample" from 6.5 Update 1 SDK.

 

Regards,

Denis

0 Kudos
abhishekdubey
Enthusiast
Enthusiast

Hi Denis ,

When i use <conditionalProperty>roleVMRestore</conditionalProperty>

I am not recieving query to my PropertyProviderAdapter.

I believe the conditional property will work on following cases :

1) action menus on plugin custom objects with their defined properties

2) action menus on VMWare objects only with native properties to vSphere Objects

However, in my use-case, i need to enable/disable context menu on vSphere Objects but based on my own custom properties.

And for that, I am using PropertyProviderAdapter using following metaData

===================================================================================================================================

<metadata>

         <!-- This filters the actions to be visible only on Chassis -->

         <objectType>VirtualMachine</objectType>

          <propertyConditions>

            <com.vmware.data.query.CompositeConstraint>

               <nestedConstraints>

                  <com.vmware.data.query.PropertyConstraint>

                     <propertyName>roleVMRestore</propertyName>

                     <comparator>EQUALS</comparator>

                     <comparableValue>

                        <Boolean>true</Boolean>

                     </comparableValue>

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

               </nestedConstraints>

               <conjoiner>AND</conjoiner>

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

         </propertyConditions>

      </metadata>

===================================================================================================================================

This is working fine in Flex i;e disabling the context menu conditionally but the same code is not behaving similarly in HTML UI.

Instead of disabling it removes the context menu itself.

Can you Please confirm the behavior or workaround for the issue.

0 Kudos
Denis_Chorbadzh
VMware Employee
VMware Employee

Hi,

 

Using <propertyConditions> should currently work as you have described it. There is actually a known issue in the HTML Client that the filtered actions are not greyed out (disabled) but just disappear. We are working on the issue.

Apart from that, using <conditionalProperty> should work for vSphere objects using a custom property. We have demonstrated this in our vsphere-wssdk sample plugin from vSphere 6.5U1 SDK. It uses custom property to filter VM actions.

Please look at the sample's code and compare it with yours. If you still have some issues, please send us the full logs and specify the versions of your vSphere Client and vCenter.

 

Best Regards,

Denis

0 Kudos
kumartade
Enthusiast
Enthusiast

is this fixed on vsphere 6.5U2 and 6.7?

0 Kudos
Denis_Chorbadzh
VMware Employee
VMware Employee

Unfortunately, no. We are currently working on this and it should be fixed in a future release.
0 Kudos