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

Migration of Advanced Parameters -> Import (Step 2) #10120

Merged
merged 91 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
60ce589
adds empty action
Aug 10, 2018
27291a8
by clicking the next step by default it loads new template
Aug 10, 2018
b27a389
adds skeleton for the step-2 form, starts adding configurations
Aug 10, 2018
d347c0b
orders data, adds button to be aligned together with the save your da…
Aug 10, 2018
fb51722
adds save import match ajax request functionality
Aug 14, 2018
76971dd
uses form handler and specific provider to display the form
Aug 14, 2018
d4577c7
Change import page 2 route to use POST
rokaszygmantas Aug 14, 2018
09ff9c8
sends data t import data configuration provider on ajax request
Aug 14, 2018
159001b
adds validation for import data configuration service
Aug 14, 2018
b6133dd
sends ajax request as a form
Aug 14, 2018
ae46cd4
adds new bundle for import data javascripts
Aug 14, 2018
c965de8
adds error display as native browser pop-up in import configuration s…
Aug 14, 2018
a2ed2dd
adds save configuration match functionality
Aug 23, 2018
371e22a
adds empty choices selector for data match loading
Aug 23, 2018
b08d64e
changes different hook dispatcher
Aug 23, 2018
aeb7986
changes the design of the data match configuration form
Aug 23, 2018
8b7a94e
loads data match types on page load
Aug 23, 2018
021fa93
adds validation so the configuration match should have unique names
Aug 23, 2018
9e65ed6
finishes static form view
Aug 23, 2018
337a102
WIP csv file converter and reader
rokaszygmantas Aug 24, 2018
eb6fce4
Comment out the forward to legacy controller
rokaszygmantas Aug 24, 2018
ba720b2
Fix translation key
rokaszygmantas Aug 26, 2018
2972ad9
Fix default value
rokaszygmantas Aug 26, 2018
560e18a
Add entity field factories and entity recognition in data mappings table
rokaszygmantas Aug 27, 2018
e3f55a8
Fix class name
rokaszygmantas Aug 30, 2018
24b3441
Fix choice providers name
rokaszygmantas Aug 30, 2018
51b40d8
Add table import data configuration table header
rokaszygmantas Aug 30, 2018
36c3f0b
Fill the import data preview table with data from the file
rokaszygmantas Aug 30, 2018
44a69e0
Fix code style
rokaszygmantas Aug 30, 2018
cc3303d
Minor fixes
rokaszygmantas Aug 31, 2018
b97724b
Add arrows to import preview table
rokaszygmantas Aug 31, 2018
25ebf6e
Cleanup / small fixes
rokaszygmantas Sep 6, 2018
2021f5d
Add import table pagination JS actions
rokaszygmantas Sep 6, 2018
d37ef5a
Save selected entity fields when saving import match
rokaszygmantas Sep 6, 2018
22a04d0
Implement loading of import match configuration
rokaszygmantas Sep 6, 2018
46d3a6e
Show the saved import match in the matches dropdown without reloading…
rokaszygmantas Sep 6, 2018
9a2a6c5
Implement deletion of import matches
rokaszygmantas Sep 6, 2018
c5019e0
Add import action to legacy controller and retrieve messages back to …
rokaszygmantas Sep 6, 2018
e1138c6
Add asterisks next to required entity fields
rokaszygmantas Sep 6, 2018
95d3f99
Pick up and normalize value separator from step 1 in step 2
rokaszygmantas Sep 6, 2018
6b93030
Refactor entity fields retrieval
rokaszygmantas Sep 6, 2018
4a8e975
Add required import entity fields validation
rokaszygmantas Sep 6, 2018
dc61739
Small fixes
rokaszygmantas Sep 7, 2018
1359abb
Migrate available fields block
rokaszygmantas Sep 7, 2018
7c19258
Fix import permissions
rokaszygmantas Sep 7, 2018
f220478
Fix code style
rokaszygmantas Sep 7, 2018
32911d6
Change step 1 redirect to step 2 to use GET
rokaszygmantas Sep 7, 2018
9d20bbd
Fix translation string
rokaszygmantas Sep 7, 2018
d22431b
Cleanup after rebase
Sep 13, 2018
e071d1e
Use import entity, remove unused constants
rokaszygmantas Sep 13, 2018
2fb1c8f
Add empty import modal
rokaszygmantas Sep 14, 2018
c763c0e
[WIP] Add JS importer
rokaszygmantas Sep 21, 2018
c786e9a
Fix import values usage from step1 in step2 and import ajax calls, pr…
rokaszygmantas Sep 27, 2018
03586de
Cleanup
rokaszygmantas Sep 28, 2018
01b4985
Change import form html class to be more specific
rokaszygmantas Sep 28, 2018
853d134
Fix "rows to skip" setting to be passed to import ajax successfully a…
rokaszygmantas Sep 28, 2018
f7ba4ce
Add import batch size calculation, validation and ajax import itself …
rokaszygmantas Sep 29, 2018
478b45d
Implement import abort button
rokaszygmantas Sep 29, 2018
decce12
Implement import continue button
rokaszygmantas Sep 29, 2018
22e7ae4
Add post size limit checking in import
rokaszygmantas Sep 29, 2018
f6c09e2
Cleanup import configuration
rokaszygmantas Sep 29, 2018
2c88111
Fix incorrect import batch size
rokaszygmantas Sep 29, 2018
5f50ef3
Cleanup import configuration retrieval from inputs
rokaszygmantas Sep 29, 2018
35c09ef
Fix translations in import modal
rokaszygmantas Sep 29, 2018
6fea700
Remove legacy files that are no longer needed
rokaszygmantas Sep 29, 2018
4f378cb
Hide "close" button when clicking on "continue import"
rokaszygmantas Sep 29, 2018
9298b76
Cleanup
rokaszygmantas Sep 29, 2018
84f7e8a
Fix exception when session expired
rokaszygmantas Sep 30, 2018
831ab91
Remove unused namespace uses
rokaszygmantas Sep 30, 2018
4d0b9f4
Fix cs
rokaszygmantas Sep 30, 2018
400f7a7
Small JS fixes
rokaszygmantas Oct 4, 2018
181e39f
JS fixes
rokaszygmantas Oct 4, 2018
51aea91
Update exceptions hierarchy
rokaszygmantas Oct 4, 2018
1c3664a
Fix csv file reader arguments to be more flexible
rokaszygmantas Oct 11, 2018
067c4e6
Throw an exception when the import file cannot be read
rokaszygmantas Oct 11, 2018
5684ae2
Show human readable error in controller when the import file cannot b…
rokaszygmantas Oct 11, 2018
df65cac
Improve exception handling when retrieving import entity fields
rokaszygmantas Oct 11, 2018
0463873
Remove unused controller action
rokaszygmantas Oct 11, 2018
9e30456
Remove not existing service declarations
rokaszygmantas Oct 11, 2018
97f5825
Small JS fixes
rokaszygmantas Oct 11, 2018
a5ff177
Cleanup syntax
rokaszygmantas Oct 11, 2018
ae930fa
Code cleanup
rokaszygmantas Oct 11, 2018
e352e75
Fix duplicate block name
rokaszygmantas Oct 11, 2018
eaa1839
Fix wording
rokaszygmantas Oct 11, 2018
558461d
Fix wrong namespace
rokaszygmantas Oct 11, 2018
1257454
Remove unused adapter
rokaszygmantas Oct 11, 2018
ae49851
Remove unused service declaration
rokaszygmantas Oct 11, 2018
c633722
Fix naming
rokaszygmantas Oct 11, 2018
3dbc4fe
Remove not existing services
rokaszygmantas Oct 11, 2018
fad0c16
Fix cs
rokaszygmantas Oct 11, 2018
6d16da0
Rebuild assets
rokaszygmantas Oct 11, 2018
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

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/**
* 2007-2018 PrestaShop.
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

const $ = window.$;

export default class EntityFieldsValidator {
/**
* Validates entity fields
*
* @returns {boolean}
*/
static validate() {
$('.js-validation-error').addClass('d-none');

return this._checkDuplicateSelectedValues() && this._checkRequiredFields();
}

/**
* Checks if there are no duplicate selected values.
*
* @returns {boolean}
* @private
*/
static _checkDuplicateSelectedValues() {
const uniqueFields = [];
let valid = true;

$('.js-entity-field select').each(function () {
let value = $(this).val();

if (value === 'no') {
return;
}

if ($.inArray(value, uniqueFields) !== -1) {
valid = false;
$('.js-duplicate-columns-warning').removeClass('d-none');
return;
}

uniqueFields.push(value);
});

return valid;
}

/**
* Checks if all required fields are selected.
*
* @returns {boolean}
* @private
*/
static _checkRequiredFields() {
let requiredImportFields = $('.js-import-data-table').data('required-fields');

for (let key in requiredImportFields) {
if (0 === $(`option[value="${requiredImportFields[key]}"]:selected`).length) {
$('.js-missing-column-warning').removeClass('d-none');
$('.js-missing-column').text($(`option[value="${requiredImportFields[key]}"]:first`).text());

return false;
}
}
return true;
}
}
Loading