Adaptive Search Actions

Adaptive Search actions implementation allows you to add your own menu actions using the ActionsMenu component.

The ActionMenu component extends the standard com.hybris.cockpitng.actions.CockpitAction component, which renders standard cockpit actions as menu items. The component consists of a button and a pop-up menu. Upon a click, the pop-up menu opens with the list of allowed actions. If none of the actions is allowed, the button is disabled.

Creating a new Action

Context

Follow the steps to implement the ActionMenu component and start using it.

Procedure

  1. Add the action configuration in the backoffice-config.xml file.
    <context component="as-promoted-results-actions">
        <y:actions xmlns:y="http://www.hybris.com/cockpit/config/hybris">
            <y:group qualifier="common">
                <y:action action-id="de.hybris.platform.adaptivesearchbackoffice.action.discardoverridepromotedresult" property="currentObject" />
                <y:action action-id="de.hybris.platform.adaptivesearchbackoffice.action.overridepromotedresult" property="currentObject" />
                <y:action action-id="de.hybris.platform.adaptivesearchbackoffice.action.unpromoteresult" property="currentObject" />
            </y:group>
        </y:actions>
    </context>
  2. Add the newly created component configuration to the *.zul file
    <actionsmenu inputValue="${result}" config="as-promoted-results-actions" >
        <custom-attributes viewModel="${vm}" />
    </actionsmenu>
  3. The configurable multi reference editor renders the menu actions by default. By convention, a component name follows the context name + actions pattern as you can see below.
    <editorArea:attribute qualifier="boostRules"
        editor="de.hybris.platform.adaptivesearchbackoffice.editor.configurablemultireference">
        <editorArea:editor-parameter>
            <editorArea:name>dataHandler</editorArea:name>
            <editorArea:value>asBoostRulesDataHandler</editorArea:value>
        </editorArea:editor-parameter>
        <editorArea:editor-parameter>
            <editorArea:name>context</editorArea:name>
            <editorArea:value>as-boost-rules-editor</editorArea:value>
        </editorArea:editor-parameter>
        <editorArea:editor-parameter>
            <editorArea:name>sortable</editorArea:name>
            <editorArea:value>true</editorArea:value>
        </editorArea:editor-parameter>
    </editorArea:attribute>
    <context component="as-boost-rules-editor">
        <list-view:list-view xmlns:list-view="http://www.hybris.com/cockpitng/component/listView">
            <list-view:column qualifier="boostType" />
            <list-view:column qualifier="boost" />
        </list-view:list-view>
    </context>
    <context component="as-boost-rules-editor-actions">
    
        <y:actions xmlns:y="http://www.hybris.com/cockpit/config/hybris">
            <y:group qualifier="common">
                <y:action action-id="de.hybris.platform.adaptivesearchbackoffice.action.deletereference" property="currentObject" />
            </y:group>
        </y:actions>
    </context>

    For details on configurable multi reference editor see Adaptive Search Editors.

Results

As a result a new action is present in the perspective.