estructure for new module route
This commit is contained in:
parent
0c84722755
commit
4d487e7980
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"salix": [],
|
||||||
|
"auth": [],
|
||||||
|
"core": [],
|
||||||
|
"client": [],
|
||||||
|
"production": [],
|
||||||
|
"route": []
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './src/route';
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"module": "route",
|
||||||
|
"name": "Route",
|
||||||
|
|
||||||
|
"validations" : false,
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"url": "/routes",
|
||||||
|
"state": "routes",
|
||||||
|
"component": "vn-route-index"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<<mg-ajax path="/client/api/Clients/filter" options="mgIndex"></mg-ajax>
|
||||||
|
<div margin-medium>
|
||||||
|
<div style="max-width: 40em; margin: 0 auto;">
|
||||||
|
<vn-card>
|
||||||
|
<vn-horizontal pad-medium>
|
||||||
|
<vn-searchbar vn-auto
|
||||||
|
index="index"
|
||||||
|
on-search="$ctrl.search(index)"
|
||||||
|
advanced="true"
|
||||||
|
search="$ctrl.model.search"
|
||||||
|
popover="vn-client-search-panel">
|
||||||
|
</vn-searchbar>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-card>
|
||||||
|
<vn-card margin-medium-top>
|
||||||
|
<vn-item-route ng-repeat="route in index.model.instances" title="View Route" client="route"></vn-item-route>
|
||||||
|
</vn-card>
|
||||||
|
<vn-paging index="index" total="index.model.count"></vn-paging>
|
||||||
|
</div>
|
||||||
|
<a ui-sref="create" fixed-bottom-right>
|
||||||
|
<vn-float-button icon="add"></vn-float-button>
|
||||||
|
</a>
|
||||||
|
</div>
|
|
@ -0,0 +1,18 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import './style.css';
|
||||||
|
import './item-route';
|
||||||
|
|
||||||
|
export default class Controller {
|
||||||
|
constructor() {
|
||||||
|
this.model = {};
|
||||||
|
}
|
||||||
|
search(index) {
|
||||||
|
index.filter.search = this.model.search;
|
||||||
|
index.accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.component('vnRouteIndex', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
import {ng} from 'vendor';
|
||||||
|
import 'core';
|
||||||
|
|
||||||
|
const ngModule = ng.module('route', []);
|
||||||
|
export default ngModule;
|
|
@ -0,0 +1,4 @@
|
||||||
|
export * from './module';
|
||||||
|
|
||||||
|
// import components
|
||||||
|
import './index/index';
|
|
@ -1,5 +1,5 @@
|
||||||
import './spliting';
|
import './spliting';
|
||||||
import deps from 'spliting/modules.json';
|
import deps from 'client/modules.json';
|
||||||
import ngModule from './module';
|
import ngModule from './module';
|
||||||
import {splitingRegister} from 'core';
|
import {splitingRegister} from 'core';
|
||||||
|
|
||||||
|
|
35
gulpfile.js
35
gulpfile.js
|
@ -17,7 +17,8 @@ var srcDir = './client';
|
||||||
var buildDir = './services/nginx/static';
|
var buildDir = './services/nginx/static';
|
||||||
var langs = ['es', 'en'];
|
var langs = ['es', 'en'];
|
||||||
|
|
||||||
var modules = require('./spliting/modules.json');
|
var modules = require('./client/modules.json');
|
||||||
|
|
||||||
var webpackConfig = require('./webpack.config.js');
|
var webpackConfig = require('./webpack.config.js');
|
||||||
|
|
||||||
// Main tasks
|
// Main tasks
|
||||||
|
@ -69,36 +70,9 @@ gulp.task('install', () => {
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spliting
|
|
||||||
|
|
||||||
var splitingFiles = './spliting/*';
|
|
||||||
|
|
||||||
gulp.task('spliting', function(cb) {
|
|
||||||
var importTpl = fs.readFileSync('./spliting/import.tpl.js', 'utf8');
|
|
||||||
var requireTpl = fs.readFileSync('./spliting/require.tpl.js', 'utf8');
|
|
||||||
|
|
||||||
for (var modName in modules) {
|
|
||||||
var deps = modules[modName];
|
|
||||||
var splitFile = `${srcDir}/${modName}/src/spliting.js`;
|
|
||||||
|
|
||||||
try {
|
|
||||||
fs.unlinkSync(splitFile);
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
fs.appendFileSync(splitFile, importTpl);
|
|
||||||
|
|
||||||
var i = deps.length;
|
|
||||||
while (i--)
|
|
||||||
fs.appendFileSync(splitFile,
|
|
||||||
requireTpl.replace(/\$module/g, deps[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Webpack
|
// Webpack
|
||||||
|
|
||||||
gulp.task('webpack', ['spliting'], function(cb) {
|
gulp.task('webpack', function(cb) {
|
||||||
var configCopy = Object.create(webpackConfig);
|
var configCopy = Object.create(webpackConfig);
|
||||||
var compiler = webpack(configCopy);
|
var compiler = webpack(configCopy);
|
||||||
|
|
||||||
|
@ -109,7 +83,7 @@ gulp.task('webpack', ['spliting'], function(cb) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('webpack-dev-server', ['spliting'], function() {
|
gulp.task('webpack-dev-server', function() {
|
||||||
var configCopy = Object.create(webpackConfig);
|
var configCopy = Object.create(webpackConfig);
|
||||||
|
|
||||||
for (var entry in configCopy.entry) {
|
for (var entry in configCopy.entry) {
|
||||||
|
@ -170,7 +144,6 @@ gulp.task('routes', function() {
|
||||||
// Watch
|
// Watch
|
||||||
|
|
||||||
gulp.task('watch', function() {
|
gulp.task('watch', function() {
|
||||||
gulp.watch(splitingFiles, ['spliting']);
|
|
||||||
gulp.watch(routeFiles, ['routes']);
|
gulp.watch(routeFiles, ['routes']);
|
||||||
gulp.watch(localeFiles, ['locales']);
|
gulp.watch(localeFiles, ['locales']);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
import * as core from 'core';
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"salix": ["client", "production"],
|
|
||||||
"auth": [],
|
|
||||||
"core": [],
|
|
||||||
"client": [],
|
|
||||||
"production": []
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
|
|
||||||
export const $module = () => {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
require.ensure([], () => {
|
|
||||||
require('$module');
|
|
||||||
resolve('$module');
|
|
||||||
}, '$module');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
core.splitingRegister.register('$module', $module);
|
|
Loading…
Reference in New Issue