Restored mcord topology
diff --git a/views/ngXosViews/mcordTopology/gulp/build.js b/views/ngXosViews/mcordTopology/gulp/build.js
index 80ba4be..afc12dd 100644
--- a/views/ngXosViews/mcordTopology/gulp/build.js
+++ b/views/ngXosViews/mcordTopology/gulp/build.js
@@ -27,16 +27,22 @@
var mqpacker = require('css-mqpacker');
var csswring = require('csswring');
-var TEMPLATE_FOOTER = `
-angular.module('xos.mcordTopology').run(function($location){$location.path('/')});
-angular.bootstrap(angular.element('#xosMcordTopology'), ['xos.mcordTopology']);`;
+const TEMPLATE_FOOTER = `
+angular.module('xos.mcordTopology')
+.run(['$location', function(a){
+ a.path('/');
+}])
+`
module.exports = function(options){
// delete previous builded file
gulp.task('clean', function(){
return del(
- [options.dashboards + 'xosMcordTopology.html'],
+ [
+ options.dashboards + 'xosMcordTopology.html',
+ options.static + 'css/xosMcordTopology.css'
+ ],
{force: true}
);
});
@@ -48,6 +54,7 @@
mqpacker,
csswring
];
+
gulp.src([
`${options.css}**/*.css`,
`!${options.css}dev.css`
@@ -56,7 +63,8 @@
.pipe(gulp.dest(options.tmp + '/css/'));
});
- gulp.task('copyCss', ['css'], function(){
+ // copy css in correct folder
+ gulp.task('copyCss', ['wait'], function(){
return gulp.src([`${options.tmp}/css/*.css`])
.pipe(concat('xosMcordTopology.css'))
.pipe(gulp.dest(options.static + 'css/'))
@@ -72,7 +80,7 @@
.pipe(concat('xosMcordTopology.js'))
.pipe(concat.header('//Autogenerated, do not edit!!!\n'))
.pipe(concat.footer(TEMPLATE_FOOTER))
- // .pipe(uglify())
+ .pipe(uglify())
.pipe(gulp.dest(options.static + 'js/'));
});
@@ -81,19 +89,17 @@
return gulp.src('./src/templates/*.html')
.pipe(templateCache({
module: 'xos.mcordTopology',
- root: 'templates/',
- templateFooter: TEMPLATE_FOOTER
+ root: 'templates/'
}))
.pipe(gulp.dest(options.tmp));
});
// copy html index to Django Folder
- gulp.task('copyHtml', ['clean'], function(){
+ gulp.task('copyHtml', function(){
return gulp.src(options.src + 'index.html')
// remove dev dependencies from html
.pipe(replace(/<!-- bower:css -->(\n.*)*\n<!-- endbower --><!-- endcss -->/, ''))
.pipe(replace(/<!-- bower:js -->(\n.*)*\n<!-- endbower --><!-- endjs -->/, ''))
- .pipe(replace(/ng-app=".*"\s/, ''))
// injecting minified files
.pipe(
inject(
@@ -134,14 +140,24 @@
.pipe(eslint.failAfterError());
});
+ gulp.task('wait', function (cb) {
+ // setTimeout could be any async task
+ setTimeout(function () {
+ cb();
+ }, 1000);
+ });
+
gulp.task('build', function() {
runSequence(
+ 'clean',
'templates',
- 'copyCss',
'babel',
'scripts',
'wiredep',
- 'copyHtml'
+ 'css',
+ 'copyCss',
+ 'copyHtml',
+ 'cleanTmp'
);
});
};
\ No newline at end of file
diff --git a/views/ngXosViews/mcordTopology/gulp/server.js b/views/ngXosViews/mcordTopology/gulp/server.js
index 162bc97..167a5a9 100644
--- a/views/ngXosViews/mcordTopology/gulp/server.js
+++ b/views/ngXosViews/mcordTopology/gulp/server.js
@@ -9,6 +9,7 @@
var wiredep = require('wiredep').stream;
var httpProxy = require('http-proxy');
var del = require('del');
+var sass = require('gulp-sass');
const environment = process.env.NODE_ENV;
@@ -23,10 +24,6 @@
target: conf.host || 'http://0.0.0.0:9999'
});
-var traffic = httpProxy.createProxyServer({
- target: 'http://10.128.13.3'
-});
-
proxy.on('error', function(error, req, res) {
res.writeHead(500, {
@@ -53,14 +50,11 @@
server: {
baseDir: options.src,
routes: {
- '/api': options.api,
- '/xosHelpers/src': options.helpers
+ '/xos/core/xoslib/static/js/vendor': options.helpers
},
middleware: function(req, res, next){
if(
- req.url.indexOf('/xos/') !== -1 ||
- req.url.indexOf('/xoslib/') !== -1 ||
- req.url.indexOf('/hpcapi/') !== -1
+ req.url.indexOf('/api/') !== -1
){
if(conf.xoscsrftoken && conf.xossessionid){
req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
@@ -68,9 +62,9 @@
}
proxy.web(req, res);
}
- else if(req.url.indexOf('videoLocal') !== -1){
- console.log('traffic: ', req.url);
- traffic.web(req, res);
+ else if(req.url.indexOf('/videoLocal.txt') !== -1){
+ let a = (Math.random() * 10).toString();
+ res.end(a)
}
else{
next();
@@ -86,6 +80,19 @@
gulp.watch(options.src + '**/*.html', function(){
browserSync.reload();
});
+ gulp.watch(options.css + '**/*.css', function(){
+ browserSync.reload();
+ });
+ gulp.watch(`${options.sass}/**/*.scss`, ['sass'], function(){
+ browserSync.reload();
+ });
+ });
+
+ // compile sass
+ gulp.task('sass', function () {
+ return gulp.src(`${options.sass}/**/*.scss`)
+ .pipe(sass().on('error', sass.logError))
+ .pipe(gulp.dest(options.css));
});
// transpile js with sourceMaps
@@ -102,8 +109,7 @@
inject(
gulp.src([
options.tmp + '**/*.js',
- options.api + '*.js',
- options.helpers + '**/*.js'
+ options.helpers + 'ngXosHelpers.js'
])
.pipe(angularFilesort()),
{
@@ -145,6 +151,7 @@
gulp.task('serve', function() {
runSequence(
+ 'sass',
'bower',
'injectScript',
'injectCss',