Loopback 3, errores solucionados, codigo reorganizado
This commit is contained in:
parent
b427361156
commit
609c984426
|
@ -5,7 +5,7 @@
|
|||
data="$ctrl.address"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form ng-submit="watcher.submitGo('clientCard.addresses')" pad-medium>
|
||||
<form name="form" ng-submit="watcher.submitGo('clientCard.addresses')" pad-medium>
|
||||
<vn-card >
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Consignatario</vn-title>
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
data="$ctrl.note"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form ng-submit="watcher.submitGo('clientCard.notes.list')" pad-medium>
|
||||
<form name="form" ng-submit="watcher.submitGo('clientCard.notes.list')" pad-medium>
|
||||
<vn-card>
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Nueva nota</vn-title>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div pad-large style="min-width: 30em">
|
||||
<form name="form" ng-submit="$ctrl.onSearch()">
|
||||
<form ng-submit="$ctrl.onSearch()">
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Id Cliente" model="$ctrl.filter.id" vn-focus></vn-textfield>
|
||||
<vn-textfield vn-one label="NIF/CIF" model="$ctrl.filter.fi"></vn-textfield>
|
||||
|
@ -23,4 +23,3 @@
|
|||
</vn-horizontal>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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);
|
|
@ -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';
|
||||
|
|
|
@ -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);
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<vn-vertical full-height class="bg-content">
|
||||
<vn-topbar vn-empty>
|
||||
<a ui-sref="home" title="{{'home' | translate}}"><img class="logo" src="./logo.svg" alt="Logo" ></img></a>
|
||||
<a ui-sref="home" title="{{'Home' | translate}}">
|
||||
<img class="logo" src="./logo.svg" alt="Logo" ></img>
|
||||
</a>
|
||||
<vn-spinner enable="$root.loading"></vn-spinner>
|
||||
<vn-main-menu></vn-main-menu>
|
||||
</vn-topbar>
|
||||
<vn-vertical vn-auto ui-view scrollable class="main-view">
|
||||
<vn-home></vn-home>
|
||||
</vn-vertical>
|
||||
<vn-snackbar></vn-snackbar>
|
||||
<vn-snackbar vn-id="snackbar"></vn-snackbar>
|
||||
</vn-vertical>
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ vn-app {
|
|||
height: 100%;
|
||||
|
||||
vn-topbar {
|
||||
|
||||
.logo {
|
||||
float: left;
|
||||
height: 30px;
|
||||
|
|
|
@ -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
|
||||
});
|
||||
|
|
|
@ -27,8 +27,8 @@ MenuActions.$inject = ['$state', '$transitions'];
|
|||
|
||||
ngModule.component('vnActions', {
|
||||
template: require('./actions.html'),
|
||||
controller: MenuActions,
|
||||
bindings: {
|
||||
items: '<'
|
||||
},
|
||||
controller: MenuActions
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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
|
||||
});
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
<vn-icon icon="account_circle" translate-attr="{title: 'Profile'}" style="font-size: 35px;"></vn-icon>
|
||||
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right" pad-medium for="apps">
|
||||
<vn-horizontal>
|
||||
<div ng-repeat="mod in $ctrl.modules">
|
||||
<vn-vertical>
|
||||
<a ui-sref="{{::mod.route.state}}">
|
||||
<button vn-one class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored popover-button">
|
||||
<vn-icon vn-one icon="{{::mod.icon}}" style="font-size:40px"></vn-icon>
|
||||
</button>
|
||||
</a>
|
||||
<vn-label class="popover-label" text="{{::mod.name}}"></vn-label>
|
||||
</vn-vertical>
|
||||
</div>
|
||||
<div ng-repeat="mod in $ctrl.modules">
|
||||
<vn-vertical>
|
||||
<a ui-sref="{{::mod.route.state}}">
|
||||
<button vn-one class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored popover-button">
|
||||
<vn-icon vn-one icon="{{::mod.icon}}" style="font-size:40px"></vn-icon>
|
||||
</button>
|
||||
</a>
|
||||
<vn-label class="popover-label" text="{{::mod.name}}"></vn-label>
|
||||
</vn-vertical>
|
||||
</div>
|
||||
</vn-horizontal>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -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
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"Applications": "Applications",
|
||||
"Home": "Home",
|
||||
"Notifications":"Notifications",
|
||||
"Logout": "Logout",
|
||||
"Change language": "Change language",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"Applications": "Aplicaciones",
|
||||
"Home": "Inicio",
|
||||
"Notifications":"Notificaciones",
|
||||
"Logout": "Cerrar sesión",
|
||||
"Change language": "Cambiar idioma",
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "user",
|
||||
"base": "User",
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"forceId": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,6 +12,8 @@
|
|||
"host": "localhost",
|
||||
"port": 3306,
|
||||
"username": "root",
|
||||
"password": ""
|
||||
"password": "",
|
||||
"connectTimeout": 20000,
|
||||
"acquireTimeout": 20000
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "user",
|
||||
"base": "User",
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"forceId": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "user",
|
||||
"base": "User",
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"forceId": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,6 +11,8 @@
|
|||
"host": "localhost",
|
||||
"port": 3306,
|
||||
"username": "root",
|
||||
"password": ""
|
||||
"password": "",
|
||||
"connectTimeout": 20000,
|
||||
"acquireTimeout": 20000
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -57,7 +57,7 @@ var config = {
|
|||
names: ['bundle.vendor', 'bundle.manifest']
|
||||
})
|
||||
],
|
||||
devtool: 'eval-source-map'
|
||||
devtool: 'source-map'
|
||||
};
|
||||
|
||||
if (!devMode) {
|
||||
|
|
Loading…
Reference in New Issue