Skip to content

Commit 85e2a32

Browse files
author
Robert He
committed
Merge branch '2.3-develop' into MAGETWO-70174-data-migration
2 parents 7e1d92e + a8e5e30 commit 85e2a32

File tree

974 files changed

+36918
-7312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

974 files changed

+36918
-7312
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Analytics\Api\Data;
7+
8+
/**
9+
* Represents link with collected data and initialized vector for decryption.
10+
*/
11+
interface LinkInterface
12+
{
13+
/**
14+
* @return string
15+
*/
16+
public function getUrl();
17+
18+
/**
19+
* @return string
20+
*/
21+
public function getInitializationVector();
22+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Analytics\Api;
7+
8+
/**
9+
* Provides link to file with collected report data.
10+
*/
11+
interface LinkProviderInterface
12+
{
13+
/**
14+
* @return \Magento\Analytics\Api\Data\LinkInterface
15+
*/
16+
public function get();
17+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Analytics\Block\Adminhtml\System\Config;
7+
8+
/**
9+
* Provides field with additional information
10+
*/
11+
class AdditionalComment extends \Magento\Config\Block\System\Config\Form\Field
12+
{
13+
/**
14+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
15+
* @return string
16+
*/
17+
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
18+
{
19+
$html = '<div class="config-additional-comment-title">' . $element->getLabel() . '</div>';
20+
$html .= '<div class="config-additional-comment-content">' . $element->getComment() . '</div>';
21+
return $this->decorateRowHtml($element, $html);
22+
}
23+
24+
/**
25+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
26+
* @param string $html
27+
* @return string
28+
*/
29+
private function decorateRowHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element, $html)
30+
{
31+
return sprintf(
32+
'<tr id="row_%s"><td colspan="3"><div class="config-additional-comment">%s</div></td></tr>',
33+
$element->getHtmlId(),
34+
$html
35+
);
36+
}
37+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Analytics\Block\Adminhtml\System\Config;
7+
8+
/**
9+
* Provides label with default Time Zone
10+
*/
11+
class CollectionTimeLabel extends \Magento\Config\Block\System\Config\Form\Field
12+
{
13+
/**
14+
* Add default time zone to comment
15+
*
16+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
17+
* @return string
18+
*/
19+
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
20+
{
21+
$timeZoneCode = $this->_localeDate->getConfigTimezone();
22+
$getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)->getDisplayName();
23+
$element->setData(
24+
'comment',
25+
sprintf("%s (%s)", $getLongTimeZoneName, $timeZoneCode)
26+
);
27+
return parent::render($element);
28+
}
29+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Analytics\Block\Adminhtml\System\Config;
7+
8+
use Magento\Analytics\Model\SubscriptionStatusProvider;
9+
use Magento\Backend\Block\Template\Context;
10+
11+
/**
12+
* Provides labels for subscription status
13+
* Status can be reviewed in System Configuration
14+
*/
15+
class SubscriptionStatusLabel extends \Magento\Config\Block\System\Config\Form\Field
16+
{
17+
/**
18+
* @var SubscriptionStatusProvider
19+
*/
20+
private $subscriptionStatusProvider;
21+
22+
/**
23+
* @param Context $context
24+
* @param SubscriptionStatusProvider $labelStatusProvider
25+
* @param array $data
26+
*/
27+
public function __construct(
28+
Context $context,
29+
SubscriptionStatusProvider $labelStatusProvider,
30+
array $data = []
31+
) {
32+
parent::__construct($context, $data);
33+
$this->subscriptionStatusProvider = $labelStatusProvider;
34+
}
35+
36+
/**
37+
* Add Subscription status to comment
38+
*
39+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
40+
* @return string
41+
*/
42+
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
43+
{
44+
$element->setData(
45+
'comment',
46+
$this->prepareLabelValue()
47+
);
48+
return parent::render($element);
49+
}
50+
51+
/**
52+
* Prepare label for subscription status
53+
*
54+
* @return string
55+
*/
56+
private function prepareLabelValue()
57+
{
58+
return __('Subscription status') . ': ' . $this->subscriptionStatusProvider->getStatus();
59+
}
60+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Analytics\Block\Adminhtml\System\Config;
7+
8+
/**
9+
* Provides vertical select with additional information and style customization
10+
*/
11+
class Vertical extends \Magento\Config\Block\System\Config\Form\Field
12+
{
13+
/**
14+
* @inheritdoc
15+
*/
16+
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
17+
{
18+
$html = '<div class="config-vertical-title">' . $element->getHint() . '</div>';
19+
$html .= '<div class="config-vertical-comment">' . $element->getComment() . '</div>';
20+
return $this->decorateRowHtml($element, $html);
21+
}
22+
23+
/**
24+
* Decorates row HTML for custom element style
25+
*
26+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
27+
* @param string $html
28+
* @return string
29+
*/
30+
private function decorateRowHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element, $html)
31+
{
32+
$rowHtml = sprintf('<tr><td colspan="4">%s</td></tr>', $html);
33+
$rowHtml .= sprintf(
34+
'<tr id="row_%s"><td class="label config-vertical-label">%s</td><td class="value">%s</td></tr>',
35+
$element->getHtmlId(),
36+
$element->getLabelHtml($element->getHtmlId(), "[WEBSITE]"),
37+
$element->getElementHtml()
38+
);
39+
return $rowHtml;
40+
}
41+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Analytics\Controller\Adminhtml\BIEssentials;
7+
8+
use Magento\Backend\App\Action;
9+
use Magento\Backend\App\Action\Context;
10+
use Magento\Framework\App\Config\ScopeConfigInterface;
11+
12+
/**
13+
* Provides link to BI Essentials signup
14+
*/
15+
class SignUp extends Action
16+
{
17+
/**
18+
* Path to config value with URL to BI Essentials sign-up page.
19+
*
20+
* @var string
21+
*/
22+
private $urlBIEssentialsConfigPath = 'analytics/url/bi_essentials';
23+
24+
/**
25+
* @var ScopeConfigInterface
26+
*/
27+
private $config;
28+
29+
/**
30+
* @inheritdoc
31+
*/
32+
const ADMIN_RESOURCE = 'Magento_Analytics::bi_essentials';
33+
34+
/**
35+
* @param Context $context
36+
* @param ScopeConfigInterface $config
37+
*/
38+
public function __construct(
39+
Context $context,
40+
ScopeConfigInterface $config
41+
) {
42+
$this->config = $config;
43+
parent::__construct($context);
44+
}
45+
46+
/**
47+
* Provides link to BI Essentials signup
48+
*
49+
* @return \Magento\Framework\Controller\AbstractResult
50+
*/
51+
public function execute()
52+
{
53+
return $this->resultRedirectFactory->create()->setUrl(
54+
$this->config->getValue($this->urlBIEssentialsConfigPath)
55+
);
56+
}
57+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Analytics\Controller\Adminhtml\Reports;
7+
8+
use Magento\Analytics\Model\Exception\State\SubscriptionUpdateException;
9+
use Magento\Analytics\Model\ReportUrlProvider;
10+
use Magento\Backend\App\Action;
11+
use Magento\Backend\App\Action\Context;
12+
use Magento\Framework\Controller\Result\Redirect;
13+
use Magento\Framework\Controller\ResultFactory;
14+
use Magento\Framework\Exception\LocalizedException;
15+
16+
/**
17+
* Provide redirect to resource with reports.
18+
*/
19+
class Show extends Action
20+
{
21+
/**
22+
* @var ReportUrlProvider
23+
*/
24+
private $reportUrlProvider;
25+
26+
/**
27+
* @inheritdoc
28+
*/
29+
const ADMIN_RESOURCE = 'Magento_Analytics::analytics_settings';
30+
31+
/**
32+
* @param Context $context
33+
* @param ReportUrlProvider $reportUrlProvider
34+
*/
35+
public function __construct(
36+
Context $context,
37+
ReportUrlProvider $reportUrlProvider
38+
) {
39+
$this->reportUrlProvider = $reportUrlProvider;
40+
parent::__construct($context);
41+
}
42+
43+
/**
44+
* Redirect to resource with reports.
45+
*
46+
* @return Redirect $resultRedirect
47+
*/
48+
public function execute()
49+
{
50+
/** @var Redirect $resultRedirect */
51+
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
52+
try {
53+
$resultRedirect->setUrl($this->reportUrlProvider->getUrl());
54+
} catch (SubscriptionUpdateException $e) {
55+
$this->getMessageManager()->addNoticeMessage($e->getMessage());
56+
$resultRedirect->setPath('adminhtml');
57+
} catch (LocalizedException $e) {
58+
$this->getMessageManager()->addExceptionMessage($e, $e->getMessage());
59+
$resultRedirect->setPath('adminhtml');
60+
} catch (\Exception $e) {
61+
$this->getMessageManager()->addExceptionMessage(
62+
$e,
63+
__('Sorry, there has been an error processing your request. Please try again later.')
64+
);
65+
$resultRedirect->setPath('adminhtml');
66+
}
67+
68+
return $resultRedirect;
69+
}
70+
}

0 commit comments

Comments
 (0)