22 private $operationDetails;
44 \
Magento\AsynchronousOperations\Model\
ResourceModel\Bulk\CollectionFactory $bulkCollectionFactory,
45 \
Magento\AsynchronousOperations\Model\Operation\Details $operationDetails,
46 \
Magento\Framework\
App\RequestInterface $request,
50 $this->collection = $bulkCollectionFactory->create();
51 $this->operationDetails = $operationDetails;
63 private function getSummaryReport($operationDetails)
65 if (0 == $operationDetails[
'operations_successful'] && 0 == $operationDetails[
'operations_failed']) {
66 return __(
'Pending, in queue...');
69 $summaryReport =
__(
'%1 items selected for mass update', $operationDetails[
'operations_total'])->__toString();
70 if ($operationDetails[
'operations_successful'] > 0) {
71 $summaryReport .=
__(
', %1 successfully updated', $operationDetails[
'operations_successful']);
74 if ($operationDetails[
'operations_failed'] > 0) {
75 $summaryReport .=
__(
', %1 failed to update', $operationDetails[
'operations_failed']);
78 return $summaryReport;
89 $items = $this->collection->getItems();
93 $bulk = array_shift(
$items);
95 $data = $bulk->getData();
96 $operationDetails = $this->operationDetails->getDetails(
$data[
'uuid']);
97 $data[
'summary'] = $this->getSummaryReport($operationDetails);
100 return [$bulk->getBulkId() =>
$data];
111 $requestId = $this->request->getParam($this->requestFieldName);
112 $operationDetails = $this->operationDetails->getDetails($requestId);
114 if (isset($operationDetails[
'failed_retriable']) && !$operationDetails[
'failed_retriable']) {
115 $meta[
'retriable_operations'][
'arguments'][
'data'][
'disabled'] =
true;
118 if (isset($operationDetails[
'failed_not_retriable']) && !$operationDetails[
'failed_not_retriable']) {
119 $meta[
'failed_operations'][
'arguments'][
'data'][
'disabled'] =
true;
__construct( $name, $primaryFieldName, $requestFieldName, \Magento\AsynchronousOperations\Model\ResourceModel\Bulk\CollectionFactory $bulkCollectionFactory, \Magento\AsynchronousOperations\Model\Operation\Details $operationDetails, \Magento\Framework\App\RequestInterface $request, array $meta=[], array $data=[])