Skip to content

Commit 1a991f4

Browse files
Merge pull request #733 from magento-frontend/pr-develop
Bugs: MAGETWO-60185 Remove distinction in http/https for requirejs-config.js MAGETWO-60611 [Magento Cloud] - Static files not being generated correctly on prod(Race condition in merging files) MAGETWO-59322 Incorrect scope filter caching in UI grids MAGETWO-55393 [Github #5636] Many storeviews break the page
2 parents 3e8c89e + 02e2c5c commit 1a991f4

File tree

24 files changed

+687
-75
lines changed

24 files changed

+687
-75
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,28 @@
1616
</strong>
1717
</div>
1818
<div class="fieldset-wrapper-content in collapse" id="manage-titles-content">
19-
<fieldset class="fieldset">
20-
<table class="admin__control-table" id="attribute-labels-table">
21-
<thead>
22-
<tr>
23-
<?php foreach ($block->getStores() as $_store): ?>
24-
<th class="col-store-view"><?php /* @escapeNotVerified */ echo $_store->getName() ?></th>
25-
<?php endforeach; ?>
26-
</tr>
27-
</thead>
28-
<tbody>
29-
<tr>
30-
<?php $_labels = $block->getLabelValues() ?>
31-
<?php foreach ($block->getStores() as $_store): ?>
32-
<td class="col-store-view">
33-
<input class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?php /* @escapeNotVerified */ echo $_store->getId() ?>]" value="<?php echo $block->escapeHtml($_labels[$_store->getId()]) ?>"<?php if ($block->getReadOnly()):?> disabled="disabled"<?php endif;?>/>
34-
</td>
35-
<?php endforeach; ?>
36-
</tr>
37-
</tbody>
38-
</table>
19+
<fieldset class="admin__fieldset fieldset">
20+
<div class="admin__control-table-wrapper">
21+
<table class="admin__control-table" id="attribute-labels-table">
22+
<thead>
23+
<tr>
24+
<?php foreach ($block->getStores() as $_store): ?>
25+
<th class="col-store-view"><?php /* @escapeNotVerified */ echo $_store->getName() ?></th>
26+
<?php endforeach; ?>
27+
</tr>
28+
</thead>
29+
<tbody>
30+
<tr>
31+
<?php $_labels = $block->getLabelValues() ?>
32+
<?php foreach ($block->getStores() as $_store): ?>
33+
<td class="col-store-view">
34+
<input class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?php /* @escapeNotVerified */ echo $_store->getId() ?>]" value="<?php echo $block->escapeHtml($_labels[$_store->getId()]) ?>"<?php if ($block->getReadOnly()):?> disabled="disabled"<?php endif;?>/>
35+
</td>
36+
<?php endforeach; ?>
37+
</tr>
38+
</tbody>
39+
</table>
40+
</div>
3941
</fieldset>
4042
</div>
4143
</div>

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
$stores = $block->getStoresSortedBySortOrder();
1212
?>
13-
<fieldset class="fieldset">
13+
<fieldset class="admin__fieldset fieldset">
1414
<legend class="legend">
1515
<span><?php echo $block->escapeHtml(__('Manage Options (Values of Your Attribute)')); ?></span>
16-
</legend>
17-
<div id="manage-options-panel" data-index="attribute_options_select_container">
16+
</legend><br />
17+
<div class="admin__control-table-wrapper" id="manage-options-panel" data-index="attribute_options_select_container">
1818
<table class="admin__control-table" data-index="attribute_options_select">
1919
<thead>
2020
<tr id="attribute-options-table">

app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
<item name="config" xsi:type="array">
2424
<item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
2525
<item name="update_url" xsi:type="url" path="mui/index/render"/>
26+
<item name="storageConfig" xsi:type="array">
27+
<item name="dataScope" xsi:type="string">filters.store_id</item>
28+
</item>
2629
</item>
2730
</argument>
2831
</argument>

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010

1111
$stores = $block->getStoresSortedBySortOrder();
1212
?>
13-
<fieldset class="fieldset">
14-
<legend class="legend"><span><?php echo $block->escapeHtml( __('Manage Swatch (Values of Your Attribute)')); ?></span></legend>
15-
<div id="swatch-visual-options-panel">
13+
<fieldset class="admin__fieldset fieldset">
14+
<legend class="legend">
15+
<span><?php echo $block->escapeHtml( __('Manage Swatch (Values of Your Attribute)')); ?></span>
16+
</legend><br />
17+
<div class="admin__control-table-wrapper" id="swatch-visual-options-panel">
1618
<table class="data-table clearfix" cellspacing="0">
1719
<thead>
1820
<tr id="swatch-visual-options-table">
@@ -116,5 +118,4 @@ $stores = $block->getStoresSortedBySortOrder();
116118
}
117119
}
118120
</script>
119-
120121
</fieldset>

app/code/Magento/Ui/view/base/web/js/grid/data-storage.js

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ define([
2020
method: 'GET',
2121
dataType: 'json'
2222
},
23+
dataScope: '',
2324
data: {}
2425
},
2526

@@ -29,8 +30,16 @@ define([
2930
* @returns {DataStorage} Chainable.
3031
*/
3132
initConfig: function () {
33+
var scope;
34+
3235
this._super();
3336

37+
scope = this.dataScope;
38+
39+
if (typeof scope === 'string') {
40+
this.dataScope = scope ? [scope] : [];
41+
}
42+
3443
this._requests = [];
3544

3645
return this;
@@ -77,10 +86,12 @@ define([
7786
* @returns {jQueryPromise}
7887
*/
7988
getData: function (params, options) {
80-
var cachedRequest = this.getRequest(params);
89+
var cachedRequest;
8190

82-
if (params && params.filters && params.filters['store_id']) {
83-
cachedRequest = false;
91+
if (this.hasScopeChanged(params)) {
92+
this.clearRequests();
93+
} else {
94+
cachedRequest = this.getRequest(params);
8495
}
8596

8697
options = options || {};
@@ -90,6 +101,30 @@ define([
90101
this.requestData(params);
91102
},
92103

104+
/**
105+
* Tells whether one of the parameters defined in the "dataScope" has
106+
* changed since the last request.
107+
*
108+
* @param {Object} params - Request parameters.
109+
* @returns {Boolean}
110+
*/
111+
hasScopeChanged: function (params) {
112+
var lastRequest = _.last(this._requests),
113+
keys,
114+
diff;
115+
116+
if (!lastRequest) {
117+
return false;
118+
}
119+
120+
diff = utils.compare(lastRequest.params, params);
121+
122+
keys = _.pluck(diff.changes, 'path');
123+
keys = keys.concat(Object.keys(diff.containers));
124+
125+
return _.intersection(this.dataScope, keys).length > 0;
126+
},
127+
93128
/**
94129
* Extends records of current data object
95130
* with the provided records collection.

app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
&._required {
132132
span {
133133
&:after {
134+
.lib-css(margin, @form-field-label-asterisk__margin);
134135
color: @validation__color;
135136
content: '*';
136137
}

app/design/adminhtml/Magento/backend/web/css/styles-old.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@
744744
// --------------------------------------
745745

746746
fieldset {
747+
min-width: 0;
747748
padding: 20px;
748749
}
749750

@@ -5049,6 +5050,10 @@
50495050
}
50505051
}
50515052
}
5053+
5054+
.admin__control-table-wrapper {
5055+
clear: both;
5056+
}
50525057
}
50535058

50545059
.catalog-product-set-index {

dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Cache.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ class Cache extends Cli
2929
const PARAM_CACHE_ENABLE = 'cache:enable';
3030

3131
/**
32-
* Flush cache.
32+
* Flush Cache.
33+
* If no parameters are set, all cache types are flushed.
3334
*
35+
* @param array $cacheTypes
3436
* @return void
3537
*/
36-
public function flush()
38+
public function flush(array $cacheTypes = [])
3739
{
38-
parent::execute(Cache::PARAM_CACHE_FLUSH);
40+
$options = empty($cacheTypes) ? '' : ' ' . implode(' ', $cacheTypes);
41+
parent::execute(Cache::PARAM_CACHE_FLUSH . $options);
3942
}
4043

4144
/**
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Mtf\Util\Command\Cli;
8+
9+
use Magento\Mtf\Util\Command\Cli;
10+
11+
/**
12+
* Merchant Developer deploys static view files during test executions so that Storefront UI updates are applied.
13+
*/
14+
class StaticContent extends Cli
15+
{
16+
/**
17+
* Parameter for deploy static view files.
18+
*/
19+
const PARAM_SETUP_STATIC_CONTENT_DEPLOY = 'setup:static-content:deploy';
20+
21+
/**
22+
* Deploy static view files.
23+
*
24+
* @return void
25+
*/
26+
public function deploy()
27+
{
28+
parent::execute(StaticContent::PARAM_SETUP_STATIC_CONTENT_DEPLOY);
29+
}
30+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Test\Constraint;
8+
9+
use Magento\Mtf\Constraint\AbstractConstraint;
10+
use Magento\Mtf\Client\BrowserInterface;
11+
use Magento\Customer\Test\Fixture\Customer;
12+
use Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep as LogInCustomerOnStorefront;
13+
use Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep as LogOutCustomerOnStorefront;
14+
15+
/**
16+
* Assert that http is used all over the Storefront.
17+
*/
18+
class AssertHttpUsedOnFrontend extends AbstractConstraint
19+
{
20+
/**
21+
* Unsecured protocol format.
22+
*
23+
* @var string
24+
*/
25+
private $unsecuredProtocol = \Magento\Framework\HTTP\PhpEnvironment\Request::SCHEME_HTTP;
26+
27+
/**
28+
* Browser interface.
29+
*
30+
* @var BrowserInterface
31+
*/
32+
protected $browser;
33+
34+
/**
35+
* Customer account.
36+
*
37+
* @var Customer
38+
*/
39+
protected $customer;
40+
41+
/**
42+
* Validations execution.
43+
*
44+
* @param BrowserInterface $browser
45+
* @param Customer $customer
46+
* @return void
47+
*/
48+
public function processAssert(BrowserInterface $browser, Customer $customer)
49+
{
50+
$this->browser = $browser;
51+
$this->customer = $customer;
52+
$this->customer->persist();
53+
54+
// Log in to Customer Account on Storefront to assert that http is used indeed.
55+
$this->objectManager->create(LogInCustomerOnStorefront::class, ['customer' => $this->customer])->run();
56+
$this->assertUsedProtocol($this->unsecuredProtocol);
57+
58+
// Log out from Customer Account on Storefront to assert that JS is deployed validly as a part of statics.
59+
$this->objectManager->create(LogOutCustomerOnStorefront::class)->run();
60+
$this->assertUsedProtocol($this->unsecuredProtocol);
61+
}
62+
63+
/**
64+
* Assert that specified protocol is used on current page.
65+
*
66+
* @param string $expectedProtocol
67+
* @return void
68+
*/
69+
protected function assertUsedProtocol($expectedProtocol)
70+
{
71+
if (substr($expectedProtocol, -3) !== "://") {
72+
$expectedProtocol .= '://';
73+
}
74+
75+
\PHPUnit_Framework_Assert::assertStringStartsWith(
76+
$expectedProtocol,
77+
$this->browser->getUrl(),
78+
"$expectedProtocol is not used."
79+
);
80+
}
81+
82+
/**
83+
* Returns a string representation of the object.
84+
*
85+
* @return string
86+
*/
87+
public function toString()
88+
{
89+
return 'Unsecured URLs are used for Storefront pages.';
90+
}
91+
}

0 commit comments

Comments
 (0)