You can extend the action menu of an object by adding a nested solution menu. The solution menu can contain actions, additional nested menus, and separators. You can extend an action menu by defining a Solution Menu extension in the plugin.xml manifest file of your plug-in module.

All Solution Menu extensions that you create use a common extension point in the vSphere Web Client extension framework, called vsphere.core.menus.solutionMenus. The extension definition must provide an extension object of type com.vmware.actionsfw.ActionMenuItemSpec.

The ActionMenuItemSpec object represents the new solution menu nested in an object action menu. In the solution menu object, you define an array of additional ActionMenuItemSpec objects to represent actions, nested menus, and separators.

The following table shows the properties of the ActionMenuItemSpec object that you must set for your nested solution menu extension.

Property

Type

Description

<label>

string

String that appears as the text label for the nested solution menu. The string can be hard-coded, or it can be a dynamic resource string included in your plug-in module.

<uid>

string

The unique identifier for the nested solution menu. A best practice is to use the English label for the nested solution menu in camel case.

<children>

array

An array of additional ActionMenuItemSpec objects. Each ActionMenuItemSpec child object can represent an action, a nested menu, or a separator.

You associate your Solution Menu extension with a particular type of vSphere or custom object. A best practice is to use the vSphere Web Client extension filtering mechanism to ensure that the actions are only visible when the user selects the relevant type of vSphere object. See Filtering Extensions.

Note

If you omit the <metadata> element for extension filtering in your Solution Menu extension definition, your Solution Menu is shown for all vSphere objects. Use the <metadata> element in your Solution Menu extension definition to ensure that your Solution Menu appears only for the correct type of vSphere or custom objects.

The following example shows a Solution Menu extension definition. In the example, the extension adds a nested solution menu to the action menu for VirtualMachine objects.

<!-- Defines a solution sub-menu on VirtualMachine objects -->
<extension id="com.vmware.samples.actions.submenus">
   <extendedPoint>vsphere.core.menus.solutionMenus</extendedPoint>
   <object>
      <label>#{allSampleActions.label}</label>
      <uid>allSampleVMActions</uid>
      <children>
         <Array>
         <!-- array of ActionMenuItemSpec objects, which are items in the Solution Menu -->
            <com.vmware.actionsfw.ActionMenuItemSpec>
            ...
            </com.vmware.actionsfw.ActionMenuItemSpec>
            <com.vmware.actionsfw.ActionMenuItemSpec>
            ...
            </com.vmware.actionsfw.ActionMenuItemSpec>
         </Array>
      </children>
   </object>
   <metadata>
      <objectType>VirtualMachine</objectType>
   </metadata>
</extension>

You can add items to a nested solution menu by using the <children> property in your Solution Menu extension’s ActionMenuItemSpec object. In the <children> property, you can add one or more additional ActionMenuItemSpec objects to represent each item.

To add an action to your solution sub-menu, you create a child ActionMenuItemSpec object with the properties listed in the following table.

Property

Type

Description

<label>

string

String that appears as the text label for the action. The string can be hard coded, or it can be a dynamic resource string included in your plug-in module.

<uid>

string

Unique identifier for the action. The action UID must match the UID you set for the action when you defined it using the ActionSpec object. See Defining Individual Actions for Flex-Based Action Extensions.

<type>

string

Type parameter for the item to add to the nested solution menu. For an action, <type> must be set to the string action.

The following example shows a nested solution menu with two action items as child objects.

<!-- Defines a solution sub-menu on VirtualMachine objects -->
<extension id="com.vmware.samples.actions.submenus">
<extendedPoint>vsphere.core.menus.solutionMenus</extendedPoint>
<object>
<label>#{allSampleActions.label}</label>
<uid>allSampleVMActions</uid>
<children>
<Array>
<!-- array of ActionMenuItemSpec objects, which are items in the Solution Menu -->
<com.vmware.actionsfw.ActionMenuItemSpec>
<!-- first action -->
<type>action</type>
<uid>com.vmware.samples.actions.myVmAction1</uid>
<label>#{action1.label}</label>
</com.vmware.actionsfw.ActionMenuItemSpec>
<com.vmware.actionsfw.ActionMenuItemSpec>
<!-- second action -->
<type>action</type>
<uid>com.vmware.samples.actions.myVmAction1</uid>
<label>#{action1.label}</label>
</com.vmware.actionsfw.ActionMenuItemSpec>
</Array>
</children>
</object>
<metadata>
<objectType>VirtualMachine</objectType>
</metadata>
</extension>

To add a separator to your nested solution menu, you create a child ActionMenuItemSpec object with a <type> property which value must be set to the string separator.

To add an action to your nested solution menu, you create a child ActionMenuItemSpec object with the following properties.

Property

Type

Description

<label>

string

String that appears as the text label for the nested solution menu. The string can be hard-coded, or it can be a dynamic resource string included in your plug-in module.

<uid>

string

The unique identifier for the nested solution menu. A best practice is to use the English label for the nested solution menu in camel case.

<children>

array

An array of additional ActionMenuItemSpec objects. Each ActionMenuItemSpec child object can represent an action, a nested menu, or a separator.

The following example shows a solution menu that adds a Solution Menu extension for VirtualMachine objects. The nested solution menu includes a subordinate nested menu called Configuration with two actions, a separator, and an additional action.

<!-- Defines a solution sub-menu on VirtualMachine objects -->
<extension id="com.vmware.samples.actions.submenus">
<extendedPoint>vsphere.core.menus.solutionMenus</extendedPoint>
<object>
<label>#{allSampleActions.label}</label>
<uid>allSampleVMActions</uid>
<children>
<Array>
<!-- array of ActionMenuItemSpec objects, which are items in the Solution Menu -->
 
<!-- add a nested sub-menu called "configuration" -->
<com.vmware.actionsfw.ActionMenuItemSpec>
<uid>configuration</uid>
<label>#{configurationMenu.label}
<children>
<array>
<!-- first action in sub-menu -->
<com.vmware.actionsfw.ActionMenuItemSpec>
<type>action</type>
<uid>com.vmware.samples.actions.myVmAction1</uid>
<label>#{action1.label}</label>
</com.vmware.actionsfw.ActionMenuItemSpec>
 
<!-- second action in sub-menu -->
<com.vmware.actionsfw.ActionMenuItemSpec>
<!-- second action -->
<type>action</type>
<uid>com.vmware.samples.actions.myVmAction1</uid>
<label>#{action1.label}</label>
</com.vmware.actionsfw.ActionMenuItemSpec>
</array>
</children>
</com.vmware.actionsfw.ActionMenuItemSpec>
 
<!-- add a separator after the sub-menu -->
<com.vmware.actionsfw.ActionMenuItemSpec>
<type>separator</type>
</com.vmware.actionsfw.ActionMenuItemSpec>
 
<!-- add an additional action -->
<com.vmware.actionsfw.ActionMenuItemSpec>
<type>action</type>
<uid>com.vmware.samples.actions.myVmAction3</uid>
<label>#{action3.label}</label>
</com.vmware.actionsfw.ActionMenuItemSpec>
</Array>
</children>
</object>
<metadata>
<objectType>VirtualMachine</objectType>
</metadata>
</extension>