From 086f3666c93684588b15cadf16a83a216379d794 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 09:49:45 +0100 Subject: [PATCH 1/8] correcting encoding bug --- .../{_edit_basic_data.spec.js => edit_basic_data.spec.js.js} | 0 .../{_edit_fiscal_data.spec.js => edit_fiscal_data.spec.js.js} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename e2e/paths/{_edit_basic_data.spec.js => edit_basic_data.spec.js.js} (100%) rename e2e/paths/{_edit_fiscal_data.spec.js => edit_fiscal_data.spec.js.js} (100%) diff --git a/e2e/paths/_edit_basic_data.spec.js b/e2e/paths/edit_basic_data.spec.js.js similarity index 100% rename from e2e/paths/_edit_basic_data.spec.js rename to e2e/paths/edit_basic_data.spec.js.js diff --git a/e2e/paths/_edit_fiscal_data.spec.js b/e2e/paths/edit_fiscal_data.spec.js.js similarity index 100% rename from e2e/paths/_edit_fiscal_data.spec.js rename to e2e/paths/edit_fiscal_data.spec.js.js From eae7a60950a920f124399b1561222251509036e9 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 10:09:27 +0100 Subject: [PATCH 2/8] encoding changes --- e2e/paths/edit_basic_data.spec.js.js | 18 +++++++++--------- e2e/paths/edit_fiscal_data.spec.js.js | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/e2e/paths/edit_basic_data.spec.js.js b/e2e/paths/edit_basic_data.spec.js.js index 0c8436a0c..233e3311f 100644 --- a/e2e/paths/edit_basic_data.spec.js.js +++ b/e2e/paths/edit_basic_data.spec.js.js @@ -81,7 +81,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -111,7 +111,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -141,7 +141,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -171,7 +171,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -201,7 +201,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -231,7 +231,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -261,7 +261,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -290,7 +290,7 @@ describe('Edit basicData path', () => { // .wait(selectors.globalItems.snackbarIsActive) // .getInnerText(selectors.globalItems.snackbarIsActive) // .then(result => { - // expect(result).toEqual(`¡Datos guardados!`); + // expect(result).toEqual(`ยกDatos guardados!`); // done(); // }) // .catch(catchErrors(done)); @@ -305,7 +305,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); diff --git a/e2e/paths/edit_fiscal_data.spec.js.js b/e2e/paths/edit_fiscal_data.spec.js.js index 231399b54..3c300e4b4 100644 --- a/e2e/paths/edit_fiscal_data.spec.js.js +++ b/e2e/paths/edit_fiscal_data.spec.js.js @@ -80,7 +80,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('ยกDatos guardados!'); done(); }) .catch(catchErrors(done)); @@ -110,7 +110,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('ยกDatos guardados!'); done(); }) .catch(catchErrors(done)); @@ -142,7 +142,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -172,7 +172,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); From 2103b1f3a37054a61ea41ec8b87c05edec890b39 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 10:10:35 +0100 Subject: [PATCH 3/8] encoding characters updated --- e2e/paths/edit_basic_data.spec.js.js | 18 +++++++++--------- e2e/paths/edit_fiscal_data.spec.js.js | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/e2e/paths/edit_basic_data.spec.js.js b/e2e/paths/edit_basic_data.spec.js.js index 233e3311f..0c8436a0c 100644 --- a/e2e/paths/edit_basic_data.spec.js.js +++ b/e2e/paths/edit_basic_data.spec.js.js @@ -81,7 +81,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -111,7 +111,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -141,7 +141,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -171,7 +171,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -201,7 +201,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -231,7 +231,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -261,7 +261,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -290,7 +290,7 @@ describe('Edit basicData path', () => { // .wait(selectors.globalItems.snackbarIsActive) // .getInnerText(selectors.globalItems.snackbarIsActive) // .then(result => { - // expect(result).toEqual(`ยกDatos guardados!`); + // expect(result).toEqual(`¡Datos guardados!`); // done(); // }) // .catch(catchErrors(done)); @@ -305,7 +305,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); diff --git a/e2e/paths/edit_fiscal_data.spec.js.js b/e2e/paths/edit_fiscal_data.spec.js.js index 3c300e4b4..231399b54 100644 --- a/e2e/paths/edit_fiscal_data.spec.js.js +++ b/e2e/paths/edit_fiscal_data.spec.js.js @@ -80,7 +80,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('ยกDatos guardados!'); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); @@ -110,7 +110,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('ยกDatos guardados!'); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); @@ -142,7 +142,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -172,7 +172,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); From 865d106d4fa21ad8d19a9d38696dce15f31b748f Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Thu, 9 Nov 2017 10:11:59 +0100 Subject: [PATCH 4/8] bug fixed in autocomplete --- client/core/src/autocomplete/autocomplete.js | 107 +++++++++++-------- 1 file changed, 61 insertions(+), 46 deletions(-) diff --git a/client/core/src/autocomplete/autocomplete.js b/client/core/src/autocomplete/autocomplete.js index ad5e9c6a1..0366cece7 100644 --- a/client/core/src/autocomplete/autocomplete.js +++ b/client/core/src/autocomplete/autocomplete.js @@ -1,14 +1,16 @@ import {module} from '../module'; import Component from '../lib/component'; +import copyObject from '../lib/copy'; import './style.scss'; class Autocomplete extends Component { - constructor($element, $scope, $http, $timeout) { + constructor($element, $scope, $http, $timeout, $filter) { super($element); this.$element = $element; this.$scope = $scope; this.$http = $http; this.$timeout = $timeout; + this.$filter = $filter; this._showDropDown = false; this.finding = false; @@ -20,7 +22,7 @@ class Autocomplete extends Component { this.showField = this.showField || 'name'; this.valueField = this.valueField || 'id'; this.order = this.order || 'name ASC'; - this.items = this.data || []; + this.items = copyObject(this.data) || []; this.displayValueMultiCheck = []; this._multiField = []; this.readonly = true; @@ -187,10 +189,7 @@ class Autocomplete extends Component { } findItems(search) { - if (!this.url) - return this.items ? this.items : []; - - if (search && !this.finding) { + if (this.url && search && !this.finding) { this.maxRow = false; let filter = {where: {name: {regexp: search}}}; if (this.filter && this.filter.where) { @@ -215,6 +214,8 @@ class Autocomplete extends Component { this.finding = false; } ); + } else if (search && !this.url && this.data) { + this.items = this.$filter('filter')(this.data, search); } else if (!search && !this.finding) { this.maxRow = 10; this.items = []; @@ -222,48 +223,54 @@ class Autocomplete extends Component { } } getItems() { - let filter = {}; - if (!this.finding) { - this.finding = true; + if (this.url === undefined) { + this.items = copyObject(this.data); + this.maxRow = false; + this.removeLoadMore = true; + } else { + let filter = {}; + if (!this.finding) { + this.finding = true; - if (this.maxRow) { - if (this.items) { - filter.skip = this.items.length; - } - filter.limit = this.maxRow; - filter.order = this.order; - } - if (this.filter) { - Object.assign(filter, this.filter); - } - - let json = JSON.stringify(filter); - - this.removeLoadMore = false; - - this.$http.get(`${this.url}?filter=${json}`).then( - json => { - if (json.data.length) { - json.data.forEach( - el => { - if (this.multiple) { - el.checked = this.field.indexOf(el[this.valueField]) !== -1; - } - this.items.push(el); - } - ); - if (filter.skip === 0 && this.maxRow && json.data.length < this.maxRow) { - this.removeLoadMore = true; - } - } else { - this.maxRow = false; + if (this.maxRow) { + if (this.items) { + filter.skip = this.items.length; } - this.finding = false; - }, - () => { - this.finding = false; + filter.limit = this.maxRow; + filter.order = this.order; } - ); + if (this.filter) { + Object.assign(filter, this.filter); + } + + let json = JSON.stringify(filter); + + this.removeLoadMore = false; + + this.$http.get(`${this.url}?filter=${json}`).then( + json => { + if (json.data.length) { + json.data.forEach( + el => { + if (this.multiple) { + el.checked = this.field.indexOf(el[this.valueField]) !== -1; + } + this.items.push(el); + } + ); + if (filter.skip === 0 && this.maxRow && json.data.length < this.maxRow) { + this.removeLoadMore = true; + } + } else { + this.maxRow = false; + } + this.finding = false; + }, + () => { + this.finding = false; + } + ); + } } } $onInit() { @@ -305,9 +312,17 @@ class Autocomplete extends Component { this.$element.unbind('focusout'); } + $onChanges(objectChange) { + if (objectChange.data && objectChange.data.currentValue && objectChange.data.currentValue.length) { + this.items = copyObject(objectChange.data.currentValue); + this.maxRow = false; + this.removeLoadMore = true; + } + } + } -Autocomplete.$inject = ['$element', '$scope', '$http', '$timeout']; +Autocomplete.$inject = ['$element', '$scope', '$http', '$timeout', '$filter']; module.component('vnAutocomplete', { template: require('./autocomplete.html'), From 6fd171e11f92a85f29dfd0b4650ef62ece979a31 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 10:57:44 +0100 Subject: [PATCH 5/8] file encoding changed to UTF-8 --- e2e/paths/edit_basic_data.spec.js.js | 18 +++++++++--------- e2e/paths/edit_fiscal_data.spec.js.js | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/e2e/paths/edit_basic_data.spec.js.js b/e2e/paths/edit_basic_data.spec.js.js index 0c8436a0c..233e3311f 100644 --- a/e2e/paths/edit_basic_data.spec.js.js +++ b/e2e/paths/edit_basic_data.spec.js.js @@ -81,7 +81,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -111,7 +111,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -141,7 +141,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -171,7 +171,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -201,7 +201,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -231,7 +231,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -261,7 +261,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -290,7 +290,7 @@ describe('Edit basicData path', () => { // .wait(selectors.globalItems.snackbarIsActive) // .getInnerText(selectors.globalItems.snackbarIsActive) // .then(result => { - // expect(result).toEqual(`¡Datos guardados!`); + // expect(result).toEqual(`ยกDatos guardados!`); // done(); // }) // .catch(catchErrors(done)); @@ -305,7 +305,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); diff --git a/e2e/paths/edit_fiscal_data.spec.js.js b/e2e/paths/edit_fiscal_data.spec.js.js index 231399b54..3c300e4b4 100644 --- a/e2e/paths/edit_fiscal_data.spec.js.js +++ b/e2e/paths/edit_fiscal_data.spec.js.js @@ -80,7 +80,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('ยกDatos guardados!'); done(); }) .catch(catchErrors(done)); @@ -110,7 +110,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('ยกDatos guardados!'); done(); }) .catch(catchErrors(done)); @@ -142,7 +142,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -172,7 +172,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); From f03f17723fc98fd4bd8bf08ecf8ae56df0c57189 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 11:00:59 +0100 Subject: [PATCH 6/8] one more character correction due to encoding --- e2e/paths/edit_basic_data.spec.js.js | 18 +++++++++--------- e2e/paths/edit_fiscal_data.spec.js.js | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/e2e/paths/edit_basic_data.spec.js.js b/e2e/paths/edit_basic_data.spec.js.js index 233e3311f..0c8436a0c 100644 --- a/e2e/paths/edit_basic_data.spec.js.js +++ b/e2e/paths/edit_basic_data.spec.js.js @@ -81,7 +81,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -111,7 +111,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -141,7 +141,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -171,7 +171,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -201,7 +201,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -231,7 +231,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -261,7 +261,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -290,7 +290,7 @@ describe('Edit basicData path', () => { // .wait(selectors.globalItems.snackbarIsActive) // .getInnerText(selectors.globalItems.snackbarIsActive) // .then(result => { - // expect(result).toEqual(`ยกDatos guardados!`); + // expect(result).toEqual(`¡Datos guardados!`); // done(); // }) // .catch(catchErrors(done)); @@ -305,7 +305,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); diff --git a/e2e/paths/edit_fiscal_data.spec.js.js b/e2e/paths/edit_fiscal_data.spec.js.js index 3c300e4b4..231399b54 100644 --- a/e2e/paths/edit_fiscal_data.spec.js.js +++ b/e2e/paths/edit_fiscal_data.spec.js.js @@ -80,7 +80,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('ยกDatos guardados!'); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); @@ -110,7 +110,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('ยกDatos guardados!'); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); @@ -142,7 +142,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -172,7 +172,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); From c74bafae7e6d53cc8bd96760e8f073cc001d3aec Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Thu, 9 Nov 2017 11:39:41 +0100 Subject: [PATCH 7/8] acl in routes --- client/client/routes.json | 3 ++- client/locator/routes.json | 3 ++- client/production/routes.json | 3 ++- .../production/src/production-table/production-table.js | 2 +- client/route/routes.json | 3 ++- client/salix/src/configroutes.js | 8 ++++---- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/client/client/routes.json b/client/client/routes.json index aff34bc6f..8b1e32a7b 100644 --- a/client/client/routes.json +++ b/client/client/routes.json @@ -7,7 +7,8 @@ { "url": "/clients", "state": "clients", - "component": "vn-client-index" + "component": "vn-client-index", + "acl": ["employee"] }, { "url": "/create", "state": "create", diff --git a/client/locator/routes.json b/client/locator/routes.json index 6907d7ee7..b508fcc5f 100644 --- a/client/locator/routes.json +++ b/client/locator/routes.json @@ -7,7 +7,8 @@ { "url": "/locator", "state": "locator", - "component": "vn-locator-index" + "component": "vn-locator-index", + "acl": ["developer"] } ] } \ No newline at end of file diff --git a/client/production/routes.json b/client/production/routes.json index 77c111ab8..f0348d7d7 100644 --- a/client/production/routes.json +++ b/client/production/routes.json @@ -7,7 +7,8 @@ { "url": "/production", "state": "production", - "component": "vn-production-index" + "component": "vn-production-index", + "acl": ["employee"] } ] } \ No newline at end of file diff --git a/client/production/src/production-table/production-table.js b/client/production/src/production-table/production-table.js index 5a66807b7..96ebf6c2e 100644 --- a/client/production/src/production-table/production-table.js +++ b/client/production/src/production-table/production-table.js @@ -4,7 +4,7 @@ export class ProductionTable { constructor($filter) { this.$filter = $filter; this._tickets = []; - this.itemsDisplayedInList = 16; + this.itemsDisplayedInList = 14; this._checkAll = 0; this.pageTable = { filter: { diff --git a/client/route/routes.json b/client/route/routes.json index 1ccf632c1..9e7c48833 100644 --- a/client/route/routes.json +++ b/client/route/routes.json @@ -14,7 +14,7 @@ "url": "/list", "state": "routes.index", "component": "vn-route-index", - "acl": ["employee"] + "acl": ["developer"] }, { "url": "/create", @@ -43,6 +43,7 @@ "url": "/logisticData", "state": "routes.card.logisticData", "component": "vn-route-logistic-data", + "acl": ["employee"], "params": { "route": "$ctrl.route" }, diff --git a/client/salix/src/configroutes.js b/client/salix/src/configroutes.js index 8a3bdd156..9a30b3180 100644 --- a/client/salix/src/configroutes.js +++ b/client/salix/src/configroutes.js @@ -37,10 +37,10 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider) { template: '' }); - for (let file in routes) { - let fileRoutes = routes[file].routes; - let moduleName = routes[file].module; - let validations = routes[file].validations || false; + for (let file in window.routes) { + let fileRoutes = window.routes[file].routes; + let moduleName = window.routes[file].module; + let validations = window.routes[file].validations || false; fileRoutes.forEach(function(route) { if (aclService.routeHasPermission(route)) { $stateProvider.state(route.state, { From 563c49b785fd0e0de6d883395bff467651ea9e92 Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Thu, 9 Nov 2017 12:51:46 +0100 Subject: [PATCH 8/8] disable all module routes if not permission --- client/salix/src/configroutes.js | 39 ++++++++++++++++++------------ client/salix/src/modulesFactory.js | 7 +++--- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/client/salix/src/configroutes.js b/client/salix/src/configroutes.js index 9a30b3180..1d79c5bc2 100644 --- a/client/salix/src/configroutes.js +++ b/client/salix/src/configroutes.js @@ -11,8 +11,8 @@ function loader(moduleName, validations) { return load; } -config.$inject = ['$stateProvider', '$urlRouterProvider', 'aclServiceProvider']; -function config($stateProvider, $urlRouterProvider, aclServiceProvider) { +config.$inject = ['$stateProvider', '$urlRouterProvider', 'aclServiceProvider', 'modulesFactoryProvider']; +function config($stateProvider, $urlRouterProvider, aclServiceProvider, modulesFactory) { splitingRegister.registerGraph(deps); let aclService = aclServiceProvider.$get(); @@ -41,21 +41,28 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider) { let fileRoutes = window.routes[file].routes; let moduleName = window.routes[file].module; let validations = window.routes[file].validations || false; - fileRoutes.forEach(function(route) { - if (aclService.routeHasPermission(route)) { - $stateProvider.state(route.state, { - url: route.url, - abstract: route.abstract || false, - template: `<${route.component} ${getParams(route)}>`, - resolve: { - loader: loader(moduleName, validations) - }, - data: { - routes: fileRoutes - } - }); + let mainModule = modulesFactory.$get().getMainRoute(fileRoutes); + if (mainModule) { + let count = fileRoutes.length; + for (let i = 0; i < count; i++) { + let route = fileRoutes[i]; + if (aclService.routeHasPermission(route)) { + $stateProvider.state(route.state, { + url: route.url, + abstract: route.abstract || false, + template: `<${route.component} ${getParams(route)}>`, + resolve: { + loader: loader(moduleName, validations) + }, + data: { + routes: fileRoutes + } + }); + } else if (route.state === mainModule.state) { + break; + } } - }); + } } } ngModule.config(config); diff --git a/client/salix/src/modulesFactory.js b/client/salix/src/modulesFactory.js index a36b301ac..02c3e845c 100644 --- a/client/salix/src/modulesFactory.js +++ b/client/salix/src/modulesFactory.js @@ -1,7 +1,7 @@ import ngModule from './module'; function modulesFactory(aclService) { - function _getMainRoute(routeCollection) { + function getMainRoute(routeCollection) { let cant = routeCollection.length; for (let i = 0; i < cant; i++) { if (!routeCollection[i].abstract) { @@ -18,7 +18,7 @@ function modulesFactory(aclService) { name: routes[file].name || routes[file].module, icon: routes[file].icon || '' }; - let mainRoute = _getMainRoute(window.routes[file].routes); + let mainRoute = getMainRoute(window.routes[file].routes); if (mainRoute && aclService.routeHasPermission(mainRoute)) { card.route = mainRoute; modules.push(card); @@ -28,7 +28,8 @@ function modulesFactory(aclService) { } return { - getModules: getModules + getModules: getModules, + getMainRoute: getMainRoute }; } modulesFactory.$inject = ['aclService'];