Skip to content

Commit

Permalink
Merge branch '2.4-develop' of github.com:magento/magento2 into 1724-s…
Browse files Browse the repository at this point in the history
…upport-batches-synchronization
  • Loading branch information
yolouiese committed Aug 20, 2020
2 parents 29c3b26 + b0eec73 commit 7bacf97
Show file tree
Hide file tree
Showing 91 changed files with 2,188 additions and 332 deletions.
4 changes: 2 additions & 2 deletions app/code/Magento/Checkout/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ Summary,Summary
"We'll send your order confirmation here.","We'll send your order confirmation here."
Payment,Payment
"Not yet calculated","Not yet calculated"
"We received your order!","We received your order!"
"The order was not successful!","The order was not successful!"
"Thank you for your purchase!","Thank you for your purchase!"
"Password", "Password"
"Something went wrong while saving the page. Please refresh the page and try again.","Something went wrong while saving the page. Please refresh the page and try again."
"Item in Cart","Item in Cart"
"Items in Cart","Items in Cart"
"Close","Close"
"Show Cross-sell Items in the Shopping Cart","Show Cross-sell Items in the Shopping Cart"
"You added %1 to your <a href=""%2"">shopping cart</a>.","You added %1 to your <a href=""%2"">shopping cart</a>."
"You added %1 to your <a href=""%2"">shopping cart</a>.","You added %1 to your <a href=""%2"">shopping cart</a>."
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<body>
<referenceBlock name="page.main.title">
<action method="setPageTitle">
<argument translate="true" name="title" xsi:type="string">We received your order!</argument>
<argument translate="true" name="title" xsi:type="string">The order was not successful!</argument>
</action>
</referenceBlock>
<referenceContainer name="content">
Expand Down
14 changes: 14 additions & 0 deletions app/code/Magento/Customer/view/frontend/web/js/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ define([
], function ($, moment, utils) {
'use strict';

$.validator.addMethod(
'validate-date',
function (value, element, params) {
var dateFormat = utils.convertToMomentFormat(params.dateFormat);

if (value === '') {
return true;
}

return moment(value, dateFormat, true).isValid();
},
$.mage.__('Invalid date')
);

$.validator.addMethod(
'validate-dob',
function (value, element, params) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
<description>Assert category grid page basic columns values for default category</description>
</annotations>

<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.image('1','image')}}" stepKey="assertImageColumn"/>
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.path('1')}}" stepKey="assertPathColumn"/>
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.name('1', 'Default Category')}}" stepKey="assertNameColumn"/>
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.displayMode('1', 'PRODUCTS')}}" stepKey="assertDisplayModeColumn"/>
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.products('1', '0')}}" stepKey="assertProductsColumn"/>
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.inMenu('1', 'Yes')}}" stepKey="assertInMenuColumn"/>
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.enabled('1', 'Yes')}}" stepKey="assertEnabledColumn"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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="AssertAdminMediaGalleryAssetFilterPlaceHolderActionGroup">
<annotations>
<description>Assert asset filter placeholder value</description>
</annotations>
<arguments>
<argument name="filterPlaceholder" type="string"/>
</arguments>

<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.activeFilterPlaceholder(filterPlaceholder)}}" stepKey="assertFilterPLaceHolder" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminMediaGalleryCatalogUiCategoryGridSection">
<element name="activeFilterPlaceholder" type="text" selector="//div[@class='admin__current-filters-list-wrap']//li//span[contains(text(), '{{filterPlaceholder}}')]" parameterized="true"/>
<element name="image" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Image')]/preceding-sibling::th) +1]//img[contains(@src, '{{imageName}}')]" parameterized="true"/>
<element name="path" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Path')]/preceding-sibling::th)]" parameterized="true"/>
<element name="name" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Name')]/preceding-sibling::th) +1 ]//*[text()='{{categoryName}}']" parameterized="true"/>
<element name="displayMode" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Display Mode')]/preceding-sibling::th) +1 ]//*[text()='{{productsText}}']" parameterized="true"/>
<element name="products" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Products')]/preceding-sibling::th) +1 ]//*[text()='{{productsQty}}']" parameterized="true"/>
<element name="inMenu" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'In Menu')]/preceding-sibling::th) +1 ]//*[text()='{{inMenuValue}}']" parameterized="true"/>
<element name="enabled" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Enabled')]/preceding-sibling::th) +1 ]//*[text()='{{enabledValue}}']" parameterized="true"/>
<element name="edit" type="button" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Action')]/preceding-sibling::th) +1 ]//*[text()='{{edit}}']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,20 @@
<actionGroup ref="AdminMediaGalleryAssertImageInGridActionGroup" stepKey="assertImageInGrid">
<argument name="title" value="ImageMetadata.title"/>
</actionGroup>

<wait time="10" stepKey="waitForBookmarkToSaveView"/>
<reloadPage stepKey="reloadPage"/>
<waitForPageLoad stepKey="waitForGridReloaded"/>
<actionGroup ref="AdminAssertMediaGalleryFilterPlaceholderActionGroup" stepKey="assertFilterApplied">
<argument name="filterPlaceholder" value="$$product.name$$"/>
</actionGroup>

<actionGroup ref="AdminEnhancedMediaGalleryEnableMassActionModeActionGroup" stepKey="enableMassActionToDeleteImages"/>
<actionGroup ref="AdminEnhancedMediaGallerySelectImageForMassActionActionGroup" stepKey="selectFirstImageToDelete">
<argument name="imageName" value="{{ImageMetadata.title}}"/>
</actionGroup>
<actionGroup ref="AdminEnhancedMediaGalleryClickDeleteImagesButtonActionGroup" stepKey="clikDeleteSelectedButton"/>
<actionGroup ref="AdminEnhancedMediaGalleryConfirmDeleteImagesActionGroup" stepKey="deleteImages"/>

</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<actionGroup ref="AdminEnhancedMediaGalleryClickEntityUsedInActionGroup" stepKey="clickUsedInCategories">
<argument name="entityName" value="Categories"/>
</actionGroup>
<actionGroup ref="AssertAdminMediaGalleryAssetFilterPlaceHolderActionGroup" stepKey="assertFilterApplied">
<argument name="filterPlaceholder" value="{{UpdatedImageDetails.title}}"/>
</actionGroup>
<actionGroup ref="AdminMediaGalleryAssertCategoryNameInCategoryGridActionGroup" stepKey="assertCategoryInGrid">
<argument name="categoryName" value="$$category.name$$"/>
</actionGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\MediaGalleryCatalogUi\Ui\Component\Listing\Columns;

use Magento\Ui\Component\Listing\Columns\Column;

/**
* Class InMenu column for Category grid
*/
class InMenu extends Column
{
/**
* Prepare data source.
*
* @param array $dataSource
* @return array
*/
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item) {
if (isset($item[$fieldName]) && $item[$fieldName] == 1) {
$item[$fieldName] = 'Yes';
} else {
$item[$fieldName] = 'No';
}
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\MediaGalleryCatalogUi\Ui\Component\Listing\Columns;

use Magento\Ui\Component\Listing\Columns\Column;

/**
* Class IsActive column for Category grid
*/
class IsActive extends Column
{
/**
* Prepare data source.
*
* @param array $dataSource
* @return array
*/
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item) {
if (isset($item[$fieldName]) && $item[$fieldName] == 1) {
$item[$fieldName] = 'Yes';
} else {
$item[$fieldName] = 'No';
}
}
}

return $dataSource;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
*/
namespace Magento\MediaGalleryCatalogUi\Ui\Component\Listing\Columns;

use Magento\Catalog\Helper\Image;
use Magento\Framework\DataObject;
use Magento\Catalog\Model\Category\Image;
use Magento\Catalog\Model\CategoryRepository;
use Magento\Framework\View\Asset\Repository as AssetRepository;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Store\Model\Store;
Expand All @@ -27,48 +28,87 @@ class Thumbnail extends Column
/**
* @var Image
*/
private $imageHelper;
private $categoryImage;

/**
* @var CategoryRepository
*/
private $categoryRepository;

/**
* @var AssetRepository
*/
private $assetRepository;

/**
* @var string[]
*/
private $defaultPlaceholder;

/**
* Thumbnail constructor.
* @param ContextInterface $context
* @param UiComponentFactory $uiComponentFactory
* @param StoreManagerInterface $storeManager
* @param Image $image
* @param Image $categoryImage
* @param CategoryRepository $categoryRepository
* @param AssetRepository $assetRepository
* @param array $defaultPlaceholder
* @param array $components
* @param array $data
*/
public function __construct(
ContextInterface $context,
UiComponentFactory $uiComponentFactory,
StoreManagerInterface $storeManager,
Image $image,
Image $categoryImage,
CategoryRepository $categoryRepository,
AssetRepository $assetRepository,
array $defaultPlaceholder = [],
array $components = [],
array $data = []
) {
parent::__construct($context, $uiComponentFactory, $components, $data);
$this->imageHelper = $image;
$this->storeManager = $storeManager;
$this->categoryImage = $categoryImage;
$this->categoryRepository = $categoryRepository;
$this->assetRepository = $assetRepository;
$this->defaultPlaceholder = $defaultPlaceholder;
}

/**
* Prepare Data Source
*
* @param array $dataSource
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item) {
if (isset($item[$fieldName])) {
$item[$fieldName . '_src'] = $this->getUrl($item[$fieldName]);
} else {
$category = new DataObject($item);
$imageHelper = $this->imageHelper->init($category, 'product_listing_thumbnail');
$item[$fieldName . '_src'] = $imageHelper->getUrl();
if (!isset($dataSource['data']['items'])) {
return $dataSource;
}

$fieldName = $this->getData('name');
foreach ($dataSource['data']['items'] as & $item) {
if (isset($item[$fieldName])) {
$item[$fieldName . '_src'] = $this->getUrl($item[$fieldName]);
continue;
}

if (isset($item['entity_id'])) {
$src = $this->categoryImage->getUrl(
$this->categoryRepository->get($item['entity_id'])
);

if (!empty($src)) {
$item[$fieldName . '_src'] = $src;
continue;
}
}

$item[$fieldName . '_src'] = $this->assetRepository->getUrl($this->defaultPlaceholder['image']);
}

return $dataSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,54 +80,36 @@ public function prepare()
{
$options = [];
$productIds = [];
$bookmarks = $this->bookmarkManagement->loadByNamespace($this->context->getNameSpace())->getItems();
foreach ($bookmarks as $bookmark) {
if ($bookmark->getIdentifier() === 'current') {
$applied = $bookmark->getConfig()['current']['filters']['applied'];
if (isset($applied[$this->getName()])) {
$productIds = $applied[$this->getName()];
}
}
$bookmark = $this->bookmarkManagement->getByIdentifierNamespace(
'current',
$this->context->getNameSpace()
);
if ($bookmark === null) {
parent::prepare();
return;
}

foreach ($productIds as $id) {
$product = $this->productRepository->getById($id);
$options[] = [
'value' => $id,
'label' => $product->getName(),
'is_active' => $product->getStatus(),
'path' => $product->getSku(),
'optgroup' => false
$applied = $bookmark->getConfig()['current']['filters']['applied'];

];
if (isset($applied[$this->getName()])) {
$productIds = $applied[$this->getName()];
}

$this->wrappedComponent = $this->uiComponentFactory->create(
$this->getName(),
parent::COMPONENT,
[
'context' => $this->getContext(),
'options' => $options
]
);

$this->wrappedComponent->prepare();
$productsFilterJsConfig = array_replace_recursive(
$this->getJsConfig($this->wrappedComponent),
$this->getJsConfig($this)
);
$this->setData('js_config', $productsFilterJsConfig);

$this->setData(
'config',
array_replace_recursive(
(array)$this->wrappedComponent->getData('config'),
(array)$this->getData('config')
)
);

$this->applyFilter();

foreach ($productIds as $id) {
try {
$product = $this->productRepository->getById($id);
$options[] = [
'value' => $id,
'label' => $product->getName(),
'is_active' => $product->getStatus(),
'path' => $product->getSku(),
'optgroup' => false
];
} catch (\Exception $e) {
continue;
}
}
$this->optionsProvider = $options;
parent::prepare();
}
}
Loading

0 comments on commit 7bacf97

Please sign in to comment.