From b0e22febd3ade9c598154505c5c4a0208ab384c2 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 12 Feb 2019 09:03:56 +0100 Subject: [PATCH 01/10] #1127 mover ticket.descriptor al modulo ticket --- front/core/lib/module-loader.js | 9 +++--- modules/item/front/index.js | 4 --- modules/item/front/routes.json | 2 +- .../front/descriptor-popover}/index.html | 0 .../front/descriptor-popover}/index.js | 0 .../front/descriptor-popover}/index.spec.js | 0 .../front/descriptor-popover}/style.scss | 0 .../front/descriptor}/addStowaway.html | 0 .../front/descriptor}/addStowaway.js | 0 .../front/descriptor}/index.html | 0 .../front/descriptor}/index.js | 0 .../front/descriptor}/index.spec.js | 0 .../front/descriptor}/locale/es.yml | 0 .../front/descriptor}/removeStowaway.html | 0 .../front/descriptor}/removeStowaway.js | 0 .../front/descriptor}/style.scss | 0 modules/ticket/front/index.js | 4 +++ services/db/install/dump/fixtures.sql | 29 +++++++++---------- 18 files changed, 23 insertions(+), 25 deletions(-) rename modules/{item/front/ticket-descriptor-popover => ticket/front/descriptor-popover}/index.html (100%) rename modules/{item/front/ticket-descriptor-popover => ticket/front/descriptor-popover}/index.js (100%) rename modules/{item/front/ticket-descriptor-popover => ticket/front/descriptor-popover}/index.spec.js (100%) rename modules/{item/front/ticket-descriptor-popover => ticket/front/descriptor-popover}/style.scss (100%) rename modules/{item/front/ticket-descriptor => ticket/front/descriptor}/addStowaway.html (100%) rename modules/{item/front/ticket-descriptor => ticket/front/descriptor}/addStowaway.js (100%) rename modules/{item/front/ticket-descriptor => ticket/front/descriptor}/index.html (100%) rename modules/{item/front/ticket-descriptor => ticket/front/descriptor}/index.js (100%) rename modules/{item/front/ticket-descriptor => ticket/front/descriptor}/index.spec.js (100%) rename modules/{item/front/ticket-descriptor => ticket/front/descriptor}/locale/es.yml (100%) rename modules/{item/front/ticket-descriptor => ticket/front/descriptor}/removeStowaway.html (100%) rename modules/{item/front/ticket-descriptor => ticket/front/descriptor}/removeStowaway.js (100%) rename modules/{item/front/ticket-descriptor => ticket/front/descriptor}/style.scss (100%) diff --git a/front/core/lib/module-loader.js b/front/core/lib/module-loader.js index 163d103bb..fa8876520 100644 --- a/front/core/lib/module-loader.js +++ b/front/core/lib/module-loader.js @@ -19,7 +19,9 @@ export function factory($http, $window, $ocLazyLoad, $translatePartialLoader, $t if (loaded[moduleName] instanceof Promise) return loaded[moduleName]; if (loaded[moduleName] === false) - return $q.reject(new Error(`Module dependency loop detected: ${moduleName}`)); + return Promise.resolve(true); + // TODO task #1134 look for a better way to handle dependency loop + // return $q.reject(new Error(`Module dependency loop detected: ${moduleName}`)); loaded[moduleName] = false; @@ -37,10 +39,7 @@ export function factory($http, $window, $ocLazyLoad, $translatePartialLoader, $t $translatePartialLoader.addPart(moduleName); promises.push(new Promise(resolve => { - $translate.refresh().then( - () => resolve(), - () => resolve() - ); + $translate.refresh().then(resolve, resolve); })); if (validations) { diff --git a/modules/item/front/index.js b/modules/item/front/index.js index c2f9a66f6..3bb2942a8 100644 --- a/modules/item/front/index.js +++ b/modules/item/front/index.js @@ -7,10 +7,6 @@ import './create'; import './card'; import './descriptor'; import './descriptor-popover'; -import './ticket-descriptor'; -import './ticket-descriptor/addStowaway'; -import './ticket-descriptor/removeStowaway'; -import './ticket-descriptor-popover'; import './data'; import './tags'; import './tax'; diff --git a/modules/item/front/routes.json b/modules/item/front/routes.json index b81625e06..35651ef5b 100644 --- a/modules/item/front/routes.json +++ b/modules/item/front/routes.json @@ -3,7 +3,7 @@ "name": "Items", "icon": "inbox", "validations" : true, - "dependencies": ["client"], + "dependencies": ["client", "ticket"], "menu": [ {"state": "item.card.data", "icon": "settings"}, {"state": "item.card.tags", "icon": "icon-tags"}, diff --git a/modules/item/front/ticket-descriptor-popover/index.html b/modules/ticket/front/descriptor-popover/index.html similarity index 100% rename from modules/item/front/ticket-descriptor-popover/index.html rename to modules/ticket/front/descriptor-popover/index.html diff --git a/modules/item/front/ticket-descriptor-popover/index.js b/modules/ticket/front/descriptor-popover/index.js similarity index 100% rename from modules/item/front/ticket-descriptor-popover/index.js rename to modules/ticket/front/descriptor-popover/index.js diff --git a/modules/item/front/ticket-descriptor-popover/index.spec.js b/modules/ticket/front/descriptor-popover/index.spec.js similarity index 100% rename from modules/item/front/ticket-descriptor-popover/index.spec.js rename to modules/ticket/front/descriptor-popover/index.spec.js diff --git a/modules/item/front/ticket-descriptor-popover/style.scss b/modules/ticket/front/descriptor-popover/style.scss similarity index 100% rename from modules/item/front/ticket-descriptor-popover/style.scss rename to modules/ticket/front/descriptor-popover/style.scss diff --git a/modules/item/front/ticket-descriptor/addStowaway.html b/modules/ticket/front/descriptor/addStowaway.html similarity index 100% rename from modules/item/front/ticket-descriptor/addStowaway.html rename to modules/ticket/front/descriptor/addStowaway.html diff --git a/modules/item/front/ticket-descriptor/addStowaway.js b/modules/ticket/front/descriptor/addStowaway.js similarity index 100% rename from modules/item/front/ticket-descriptor/addStowaway.js rename to modules/ticket/front/descriptor/addStowaway.js diff --git a/modules/item/front/ticket-descriptor/index.html b/modules/ticket/front/descriptor/index.html similarity index 100% rename from modules/item/front/ticket-descriptor/index.html rename to modules/ticket/front/descriptor/index.html diff --git a/modules/item/front/ticket-descriptor/index.js b/modules/ticket/front/descriptor/index.js similarity index 100% rename from modules/item/front/ticket-descriptor/index.js rename to modules/ticket/front/descriptor/index.js diff --git a/modules/item/front/ticket-descriptor/index.spec.js b/modules/ticket/front/descriptor/index.spec.js similarity index 100% rename from modules/item/front/ticket-descriptor/index.spec.js rename to modules/ticket/front/descriptor/index.spec.js diff --git a/modules/item/front/ticket-descriptor/locale/es.yml b/modules/ticket/front/descriptor/locale/es.yml similarity index 100% rename from modules/item/front/ticket-descriptor/locale/es.yml rename to modules/ticket/front/descriptor/locale/es.yml diff --git a/modules/item/front/ticket-descriptor/removeStowaway.html b/modules/ticket/front/descriptor/removeStowaway.html similarity index 100% rename from modules/item/front/ticket-descriptor/removeStowaway.html rename to modules/ticket/front/descriptor/removeStowaway.html diff --git a/modules/item/front/ticket-descriptor/removeStowaway.js b/modules/ticket/front/descriptor/removeStowaway.js similarity index 100% rename from modules/item/front/ticket-descriptor/removeStowaway.js rename to modules/ticket/front/descriptor/removeStowaway.js diff --git a/modules/item/front/ticket-descriptor/style.scss b/modules/ticket/front/descriptor/style.scss similarity index 100% rename from modules/item/front/ticket-descriptor/style.scss rename to modules/ticket/front/descriptor/style.scss diff --git a/modules/ticket/front/index.js b/modules/ticket/front/index.js index 325dc11d8..1269a60db 100644 --- a/modules/ticket/front/index.js +++ b/modules/ticket/front/index.js @@ -3,6 +3,10 @@ export * from './module'; import './index/'; import './search-panel'; import './card'; +import './descriptor'; +import './descriptor/addStowaway'; +import './descriptor/removeStowaway'; +import './descriptor-popover'; import './create/card'; import './create/index'; import './summary'; diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index 8ebe1bab9..a88d19e2e 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -860,27 +860,27 @@ INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`) VALUES - (1 , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 1, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) ), - (2 , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 2, 1, 121, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) ), - (3 , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 3, 2, 122, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) ), - (4 , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 1, 2, 122, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) ), - (5 , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 2, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) ), - (6 , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 3, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) ), - (7 , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 1, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) ), + (1 , DATE_ADD(CURDATE(), INTERVAL -15 DAY), 101, 1, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) ), + (2 , DATE_ADD(CURDATE(), INTERVAL -10 DAY), 101, 2, 1, 121, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) ), + (3 , DATE_ADD(CURDATE(), INTERVAL -5 DAY), 102, 3, 2, 122, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) ), + (4 , DATE_ADD(CURDATE(), INTERVAL -4 DAY), 102, 1, 2, 122, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) ), + (5 , DATE_ADD(CURDATE(), INTERVAL -3 DAY), 103, 2, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) ), + (6 , DATE_ADD(CURDATE(), INTERVAL -2 DAY), 103, 3, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) ), + (7 , DATE_ADD(CURDATE(), INTERVAL -1 DAY), 104, 1, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) ), (8 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 104, 2, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), (9 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 3, 5, 125, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), (10, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 1, 6, 125, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), - (11, CURDATE() , 101, 2, 7, 121, 442, NULL, 'SALIX', 1, CURDATE() , CURDATE() , CURDATE() ), + (11, CURDATE(), 101, 2, 7, 121, 442, NULL, 'SALIX', 1, CURDATE() , CURDATE() , CURDATE() ), (12, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 3, 1, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), (13, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 1, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH)), (14, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 2, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH)), (15, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 3, 3, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH)), - (16, DATE_ADD(CURDATE(), INTERVAL +4 DAY) , 101, 1, 1, 121, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), - (17, CURDATE() , 106, 2, 4, 126, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), - (18, CURDATE() , 107, 3, 4, 127, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), - (19, CURDATE() , 108, 1, 5, 128, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), - (20, CURDATE() , 109, 2, 5, 119, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), - (21, CURDATE() , 110, 3, 5, 129, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ); + (16, DATE_ADD(CURDATE(), INTERVAL +4 DAY), 101, 1, 1, 121, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (17, CURDATE(), 106, 2, 4, 126, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (18, CURDATE(), 107, 3, 4, 127, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (19, CURDATE(), 108, 1, 5, 128, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (20, CURDATE(), 109, 2, 5, 119, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (21, CURDATE(), 110, 3, 5, 129, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ); INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`) VALUES @@ -1043,7 +1043,6 @@ INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`) (13, 13), (14, 14), (15, 15), - (16, 16), (17, 17), (18, 18), (19, 19), From 9c0613e8e7900df1f1f113b271e770c4d9f1c8b6 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 12 Feb 2019 14:40:13 +0100 Subject: [PATCH 02/10] #1127 --- front/core/lib/specs/module-loader.spec.js | 14 -- .../front/descriptor-popover/index.spec.js | 201 +++++++++--------- modules/ticket/front/descriptor/index.spec.js | 6 +- 3 files changed, 102 insertions(+), 119 deletions(-) diff --git a/front/core/lib/specs/module-loader.spec.js b/front/core/lib/specs/module-loader.spec.js index c8def1634..bc705f40f 100644 --- a/front/core/lib/specs/module-loader.spec.js +++ b/front/core/lib/specs/module-loader.spec.js @@ -28,19 +28,5 @@ describe('factory vnModuleLoader', () => { expect(result).toEqual(jasmine.any(Promise)); }); - - it('should return an error if the module wasnt loaded', done => { - vnModuleLoader._loaded.myModule = false; - - vnModuleLoader.load('myModule', {myValidations: () => {}}) - .then(() => { - done.fail('this must fail'); - }) - .catch(error => { - expect(error.toString()).toEqual(`Error: Module dependency loop detected: myModule`); - done(); - }); - $scope.$apply(); - }); }); }); diff --git a/modules/ticket/front/descriptor-popover/index.spec.js b/modules/ticket/front/descriptor-popover/index.spec.js index 9e3d39e4b..499ca5413 100644 --- a/modules/ticket/front/descriptor-popover/index.spec.js +++ b/modules/ticket/front/descriptor-popover/index.spec.js @@ -1,126 +1,125 @@ import './index.js'; -describe('Item', () => { - describe('Component vnTicketDescriptorPopover', () => { - let $httpBackend; - let $scope; - let controller; - let $element; - let $timeout; +describe('ticket Component vnTicketDescriptorPopover', () => { + let $httpBackend; + let $scope; + let controller; + let $element; + let $timeout; - beforeEach(ngModule('item')); + beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$timeout_) => { - $httpBackend = _$httpBackend_; - $timeout = _$timeout_; - $element = angular.element(`
`); - $scope = $rootScope.$new(); - $scope.popover = {relocate: () => {}, show: () => {}}; - controller = $componentController('vnTicketDescriptorPopover', {$scope, $element}); - })); + beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$timeout_) => { + $httpBackend = _$httpBackend_; + $timeout = _$timeout_; + $element = angular.element(`
`); + $scope = $rootScope.$new(); + $scope.popover = {relocate: () => {}, show: () => {}}; + controller = $componentController('vnTicketDescriptorPopover', {$scope, $element}); + })); - describe('ticketFk()', () => { - it(`should not apply any changes if the received id is the same stored in _ticketFk`, () => { - controller.ticket = 'I exist!'; - controller._ticketFk = 1; - spyOn(controller, 'getCard'); - controller.ticketFk = 1; + describe('ticketFk()', () => { + it(`should not apply any changes if the received id is the same stored in _ticketFk`, () => { + controller.ticket = 'I exist!'; + controller._ticketFk = 1; + spyOn(controller, 'getCard'); + controller.ticketFk = 1; - expect(controller.ticket).toEqual('I exist!'); - expect(controller._ticketFk).toEqual(1); - expect(controller.getCard).not.toHaveBeenCalled(); - }); - - it(`should set the received id into _ticketFk, set the ticket to null and then call getCard()`, () => { - controller.ticket = `Please don't`; - controller._ticketFk = 1; - spyOn(controller, 'getCard'); - controller.ticketFk = 999; - - expect(controller.ticket).toBeNull(); - expect(controller._ticketFk).toEqual(999); - expect(controller.getCard).toHaveBeenCalledWith(); - }); + expect(controller.ticket).toEqual('I exist!'); + expect(controller._ticketFk).toEqual(1); + expect(controller.getCard).not.toHaveBeenCalled(); }); - describe('ticket()', () => { - it(`should save the ticket into _ticket and then call relocate()`, () => { - spyOn(controller.$.popover, 'relocate'); - controller.ticket = `i'm the ticket!`; - $timeout.flush(); + it(`should set the received id into _ticketFk, set the ticket to null and then call getCard()`, () => { + controller.ticket = `Please don't`; + controller._ticketFk = 1; + spyOn(controller, 'getCard'); + controller.ticketFk = 999; - expect(controller._ticket).toEqual(`i'm the ticket!`); - expect(controller.$.popover.relocate).toHaveBeenCalledWith(); - }); + expect(controller.ticket).toBeNull(); + expect(controller._ticketFk).toEqual(999); + expect(controller.getCard).toHaveBeenCalledWith(); }); + }); - describe('show()', () => { - it(`should call the show()`, () => { - spyOn(controller.$.popover, 'show'); - controller.show(); + describe('ticket()', () => { + it(`should save the ticket into _ticket and then call relocate()`, () => { + spyOn(controller.$.popover, 'relocate'); + controller.ticket = `i'm the ticket!`; + $timeout.flush(); - expect(controller.$.popover.show).toHaveBeenCalledWith(); - }); + expect(controller._ticket).toEqual(`i'm the ticket!`); + expect(controller.$.popover.relocate).toHaveBeenCalledWith(); }); + }); - describe('getCard()', () => { - it(`should perform a get query to store the ticket data into the controller`, () => { - controller.ticketFk = 1; - controller.canceler = null; - let response = {}; + describe('show()', () => { + it(`should call the show()`, () => { + spyOn(controller.$.popover, 'show'); + controller.show(); - let filter = { - include: [ - { - relation: 'warehouse', - scope: { - fields: ['name'] - } - }, - { - relation: 'agencyMode', - scope: { - fields: ['name'] - } - }, - { - relation: 'client', - scope: { - fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'], - include: { - relation: 'salesPerson', - scope: { - fields: ['userFk'], - include: { - relation: 'user', - scope: { - fields: ['nickname'] - } + expect(controller.$.popover.show).toHaveBeenCalledWith(); + }); + }); + + describe('getCard()', () => { + it(`should perform a get query to store the ticket data into the controller`, () => { + controller.ticketFk = 1; + controller.canceler = null; + let response = {}; + + let filter = { + include: [ + { + relation: 'warehouse', + scope: { + fields: ['name'] + } + }, + { + relation: 'agencyMode', + scope: { + fields: ['name'] + } + }, + { + relation: 'client', + scope: { + fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'], + include: { + relation: 'salesPerson', + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] } } } } - }, - { - relation: 'state', - scope: { - fields: ['stateFk'], - include: { - relation: 'state', - fields: ['id', 'name'], - } + } + }, + { + relation: 'state', + scope: { + fields: ['stateFk'], + include: { + relation: 'state', + fields: ['id', 'name'], } } - ] - }; - let json = encodeURIComponent(JSON.stringify(filter)); - $httpBackend.when('GET', `/ticket/api/Tickets/${controller._ticketFk}?filter=${json}`).respond(response); - $httpBackend.expect('GET', `/ticket/api/Tickets/${controller._ticketFk}?filter=${json}`); - controller.getCard(); - $httpBackend.flush(); + } + ] + }; + let json = encodeURIComponent(JSON.stringify(filter)); + $httpBackend.when('GET', `/ticket/api/Tickets/${controller._ticketFk}?filter=${json}`).respond(response); + $httpBackend.expect('GET', `/ticket/api/Tickets/${controller._ticketFk}?filter=${json}`); + controller.getCard(); + $httpBackend.flush(); - expect(controller.ticket).toEqual(response); - }); + expect(controller.ticket).toEqual(response); }); }); }); + diff --git a/modules/ticket/front/descriptor/index.spec.js b/modules/ticket/front/descriptor/index.spec.js index 51293f462..2c2359299 100644 --- a/modules/ticket/front/descriptor/index.spec.js +++ b/modules/ticket/front/descriptor/index.spec.js @@ -1,12 +1,10 @@ import './index.js'; -describe('Item Component vnTicketDescriptor', () => { +describe('Ticket Component vnTicketDescriptor', () => { let $httpBackend; let controller; - beforeEach(() => { - ngModule('item'); - }); + beforeEach(ngModule('ticket')); beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; From 7f96eae312cb898a004e0da9933b3d762274a95a Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 13 Feb 2019 07:57:08 +0100 Subject: [PATCH 03/10] $applyAsync() with relocate() on catalog. Replaced $$postDigest() #1072 --- modules/agency/front/location/index.js | 2 +- modules/item/front/diary/index.js | 2 +- modules/item/front/diary/index.spec.js | 12 +++--- modules/order/front/filter/index.js | 2 +- modules/order/front/filter/index.spec.js | 48 +++++++++++++-------- modules/order/front/prices-popover/index.js | 5 ++- 6 files changed, 44 insertions(+), 27 deletions(-) diff --git a/modules/agency/front/location/index.js b/modules/agency/front/location/index.js index cdb89829a..92e893297 100644 --- a/modules/agency/front/location/index.js +++ b/modules/agency/front/location/index.js @@ -10,7 +10,7 @@ class Controller { } onSearch() { - this.$scope.$$postDigest(() => { + this.$scope.$applyAsync(() => { this.$scope.treeview.refresh(); }); } diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js index 6745ad94c..c2e5e6bff 100644 --- a/modules/item/front/diary/index.js +++ b/modules/item/front/diary/index.js @@ -22,7 +22,7 @@ class Controller { where: {itemFk: this.$stateParams.id} }; - this.$scope.$$postDigest(() => { + this.$scope.$applyAsync(() => { if (this.$stateParams.warehouseFk) this.warehouseFk = this.$stateParams.warehouseFk; else if (value) diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js index 454a8b25f..9286f2863 100644 --- a/modules/item/front/diary/index.spec.js +++ b/modules/item/front/diary/index.spec.js @@ -69,23 +69,23 @@ describe('Item', () => { describe('set item()', () => { it(`should set warehouseFk property based on itemType warehouseFk`, () => { - spyOn(controller.$scope, '$$postDigest').and.callThrough(); + spyOn(controller.$scope, '$applyAsync').and.callThrough(); controller.item = {id: 1, itemType: {warehouseFk: 1}}; - expect(controller.$scope.$$postDigest).toHaveBeenCalledWith(jasmine.any(Function)); - $scope.$digest(); + expect(controller.$scope.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function)); + $scope.$apply(); expect(controller.warehouseFk).toEqual(1); expect(controller.item.id).toEqual(1); }); it(`should set warehouseFk property based on url query warehouseFk`, () => { - spyOn(controller.$scope, '$$postDigest').and.callThrough(); + spyOn(controller.$scope, '$applyAsync').and.callThrough(); controller.$stateParams.warehouseFk = 4; controller.item = {id: 1, itemType: {warehouseFk: 1}}; - expect(controller.$scope.$$postDigest).toHaveBeenCalledWith(jasmine.any(Function)); - $scope.$digest(); + expect(controller.$scope.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function)); + $scope.$apply(); expect(controller.warehouseFk).toEqual(4); expect(controller.item.id).toEqual(1); diff --git a/modules/order/front/filter/index.js b/modules/order/front/filter/index.js index 9f1013b35..c2bfb8e4b 100644 --- a/modules/order/front/filter/index.js +++ b/modules/order/front/filter/index.js @@ -28,7 +28,7 @@ class Controller { this._order = value; - this.$scope.$$postDigest(() => { + this.$scope.$applyAsync(() => { let category; let type; diff --git a/modules/order/front/filter/index.spec.js b/modules/order/front/filter/index.spec.js index 3d9888c57..c31e87500 100644 --- a/modules/order/front/filter/index.spec.js +++ b/modules/order/front/filter/index.spec.js @@ -6,10 +6,12 @@ describe('Order', () => { let $scope; let $state; let controller; + let $httpBackend; beforeEach(ngModule('order')); - beforeEach(angular.mock.inject(($componentController, _$state_, $rootScope) => { + beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => { + $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); $scope.model = crudModel; $scope.search = {}; @@ -27,12 +29,14 @@ describe('Order', () => { })); describe('order() setter', () => { - it(`should call scope $$postDigest() method and apply filters from state params`, () => { - spyOn(controller.$scope, '$$postDigest').and.callThrough(); + it(`should call scope $applyAsync() method and apply filters from state params`, () => { + $httpBackend.expect('GET', `/item/api/ItemCategories/1/itemTypes`).respond(); + spyOn(controller.$scope, '$applyAsync').and.callThrough(); controller.order = {id: 4}; - expect(controller.$scope.$$postDigest).toHaveBeenCalledWith(jasmine.any(Function)); - $scope.$digest(); + expect(controller.$scope.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function)); + $scope.$apply(); + expect(controller.category).toEqual({id: 1, value: 'My Category'}); expect(controller.type).toEqual({id: 1, value: 'My type'}); @@ -96,28 +100,38 @@ describe('Order', () => { }); describe('applyFilters()', () => { - it(`should set type property to null, call updateStateParams() method and not call applyFilters()`, () => { - spyOn(controller.catalog.$scope.model, 'applyFilter'); - controller.order = {id: 4}; - $scope.$digest(); + it(`should call model applyFilter() method with a new filter`, () => { + let model = controller.catalog.$scope.model; + spyOn(model, 'applyFilter'); + controller._category = {id: 1, value: 'My Category'}; + controller._type = {id: 1, value: 'My type'}; + controller._order = {id: 4}; + controller.applyFilters(); - expect(controller.catalog.$scope.model.applyFilter).toHaveBeenCalledWith( + expect(model.applyFilter).toHaveBeenCalledWith( {where: {categoryFk: 1, typeFk: 1}}, {orderFk: 4, orderBy: controller.catalog.getOrderBy(), tags: []}); }); }); describe('remove()', () => { - it(`should remove a filter from tags property and then call applyFilters()`, () => { - spyOn(controller, 'applyFilters'); - controller.order = {id: 4}; + it(`should remove a tag from tags property`, () => { controller.tags = [{tagFk: 1, value: 'Blue'}, {tagFk: 2, value: '70'}]; - $scope.$digest(); controller.remove(0); expect(controller.tags.length).toEqual(1); expect(controller.tags[0].tagFk).toEqual(2); + }); + + it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => { + spyOn(controller, 'applyFilters'); + controller._category = {id: 1, value: 'My Category'}; + controller._type = {id: 1, value: 'My type'}; + controller.tags = [{tagFk: 1, value: 'Blue'}]; + controller.remove(0); + + expect(controller.tags.length).toEqual(0); expect(controller.applyFilters).toHaveBeenCalledWith(); }); }); @@ -125,10 +139,10 @@ describe('Order', () => { describe('updateStateParams()', () => { it(`should call state go() method passing category and type state params`, () => { spyOn(controller.$state, 'go'); - controller.order = {id: 4}; - $scope.$digest(); - + controller._category = {id: 1, value: 'My Category'}; + controller._type = {id: 1, value: 'My type'}; let result = {category: '{"id":1,"value":"My Category"}', type: '{"id":1,"value":"My type"}'}; + controller.updateStateParams(); expect(controller.$state.go).toHaveBeenCalledWith('my.current.state', result); }); diff --git a/modules/order/front/prices-popover/index.js b/modules/order/front/prices-popover/index.js index c44ff7109..e89f04774 100644 --- a/modules/order/front/prices-popover/index.js +++ b/modules/order/front/prices-popover/index.js @@ -35,6 +35,9 @@ class Controller { }; this.$http.get(`/item/api/ItemTags?filter=${JSON.stringify(filter)}`).then(response => { this.tags = response.data; + this.$.$applyAsync(() => { + this.$.popover.relocate(); + }); }); } show(event, item) { @@ -42,8 +45,8 @@ class Controller { this.prices = this.item.prices; this.getTags(); this.$.popover.parent = event.target; - this.$.popover.relocate(); this.$.popover.show(); + this.$.popover.relocate(); } clear() { this.item = {}; From 758602442259bbf49cf5386bc83bf370597ec4a7 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 13 Feb 2019 08:34:40 +0100 Subject: [PATCH 04/10] data base test refactor and fix with app boot --- services/db/tests.js | 4 +++- services/db/tests/vn/buyUltimate.spec.js | 2 +- services/db/tests/vn/buyUltimateFromInterval.spec.js | 2 +- services/db/tests/vn/logAddWithUser.spec.js | 2 +- services/db/tests/vn/ticketCalculateClon.spec.js | 2 +- services/db/tests/vn/ticketComponentUpdateSale.spec.js | 2 +- services/db/tests/vn/ticketCreateWithUser.spec.js | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/services/db/tests.js b/services/db/tests.js index 88afa942e..bf2f45b2e 100644 --- a/services/db/tests.js +++ b/services/db/tests.js @@ -9,7 +9,9 @@ let verbose = false; if (process.argv[2] === '--v') verbose = true; -loopbackApp = `vn-loopback/server/server`; +let app = require(`vn-loopback/server/server`); +app.boot(); +loopbackApp = 'vn-loopback/server/server'; let Jasmine = require('jasmine'); let jasmine = new Jasmine(); diff --git a/services/db/tests/vn/buyUltimate.spec.js b/services/db/tests/vn/buyUltimate.spec.js index f5a26c1fe..4ff6c4708 100644 --- a/services/db/tests/vn/buyUltimate.spec.js +++ b/services/db/tests/vn/buyUltimate.spec.js @@ -1,4 +1,4 @@ -const app = require(`${loopbackApp}`); +const app = require('vn-loopback/server/server'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; describe('buyUltimate()', () => { diff --git a/services/db/tests/vn/buyUltimateFromInterval.spec.js b/services/db/tests/vn/buyUltimateFromInterval.spec.js index 6a22fb34b..b416b5cb2 100644 --- a/services/db/tests/vn/buyUltimateFromInterval.spec.js +++ b/services/db/tests/vn/buyUltimateFromInterval.spec.js @@ -1,4 +1,4 @@ -const app = require(`${loopbackApp}`); +const app = require('vn-loopback/server/server'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; describe('buyUltimateFromInterval()', () => { diff --git a/services/db/tests/vn/logAddWithUser.spec.js b/services/db/tests/vn/logAddWithUser.spec.js index 48bc70aac..8711769d0 100644 --- a/services/db/tests/vn/logAddWithUser.spec.js +++ b/services/db/tests/vn/logAddWithUser.spec.js @@ -1,4 +1,4 @@ -const app = require(`${loopbackApp}`); +const app = require('vn-loopback/server/server'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; describe('logAddWithUser()', () => { diff --git a/services/db/tests/vn/ticketCalculateClon.spec.js b/services/db/tests/vn/ticketCalculateClon.spec.js index 3c7bd0c2e..0b3969f1f 100644 --- a/services/db/tests/vn/ticketCalculateClon.spec.js +++ b/services/db/tests/vn/ticketCalculateClon.spec.js @@ -1,4 +1,4 @@ -const app = require(`${loopbackApp}`); +const app = require('vn-loopback/server/server'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; describe('ticket ticketCalculateClon()', () => { diff --git a/services/db/tests/vn/ticketComponentUpdateSale.spec.js b/services/db/tests/vn/ticketComponentUpdateSale.spec.js index 50e7cd265..45551c165 100644 --- a/services/db/tests/vn/ticketComponentUpdateSale.spec.js +++ b/services/db/tests/vn/ticketComponentUpdateSale.spec.js @@ -1,4 +1,4 @@ -const app = require(`${loopbackApp}`); +const app = require('vn-loopback/server/server'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; describe('ticketComponentUpdateSale()', () => { diff --git a/services/db/tests/vn/ticketCreateWithUser.spec.js b/services/db/tests/vn/ticketCreateWithUser.spec.js index e8c5b5be8..52a8a1183 100644 --- a/services/db/tests/vn/ticketCreateWithUser.spec.js +++ b/services/db/tests/vn/ticketCreateWithUser.spec.js @@ -1,4 +1,4 @@ -const app = require(`${loopbackApp}`); +const app = require('vn-loopback/server/server'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; describe('ticket ticketCreateWithUser()', () => { From 8bbf92457389147b8bb685af280e0ecddf2bc618 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 13 Feb 2019 08:35:39 +0100 Subject: [PATCH 05/10] removed deprecated script --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index cea470bbc..3a587e8e0 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,6 @@ "yaml-loader": "^0.5.0" }, "scripts": { - "test": "nodemon -q back/tests.js -w modules", "dbtest": "nodemon -q services/db/tests.js -w services/db/tests", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", "lint": "eslint ./ --cache --ignore-pattern .gitignore", From fefd6f45aff476cf547cbde412985cab462c6ecf Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 13 Feb 2019 08:43:09 +0100 Subject: [PATCH 06/10] removed deprecation --- front/core/lib/module-loader.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/front/core/lib/module-loader.js b/front/core/lib/module-loader.js index fa8876520..477b1c943 100644 --- a/front/core/lib/module-loader.js +++ b/front/core/lib/module-loader.js @@ -20,8 +20,6 @@ export function factory($http, $window, $ocLazyLoad, $translatePartialLoader, $t return loaded[moduleName]; if (loaded[moduleName] === false) return Promise.resolve(true); - // TODO task #1134 look for a better way to handle dependency loop - // return $q.reject(new Error(`Module dependency loop detected: ${moduleName}`)); loaded[moduleName] = false; From 3bd137a43523c003176395b0ae512b3276498510 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 13 Feb 2019 08:53:57 +0100 Subject: [PATCH 07/10] minor refactor --- e2e/helpers/extensions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 27590c4ea..e311df432 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -266,11 +266,11 @@ let actions = { }); }, - waitForTextInElement: function(selector, name, done) { + waitForTextInElement: function(selector, text, done) { this.wait(selector) - .wait((selector, name) => { - return document.querySelector(selector).innerText.toLowerCase().includes(name.toLowerCase()); - }, selector, name) + .wait((selector, text) => { + return document.querySelector(selector).innerText.toLowerCase().includes(text.toLowerCase()); + }, selector, text) .then(done) .catch(done); }, From 5063bd8137db35895670da38de1fe7ff46404328 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 13 Feb 2019 09:27:11 +0100 Subject: [PATCH 08/10] #1128 item.index --- e2e/helpers/selectors.js | 6 +- modules/item/back/methods/item/filter.js | 13 +++- modules/item/front/index/index.html | 87 +++++++++++++++++++----- modules/item/front/index/index.js | 31 ++++++++- modules/item/front/index/style.scss | 7 ++ 5 files changed, 119 insertions(+), 25 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 0094dca9a..941c86038 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -171,9 +171,9 @@ export default { itemsIndex: { goBackToModuleIndexButton: `vn-ticket-descriptor a[href="#!/ticket/index"]`, createItemButton: `${components.vnFloatButton}`, - searchResult: `vn-item-product a`, - searchResultPreviewButton: `vn-item-product .buttons > [icon="desktop_windows"]`, - searchResultCloneButton: `vn-item-product .buttons > [icon="icon-clone"]`, + searchResult: `vn-item-index a.vn-tr`, + searchResultPreviewButton: `vn-item-index .buttons > [icon="desktop_windows"]`, + searchResultCloneButton: `vn-item-index .buttons > [icon="icon-clone"]`, acceptClonationAlertButton: `vn-item-index [vn-id="clone"] [response="ACCEPT"]`, searchItemInput: `vn-searchbar vn-textfield input`, searchButton: `vn-searchbar vn-icon[icon="search"]`, diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 316fd2ef6..cc047c608 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -32,12 +32,19 @@ module.exports = Self => { let stmt = new ParameterizedSQL( `SELECT i.id, i.image, i.name, i.description, i.size, i.tag5, i.value5, i.tag6, i.value6, - i.tag7, i.value7, i.tag8, i.value8, - t.name type, u.nickname userNickname + i.tag7, i.value7, i.tag8, i.value8, i.isActive, + t.name type, u.nickname userNickname, + intr.description AS intrastat, i.stems, + ori.code AS origin, t.name AS type, + ic.name AS category FROM item i JOIN itemType t ON t.id = i.typeFk + LEFT JOIN itemCategory ic ON ic.id = t.categoryFk JOIN worker w ON w.id = t.workerFk - JOIN account.user u ON u.id = w.userFk` + JOIN account.user u ON u.id = w.userFk + LEFT JOIN intrastat intr ON intr.id = i.intrastatFk + LEFT JOIN producer pr ON pr.id = i.producerFk + LEFT JOIN origin ori ON ori.id = i.originFk` ); if (tags) { diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index e2d2df6e5..d4def30a2 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -1,10 +1,10 @@ + auto-load="true">
@@ -17,23 +17,76 @@ vn-focus> - - - - +
+ + + + + + Id + Description + Stems + Type + Category + Intrastat + Origin + Sales person + Active + + + + + + + + + {{::item.id | zeroFill:6}} + + + + + {{::item.stems}} + {{::item.type}} + {{::item.category}} + {{::item.intrastat}} + {{::item.origin}} + {{::item.userNickname}} + + + + + + + + + + + + + + + No results - - Enter a new search - - - -
+ + + diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index 7926c33c6..e2decd07b 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -8,6 +8,12 @@ class Controller { this.$state = $state; this.$ = $scope; this.itemSelected = null; + this.imagesPath = '//verdnatura.es/vn-image-data/catalog'; + + this.showFields = { + id: false, + actions: false + }; } exprBuilder(param, value) { @@ -25,6 +31,23 @@ class Controller { } } + showDescriptor(event, itemFk) { + this.quicklinks = { + btnThree: { + icon: 'icon-transaction', + state: `item.card.diary({ + id: ${itemFk}, + warehouseFk: ${this.ticket.warehouseFk}, + ticketFk: ${this.ticket.id} + })`, + tooltip: 'Item diary' + } + }; + this.$scope.descriptor.itemFk = itemFk; + this.$scope.descriptor.parent = event.target; + this.$scope.descriptor.show(); + } + paramBuilder(param, value) { switch (param) { case 'tags': @@ -32,7 +55,9 @@ class Controller { } } - cloneItem(item) { + cloneItem(event, item) { + event.preventDefault(); + event.stopImmediatePropagation(); this.itemSelected = item; this.$.clone.show(); } @@ -49,7 +74,9 @@ class Controller { this.itemSelected = null; } - showItemPreview(item) { + preview(event, item) { + event.preventDefault(); + event.stopImmediatePropagation(); this.itemSelected = item; this.$.preview.show(); } diff --git a/modules/item/front/index/style.scss b/modules/item/front/index/style.scss index b73c1e32c..0dc1f3049 100644 --- a/modules/item/front/index/style.scss +++ b/modules/item/front/index/style.scss @@ -25,3 +25,10 @@ vn-item-product { margin-top: 0.9em; } } + +vn-table { + img { + border-radius: 50%; + max-width: 50px; + } +} \ No newline at end of file From b93e2f5359718992bad46e924d548c23ab631573 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 13 Feb 2019 09:49:41 +0100 Subject: [PATCH 09/10] #1114 item.regularize --- front/salix/components/user-configuration-popover/index.js | 6 +++--- modules/item/front/descriptor/index.html | 2 +- modules/item/front/descriptor/index.js | 5 +++-- modules/item/front/descriptor/locale/es.yml | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/front/salix/components/user-configuration-popover/index.js b/front/salix/components/user-configuration-popover/index.js index 18a8aae7e..5f8eeb330 100644 --- a/front/salix/components/user-configuration-popover/index.js +++ b/front/salix/components/user-configuration-popover/index.js @@ -92,7 +92,7 @@ class Controller { this.company = value; if (value && (!window.localStorage.localCompanyFk || window.localStorage.localCompanyFk === 'null')) - window.localStorage.defaultCompanyFk = value; + window.localStorage.setItem('localCompanyFk', value); this.setUserConfig('companyFk', value); } @@ -118,13 +118,13 @@ class Controller { if (res.data && res.data.warehouseFk) { this.warehouse = res.data.warehouseFk; if (res.data.warehouseFk && !window.localStorage.localWarehouseFk) - window.localStorage.defaultWarehouseFk = res.data.warehouseFk; + window.localStorage.setItem('localWarehouseFk', res.data.warehouseFk); } if (res.data && res.data.companyFk) { this.company = res.data.companyFk; if (res.data.companyFk && !window.localStorage.localCompanyFk) - window.localStorage.defaultCompanyFk = res.data.companyFk; + window.localStorage.setItem('defaultCompanyFk', res.data.companyFk); } }); } diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index 56f64c3aa..02e1267dc 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -92,7 +92,7 @@
- Regularize + Regularize stock
Date: Wed, 13 Feb 2019 10:00:56 +0100 Subject: [PATCH 10/10] updated backend unit test gulp tasks --- gulpfile.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index d69dd5d0d..b6427cdd1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -74,7 +74,7 @@ defaultTask.description = `Starts all application services`; // Backend tests -async function backTestOnly() { +async function backTestOnce() { let bootOptions; if (argv['random']) @@ -107,11 +107,19 @@ async function backTestOnly() { await app.disconnect(); } -backTestOnly.description = `Runs the backend tests only, can receive --junit arg to save reports on a xml file`; +backTestOnce.description = `Runs the backend tests once, can receive --junit arg to save reports on a xml file`; + +async function backTestDockerOnce() { + let containerId = await docker(); + await backTestOnce(); + if (argv['random']) + await execP(`docker rm -fv ${containerId}`); +} +backTestDockerOnce.description = `Runs backend tests using in site container once`; async function backTestDocker() { let containerId = await docker(); - await backTestOnly(); + await backTest(); if (argv['random']) await execP(`docker rm -fv ${containerId}`); } @@ -122,7 +130,7 @@ function backTest(done) { nodemon({ exec: ['node ./node_modules/gulp/bin/gulp.js'], - args: ['backTestOnly'], + args: ['backTestOnce'], watch: backSources, done: done }); @@ -484,8 +492,9 @@ module.exports = { back, backOnly, backWatch, + backTestOnce, + backTestDockerOnce, backTest, - backTestOnly, backTestDocker, e2e, e2eOnly,