Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
ffe85cca17
|
@ -5,7 +5,7 @@
|
|||
"name": "Iniciar",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/app.js",
|
||||
"program": "${workspaceRoot}/services/client/server/server.js",
|
||||
"stopOnEntry": false,
|
||||
"args": [],
|
||||
"cwd": "${workspaceRoot}",
|
||||
|
|
|
@ -7,15 +7,16 @@ def branchName = "${env.BRANCH_NAME}";
|
|||
def branchNameTest = "preprod";
|
||||
def branchNameProd = "master";
|
||||
def prefixDocker = "test";
|
||||
def dockerNginxName = ["nginx", "-p 80:80 --privileged --link test-auth:auth --link test-salix:salix --link test-client:client --link test-mailer:mailer"]
|
||||
def dockerNginxName = ["nginx", "-p 80:80 --privileged --link test-auth:auth --link test-salix:salix --link test-client:client --link test-mailer:mailer --link test-production:production"]
|
||||
def dockerAuthName = ["auth", "-p 3000:3000"]
|
||||
def dockerSalixName = ["salix", "-p 3001:3001"]
|
||||
def dockerClientName = ["client", "-p 3002:3002"]
|
||||
def dockerMailerName = ["mailer", "-p 3003:3003"]
|
||||
def dockerProductionName = ["production", "-p 3004:3004"]
|
||||
|
||||
def buildNumber = "${env.BUILD_NUMBER}";
|
||||
|
||||
def dockers = [dockerAuthName, dockerSalixName, dockerClientName, dockerMailerName, dockerNginxName]
|
||||
def dockers = [dockerAuthName, dockerSalixName, dockerClientName, dockerMailerName, dockerNginxName, dockerProductionName]
|
||||
|
||||
node {
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"module": "client",
|
||||
"name": "Clients",
|
||||
"icon": "person",
|
||||
"validations" : true,
|
||||
"routes": [
|
||||
{
|
||||
"url": "/clients",
|
||||
|
|
|
@ -34,7 +34,9 @@ export default class DropDown {
|
|||
this.search = '';
|
||||
this.showLoadMore = this.loadMore != null;
|
||||
if (this.filterAction) {
|
||||
this.filterAction();
|
||||
this.filterAction({search: this.search});
|
||||
} else {
|
||||
this.filterItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="icon-menu">
|
||||
<vn-icon-button icon="{{::$ctrl.icon}}"></vn-icon-button>
|
||||
<div ng-if="!$ctrl.url">
|
||||
<div ng-if="!$ctrl.findMore">
|
||||
<vn-drop-down
|
||||
items="$ctrl.items"
|
||||
show="$ctrl.showDropDown"
|
||||
|
@ -8,7 +8,7 @@
|
|||
filter="true"
|
||||
></vn-drop-down>
|
||||
</div>
|
||||
<div ng-if="$ctrl.url">
|
||||
<div ng-if="$ctrl.findMore">
|
||||
<vn-drop-down
|
||||
items="$ctrl.items"
|
||||
show="$ctrl.showDropDown"
|
||||
|
|
|
@ -7,6 +7,8 @@ export default class IconMenu {
|
|||
this.$http = $http;
|
||||
this.$timeout = $timeout;
|
||||
this._showDropDown = false;
|
||||
this.finding = false;
|
||||
this.findMore = false;
|
||||
}
|
||||
get showDropDown() {
|
||||
return this._showDropDown;
|
||||
|
@ -18,16 +20,20 @@ export default class IconMenu {
|
|||
if (!this.url)
|
||||
return this.items ? this.items : [];
|
||||
|
||||
if (search) {
|
||||
if (search && !this.finding) {
|
||||
let filter = {where: {name: {regexp: search}}};
|
||||
let json = JSON.stringify(filter);
|
||||
|
||||
this.finding = true;
|
||||
this.$http.get(`${this.url}?filter=${json}`).then(
|
||||
json => {
|
||||
this.items = json.data;
|
||||
this.finding = false;
|
||||
},
|
||||
() => {
|
||||
this.finding = false;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
} else if (!search && !this.finding) {
|
||||
this.items = [];
|
||||
this.getItems();
|
||||
}
|
||||
|
@ -64,6 +70,8 @@ export default class IconMenu {
|
|||
this.getItems();
|
||||
}
|
||||
|
||||
this.findMore = this.url && this.maxRow;
|
||||
|
||||
this.$element.bind('mouseover', e => {
|
||||
this.$timeout(() => {
|
||||
this.showDropDown = true;
|
||||
|
|
|
@ -7,7 +7,7 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
|
|||
constructor() {
|
||||
this._loadedModules = {};
|
||||
}
|
||||
load(moduleName) {
|
||||
load(moduleName, validations) {
|
||||
if (this._loadedModules[moduleName])
|
||||
return;
|
||||
|
||||
|
@ -20,12 +20,13 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
|
|||
for (let dep of deps) {
|
||||
this._loadedModules[dep] = true;
|
||||
promises.push(modules[dep]());
|
||||
promises.push(new Promise(resolve => {
|
||||
$http.get(`/${dep}/validations`).then(
|
||||
json => this.onValidationsReady(json, resolve),
|
||||
json => resolve()
|
||||
);
|
||||
}));
|
||||
if (validations)
|
||||
promises.push(new Promise(resolve => {
|
||||
$http.get(`/${dep}/validations`).then(
|
||||
json => this.onValidationsReady(json, resolve),
|
||||
json => resolve()
|
||||
);
|
||||
}));
|
||||
|
||||
$translatePartialLoader.addPart(dep);
|
||||
// FIXME: https://github.com/angular-translate/angular-translate/pull/1674
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"Cancel": "Cancelar",
|
||||
"Close": "Cerrar",
|
||||
"Clear": "Borrar",
|
||||
"Load More": "Cargar más"
|
||||
"Load More": "Cargar más",
|
||||
"Search" : "Buscar"
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
"module": "production",
|
||||
"name": "Production",
|
||||
"icon": "group_work",
|
||||
"validations" : false,
|
||||
"routes": [
|
||||
{
|
||||
"url": "/production",
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
<vn-icon-button icon="textsms" ng-click="$ctrl.doAction('addComment')"></vn-icon-button>
|
||||
</vn-none>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-menu icon="person" url="/client/api/Employees" max-row="10"
|
||||
selected="$ctrl.actionWorker"></vn-icon-menu>
|
||||
<vn-icon-menu icon="person" url="/client/api/Clients/employeeList" selected="$ctrl.actionWorker"></vn-icon-menu>
|
||||
</vn-none>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-menu icon="query_builder" items="$ctrl.hourItems" selected="$ctrl.actionHours"></vn-icon-menu>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<vn-autocomplete vn-one
|
||||
data="$ctrl.data.hourItems"
|
||||
label="Hour"
|
||||
value-field="name"
|
||||
field="$ctrl.filter.hour"
|
||||
>
|
||||
</vn-autocomplete>
|
||||
|
|
|
@ -3,10 +3,10 @@ import deps from 'spliting/modules.json';
|
|||
import ngModule from './module';
|
||||
import {splitingRegister} from 'core';
|
||||
|
||||
function loader(moduleName) {
|
||||
function loader(moduleName, validations) {
|
||||
load.$inject = ['vnModuleLoader'];
|
||||
function load(moduleLoader) {
|
||||
return moduleLoader.load(moduleName);
|
||||
return moduleLoader.load(moduleName, validations);
|
||||
}
|
||||
return load;
|
||||
}
|
||||
|
@ -40,19 +40,22 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider) {
|
|||
for (let file in routes) {
|
||||
let fileRoutes = routes[file].routes;
|
||||
let moduleName = routes[file].module;
|
||||
let validations = routes[file].validations;
|
||||
fileRoutes.forEach(function(route) {
|
||||
if (aclService.routeHasPermission(route)) {
|
||||
$stateProvider.state(route.state, {
|
||||
let routeOptions = {
|
||||
url: route.url,
|
||||
abstract: route.abstract || false,
|
||||
template: `<${route.component} ${getParams(route)}></${route.component}>`,
|
||||
resolve: {
|
||||
loader: loader(moduleName)
|
||||
loader: loader(moduleName, validations)
|
||||
},
|
||||
data: {
|
||||
routes: fileRoutes
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$stateProvider.state(route.state, routeOptions);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"loopback-component-explorer": {
|
||||
"mountPath": "/explorer"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
module.exports = function(Client){
|
||||
Client.remoteMethod('employeeList', {
|
||||
description: 'List employee',
|
||||
accessType: 'READ',
|
||||
returns: {
|
||||
arg: 'data',
|
||||
type: 'Employee',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/employeeList`,
|
||||
verb: 'get'
|
||||
}
|
||||
});
|
||||
|
||||
Client.employeeList = function(cb) {
|
||||
var include = {include: { relation: 'user'}, where: { userFk: { neq: null }}};
|
||||
Client.app.models.Employee.find(include, function(err, instances) {
|
||||
(err) ? cb(err, null) : cb(null, generateEmployees(instances));
|
||||
});
|
||||
};
|
||||
|
||||
function generateEmployees(instances){
|
||||
var emps = [];
|
||||
instances.forEach(function(e) {
|
||||
emps.push({id: e.id, name: e.user().name});
|
||||
}, this);
|
||||
return emps;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ module.exports = function(Client) {
|
|||
require('../methods/client/addresses.js')(Client);
|
||||
require('../methods/client/filter.js')(Client);
|
||||
require('../methods/client/before-save.js')(Client);
|
||||
require('../methods/client/employee.js')(Client);
|
||||
|
||||
// Validations
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ app.start = function() {
|
|||
app.emit('started');
|
||||
var baseUrl = app.get('url').replace(/\/$/, '');
|
||||
console.log('Web server listening at: %s', baseUrl);
|
||||
|
||||
if (app.get('loopback-component-explorer')) {
|
||||
var explorerPath = app.get('loopback-component-explorer').mountPath;
|
||||
console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
|
||||
|
|
Loading…
Reference in New Issue