Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#ESP-295 [Optimizers] UX update #2309

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private function getForm()
$ruleConditionField = $form->addField(
'rule_condition',
'text',
['name' => 'rule_condition', 'label' => __('Rule conditions'), 'container_id' => 'rule_condition']
['name' => 'rule_condition', 'label' => __('Apply to products'), 'container_id' => 'rule_condition']
);

$ruleConditionField->setValue($rule);
Expand Down
1 change: 1 addition & 0 deletions src/module-elasticsuite-catalog-optimizer/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ Active,Active
Inactive,Inactive
Status,Status
"Using extreme boost values complicates achieving a balance between optimizers.","Using extreme boost values complicates achieving a balance between optimizers."
"Boost & Bury","Boost & Bury"
1 change: 1 addition & 0 deletions src/module-elasticsuite-catalog-optimizer/i18n/fr_FR.csv
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ Active,Activé
Inactive,Désactivé
Status,Statut
"Using extreme boost values complicates achieving a balance between optimizers.","L'utilisation de valeurs extrêmes complique l'equilibrage des optimiseurs."
"Boost & Bury","Booster & Déclasser"
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,23 @@
</item>
</argument>
</field>
<container name="optimizer_rule_container">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sortOrder" xsi:type="number">80</item>
</item>
</argument>
<htmlContent name="rule_condition">
<argument name="block" xsi:type="object">Smile\ElasticsuiteCatalogOptimizer\Block\Adminhtml\Optimizer\RuleCondition</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sortOrder" xsi:type="number">10</item>
<item name="component" xsi:type="string">Smile_ElasticsuiteCatalogRule/js/component/catalog/product/form/rule</item>
<item name="dataScope" xsi:type="string">rule_condition</item>
</item>
</argument>
</htmlContent>
</container>
</fieldset>

<fieldset name="quick_search_container">
Expand Down Expand Up @@ -445,6 +462,7 @@
<item name="imports" xsi:type="array">
<item name="searchContainers" xsi:type="string">${ $.provider }:data.search_containers</item>
</item>
<item name="searchInput" xsi:type="string">query_text_preview</item>
<item name="additionalClasses" xsi:type="string">optimizer-preview</item>
</item>
</argument>
Expand Down Expand Up @@ -694,6 +712,7 @@
<item name="imports" xsi:type="array">
<item name="searchContainers" xsi:type="string">${ $.provider }:data.search_containers</item>
</item>
<item name="searchInput" xsi:type="string">category_preview</item>
<item name="additionalClasses" xsi:type="string">optimizer-preview</item>
</item>
</argument>
Expand All @@ -705,9 +724,15 @@
<fieldset name="constant_score">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Configuration</item>
<item name="label" xsi:type="string" translate="true"><![CDATA[Boost & Bury]]></item>
<item name="sortOrder" xsi:type="number">80</item>
<item name="component" xsi:type="string">Smile_ElasticsuiteCatalogOptimizer/js/components/form/optimizer/fieldset-visibility</item>
<item name="imports" xsi:type="array">
<item name="initValue" xsi:type="string">${ $.provider }:data.model</item>
</item>
<item name="listens" xsi:type="array">
<item name="${ $.provider }:data.model" xsi:type="string">onChange</item>
</item>
</item>
</argument>
<field name="config">
Expand Down Expand Up @@ -742,9 +767,15 @@
<fieldset name="attribute_value">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Configuration</item>
<item name="label" xsi:type="string" translate="true"><![CDATA[Boost & Bury]]></item>
<item name="sortOrder" xsi:type="number">100</item>
<item name="component" xsi:type="string">Smile_ElasticsuiteCatalogOptimizer/js/components/form/optimizer/fieldset-visibility</item>
<item name="imports" xsi:type="array">
<item name="initValue" xsi:type="string">${ $.provider }:data.model</item>
</item>
<item name="listens" xsi:type="array">
<item name="${ $.provider }:data.model" xsi:type="string">onChange</item>
</item>
</item>
</argument>

Expand Down Expand Up @@ -835,30 +866,5 @@
</field>
</fieldset>

<fieldset name="optimizer_rule_fieldset">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Apply to products</item>
<item name="sortOrder" xsi:type="number">120</item>
</item>
</argument>

<container name="optimizer_rule_container">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sortOrder" xsi:type="number">20</item>
</item>
</argument>
<htmlContent name="rule_condition">
<argument name="block" xsi:type="object">Smile\ElasticsuiteCatalogOptimizer\Block\Adminhtml\Optimizer\RuleCondition</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sortOrder" xsi:type="number">10</item>
<item name="component" xsi:type="string">Smile_ElasticsuiteCatalogRule/js/component/catalog/product/form/rule</item>
<item name="dataScope" xsi:type="string">rule_condition</item>
</item>
</argument>
</htmlContent>
</container>
</fieldset>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,14 @@
define(['Magento_Ui/js/form/components/fieldset', 'underscore'], function(Fieldset, _) {
return Fieldset.extend({
defaults: {
imports: {
"initValue": "${ $.provider }:data.model"
},
listens: {
"${ $.provider }:data.model" : "onChange"
},
displayedForValues : {}
},
initialize: function() {
this._super();
this.observe(['disableChildren']);
this.onChange(this.initValue);
},
onChange: function(value) {
onChange: function(value) {

var isVisible = this.index == value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ define([
'Magento_Ui/js/form/element/abstract',
'jquery',
'Smile_ElasticsuiteCatalogOptimizer/js/components/form/optimizer/preview/item',
'uiRegistry',
'MutationObserver'
], function (Component, $, Product) {
], function (Component, $, Product, uiRegistry) {
'use strict';

return Component.extend({
Expand All @@ -25,6 +26,9 @@ define([
template: "Smile_ElasticsuiteCatalogOptimizer/form/element/optimizer-preview",
refreshFields: {},
maxRefreshInterval: 200,
listens: {
"${ $.provider }:data.model" : "resetPreview"
},
imports: {
formData: "${ $.provider }:data"
},
Expand Down Expand Up @@ -106,6 +110,17 @@ define([
showMoreProducts: function () {
this.currentSize(this.currentSize() + this.pageSize);
this.refreshProductList();
}
},

resetPreview: function () {
this.baseProducts([]);
this.optimizedProducts([]);
this.countTotalProducts(0)
this.currentSize(this.pageSize);
let searchInput = uiRegistry.get(this.parentName + '.' + this.searchInput);
if (searchInput !== undefined) {
searchInput.reset();
}
},
});
});