Skip to content

Commit

Permalink
ENGCOM-8211: [Fixed] - resolve issue with filter visibility with colu…
Browse files Browse the repository at this point in the history
…mn visibility in grid #28385
  • Loading branch information
sidolov committed Oct 5, 2020
2 parents 17603f2 + 2538135 commit 814639b
Show file tree
Hide file tree
Showing 36 changed files with 384 additions and 245 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<label translate="true">Status</label>
<dataScope>status</dataScope>
<imports>
<link name="visible">componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public function getOptions(array $optionIds, ?int $storeId, array $attributeCode
'attribute_label' => 'a.frontend_label',
]
)
->joinLeft(
['attribute_label' => $this->resourceConnection->getTableName('eav_attribute_label')],
"a.attribute_id = attribute_label.attribute_id AND attribute_label.store_id = {$storeId}",
[
'attribute_store_label' => 'attribute_label.value',
]
)
->joinLeft(
['options' => $this->resourceConnection->getTableName('eav_attribute_option')],
'a.attribute_id = options.attribute_id',
Expand Down Expand Up @@ -119,7 +126,8 @@ private function formatResult(\Magento\Framework\DB\Select $select): array
$result[$option['attribute_code']] = [
'attribute_id' => $option['attribute_id'],
'attribute_code' => $option['attribute_code'],
'attribute_label' => $option['attribute_label'],
'attribute_label' => $option['attribute_store_label']
? $option['attribute_store_label'] : $option['attribute_label'],
'options' => [],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<label translate="true">Store View</label>
<dataScope>store_id</dataScope>
<imports>
<link name="visible">componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<label translate="true">Store View</label>
<dataScope>store_id</dataScope>
<imports>
<link name="visible">componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<label translate="true">Status</label>
<dataScope>status</dataScope>
<imports>
<link name="visible">componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
<element name="multicheck" type="checkbox" selector="#container>div>div.admin__data-grid-wrap>table>thead>tr>th.data-grid-multicheck-cell>div>label"/>
<element name="multicheckTick" type="checkbox" selector="#container>div>div.admin__data-grid-wrap>table>thead>tr>th.data-grid-multicheck-cell>div>input"/>
<element name="delete" type="button" selector="//*[contains(@class, 'admin__data-grid-header')]//span[contains(@class,'action-menu-item') and text()='Delete']"/>
<element name="actions" type="text" selector=".action-select"/>
<element name="customerCheckbox" type="button" selector="//*[contains(text(),'{{arg}}')]/parent::td/preceding-sibling::td/label[@class='data-grid-checkbox-cell-inner']//input" parameterized="true"/>
<element name="ok" type="button" selector="//button[@data-role='action']//span[text()='OK']"/>
<element name="addNewAddress" type="button" selector=".add-new-address-button" timeout="30"/>
<element name="actions" type="text" selector=".admin__data-grid-header-row .action-select"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<label translate="true">Status</label>
<dataScope>status</dataScope>
<imports>
<link name="visible">componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSelectFieldToColumnActionGroup">
<annotations>
<description>Select or clear the checkbox to display the column on the Orders grid page.</description>
</annotations>
<arguments>
<argument name="column" type="string" defaultValue="Purchase Point"/>
</arguments>
<click selector="{{AdminOrdersGridSection.columnsDropdown}}" stepKey="openColumnsDropdown" />
<click selector="{{AdminOrdersGridSection.viewColumnCheckbox(column)}}" stepKey="disableColumn"/>
<click selector="{{AdminOrdersGridSection.columnsDropdown}}" stepKey="closeColumnsDropdown" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<element name="idFilter" type="input" selector=".admin__data-grid-filters input[name='increment_id']"/>
<element name="selectStatus" type="select" selector="select[name='status']" timeout="60"/>
<element name="billToNameFilter" type="input" selector=".admin__data-grid-filters input[name='billing_name']"/>
<element name="purchasePoint" type="select" selector=".admin__data-grid-filters select[name='store_id']"/>
<element name="enabledFilters" type="block" selector=".admin__data-grid-header .admin__data-grid-filters-current._show"/>
<element name="clearFilters" type="button" selector=".admin__data-grid-header [data-action='grid-filter-reset']" timeout="30"/>
<element name="applyFilters" type="button" selector="button[data-action='grid-filter-apply']" timeout="30"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminVerifyFieldToFilterOnOrdersGridTest">
<annotations>
<features value="Sales"/>
<stories value="Github issue: #28385 Resolve issue with filter visibility with column visibility in grid"/>
<title value="Verify field to filter"/>
<description value="Verify not appear fields to filter on Orders grid if it disables in columns dropdown."/>
<severity value="MAJOR"/>
</annotations>

<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin" />
</before>

<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout" />
</after>

<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="goToOrders"/>
<actionGroup ref="AdminSelectFieldToColumnActionGroup" stepKey="unSelectPurchasePoint" />
<click selector="{{AdminOrdersGridSection.filters}}" stepKey="openColumnsDropdown" />
<dontSeeElement selector="{{AdminOrdersGridSection.purchasePoint}}" stepKey="dontSeeElement"/>

<click selector="{{AdminOrdersGridSection.filters}}" stepKey="closeColumnsDropdown" />
<actionGroup ref="AdminSelectFieldToColumnActionGroup" stepKey="selectPurchasePoint" />
<click selector="{{AdminOrdersGridSection.filters}}" stepKey="openColumnsDropdown2" />
<seeElement selector="{{AdminOrdersGridSection.purchasePoint}}" stepKey="seeElement"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<label translate="true">Purchased From</label>
<dataScope>store_id</dataScope>
<imports>
<link name="visible">componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<label translate="true">Purchase Point</label>
<dataScope>store_id</dataScope>
<imports>
<link name="visible">ns = ${ $.ns }, componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<label translate="true">Purchased From</label>
<dataScope>store_id</dataScope>
<imports>
<link name="visible">componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<label translate="true">Purchased From</label>
<dataScope>store_id</dataScope>
<imports>
<link name="visible">ns = ${ $.ns }, componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<label translate="true">Purchased From</label>
<dataScope>store_id</dataScope>
<imports>
<link name="visible">ns = ${ $.ns }, componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<label translate="true">Purchased From</label>
<dataScope>store_id</dataScope>
<imports>
<link name="visible">ns = ${ $.ns }, componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<label translate="true">Purchased From</label>
<dataScope>store_id</dataScope>
<imports>
<link name="visible">ns = ${ $.ns }, componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<label translate="true">Store View</label>
<dataScope>store_id</dataScope>
<imports>
<link name="visible">ns = ${ $.ns }, componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand All @@ -76,7 +76,7 @@
<label translate="true">Website</label>
<dataScope>website_id</dataScope>
<imports>
<link name="visible">ns = ${ $.ns }, componentType = column, index = ${ $.index }:visible</link>
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
</imports>
</settings>
</filterSelect>
Expand Down
20 changes: 0 additions & 20 deletions app/code/Magento/User/Test/Mftf/Section/AdminDeleteRoleSection.xml

This file was deleted.

17 changes: 0 additions & 17 deletions app/code/Magento/User/Test/Mftf/Section/AdminDeleteUserSection.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminDeleteRoleSection">
<element name="theRole" selector="//td[contains(text(), 'Role')]" type="button"/>
<element name="role" parameterized="true" selector="//td[contains(text(), '{{args}}')]" type="button"/>
<element name="salesRole" selector="//td[contains(text(), 'Sales')]" type="button"/>
<element name="role" parameterized="true" selector="//td[contains(@class,'col-role_name') and contains(text(), '{{roleName}}')]" type="button"/>
<element name="current_pass" type="button" selector="#current_password"/>
<element name="delete" selector="//button/span[contains(text(), 'Delete Role')]" type="button"/>
<element name="confirm" selector="//*[@class='action-primary action-accept']" type="button"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<element name="theUser" selector="//td[contains(text(), '{{userName}}')]" type="button" parameterized="true"/>
<element name="password" selector="#user_current_password" type="input"/>
<element name="delete" selector="//button/span[contains(text(), 'Delete User')]" type="button"/>
<element name="confirm" selector="//*[@class='action-primary action-accept']" type="button"/>
<element name="confirm" selector=".action-primary.action-accept" type="button"/>
<element name="role" parameterized="true" selector="//td[contains(text(), '{{args}}')]" type="button"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Magento\Wishlist\Model\Wishlist;

use Magento\Framework\Exception\LocalizedException;
use Magento\Wishlist\Model\Item as WishlistItem;
use Magento\Wishlist\Model\ItemFactory as WishlistItemFactory;
use Magento\Wishlist\Model\ResourceModel\Item as WishlistItemResource;
Expand Down Expand Up @@ -63,7 +64,7 @@ public function __construct(
public function execute(Wishlist $wishlist, array $wishlistItemsIds): WishlistOutput
{
foreach ($wishlistItemsIds as $wishlistItemId) {
$this->removeItemFromWishlist((int) $wishlistItemId);
$this->removeItemFromWishlist((int) $wishlistItemId, $wishlist);
}

return $this->prepareOutput($wishlist);
Expand All @@ -73,12 +74,22 @@ public function execute(Wishlist $wishlist, array $wishlistItemsIds): WishlistOu
* Remove product item from wishlist
*
* @param int $wishlistItemId
* @param Wishlist $wishlist
*
* @return void
*/
private function removeItemFromWishlist(int $wishlistItemId): void
private function removeItemFromWishlist(int $wishlistItemId, Wishlist $wishlist): void
{
try {
if ($wishlist->getItem($wishlistItemId) == null) {
throw new LocalizedException(
__(
'The wishlist item with ID "%id" does not belong to the wishlist',
['id' => $wishlistItemId]
)
);
}
$wishlist->getItemCollection()->clear();
/** @var WishlistItem $wishlistItem */
$wishlistItem = $this->wishlistItemFactory->create();
$this->wishlistItemResource->load($wishlistItem, $wishlistItemId);
Expand All @@ -90,6 +101,8 @@ private function removeItemFromWishlist(int $wishlistItemId): void
}

$this->wishlistItemResource->delete($wishlistItem);
} catch (LocalizedException $exception) {
$this->addError($exception->getMessage());
} catch (\Exception $e) {
$this->addError(
__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ public function execute(Wishlist $wishlist, array $wishlistItems): WishlistOutpu
private function updateItemInWishlist(Wishlist $wishlist, WishlistItemData $wishlistItemData): void
{
try {
if ($wishlist->getItem($wishlistItemData->getId()) == null) {
throw new LocalizedException(
__(
'The wishlist item with ID "%id" does not belong to the wishlist',
['id' => $wishlistItemData->getId()]
)
);
}
$wishlist->getItemCollection()->clear();
$options = $this->buyRequestBuilder->build($wishlistItemData);
/** @var WishlistItem $wishlistItem */
$wishlistItem = $this->wishlistItemFactory->create();
Expand Down
Loading

0 comments on commit 814639b

Please sign in to comment.