Skip to content

Commit

Permalink
Merge branch '2.3-develop' of https://github.com/rsantellan/magento2
Browse files Browse the repository at this point in the history
…into 2.3-develop
  • Loading branch information
rsantellan committed Jun 29, 2018
2 parents 85577bd + 5b27b6e commit d51fe75
Show file tree
Hide file tree
Showing 610 changed files with 14,541 additions and 3,287 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,12 @@
</ul>
</div>

<script>
require([
"jquery",
"Magento_Ui/js/modal/modal"
], function($){
if (this.modal) {
this.modal.html($('[data-role="system_messages_list"]').html());
} else {
this.modal = $('[data-role="system_messages_list"]').modal({
modalClass: 'modal-system-messages ui-popup-message',
type: 'popup',
buttons: []
});
<script type="text/x-magento-init">
{
"[data-role=system_messages_list]": {
"Magento_AdminNotification/js/system/messages/popup": {
class: 'modal-system-messages ui-popup-message'
}
}
}
this.modal.modal('openModal');
});
</script>
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

define([
'jquery',
'Magento_Ui/js/modal/modal'
], function ($) {
'use strict';

return function (data, element) {
if (this.modal) {
this.modal.html($(element).html());
} else {
this.modal = $(element).modal({
modalClass: data.class,
type: 'popup',
buttons: []
});
}
this.modal.modal('openModal');
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
namespace Magento\AsynchronousOperations\Api;

/**
* Interface BulkStatusInterface
* Interface BulkStatusInterface.
*
* Bulk summary data with list of operations items short data.
*
* @api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ interface DetailedBulkOperationsStatusInterface extends BulkSummaryInterface
/**
* Retrieve operations list.
*
* @return \Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface[]
* @return \Magento\AsynchronousOperations\Api\Data\OperationInterface[]
*/
public function getOperationsList();

/**
* Set operations list.
*
* @param \Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface[] $operationStatusList
* @param \Magento\AsynchronousOperations\Api\Data\OperationInterface[] $operationStatusList
* @return $this
*/
public function setOperationsList($operationStatusList);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AsynchronousOperations\Api\Data;

/**
* Bulk operation search result interface.
*
* An bulk is a group of queue messages. An bulk operation item is a queue message.
* @api
*/
interface OperationSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface
{
/**
* Get list of operations.
*
* @return \Magento\AsynchronousOperations\Api\Data\OperationInterface[]
*/
public function getItems();

/**
* Set list of operations.
*
* @param \Magento\AsynchronousOperations\Api\Data\OperationInterface[] $items
* @return $this
*/
public function setItems(array $items);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AsynchronousOperations\Api;

/**
* Bulk operation item repository interface.
*
* An bulk is a group of queue messages. An bulk operation item is a queue message.
* @api
*/
interface OperationRepositoryInterface
{
/**
* Lists the bulk operation items that match specified search criteria.
*
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
* @return \Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterface
*/
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);
}
5 changes: 2 additions & 3 deletions app/code/Magento/AsynchronousOperations/Model/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
*/
namespace Magento\AsynchronousOperations\Model;

use Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface;
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
use Magento\Framework\DataObject;
use Magento\Framework\Api\ExtensibleDataInterface;

/**
* Class Operation
*/
class Operation extends DataObject implements DetailedOperationStatusInterface, ExtensibleDataInterface
class Operation extends DataObject implements OperationInterface
{
/**
* @inheritDoc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Magento\AsynchronousOperations\Model;

use Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterfaceFactory;
use Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory;
use Magento\Framework\EntityManager\EntityManager;

/**
Expand All @@ -20,7 +20,7 @@ class OperationManagement implements \Magento\Framework\Bulk\OperationManagement
private $entityManager;

/**
* @var DetailedOperationStatusInterfaceFactory
* @var OperationInterfaceFactory
*/
private $operationFactory;

Expand All @@ -33,12 +33,12 @@ class OperationManagement implements \Magento\Framework\Bulk\OperationManagement
* OperationManagement constructor.
*
* @param EntityManager $entityManager
* @param DetailedOperationStatusInterfaceFactory $operationFactory
* @param OperationInterfaceFactory $operationFactory
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
EntityManager $entityManager,
DetailedOperationStatusInterfaceFactory $operationFactory,
OperationInterfaceFactory $operationFactory,
\Psr\Log\LoggerInterface $logger
) {
$this->entityManager = $entityManager;
Expand All @@ -65,7 +65,6 @@ public function changeOperationStatus(
$operationEntity->setResultMessage($message);
$operationEntity->setSerializedData($data);
$operationEntity->setResultSerializedData($resultData);
$operationEntity->setResultSerializedData($resultData);
$this->entityManager->save($operationEntity);
} catch (\Exception $exception) {
$this->logger->critical($exception->getMessage());
Expand Down
108 changes: 108 additions & 0 deletions app/code/Magento/AsynchronousOperations/Model/OperationRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AsynchronousOperations\Model;

use Magento\Framework\EntityManager\EntityManager;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterfaceFactory as SearchResultFactory;
use Magento\AsynchronousOperations\Api\Data\OperationExtensionInterfaceFactory;
use Magento\AsynchronousOperations\Model\ResourceModel\Operation\CollectionFactory;
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Repository class for @see \Magento\AsynchronousOperations\Api\OperationRepositoryInterface
*/
class OperationRepository implements \Magento\AsynchronousOperations\Api\OperationRepositoryInterface
{
/**
* @var EntityManager
*/
private $entityManager;

/**
* @var CollectionFactory
*/
private $collectionFactory;

/**
* @var SearchResultFactory
*/
private $searchResultFactory;

/**
* @var JoinProcessorInterface
*/
private $joinProcessor;

/**
* @var \Magento\AsynchronousOperations\Api\Data\OperationExtensionInterfaceFactory
*/
private $operationExtensionFactory;

/**
* @var CollectionProcessorInterface
*/
private $collectionProcessor;

/**
* @var \Psr\Log\LoggerInterface
*/
private $logger;

/**
* OperationRepository constructor.
*
* @param EntityManager $entityManager
* @param CollectionFactory $collectionFactory
* @param SearchResultFactory $searchResultFactory
* @param JoinProcessorInterface $joinProcessor
* @param OperationExtensionInterfaceFactory $operationExtension
* @param CollectionProcessorInterface $collectionProcessor
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
EntityManager $entityManager,
CollectionFactory $collectionFactory,
SearchResultFactory $searchResultFactory,
JoinProcessorInterface $joinProcessor,
OperationExtensionInterfaceFactory $operationExtension,
CollectionProcessorInterface $collectionProcessor,
\Psr\Log\LoggerInterface $logger
) {
$this->entityManager = $entityManager;
$this->collectionFactory = $collectionFactory;
$this->searchResultFactory = $searchResultFactory;
$this->joinProcessor = $joinProcessor;
$this->operationExtensionFactory = $operationExtension;
$this->collectionProcessor = $collectionProcessor;
$this->logger = $logger;
$this->collectionProcessor = $collectionProcessor;
}

/**
* @inheritDoc
*/
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
{
/** @var \Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterface $searchResult */
$searchResult = $this->searchResultFactory->create();

/** @var \Magento\AsynchronousOperations\Model\ResourceModel\Operation\Collection $collection */
$collection = $this->collectionFactory->create();
$this->joinProcessor->process($collection, \Magento\AsynchronousOperations\Api\Data\OperationInterface::class);
$this->collectionProcessor->process($searchCriteria, $collection);
$searchResult->setSearchCriteria($searchCriteria);
$searchResult->setTotalCount($collection->getSize());
$searchResult->setItems($collection->getItems());

return $searchResult;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ protected function setUp()
$this->entityManagerMock = $this->createMock(\Magento\Framework\EntityManager\EntityManager::class);
$this->metadataPoolMock = $this->createMock(\Magento\Framework\EntityManager\MetadataPool::class);
$this->operationFactoryMock = $this->createPartialMock(
\Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterfaceFactory::class,
\Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory::class,
['create']
);
$this->operationMock =
$this->createMock(\Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface::class);
$this->createMock(\Magento\AsynchronousOperations\Api\Data\OperationInterface::class);
$this->loggerMock = $this->createMock(\Psr\Log\LoggerInterface::class);
$this->model = new \Magento\AsynchronousOperations\Model\OperationManagement(
$this->entityManagerMock,
Expand Down
5 changes: 3 additions & 2 deletions app/code/Magento/AsynchronousOperations/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface" type="Magento\AsynchronousOperations\Model\BulkSummary" />
<preference for="Magento\AsynchronousOperations\Api\Data\OperationInterface" type="Magento\AsynchronousOperations\Model\Operation" />
<preference for="Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface" type="Magento\AsynchronousOperations\Model\Operation" />
<preference for="Magento\AsynchronousOperations\Api\Data\OperationListInterface" type="Magento\AsynchronousOperations\Model\OperationList" />
<preference for="Magento\Framework\Bulk\BulkManagementInterface" type="Magento\AsynchronousOperations\Model\BulkManagement" />
<preference for="Magento\AsynchronousOperations\Api\BulkStatusInterface" type="Magento\AsynchronousOperations\Model\BulkOperationsStatus" />
Expand All @@ -17,10 +16,12 @@
<preference for="Magento\AsynchronousOperations\Api\Data\SummaryOperationStatusInterface" type="Magento\AsynchronousOperations\Model\OperationStatus" />
<preference for="Magento\AsynchronousOperations\Api\Data\DetailedBulkOperationsStatusInterface" type="Magento\AsynchronousOperations\Model\BulkStatus\Detailed" />
<preference for="Magento\AsynchronousOperations\Api\Data\BulkOperationsStatusInterface" type="Magento\AsynchronousOperations\Model\BulkStatus\Short" />
<preference for="Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterface" type="Magento\Framework\Api\SearchResults" />
<preference for="Magento\AsynchronousOperations\Api\OperationRepositoryInterface" type="Magento\AsynchronousOperations\Model\OperationRepository" />
<type name="Magento\Framework\EntityManager\MetadataPool">
<arguments>
<argument name="metadata" xsi:type="array">
<item name="Magento\AsynchronousOperations\Api\Data\DetailedOperationStatusInterface" xsi:type="array">
<item name="Magento\AsynchronousOperations\Api\Data\OperationInterface" xsi:type="array">
<item name="entityTableName" xsi:type="string">magento_operation</item>
<item name="identifierField" xsi:type="string">id</item>
</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\AsynchronousOperations\Api\Data\OperationInterface">
<attribute code="start_time" type="string">
<resources>
<resource ref="Magento_Logging::system_magento_logging_bulk_operations"/>
</resources>
<join reference_table="magento_bulk" join_on_field="bulk_uuid" reference_field="uuid">
<field column="start_time">start_time</field>
</join>
</attribute>
</extension_attributes>
</config>
Loading

0 comments on commit d51fe75

Please sign in to comment.