diff --git a/Jenkinsfile b/Jenkinsfile index 17aeb4ec3..2c3df72e5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,11 +43,35 @@ node stage ("Stopping/Removing Docker") { +<<<<<<< HEAD +======= +<<<<<<< HEAD + step{ + env.TAG = env.BUILD_NUMBER - 1; + sh "docker-compose down --rmi 'all'" +======= + environment { + env.BUILD_TAG = env.BUILD_NUMBER - 1; +>>>>>>> 1acfdf5950d33f4bf972dc2830e05d2f2b1ba99a + } +>>>>>>> e47138eda088c8d307f58d42cc34cbde7295946f sh "docker-compose down --rmi 'all'" } stage ("Generar dockers") { +<<<<<<< HEAD +======= +<<<<<<< HEAD + step{ + env.TAG = env.BUILD_NUMBER + 1; + sh "docker-compose up -d --build" +======= + environment { + env.BUILD_TAG = env.BUILD_NUMBER; +>>>>>>> 1acfdf5950d33f4bf972dc2830e05d2f2b1ba99a + } +>>>>>>> e47138eda088c8d307f58d42cc34cbde7295946f sh "docker-compose up -d --build" } } diff --git a/README.md b/README.md index a8df77f6a..8bd93762d 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,67 @@ # Project Title -One Paragraph of project description goes here +Salix is an Enterprise resource planning (ERP) integrated management of core business processes, in real-time and mediated by software and technology developed with the stack listed below. + +Salix is also the scientific name of a beautifull tree! :) ### Prerequisites -For testing purposes you will need to install globally the following items: -npm install -g karma -npm install -g karma-cli - -## Getting Started // ### Installing - -Pull from repo. - -install nodejs v6 or above. +You will need to install globally the following items: +$ npm install -g karma +$ npm install -g karma-cli +$ npm install -g gulp +$ npm install -g webpack +$ npm install -g nodemon install nginx globally. -Ask a senior dev for the datasources.development.json files required to run the project. +## Getting Started // ### Installing + +Pull from repository. + +install nodejs v6. + +Ask a senior developer for the datasources.development.json files required to run the project. on root run: -npm install -gulp install +$ npm install +$ gulp install lauching nginx: -./dev.sh +$ ./dev.sh launching frontend: -gulp client +$ gulp client +or start nginx before client on sequence +$ gulp clientDev launching backend: -gulp services +$ gulp services +or start the local database before services on sequence +$ gulp serivcesDev + +Manually reset local fixtures: +$ gulp docker + +to check docker images and containers status: +$ docker images +$ docker ps -a ## Running the tests for client-side unit tests run from project's root: -karma start +$ karma start for server-side unit tests run from project's root: -npm run testWatch or test for single run +$ npm run test ### Break down into end to end tests -on root run: +Run local database plus e2e paths: +$ gulp e2e -gulp docker - -wait 10 secs for db to be ready - -npm run e2e +Just the e2e paths as the fixtures are untainted: +$ npm run e2e ## Built With diff --git a/client/client/src/descriptor/descriptor.html b/client/client/src/descriptor/descriptor.html index b0daabe8a..bf1a99337 100644 --- a/client/client/src/descriptor/descriptor.html +++ b/client/client/src/descriptor/descriptor.html @@ -5,11 +5,11 @@ - + {{::title}}: - {{$ctrl.client[field] | number:2}} € - {{::$ctrl.client[field]}} + {{$ctrl.client[field] || 0 | number:2}} € + {{$ctrl.client[field]}} diff --git a/client/client/src/greuge-create/greuge-create.html b/client/client/src/greuge-create/greuge-create.html index 9bc8830dd..2e8ed2454 100644 --- a/client/client/src/greuge-create/greuge-create.html +++ b/client/client/src/greuge-create/greuge-create.html @@ -5,13 +5,19 @@ form="form" save="post"> -
+ + Add Greuge - - + + + diff --git a/client/client/src/greuge-create/greuge-create.js b/client/client/src/greuge-create/greuge-create.js index f3232f09c..3e8aa96a8 100644 --- a/client/client/src/greuge-create/greuge-create.js +++ b/client/client/src/greuge-create/greuge-create.js @@ -5,7 +5,7 @@ class ClientGreugeCreate { this.$ = $scope; this.$state = $state; this.greuge = { - shipped: $filter('date')(new Date(), 'yyyy-MM-dd') + shipped: $filter('date')(new Date(), 'yyyy-MM-dd HH:mm') }; } onSubmit() { diff --git a/client/client/src/greuge-create/greuge-create.spec.js b/client/client/src/greuge-create/greuge-create.spec.js new file mode 100644 index 000000000..1cc408088 --- /dev/null +++ b/client/client/src/greuge-create/greuge-create.spec.js @@ -0,0 +1,39 @@ +import './greuge-create.js'; + +describe('Client', () => { + describe('Component vnClientGreugeCreate', () => { + let $componentController; + let $scope; + let $state; + let controller; + + beforeEach(() => { + angular.mock.module('client'); + }); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$state_) => { + $componentController = _$componentController_; + $scope = $rootScope.$new(); + $state = _$state_; + $scope.watcher = { + submit: () => { + return { + then: callback => { + callback(); + } + }; + } + }; + controller = $componentController('vnClientGreugeCreate', {$scope: $scope}); + })); + + describe('onSubmit()', () => { + it('should call the function go() on $state to go to the greuges list', () => { + spyOn($state, 'go'); + controller.onSubmit(); + + expect(controller.$state.go).toHaveBeenCalledWith('clientCard.greuge.list'); + }); + }); + }); +}); diff --git a/client/client/src/locale/es.json b/client/client/src/locale/es.json index cdd92bb5a..b6d78de1d 100644 --- a/client/client/src/locale/es.json +++ b/client/client/src/locale/es.json @@ -20,5 +20,6 @@ "Credit" : "Crédito", "Secured credit": "Crédito asegurado", "Verified data": "Datos comprobados", - "Mandate": "Mandato" + "Mandate": "Mandato", + "Amount": "Importe" } diff --git a/client/core/src/autocomplete/autocomplete.html b/client/core/src/autocomplete/autocomplete.html index b709e278a..eda0596a3 100644 --- a/client/core/src/autocomplete/autocomplete.html +++ b/client/core/src/autocomplete/autocomplete.html @@ -1,5 +1,11 @@ - - + + + { + this.model = value; + }, 250); + } else { + this.model = null; + this.modelView = ''; + this._waitingInit = 0; } } get modelView() { @@ -54,10 +77,9 @@ class DatePicker extends Component { this._modelView = value; this.input.value = value; this._setModel(value); - this.$timeout(() => { - this.mdlUpdate(); - }, 500); + this.mdlUpdate(); } + onClear() { this.modelView = null; } @@ -67,9 +89,11 @@ class DatePicker extends Component { } } mdlUpdate() { - let mdlField = this.element.firstChild.MaterialTextfield; - if (mdlField) - mdlField.updateClasses_(); + this.$timeout(() => { + let mdlField = this.element.firstChild.MaterialTextfield; + if (mdlField) + mdlField.updateClasses_(); + }, 500); } _formatFlat2Angular(string) { // change string Flatpickr format to angular format (d-m-Y -> dd-MM-yyyy) @@ -90,54 +114,59 @@ class DatePicker extends Component { return parts.join('-'); } + _string2BackFormat(value) { + let formats = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/); + let aux = value.split(/[ZT.,/ :-]/); + let date = {}; + formats.forEach( + (k, i) => { + if (k.toLowerCase() === 'y') { + date.year = aux[i]; + } else if (k === 'm' || k === 'n') { + date.month = aux[i]; + } else if (k === 'd' || k === 'j') { + date.day = aux[i]; + } else if (k.toLowerCase() === 'h') { + date.hour = aux[i]; + } else if (k === 'i') { + date.minutes = aux[i]; + } else if (k === 's') { + date.seccons = aux[i]; + } + } + ); + + let dateStr = ''; + let hourStr = ''; + + if (date.year && date.month && date.day) { + dateStr = `${date.year}-${date.month}-${date.day}`; + } + if (date.hour) { + hourStr = date.hour; + if (date.minutes) { + hourStr += ':' + date.minutes; + } else { + hourStr += ':00'; + } + if (date.seccons) { + hourStr += ':' + date.seccons; + } else { + hourStr += ':00'; + } + } + return `${dateStr} ${hourStr}`.trim(); + } + _setModel(value) { let model; + let options = this._getOptions(); if (!value) { model = undefined; - } else if (!this.iniOptions || (this.iniOptions.dateFormat && this.iniOptions.dateFormat.startsWith('Y-m-d'))) { + } else if (!options || (options.dateFormat && options.dateFormat.startsWith('Y-m-d'))) { model = value; } else { - let formats = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/); - let aux = value.split(/[ZT.,/ :-]/); - let date = {}; - formats.forEach( - (k, i) => { - if (k.toLowerCase() === 'y') { - date.year = aux[i]; - } else if (k === 'm' || k === 'n') { - date.month = aux[i]; - } else if (k === 'd' || k === 'j') { - date.day = aux[i]; - } else if (k.toLowerCase() === 'h') { - date.hour = aux[i]; - } else if (k === 'i') { - date.minutes = aux[i]; - } else if (k === 's') { - date.seccons = aux[i]; - } - } - ); - - let dateStr = ''; - let hourStr = ''; - - if (date.year && date.month && date.day) { - dateStr = `${date.year}-${date.month}-${date.day}`; - } - if (date.hour) { - hourStr = date.hour; - if (date.minutes) { - hourStr += ':' + date.minutes; - } else { - hourStr += ':00'; - } - if (date.seccons) { - hourStr += ':' + date.seccons; - } else { - hourStr += ':00'; - } - } - model = `${dateStr} ${hourStr}`.trim(); + model = this._string2BackFormat(value); } if (this.model !== model) { @@ -155,8 +184,8 @@ class DatePicker extends Component { if (!this.iniOptions.locale) this.iniOptions.locale = this.$translate.use(); - if (!this.iniOptions.dateFormat && this.iniOptions.locale === 'es') - this.iniOptions.dateFormat = 'd-m-Y'; + if (!this.iniOptions.dateFormat) + this.iniOptions.dateFormat = this.iniOptions.locale === 'es' ? 'd-m-Y' : 'Y-m-d'; else if (this.iniOptions.dateFormat) { let format = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/); if (format.length <= 1) { @@ -193,6 +222,12 @@ class DatePicker extends Component { this.vp = undefined; } + $onChanges(objChange) { + if (objChange.iniOptions && objChange.iniOptions.currentValue) { + this.iniOptions = Object.assign(this.iniOptions, objChange.iniOptions.currentValue); + } + } + $onInit() { this.initPicker(); } diff --git a/client/core/src/datePicker/datePicker.spec.js b/client/core/src/datePicker/datePicker.spec.js index 14695a99b..05ff49d4f 100644 --- a/client/core/src/datePicker/datePicker.spec.js +++ b/client/core/src/datePicker/datePicker.spec.js @@ -38,6 +38,7 @@ describe('Component vnDatePicker', () => { it(`should split the given string into parts`, () => { controller.iniOptions = {dateFormat: 'd/m/Y'}; + controller._optionsChecked = true; controller.model = '2017-12-23'; expect(controller.modelView).toBe('23-12-2017'); diff --git a/client/core/src/directives/validation.js b/client/core/src/directives/validation.js index 10669e738..09c4a9f8e 100644 --- a/client/core/src/directives/validation.js +++ b/client/core/src/directives/validation.js @@ -29,7 +29,6 @@ export function directive(interpolate, compile, $window) { throw new Error(`vnValidation: Entity '${entityName}' doesn't exist`); let validations = entity.validations[fieldName]; - if (!validations || validations.length == 0) return; diff --git a/client/core/src/drop-down/drop-down.html b/client/core/src/drop-down/drop-down.html index c8971a551..e155c67af 100644 --- a/client/core/src/drop-down/drop-down.html +++ b/client/core/src/drop-down/drop-down.html @@ -7,7 +7,7 @@