Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 98x 98x 119x 119x 119x 1402x 1402x 119x 119x 119x 476x 119x 119x 119x 119x 119x 119x 119x 119x | 'use strict';
define(
[
'jquery',
'underscore',
'oro/translator',
'pim/controller/front',
'pim/form-builder',
'pim/page-title',
'routing'
],
function ($, _, __, BaseController, FormBuilder, PageTitle, Routing) {
return BaseController.extend({
/**
* {@inheritdoc}
*/
initialize: function (options) {
this.config = options.config;
},
/**
* {@inheritdoc}
*/
renderForm: function (route, path) {
var query = path.replace(route.route.tokens[0][1], '');
var parameters = _.chain(query.split('&'))
.map(function (parameter) {
return parameter.split('=');
}).map(function (parameter) {
return {
key: parameter[0].replace('?', ''),
value: parameter[1]
};
}).value();
var actionName = _.find(parameters, function (parameter) {
return 'actionName' === parameter.key;
}).value.replace(new RegExp('_', 'g'), '-');
/*
The `values` parameter can raise a 414 Too Long URI when we select more than 650 products in
the grid. We use POST request to send the values to the backend to avoid these exceptions.
*/
const values = _.find(parameters, function (parameter) {
return 'values' === parameter.key;
}).value.split('%2C'); // %2C = ,
const queryWithoutValues = query.replace(/&values=[^&]+/, '');
return $.ajax({
url: Routing.generate(this.config.route) + queryWithoutValues,
method: 'POST',
data: { values }
}).then((response) => {
const filters = response.filters;
const itemsCount = response.itemsCount;
return FormBuilder.build('pim-mass-' + actionName).then((form) => {
form.setData({
filters: filters,
jobInstanceCode: null,
actions: [],
itemsCount: itemsCount
});
form.setElement(this.$el).render();
return form;
});
});
}
});
}
);
|