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 | 1162x 1162x 704x 704x 704x 704x 983x 727x 983x 983x 983x 727x | 'use strict';
define([
'underscore',
'pim/form',
'oro/mediator',
'pim/fetcher-registry'
],
function (_, BaseForm, mediator, FetcherRegistry) {
return BaseForm.extend({
/**
* {@inheritdoc}
*/
configure: function () {
_.each(__moduleConfig.events, function (event) {
this.listenTo(this.getRoot(), event, this.checkStructureVersion);
}.bind(this));
this.listenTo(this.getRoot(), 'pim_enrich:form:cache:clear', this.clearCache);
return BaseForm.prototype.configure.apply(this, arguments);
},
/**
* Check if the given entity need e newer version of the cache
*
* @param {Object} entity
*/
checkStructureVersion: function (entity) {
if (entity.meta.structure_version !== this.getLocaleStructureVersion(entity.meta.model_type)) {
this.clearCache();
}
this.setLocaleStructureVersion(entity.meta.model_type, entity.meta.structure_version);
},
/**
* Get the in locale storage structure version
*
* @param {string} modelType
*
* @return {int}
*/
getLocaleStructureVersion: function (modelType) {
return parseInt(sessionStorage.getItem('structure_version_' + modelType));
},
/**
* Set the current locale structure version in locale storage
*
* @param {string} modelType
* @param {int} structureVersion
*/
setLocaleStructureVersion: function (modelType, structureVersion) {
sessionStorage.setItem('structure_version_' + modelType, structureVersion);
},
/**
* Clear the cache for all fetchers
*/
clearCache: function () {
FetcherRegistry.clearAll();
}
});
}
);
|