Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mass Actions with Childs don't work in CMS #9854

Closed
bvboas opened this issue Jun 6, 2017 · 11 comments
Closed

Mass Actions with Childs don't work in CMS #9854

bvboas opened this issue Jun 6, 2017 · 11 comments
Labels
Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Progress: done

Comments

@bvboas
Copy link

bvboas commented Jun 6, 2017

When we try to add a new option in Mass Actions for CMS pages and blocks, child options do not work as expected.

When in Catalog/Products we can choose "Actions/Change Status" and than two items appear "Enable/Disable".

We cannot replicate this behavior in CMS pages/blocks.

Preconditions

  1. Magento 2.1.6

Steps to reproduce

  1. create a file cms_block_listing.xml in view/adminhtml/ui_component/
  2. Example:
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <listingToolbar name="listing_top">
        <massaction name="listing_massaction">
            <action name="status">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="type" xsi:type="string">status</item>
                        <item name="label" xsi:type="string" translate="true">Change status</item>
                    </item>
                </argument>
                <argument name="actions" xsi:type="array">
                    <item name="0" xsi:type="array">
                        <item name="type" xsi:type="string">enable</item>
                        <item name="label" xsi:type="string" translate="true">Enable</item>
                        <item name="url" xsi:type="url" path="catalog/product/massStatus">
                            <param name="status">1</param>
                        </item>
                    </item>
                    <item name="1" xsi:type="array">
                        <item name="type" xsi:type="string">disable</item>
                        <item name="label" xsi:type="string" translate="true">Disable</item>
                        <item name="url" xsi:type="url" path="catalog/product/massStatus">
                            <param name="status">2</param>
                        </item>
                    </item>
                </argument>
            </action>
        </massaction>
    </listingToolbar>
</listing>
  1. Flush cache

Expected result

  1. Choose the option "Enable / Disable"

Actual result

  1. Form is submitted

###Additional Info
Tested in a Magento app skeleton

@tkacheva
Copy link

tkacheva commented Jun 23, 2017

@bvboas Changing page and blocks status happens from the grid column. Pagers are different from Products
screen shot 2017-06-23 at 3 42 38 pm

@bvboas
Copy link
Author

bvboas commented Jun 23, 2017

Hi @tkacheva ,

Changing status was an example of a possible mass actions with children elements we would like to add.

We want to select a few or all blocks/pages and duplicate them or copying them to another store view. The process would be: Select the desired pages, go to the actions menu, choose "Copy to Store View" and then in a submenu list the existing store views. That is currently not achievable

Thanks

@tkacheva
Copy link

@bvboas Now it's clear what you want to achieve. @que-etc will look into it.

@que-etc
Copy link
Contributor

que-etc commented Jun 26, 2017

Hi, @bvboas.

There is just one tweak you need to make. Swap out the default MassActions component (Magento_Ui/js/grid/massactions) for the one that handles nested actions.

So, the resulting config will look like the following:

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <listingToolbar name="listing_top">
        <massaction name="listing_massaction">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>
                </item>
            </argument>
            <action name="status">
                <!-- ... -->
            </action>
        </massaction>
    </listingToolbar>
</listing>

@bvboas
Copy link
Author

bvboas commented Jun 26, 2017

@que-etc Thanks. That did it.

@bvboas bvboas closed this as completed Jun 26, 2017
@bvboas
Copy link
Author

bvboas commented Jun 27, 2017

I spoke too soon ...

If you have two items in the dropdown that have childrens and you click on the second, the displayed confirmation message and post params will be from the first one.

Steps to reproduce the error

  1. open the file customer_listing.xml

  2. Duplicate the action "assign_to_group"

<action name="assign_to_group">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="type" xsi:type="string">assign_to_group</item>
            <item name="label" xsi:type="string" translate="true">Assign a Customer Group</item>
        </item>
    </argument>
    <argument name="actions" xsi:type="configurableObject">
    <argument name="class" xsi:type="string">Magento\Customer\Ui\Component\MassAction\Group\Options</argument>
        <argument name="data" xsi:type="array">
            <item name="urlPath" xsi:type="string">customer/index/massAssignGroup</item>
            <item name="paramName" xsi:type="string">group</item>
            <item name="confirm" xsi:type="array">
                <item name="title" xsi:type="string" translate="true">Assign a Customer Group</item>
                <item name="message" xsi:type="string" translate="true">Are you sure to assign selected customers to new group?</item>
            </item>
        </argument>
    </argument>
</action>
  1. and give it another name.
<action name="assign_to_group_duplicated">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="type" xsi:type="string">assign_to_group_duplicated</item>
            <item name="label" xsi:type="string" translate="true">Assign a Customer Group Duplicated</item>
        </item>
    </argument>
    <argument name="actions" xsi:type="configurableObject">
    <argument name="class" xsi:type="string">Magento\Customer\Ui\Component\MassAction\Group\Options</argument>
        <argument name="data" xsi:type="array">
            <item name="urlPath" xsi:type="string">customer/index/massAssignGroup</item>
            <item name="paramName" xsi:type="string">group</item>
            <item name="confirm" xsi:type="array">
                <item name="title" xsi:type="string" translate="true">Assign a Customer Group Duplicated</item>
                <item name="message" xsi:type="string" translate="true">Are you sure to assign selected customers to new group Duplicated?</item>
            </item>
        </argument>
    </argument>
</action>
  1. Refresh cache

Result

When clicking on the child elements from the duplicated massAction, the message that shows up is from the first massAction

@bvboas bvboas reopened this Jun 27, 2017
@que-etc
Copy link
Contributor

que-etc commented Jun 27, 2017

Yep, I can confirm it. I'll create an internal ticket. Thanks!

@vil11
Copy link

vil11 commented Jun 27, 2017

Internal tickets MAGETWO-70294 / MAGETWO-70295.

@que-etc
Copy link
Contributor

que-etc commented Jun 27, 2017

@bvboas So, I've found out what causes this bug. It happens when some actions have the same value of the type property. And this is related not only to elements on the same level but also to those which are located in parallel nodes or somewhere else in a hierarchy.

<action name="actions_name">
    <!-- ... -->
    <argument name="actions" xsi:type="array">
        <item name="0" xsi:type="array">
            <item name="type" xsi:type="string">enable</item>
            <item name="label" xsi:type="string" translate="true">Enable</item>
        </item>
        <item name="1" xsi:type="array">
            <item name="type" xsi:type="string">disable</item>
            <item name="label" xsi:type="string" translate="true">Disable</item>
        </item>
    </argument>
</action>

<action name="actions_name_duplicated">
    <!-- ... -->
    <argument name="actions" xsi:type="array">
        <item name="0" xsi:type="array">
            <!-- action with the type "enabled" is already present in the parallel node -->
            <item name="type" xsi:type="string">enable</item>
            <item name="label" xsi:type="string" translate="true">Enable</item>
        </item>
        <item name="1" xsi:type="array">
            <item name="type" xsi:type="string">disable</item>
            <item name="label" xsi:type="string" translate="true">Disable</item>
        </item>
    </argument>
</action>

Thus, as a makeshift solution until we deliver the fix, you can ensure that all actions have a unique type value.

@bvboas
Copy link
Author

bvboas commented Jun 27, 2017

@que-etc thanks. added a workaround and works.

cpartica pushed a commit that referenced this issue Jul 14, 2017


- Change action's reference in the unit test
cpartica pushed a commit that referenced this issue Jul 14, 2017
Fixed issues:
- MAGETWO-57995 [GITHUB] Simple product videos display the thumbnail image rather than the embedded video player. #6360
- MAGETWO-57070 [GitHub] Locale\Format throws away country part, results in wrong number format #5073
- MAGETWO-69854 Can't set allowed or default currencies using config:set command
- MAGETWO-66627 [GitHub] Default Post Code is applied for all Order's addresses if zip is not required
- MAGETWO-66906 Deprecate setup:store-config:set command
- MAGETWO-67274 Can't set value using config:set on uninstalled instance
- MAGETWO-70294 [GitHub] Mass Actions with Childs don't work in CMS #9854
- MAGETWO-70216 Remove section i18n from shared file (config.php)
- MAGETWO-59514 Hard coded "tax_region_id" in the \Magento\Tax\Setup\InstallData
@magento-engcom-team magento-engcom-team added G1 Passed Progress: needs update Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed and removed Progress: needs update labels Sep 29, 2017
@magento-engcom-team magento-engcom-team added the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Oct 2, 2017
@magento-engcom-team
Copy link
Contributor

@bvboas, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.1.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Progress: done
Projects
None yet
Development

No branches or pull requests

5 participants