diff --git a/client/client/src/address-create/address-create.html b/client/client/src/address-create/address-create.html index caf042a212..f76a89a8d4 100644 --- a/client/client/src/address-create/address-create.html +++ b/client/client/src/address-create/address-create.html @@ -5,7 +5,7 @@ data="$ctrl.address" form="form"> -
+ Consignatario diff --git a/client/client/src/billing-data/billing-data.js b/client/client/src/billing-data/billing-data.js index 8fe8062c69..9537b5590f 100644 --- a/client/client/src/billing-data/billing-data.js +++ b/client/client/src/billing-data/billing-data.js @@ -1,11 +1,11 @@ import ngModule from '../module'; export default class Controller { - constructor($scope, $http, $timeout, vnAppLogger, $translate) { + constructor($scope, $http, $timeout, vnApp, $translate) { this.$ = $scope; this.http = $http; this.timeout = $timeout; - this.logger = vnAppLogger; + this.vnApp = vnApp; this.translate = $translate; this.payId = null; this.dueDay = null; @@ -34,8 +34,8 @@ export default class Controller { returnDialog(response) { if (response === 'ACCEPT') { this.sendMail().then( - () => this.logger.showMessage(this.translate.instant('Notification sent!')), - () => this.logger.showMessage(this.translate.instant('Notification error')) + () => this.vnApp.showMessage(this.translate.instant('Notification sent!')), + () => this.vnApp.showMessage(this.translate.instant('Notification error')) ); } this.timeout(() => this.$.watcher.submit()); @@ -44,7 +44,7 @@ export default class Controller { return this.http.post(`/mailer/manuscript/paymentUpdate`, {user: this.client.id}); } } -Controller.$inject = ['$scope', '$http', '$timeout', 'vnAppLogger', '$translate']; +Controller.$inject = ['$scope', '$http', '$timeout', 'vnApp', '$translate']; ngModule.component('vnClientBillingData', { template: require('./billing-data.html'), diff --git a/client/client/src/descriptor/descriptor.js b/client/client/src/descriptor/descriptor.js index b8c2092a99..ae19d96c4b 100644 --- a/client/client/src/descriptor/descriptor.js +++ b/client/client/src/descriptor/descriptor.js @@ -5,14 +5,14 @@ export default class Controller { constructor($scope, $http) { this.$http = $http; } - $onChanges(changes) { - let active = changes.active; - let sendPut = active - && !active.isFirstChange() - && active.previousValue !== active.currentValue; + set active(value) { + if (this._active !== value && this._active !== undefined) + this.$http.put(`/client/api/Clients/${this.client.id}/activate`); - if (sendPut) - $http.put(`/client/api/Clients/${this.client.id}/activate`); + this._active = value; + } + get active() { + return this._active; } } Controller.$inject = ['$scope', '$http']; diff --git a/client/client/src/note-create/note-create.html b/client/client/src/note-create/note-create.html index 4a0617c3a1..4331bb4643 100644 --- a/client/client/src/note-create/note-create.html +++ b/client/client/src/note-create/note-create.html @@ -5,7 +5,7 @@ data="$ctrl.note" form="form"> - + Nueva nota diff --git a/client/client/src/search-panel/search-panel.html b/client/client/src/search-panel/search-panel.html index 43ab1c73ec..f17828f6a2 100644 --- a/client/client/src/search-panel/search-panel.html +++ b/client/client/src/search-panel/search-panel.html @@ -1,5 +1,5 @@
- + @@ -23,4 +23,3 @@
- diff --git a/client/client/src/search-panel/search-panel.js b/client/client/src/search-panel/search-panel.js index 7d15301fec..12b368c798 100644 --- a/client/client/src/search-panel/search-panel.js +++ b/client/client/src/search-panel/search-panel.js @@ -3,16 +3,6 @@ import ngModule from '../module'; export default class Controller { constructor($window) { this.$window = $window; - this.filter = { - id: null, - fi: null, - name: null, - socialName: null, - city: null, - postcode: null, - email: null, - phone: null - }; } onSearch() { this.setStorageValue(); diff --git a/client/client/src/web-access/web-access.js b/client/client/src/web-access/web-access.js index 6a2eedecb7..aa1f5d8787 100644 --- a/client/client/src/web-access/web-access.js +++ b/client/client/src/web-access/web-access.js @@ -1,10 +1,10 @@ import ngModule from '../module'; export default class Controller { - constructor($scope, $http, vnAppLogger) { + constructor($scope, $http, vnApp) { this.$ = $scope; this.$http = $http; - this.vnAppLogger = vnAppLogger; + this.vnApp = vnApp; } $onChanges() { if (this.client) @@ -28,14 +28,14 @@ export default class Controller { this.$http.patch(`/client/api/Accounts/${this.client.id}`, account); } catch (e) { - this.vnAppLogger.showError(e.message); + this.vnApp.showError(e.message); return false; } return true; } } -Controller.$inject = ['$scope', '$http', 'vnAppLogger']; +Controller.$inject = ['$scope', '$http', 'vnApp']; ngModule.component('vnClientWebAccess', { template: require('./web-access.html'), diff --git a/client/core/src/lib/app.js b/client/core/src/lib/app.js new file mode 100644 index 0000000000..78afdbf0bf --- /dev/null +++ b/client/core/src/lib/app.js @@ -0,0 +1,23 @@ +import {module} from '../module'; + +/** + * The main application class. + * + * @property {String} name The application name. + * @property {Snackbar} snackbar The main object to show messages. + */ +export default class App { + show(message) { + if (this.snackbar) + this.snackbar.show({message: message}); + else + console.log(message); + } + showMessage(message) { + this.show(message); + } + showError(message) { + this.show(`Error: ${message}`); + } +} +module.service('vnApp', App); diff --git a/client/core/src/lib/index.js b/client/core/src/lib/index.js index 806c6cfde6..c911e09a3b 100644 --- a/client/core/src/lib/index.js +++ b/client/core/src/lib/index.js @@ -2,6 +2,8 @@ import './moduleLoader'; import './crud'; import './template'; import './getTemplate'; +import './app'; +import './interceptor'; export * from './util'; export {default as splitingRegister} from './splitingRegister'; diff --git a/client/core/src/lib/interceptor.js b/client/core/src/lib/interceptor.js new file mode 100644 index 0000000000..9cd97d78af --- /dev/null +++ b/client/core/src/lib/interceptor.js @@ -0,0 +1,53 @@ +import {module} from '../module'; + +interceptor.$inject = ['$q', '$rootScope', '$window', 'vnApp', '$translate', '$cookies']; +function interceptor($q, $rootScope, $window, vnApp, $translate, $cookies) { + $rootScope.loading = false; + return { + request: function(config) { + $rootScope.loading = true; + let token = $cookies.get('vnToken'); + + if (token) + config.headers.Authorization = token; + + return config; + }, + requestError: function(rejection) { + return $q.reject(rejection); + }, + response: function(response) { + switch (response.config.method) { + case 'PUT': + case 'POST': + case 'PATCH': + vnApp.showMessage($translate.instant('Data saved!')); + } + $rootScope.loading = false; + return response; + }, + responseError: function(rejection) { + $rootScope.loading = false; + let data = rejection.data; + let error; + + if (data && data.error instanceof Object) + error = data.error.message; + else if (rejection.status === -1) + error = $translate.instant(`Can't contact with server`); + else + error = `${rejection.status}: ${rejection.statusText}`; + + if (rejection.status === 401) { + let location = $window.location; + let continueUrl = location.pathname + location.search + location.hash; + continueUrl = encodeURIComponent(continueUrl); + $window.location = `/auth/?apiKey=${vnApp.name}&continue=${continueUrl}`; + } + + vnApp.showError(error); + return $q.reject(rejection); + } + }; +} +module.factory('vnInterceptor', interceptor); diff --git a/client/core/src/lib/interpolate.js b/client/core/src/lib/interpolate.js index d961a6a415..c14a2079b7 100644 --- a/client/core/src/lib/interpolate.js +++ b/client/core/src/lib/interpolate.js @@ -4,8 +4,6 @@ import * as util from './util'; export const NAME = util.getProviderName('interpolate'); -function minErr() {} - function stringify(value) { if (value === null) { // null || undefined return ''; @@ -89,9 +87,8 @@ function $get($parse, $exceptionHandler, $sce) { while (index < textLength) { if (((startIndex = text.indexOf(self._startSymbol, index)) !== -1) && ((endIndex = text.indexOf(self._endSymbol, startIndex + startSymbolLength)) !== -1)) { - if (index !== startIndex) { - concat.push(unescapeText(text.substring(index, startIndex))); - } + if (index !== startIndex) + concat.push(unescapeText(text.substring(index, startIndex))); exp = text.substring(startIndex + startSymbolLength, endIndex); expressions.push(exp); parseFns.push($parse(exp, parseStringifyInterceptor)); @@ -100,9 +97,8 @@ function $get($parse, $exceptionHandler, $sce) { concat.push(''); } else { // we did not find an interpolation, so we have to add the remainder to the separators array - if (index !== textLength) { - concat.push(unescapeText(text.substring(index))); - } + if (index !== textLength) + concat.push(unescapeText(text.substring(index))); break; } } @@ -114,9 +110,9 @@ function $get($parse, $exceptionHandler, $sce) { if (!mustHaveExpression || expressions.length) { var compute = function(values) { for (var i = 0, ii = expressions.length; i < ii; i++) { - if (allOrNothing && isUndefined(values[i])) return; - concat[expressionPositions[i]] = values[i]; - } + if (allOrNothing && isUndefined(values[i])) return; + concat[expressionPositions[i]] = values[i]; + } return concat.join(''); }; @@ -132,19 +128,19 @@ function $get($parse, $exceptionHandler, $sce) { var values = new Array(ii); try { - for (; i < ii; i++) { - values[i] = parseFns[i](context); - } - - return compute(values); - } catch (err) { - $exceptionHandler($interpolateMinErr.interr(text, err)); + for (; i < ii; i++) { + values[i] = parseFns[i](context); } + + return compute(values); + } catch (err) { + $exceptionHandler($interpolateMinErr.interr(text, err)); + } }, { - // all of these properties are undocumented for now - exp: text, // just for compatibility with regular watchers created via $watch - expressions: expressions - }); + // all of these properties are undocumented for now + exp: text, // just for compatibility with regular watchers created via $watch + expressions: expressions + }); } function parseStringifyInterceptor(value) { @@ -170,31 +166,25 @@ function $get($parse, $exceptionHandler, $sce) { $get.$inject = ['$parse', '$exceptionHandler', '$sce']; -export class Interpolate -{ +export class Interpolate { constructor() { this._startSymbol = '*['; this._endSymbol = ']*'; } - set startSymbol(value) { if (value) { this._startSymbol = value; return this; - } else { - return this._startSymbol; } + return this._startSymbol; } - set endSymbol(value) { if (value) { this._endSymbol = value; return this; - } else { - return this._endSymbol; } + return this._endSymbol; } - } Interpolate.prototype.$get = $get; diff --git a/client/core/src/lib/resolveDefaultComponents.js b/client/core/src/lib/resolveDefaultComponents.js index 312bf8ca22..58be1f72a4 100644 --- a/client/core/src/lib/resolveDefaultComponents.js +++ b/client/core/src/lib/resolveDefaultComponents.js @@ -1,39 +1,28 @@ import {module} from '../module'; import * as util from './util'; -import constant from './constants'; -import Interpolate from './interpolate'; -export const NAME = util.getProviderName('ResolveDefaultComponent'); +export const NAME = 'vnComponentResolver'; -function $get($injector, vnInterpolate) { - return { - getTemplate: function(name, attrs) { - this._frameworkName = 'Mdl'; - let _name = util.getFactoryName(name + this._frameworkName); - let defaultfactory = $injector.has(_name) ? $injector.get(_name) : undefined; - - if (!defaultfactory) { - throw new Error("factory is not defined"); - } - - let defaultValues = defaultfactory.default; - let template = defaultfactory.template; - let scope = Object.assign({}, defaultValues || {}, attrs || {}); - return template && vnInterpolate(template)(scope); - } - }; -} -$get.$inject = ['$injector', 'vnInterpolate']; - -export class ResolveDefaultComponent { - constructor() { - this._frameworkName = 'Mdl'; +export default class ComponentResolver { + constructor($injector, vnInterpolate) { + this.$injector = $injector; + this.vnInterpolate = vnInterpolate; + this.frameworkName = 'Mdl'; } - set frameworkName(value) { - this._frameworkName = value; + getTemplate(name, attrs) { + let factoryName = util.getFactoryName(name + this.frameworkName); + let factory = this.$injector.has(factoryName) ? + this.$injector.get(factoryName) : undefined; + + if (!factory) + throw new Error(`ComponentResolver: Factory '${factoryName}' is not defined`); + + let defaultValues = factory.default; + let template = factory.template; + let scope = Object.assign({}, defaultValues || {}, attrs || {}); + return template && this.vnInterpolate(template)(scope); } } +ComponentResolver.$inject = ['$injector', 'vnInterpolate']; -ResolveDefaultComponent.prototype.$get = $get; -var resolve = new ResolveDefaultComponent(); -module.provider(NAME, () => resolve); +module.service('vnComponentResolver', ComponentResolver); diff --git a/client/core/src/lib/splitingRegister.js b/client/core/src/lib/splitingRegister.js index 28daae0623..60c52f0bcf 100644 --- a/client/core/src/lib/splitingRegister.js +++ b/client/core/src/lib/splitingRegister.js @@ -12,14 +12,15 @@ class SplitingRegister { array.push(dependency); var first = this._graph[dependency]; - while (first && first.length > 0) { - dependency = first.shift(); - array = array.concat(this.getDependencies(dependency)); - } + if (first) + while (first.length > 0) { + dependency = first.shift(); + array = array.concat(this.getDependencies(dependency)); + } return array; } registerGraph(graph) { - this._graph = graph; + this._graph = graph; } register(moduleName, loader) { this._modules[moduleName] = loader; diff --git a/client/core/src/lib/string.js b/client/core/src/lib/string.js index e48bd082b9..c2128cd029 100644 --- a/client/core/src/lib/string.js +++ b/client/core/src/lib/string.js @@ -1,12 +1,12 @@ /** * Transforms a kebab-case string to camelCase. A kebab-case string * is a string with hyphen character as word separator. - * + * * @param {String} str The hyphenized string * @return {String} The camelized string */ export function kebabToCamel(str) { - var camelCased = str.replace (/-([a-z])/, function(g) { + var camelCased = str.replace(/-([a-z])/, function(g) { return g[1].toUpperCase(); }); return camelCased; @@ -14,7 +14,7 @@ export function kebabToCamel(str) { /** * Transforms the first letter of a string to uppercase. - * + * * @param {String} str The input string * @return {String} The transformed string */ diff --git a/client/core/src/watcher/watcher.js b/client/core/src/watcher/watcher.js index e4b5c23058..c50ea94c39 100644 --- a/client/core/src/watcher/watcher.js +++ b/client/core/src/watcher/watcher.js @@ -11,13 +11,13 @@ import isEqual from '../lib/equals'; * properties are provided. */ export default class Watcher extends Component { - constructor($element, $scope, $state, $transitions, $http, vnAppLogger, $translate) { + constructor($element, $scope, $state, $transitions, $http, vnApp, $translate) { super($element); this.$scope = $scope; this.$state = $state; this.$http = $http; this.$translate = $translate; - this.vnAppLogger = vnAppLogger; + this.vnApp = vnApp; this.state = null; this.deregisterCallback = $transitions.onStart({}, @@ -121,13 +121,13 @@ export default class Watcher extends Component { resolve(json); } noChanges(resolve) { - this.vnAppLogger.showMessage( + this.vnApp.showMessage( this.$translate.instant('No changes to save') ); resolve(); } invalidForm(resolve) { - this.vnAppLogger.showMessage( + this.vnApp.showMessage( this.$translate.instant('Some fields are invalid') ); resolve(); @@ -156,7 +156,7 @@ export default class Watcher extends Component { } } } -Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnAppLogger', '$translate']; +Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnApp', '$translate']; module.component('vnWatcher', { template: require('./watcher.html'), diff --git a/client/salix/src/components/app/app.html b/client/salix/src/components/app/app.html index 7d27da5c1a..959cf42823 100644 --- a/client/salix/src/components/app/app.html +++ b/client/salix/src/components/app/app.html @@ -1,11 +1,13 @@ - + + + - + \ No newline at end of file diff --git a/client/salix/src/components/app/app.js b/client/salix/src/components/app/app.js index c9a828daef..2368fdef2c 100644 --- a/client/salix/src/components/app/app.js +++ b/client/salix/src/components/app/app.js @@ -1,85 +1,18 @@ -import ngModule, {appName} from '../../module'; +import ngModule from '../../module'; import './style.scss'; -export const NAME = 'vnApp'; -export const COMPONENT = { - template: require('./app.html') -}; -ngModule.component(NAME, COMPONENT); - -vnAppLogger.$inject = ['$document']; -function vnAppLogger($document) { - return { - showMessage: function(message) { - let snackbar = $document.find('vn-snackbar').controller('vnSnackbar'); - snackbar.show({message: message}); - }, - showError: function(message) { - this.showMessage(`Error: ${message}`); - } - }; +export default class App { + constructor($scope, vnApp) { + this.$ = $scope; + this.vnApp = vnApp; + } + $postLink() { + this.vnApp.snackbar = this.$.snackbar; + } } -ngModule.provider('vnAppLogger', function() { - this.$get = vnAppLogger; +App.$inject = ['$scope', 'vnApp']; + +ngModule.component('vnApp', { + template: require('./app.html'), + controller: App }); - -vnAppInterceptor.$inject = ['$q', '$rootScope', '$window', 'vnAppLogger', '$translate', '$cookies']; -function vnAppInterceptor($q, $rootScope, $window, logger, $translate, $cookies) { - $rootScope.loading = false; - return { - request: function(config) { - $rootScope.loading = true; - let token = $cookies.get('vnToken'); - - if (token) - config.headers.Authorization = token; - - return config; - }, - requestError: function(rejection) { - return $q.reject(rejection); - }, - response: function(response) { - switch (response.config.method) { - case 'PUT': - case 'POST': - logger.showMessage($translate.instant('Data saved!')); - } - $rootScope.loading = false; - return response; - }, - responseError: function(rejection) { - $rootScope.loading = false; - let data = rejection.data; - let error; - - if (data && data.error instanceof Object) - error = data.error.message; - else if (rejection.status === -1) - error = $translate.instant(`Can't contact with server`); - else - error = `${rejection.status}: ${rejection.statusText}`; - - if (rejection.status === 401) { - let location = $window.location; - let continueUrl = location.pathname + location.search + location.hash; - continueUrl = encodeURIComponent(continueUrl); - $window.location = `/auth/?apiKey=salix&continue=${continueUrl}`; - } - - logger.showError(error); - return $q.reject(rejection); - } - }; -} -ngModule.factory('vnAppInterceptor', vnAppInterceptor); - -interceptorConfig.$inject = ['$httpProvider']; -function interceptorConfig($httpProvider) { - $httpProvider.interceptors.push('vnAppInterceptor'); -} -ngModule.config(interceptorConfig); - -var acl = window[appName] ? window[appName].acl : {}; -ngModule.constant('aclConstant', acl); - diff --git a/client/salix/src/components/app/style.scss b/client/salix/src/components/app/style.scss index 3c7c383997..61c1dee7b5 100644 --- a/client/salix/src/components/app/style.scss +++ b/client/salix/src/components/app/style.scss @@ -7,7 +7,6 @@ vn-app { height: 100%; vn-topbar { - .logo { float: left; height: 30px; diff --git a/client/salix/src/components/home/home.js b/client/salix/src/components/home/home.js index 66002ae9fc..d24fc4eaf6 100644 --- a/client/salix/src/components/home/home.js +++ b/client/salix/src/components/home/home.js @@ -1,19 +1,15 @@ import ngModule from '../../module'; import './style.scss'; -export const NAME = 'vnHome'; - -export default class vnHome { +export default class Home { constructor(modulesFactory, $state) { this.modules = modulesFactory.getModules(); this.state = $state; } } -vnHome.$inject = ['modulesFactory', '$state']; +Home.$inject = ['modulesFactory', '$state']; -export const COMPONENT = { +ngModule.component('vnHome', { template: require('./home.html'), - controller: vnHome -}; - -ngModule.component(NAME, COMPONENT); + controller: Home +}); diff --git a/client/salix/src/components/left-menu/actions.js b/client/salix/src/components/left-menu/actions.js index 096c090490..4d4d6ee6d8 100644 --- a/client/salix/src/components/left-menu/actions.js +++ b/client/salix/src/components/left-menu/actions.js @@ -27,8 +27,8 @@ MenuActions.$inject = ['$state', '$transitions']; ngModule.component('vnActions', { template: require('./actions.html'), + controller: MenuActions, bindings: { items: '<' - }, - controller: MenuActions + } }); diff --git a/client/salix/src/components/left-menu/left-menu.js b/client/salix/src/components/left-menu/left-menu.js index 77626fe33c..235c299d46 100644 --- a/client/salix/src/components/left-menu/left-menu.js +++ b/client/salix/src/components/left-menu/left-menu.js @@ -1,14 +1,13 @@ import ngModule from '../../module'; import './style.css'; -export default class vnLeftMenu { +export default class LeftMenu { constructor(aclService, $state) { this.aclService = aclService; this.$state = $state; this.items = []; this.init(); } - init() { let station = this.$state.current.data.station || 'default'; if (routes[station]) { @@ -23,9 +22,9 @@ export default class vnLeftMenu { } } } -vnLeftMenu.$inject = ['aclService', '$state']; +LeftMenu.$inject = ['aclService', '$state']; ngModule.component('vnLeftMenu', { template: require('./left-menu.html'), - controller: vnLeftMenu + controller: LeftMenu }); diff --git a/client/salix/src/components/main-menu/main-menu.html b/client/salix/src/components/main-menu/main-menu.html index da5047c633..7902c4b72b 100644 --- a/client/salix/src/components/main-menu/main-menu.html +++ b/client/salix/src/components/main-menu/main-menu.html @@ -6,16 +6,16 @@ diff --git a/client/salix/src/components/main-menu/main-menu.js b/client/salix/src/components/main-menu/main-menu.js index 113c940b8f..ce36593ced 100644 --- a/client/salix/src/components/main-menu/main-menu.js +++ b/client/salix/src/components/main-menu/main-menu.js @@ -1,7 +1,7 @@ import ngModule from '../../module'; import './style.scss'; -export default class Controller { +export default class MainMenu { constructor($translate, $window, modulesFactory) { this.$translate = $translate; this.$window = $window; @@ -16,9 +16,9 @@ export default class Controller { console.log(`Locale changed: ${lang}`); } } -Controller.$inject = ['$translate', '$window', 'modulesFactory']; +MainMenu.$inject = ['$translate', '$window', 'modulesFactory']; ngModule.component('vnMainMenu', { template: require('./main-menu.html'), - controller: Controller + controller: MainMenu }); diff --git a/client/salix/src/components/searchbar/searchbar.js b/client/salix/src/components/searchbar/searchbar.js index 2773ef4b4c..081f566f18 100644 --- a/client/salix/src/components/searchbar/searchbar.js +++ b/client/salix/src/components/searchbar/searchbar.js @@ -16,6 +16,7 @@ export default class Controller { // XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente? var childCtrl = angular.element(child).isolateScope().$ctrl; + childCtrl.filter = Object.assign({}, this.index.filter); childCtrl.onSubmit = filter => this.onChildSubmit(filter); event.preventDefault(); diff --git a/client/salix/src/config.js b/client/salix/src/config.js index 877d167301..f4ceea3923 100644 --- a/client/salix/src/config.js +++ b/client/salix/src/config.js @@ -1,13 +1,20 @@ -import ngModule, {appName} from './module'; +import ngModule from './module'; -config.$inject = ['$translatePartialLoaderProvider']; -export function config($translatePartialLoaderProvider) { +export const appName = 'salix'; + +var acl = window[appName] ? window[appName].acl : {}; +ngModule.constant('aclConstant', acl); + +config.$inject = ['$translatePartialLoaderProvider', '$httpProvider']; +export function config($translatePartialLoaderProvider, $httpProvider) { $translatePartialLoaderProvider.addPart(appName); + $httpProvider.interceptors.push('vnInterceptor'); } ngModule.config(config); -run.$inject = ['$window', '$rootScope']; -export function run($window, $rootScope) { +run.$inject = ['$window', '$rootScope', 'vnApp']; +export function run($window, $rootScope, vnApp) { $window.validations = {}; + vnApp.name = appName; } ngModule.run(run); diff --git a/client/salix/src/locale/en.json b/client/salix/src/locale/en.json index 70dabcc3a9..d24ba5e4d1 100644 --- a/client/salix/src/locale/en.json +++ b/client/salix/src/locale/en.json @@ -1,5 +1,6 @@ { "Applications": "Applications", + "Home": "Home", "Notifications":"Notifications", "Logout": "Logout", "Change language": "Change language", diff --git a/client/salix/src/locale/es.json b/client/salix/src/locale/es.json index 5ff53c91d3..f2bc551fc0 100644 --- a/client/salix/src/locale/es.json +++ b/client/salix/src/locale/es.json @@ -1,5 +1,6 @@ { "Applications": "Aplicaciones", + "Home": "Inicio", "Notifications":"Notificaciones", "Logout": "Cerrar sesión", "Change language": "Cambiar idioma", diff --git a/client/salix/src/module.js b/client/salix/src/module.js index 568a43d69b..d0c4657a96 100644 --- a/client/salix/src/module.js +++ b/client/salix/src/module.js @@ -1,6 +1,5 @@ import {ng} from 'vendor'; import 'core'; -export const appName = 'salix'; -const ngModule = ng.module(appName, ['vnCore']); +const ngModule = ng.module('salix', ['vnCore']); export default ngModule; diff --git a/services/auth/common/models/Account.json b/services/auth/common/models/account.json similarity index 100% rename from services/auth/common/models/Account.json rename to services/auth/common/models/account.json diff --git a/services/auth/common/models/user.json b/services/auth/common/models/user.json new file mode 100644 index 0000000000..0fe53764b0 --- /dev/null +++ b/services/auth/common/models/user.json @@ -0,0 +1,11 @@ +{ + "name": "user", + "base": "User", + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + } + } +} diff --git a/services/auth/server/datasources.json b/services/auth/server/datasources.json index 562cd0e62b..fe38540f0a 100644 --- a/services/auth/server/datasources.json +++ b/services/auth/server/datasources.json @@ -12,6 +12,8 @@ "host": "localhost", "port": 3306, "username": "root", - "password": "" + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 } } diff --git a/services/auth/server/model-config.json b/services/auth/server/model-config.json index 7aafa7b3fe..a35d7196f6 100644 --- a/services/auth/server/model-config.json +++ b/services/auth/server/model-config.json @@ -13,11 +13,18 @@ "./mixins" ] }, - "User": { + "user": { "dataSource": "auth" }, "AccessToken": { - "dataSource": "auth" + "dataSource": "auth", + "relations": { + "user": { + "type": "belongsTo", + "model": "user", + "foreignKey": "userId" + } + } }, "ACL": { "dataSource": "auth" diff --git a/services/client/common/models/Account.json b/services/client/common/models/account.json similarity index 100% rename from services/client/common/models/Account.json rename to services/client/common/models/account.json diff --git a/services/client/common/models/Address.js b/services/client/common/models/address.js similarity index 100% rename from services/client/common/models/Address.js rename to services/client/common/models/address.js diff --git a/services/client/common/models/Address.json b/services/client/common/models/address.json similarity index 100% rename from services/client/common/models/Address.json rename to services/client/common/models/address.json diff --git a/services/client/common/models/AgencyService.json b/services/client/common/models/agency-service.json similarity index 100% rename from services/client/common/models/AgencyService.json rename to services/client/common/models/agency-service.json diff --git a/services/client/common/models/ClientCreditLimit.json b/services/client/common/models/client-credit-limit.json similarity index 100% rename from services/client/common/models/ClientCreditLimit.json rename to services/client/common/models/client-credit-limit.json diff --git a/services/client/common/models/ClientCredit.json b/services/client/common/models/client-credit.json similarity index 100% rename from services/client/common/models/ClientCredit.json rename to services/client/common/models/client-credit.json diff --git a/services/client/common/models/ClientObservation.js b/services/client/common/models/client-observation.js similarity index 100% rename from services/client/common/models/ClientObservation.js rename to services/client/common/models/client-observation.js diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/client-observation.json similarity index 100% rename from services/client/common/models/ClientObservation.json rename to services/client/common/models/client-observation.json diff --git a/services/client/common/models/Client.js b/services/client/common/models/client.js similarity index 100% rename from services/client/common/models/Client.js rename to services/client/common/models/client.js diff --git a/services/client/common/models/Client.json b/services/client/common/models/client.json similarity index 100% rename from services/client/common/models/Client.json rename to services/client/common/models/client.json diff --git a/services/client/common/models/ContactChannel.json b/services/client/common/models/contact-channel.json similarity index 100% rename from services/client/common/models/ContactChannel.json rename to services/client/common/models/contact-channel.json diff --git a/services/client/common/models/Country.json b/services/client/common/models/country.json similarity index 100% rename from services/client/common/models/Country.json rename to services/client/common/models/country.json diff --git a/services/client/common/models/Employee.json b/services/client/common/models/employee.json similarity index 100% rename from services/client/common/models/Employee.json rename to services/client/common/models/employee.json diff --git a/services/client/common/models/MyModel.js b/services/client/common/models/my-model.js similarity index 100% rename from services/client/common/models/MyModel.js rename to services/client/common/models/my-model.js diff --git a/services/client/common/models/MyModel.json b/services/client/common/models/my-model.json similarity index 100% rename from services/client/common/models/MyModel.json rename to services/client/common/models/my-model.json diff --git a/services/client/common/models/PayMethod.json b/services/client/common/models/pay-method.json similarity index 100% rename from services/client/common/models/PayMethod.json rename to services/client/common/models/pay-method.json diff --git a/services/client/common/models/Province.json b/services/client/common/models/province.json similarity index 100% rename from services/client/common/models/Province.json rename to services/client/common/models/province.json diff --git a/services/client/common/models/user.json b/services/client/common/models/user.json new file mode 100644 index 0000000000..f13d4c1686 --- /dev/null +++ b/services/client/common/models/user.json @@ -0,0 +1,11 @@ +{ + "name": "user", + "base": "User", + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + } + } +} \ No newline at end of file diff --git a/services/client/server/datasources.json b/services/client/server/datasources.json index 99577e1927..ba7db7577e 100644 --- a/services/client/server/datasources.json +++ b/services/client/server/datasources.json @@ -12,7 +12,9 @@ "host": "localhost", "port": 3306, "username": "root", - "password": "" + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 }, "vn": { "name": "mysql", @@ -22,6 +24,8 @@ "host": "localhost", "port": 3306, "username": "root", - "password": "" + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 } } diff --git a/services/client/server/model-config.json b/services/client/server/model-config.json index 4bf5b47a7e..986f3b4df6 100644 --- a/services/client/server/model-config.json +++ b/services/client/server/model-config.json @@ -13,13 +13,18 @@ "./mixins" ] }, - "User": { - "dataSource": "auth", - "public": false + "user": { + "dataSource": "auth" }, "AccessToken": { "dataSource": "auth", - "public": false + "relations": { + "user": { + "type": "belongsTo", + "model": "user", + "foreignKey": "userId" + } + } }, "ACL": { "dataSource": "auth", diff --git a/services/salix/common/models/user.json b/services/salix/common/models/user.json new file mode 100644 index 0000000000..f13d4c1686 --- /dev/null +++ b/services/salix/common/models/user.json @@ -0,0 +1,11 @@ +{ + "name": "user", + "base": "User", + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + } + } +} \ No newline at end of file diff --git a/services/salix/server/datasources.json b/services/salix/server/datasources.json index ea04dddf1c..967e6cbe85 100644 --- a/services/salix/server/datasources.json +++ b/services/salix/server/datasources.json @@ -11,6 +11,8 @@ "host": "localhost", "port": 3306, "username": "root", - "password": "" + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 } } diff --git a/services/salix/server/model-config.json b/services/salix/server/model-config.json index 8cef8e4581..fc5e58edca 100644 --- a/services/salix/server/model-config.json +++ b/services/salix/server/model-config.json @@ -13,13 +13,18 @@ "./mixins" ] }, - "User": { - "dataSource": "auth", - "public": false + "user": { + "dataSource": "auth" }, "AccessToken": { "dataSource": "auth", - "public": false + "relations": { + "user": { + "type": "belongsTo", + "model": "user", + "foreignKey": "userId" + } + } }, "ACL": { "dataSource": "auth", diff --git a/webpack.config.js b/webpack.config.js index d5166e84fc..c4e78fced0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -57,7 +57,7 @@ var config = { names: ['bundle.vendor', 'bundle.manifest'] }) ], - devtool: 'eval-source-map' + devtool: 'source-map' }; if (!devMode) {