Updated generator to read parent env config
diff --git a/views/ngXosViews/ceilometerDashboard/env/default.js b/views/ngXosViews/ceilometerDashboard/env/default.js
deleted file mode 100644
index d6dcddd..0000000
--- a/views/ngXosViews/ceilometerDashboard/env/default.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://apt020.apt.emulab.net:9999/',
- xoscsrftoken: 'Z5RslzJ4IpxQ22c9pLyQalRnMbIGuK6p',
- xossessionid: '0fqmxa903dhj7pjkwk21lmhako9qgdi8'
-};
diff --git a/views/ngXosViews/ceilometerDashboard/env/srikanth.js b/views/ngXosViews/ceilometerDashboard/env/srikanth.js
deleted file mode 100644
index 388abf7..0000000
--- a/views/ngXosViews/ceilometerDashboard/env/srikanth.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://130.127.133.41:9999',
- xoscsrftoken: 'pZAcFg4SqcXajLsk46cPypotlUyi8Y2R',
- xossessionid: 'qir5ym7n86zivh3dhv6ne2wgcjwsfyop'
-};
diff --git a/views/ngXosViews/ceilometerDashboard/gulp/server.js b/views/ngXosViews/ceilometerDashboard/gulp/server.js
index c0678d9..19caf89 100644
--- a/views/ngXosViews/ceilometerDashboard/gulp/server.js
+++ b/views/ngXosViews/ceilometerDashboard/gulp/server.js
@@ -10,21 +10,26 @@
var httpProxy = require('http-proxy');
var del = require('del');
var sass = require('gulp-sass');
+var fs = require('fs');
+var path = require('path');
const environment = process.env.NODE_ENV;
-if (environment){
- var conf = require(`../env/${environment}.js`);
+if(!fs.existsSync(path.join(__dirname, `../../../env/${environment || 'default'}.js`))){
+ if(!environment){
+ throw new Error('You should define a default.js config in /views/env folder.');
+ }
+ else{
+ throw new Error(`Since you are loading a custom environment, you should define a ${environment}.js config in /views/env folder.`);
+ }
}
-else{
- var conf = require('../env/default.js')
-}
+
+var conf = require(path.join(__dirname, `../../../env/${environment || 'default'}.js`));
var proxy = httpProxy.createProxyServer({
- target: conf.host || 'http://0.0.0.0:9999'
+ target: conf.host
});
-
proxy.on('error', function(error, req, res) {
res.writeHead(500, {
'Content-Type': 'text/plain'
@@ -51,10 +56,7 @@
},
middleware: function(req, res, next){
if(
- // to be removed, deprecated API
- // req.url.indexOf('/xos/') !== -1 ||
- // req.url.indexOf('/xoslib/') !== -1 ||
- // req.url.indexOf('/hpcapi/') !== -1 ||
+ req.url.indexOf('?no_hyperlinks=1') !== -1 ||
req.url.indexOf('/api/') !== -1
){
if(conf.xoscsrftoken && conf.xossessionid){
diff --git a/views/ngXosViews/truckroll/src/templates/users-list.tpl.html b/views/ngXosViews/ceilometerDashboard/src/templates/users-list.tpl.html
similarity index 100%
copy from views/ngXosViews/truckroll/src/templates/users-list.tpl.html
copy to views/ngXosViews/ceilometerDashboard/src/templates/users-list.tpl.html
diff --git a/views/ngXosViews/contentProvider/env/default.js b/views/ngXosViews/contentProvider/env/default.js
deleted file mode 100644
index e4f9b73..0000000
--- a/views/ngXosViews/contentProvider/env/default.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://xos.dev:9999/',
- xoscsrftoken: 'v9QmTQomVGdvkps5K3AxWfTJeidrFOvt',
- xossessionid: 'h0chy2q37rrd8vpbt62c89wvp31b0ycb'
-};
diff --git a/views/ngXosViews/contentProvider/gulp/server.js b/views/ngXosViews/contentProvider/gulp/server.js
index 78c1620..0bc2bd3 100644
--- a/views/ngXosViews/contentProvider/gulp/server.js
+++ b/views/ngXosViews/contentProvider/gulp/server.js
@@ -10,18 +10,24 @@
var httpProxy = require('http-proxy');
var del = require('del');
var sass = require('gulp-sass');
+var fs = require('fs');
+var path = require('path');
const environment = process.env.NODE_ENV;
-if (environment){
- var conf = require(`../env/${environment}.js`);
-}
-else{
- var conf = require('../env/default.js')
+if(!fs.existsSync(path.join(__dirname, `../../../env/${environment || 'default'}.js`))){
+ if(!environment){
+ throw new Error('You should define a default.js config in /views/env folder.');
+ }
+ else{
+ throw new Error(`Since you are loading a custom environment, you should define a ${environment}.js config in /views/env folder.`);
+ }
}
+var conf = require(path.join(__dirname, `../../../env/${environment || 'default'}.js`));
+
var proxy = httpProxy.createProxyServer({
- target: conf.host || 'http://0.0.0.0:9999'
+ target: conf.host
});
@@ -51,11 +57,8 @@
},
middleware: function(req, res, next){
if(
- // to be removed, deprecated API
- // req.url.indexOf('/xos/') !== -1 ||
- // req.url.indexOf('/xoslib/') !== -1 ||
- req.url.indexOf('/hpcapi/') !== -1 ||
- req.url.indexOf('/api/') !== -1
+ req.url.indexOf('/api/') !== -1 ||
+ req.url.indexOf('/hpcapi/') !== -1
){
if(conf.xoscsrftoken && conf.xossessionid){
req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
diff --git a/views/ngXosViews/truckroll/src/templates/users-list.tpl.html b/views/ngXosViews/contentProvider/src/templates/users-list.tpl.html
similarity index 100%
copy from views/ngXosViews/truckroll/src/templates/users-list.tpl.html
copy to views/ngXosViews/contentProvider/src/templates/users-list.tpl.html
diff --git a/views/ngXosViews/developer/env/default.js b/views/ngXosViews/developer/env/default.js
deleted file mode 100644
index 56a6b77..0000000
--- a/views/ngXosViews/developer/env/default.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://xos.dev:9999/',
- xoscsrftoken: 'Di0iR0Sjg6ZLb0icOtuBqnh5AmE1ddKW',
- xossessionid: 'oem5kppdaihc6pa5qa2ojtxt1r0xterh'
-};
diff --git a/views/ngXosViews/developer/env/mock.js b/views/ngXosViews/developer/env/mock.js
deleted file mode 100644
index 777c149..0000000
--- a/views/ngXosViews/developer/env/mock.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://127.0.0.1:4000/'
-};
diff --git a/views/ngXosViews/developer/gulp/build.js b/views/ngXosViews/developer/gulp/build.js
index f86af0f..87e68d8 100644
--- a/views/ngXosViews/developer/gulp/build.js
+++ b/views/ngXosViews/developer/gulp/build.js
@@ -150,6 +150,7 @@
gulp.task('build', function() {
runSequence(
'clean',
+ 'sass',
'templates',
'babel',
'scripts',
diff --git a/views/ngXosViews/developer/gulp/server.js b/views/ngXosViews/developer/gulp/server.js
index c0678d9..1e40a34 100644
--- a/views/ngXosViews/developer/gulp/server.js
+++ b/views/ngXosViews/developer/gulp/server.js
@@ -10,18 +10,24 @@
var httpProxy = require('http-proxy');
var del = require('del');
var sass = require('gulp-sass');
+var fs = require('fs');
+var path = require('path');
const environment = process.env.NODE_ENV;
-if (environment){
- var conf = require(`../env/${environment}.js`);
-}
-else{
- var conf = require('../env/default.js')
+if(!fs.existsSync(path.join(__dirname, `../../../env/${environment || 'default'}.js`))){
+ if(!environment){
+ throw new Error('You should define a default.js config in /views/env folder.');
+ }
+ else{
+ throw new Error(`Since you are loading a custom environment, you should define a ${environment}.js config in /views/env folder.`);
+ }
}
+var conf = require(path.join(__dirname, `../../../env/${environment || 'default'}.js`));
+
var proxy = httpProxy.createProxyServer({
- target: conf.host || 'http://0.0.0.0:9999'
+ target: conf.host
});
@@ -51,10 +57,6 @@
},
middleware: function(req, res, next){
if(
- // to be removed, deprecated API
- // 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){
diff --git a/views/ngXosViews/truckroll/src/templates/users-list.tpl.html b/views/ngXosViews/developer/src/templates/users-list.tpl.html
similarity index 100%
rename from views/ngXosViews/truckroll/src/templates/users-list.tpl.html
rename to views/ngXosViews/developer/src/templates/users-list.tpl.html
diff --git a/views/ngXosViews/diagnostic/.eslintrc b/views/ngXosViews/diagnostic/.eslintrc
index ef5b468..c852748 100644
--- a/views/ngXosViews/diagnostic/.eslintrc
+++ b/views/ngXosViews/diagnostic/.eslintrc
@@ -16,7 +16,6 @@
],
"rules": {
"quotes": [2, "single"],
- "no-undef": 2,
"camelcase": [1, {"properties": "always"}],
"no-underscore-dangle": 1,
"eqeqeq": [2, "smart"],
@@ -38,7 +37,6 @@
//"angular/ng_di": [0, "function or array"]
},
"globals" :{
- "angular": true,
- "d3": true
+ "angular": true
}
}
\ No newline at end of file
diff --git a/views/ngXosViews/diagnostic/bower.json b/views/ngXosViews/diagnostic/bower.json
index afb3524..9279b8e 100644
--- a/views/ngXosViews/diagnostic/bower.json
+++ b/views/ngXosViews/diagnostic/bower.json
@@ -1,10 +1,10 @@
{
- "name": "xos-serviceTopology",
+ "name": "xos-diagnostic",
"version": "0.0.0",
"authors": [
"Matteo Scandolo <teo@onlab.us>"
],
- "description": "The serviceTopology view",
+ "description": "The diagnostic view",
"license": "MIT",
"ignore": [
"**/.*",
@@ -14,18 +14,21 @@
"test",
"tests"
],
- "dependencies": {
- "d3": "~3.5.13",
- "lodash": "~4.0.0",
- "angular-animate": "~1.4.9"
- },
+ "dependencies": {},
"devDependencies": {
- "jquery": "~2.1.4",
- "angular-mocks": "~1.4.7",
- "angular": "~1.4.7",
- "angular-ui-router": "~0.2.15",
- "angular-cookies": "~1.4.7",
- "angular-resource": "~1.4.7",
- "bootstrap-css": "~3.3.6"
+ "jquery": "2.1.4",
+ "angular-mocks": "1.4.7",
+ "angular": "1.4.7",
+ "angular-ui-router": "0.2.15",
+ "angular-cookies": "1.4.7",
+ "angular-animate": "1.4.7",
+ "angular-resource": "1.4.7",
+ "lodash": "~4.11.1",
+ "bootstrap-css": "3.3.6",
+ "angular-chart.js": "~0.10.2",
+ "d3": "~3.5.17"
+ },
+ "resolutions": {
+ "angular": "1.4.7"
}
}
diff --git a/views/ngXosViews/diagnostic/env/default.js b/views/ngXosViews/diagnostic/env/default.js
deleted file mode 100644
index e9ed236..0000000
--- a/views/ngXosViews/diagnostic/env/default.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://clnode067.clemson.cloudlab.us:9999/',
- xoscsrftoken: 'ZhPiXOVgQH2S0QQtLTkx3DaESR7IOvQc',
- xossessionid: '49cjbceeg483ife9rocex8h1st360ii3'
-};
diff --git a/views/ngXosViews/diagnostic/env/local.js b/views/ngXosViews/diagnostic/env/local.js
deleted file mode 100644
index 3a17b94..0000000
--- a/views/ngXosViews/diagnostic/env/local.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://xos.dev:9999/',
- xoscsrftoken: 'oPSbkruovBQoKcAOUVdX39Ncxt9E93MO',
- xossessionid: 'cy1kwat93lomok0d180c4c0cwvi5fpnn'
-};
diff --git a/views/ngXosViews/diagnostic/env/mock.js b/views/ngXosViews/diagnostic/env/mock.js
deleted file mode 100644
index c65eb2f..0000000
--- a/views/ngXosViews/diagnostic/env/mock.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://localhost:4000/',
- xoscsrftoken: 'IGSrPSAOmBorK8uxbbscQbn3ODPb9dDW',
- xossessionid: 'i8hltbdt3po3uxkbvfmzy15o98p9s157'
-};
diff --git a/views/ngXosViews/diagnostic/env/onlab_pod.js b/views/ngXosViews/diagnostic/env/onlab_pod.js
deleted file mode 100644
index 42211be..0000000
--- a/views/ngXosViews/diagnostic/env/onlab_pod.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://10.90.0.132/',
- xoscsrftoken: 'JmfZETFs72GiVGxIJkCPSrybZvTtJLwF',
- xossessionid: 'jmf3z9wat049cmrh91ppg37pn4yj3830'
-};
diff --git a/views/ngXosViews/diagnostic/gulp/build.js b/views/ngXosViews/diagnostic/gulp/build.js
index 1a1be80..20bbc14 100644
--- a/views/ngXosViews/diagnostic/gulp/build.js
+++ b/views/ngXosViews/diagnostic/gulp/build.js
@@ -39,7 +39,10 @@
// delete previous builded file
gulp.task('clean', function(){
return del(
- [options.dashboards + 'xosDiagnostic.html'],
+ [
+ options.dashboards + 'xosDiagnostic.html',
+ options.static + 'css/xosDiagnostic.css'
+ ],
{force: true}
);
});
@@ -60,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('xosDiagnostic.css'))
.pipe(gulp.dest(options.static + 'css/'))
@@ -69,8 +73,7 @@
// compile and minify scripts
gulp.task('scripts', function() {
return gulp.src([
- options.tmp + '**/*.js',
- options.tmp + 'templates.js'
+ options.tmp + '**/*.js'
])
.pipe(ngAnnotate())
.pipe(angularFilesort())
@@ -86,19 +89,17 @@
return gulp.src('./src/templates/*.html')
.pipe(templateCache({
module: 'xos.diagnostic',
- 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/, ''))
+ .pipe(replace(/<!-- bower:css -->(\n^<link.*)*\n<!-- endbower -->/gmi, ''))
+ .pipe(replace(/<!-- bower:js -->(\n^<script.*)*\n<!-- endbower -->/gmi, ''))
// injecting minified files
.pipe(
inject(
@@ -139,30 +140,25 @@
.pipe(eslint.failAfterError());
});
- // inject CSS
- gulp.task('injectCss', function(){
- return gulp.src(options.src + 'index.html')
- .pipe(
- inject(
- gulp.src(options.src + 'css/*.css'),
- {
- ignorePath: [options.src]
- }
- )
- )
- .pipe(gulp.dest(options.src));
+ gulp.task('wait', function (cb) {
+ // setTimeout could be any async task
+ setTimeout(function () {
+ cb();
+ }, 1000);
});
gulp.task('build', function() {
runSequence(
- 'lint',
+ 'clean',
+ 'sass',
'templates',
'babel',
'scripts',
'wiredep',
- 'injectCss',
+ 'css',
+ 'copyCss',
'copyHtml',
- 'copyCss'
+ 'cleanTmp'
);
});
};
\ No newline at end of file
diff --git a/views/ngXosViews/diagnostic/gulp/server.js b/views/ngXosViews/diagnostic/gulp/server.js
index 194bd45..fbc605b 100644
--- a/views/ngXosViews/diagnostic/gulp/server.js
+++ b/views/ngXosViews/diagnostic/gulp/server.js
@@ -10,18 +10,24 @@
var httpProxy = require('http-proxy');
var del = require('del');
var sass = require('gulp-sass');
+var fs = require('fs');
+var path = require('path');
const environment = process.env.NODE_ENV;
-if (environment){
- var conf = require(`../env/${environment}.js`);
-}
-else{
- var conf = require('../env/default.js')
+if(!fs.existsSync(path.join(__dirname, `../../../env/${environment || 'default'}.js`))){
+ if(!environment){
+ throw new Error('You should define a default.js config in /views/env folder.');
+ }
+ else{
+ throw new Error(`Since you are loading a custom environment, you should define a ${environment}.js config in /views/env folder.`);
+ }
}
+var conf = require(path.join(__dirname, `../../../env/${environment || 'default'}.js`));
+
var proxy = httpProxy.createProxyServer({
- target: conf.host || 'http://0.0.0.0:9999'
+ target: conf.host
});
@@ -35,12 +41,8 @@
module.exports = function(options){
- // open in browser with sync and proxy to 0.0.0.0
gulp.task('browser', function() {
browserSync.init({
- // reloadDelay: 500,
- // logLevel: 'debug',
- // logConnections: true,
startPath: '#/',
snippetOptions: {
rule: {
@@ -50,14 +52,13 @@
server: {
baseDir: options.src,
routes: {
- '/api': options.api,
- '/xosHelpers/src': options.helpers
+ '/xos/core/xoslib/static/js/vendor': options.helpers,
+ '/xos/core/static': options.static + '../../static/'
},
middleware: function(req, res, next){
if(
- req.url.indexOf('/xos/') !== -1 ||
- req.url.indexOf('/xoslib/') !== -1 ||
- req.url.indexOf('/hpcapi/') !== -1
+ req.url.indexOf('/?no_hyperlinks') !== -1 ||
+ req.url.indexOf('/api/') !== -1
){
if(conf.xoscsrftoken && conf.xossessionid){
req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
@@ -85,17 +86,21 @@
gulp.watch(`${options.sass}/**/*.scss`, ['sass'], function(){
browserSync.reload();
});
+
+ gulp.watch([
+ options.helpers + 'ngXosHelpers.js',
+ options.static + '../../static/xosNgLib.css'
+ ], 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));
});
-
- // gulp.task('sass:watch', function () {
- // gulp.watch('./sass/**/*.scss', ['sass']);
- // });
// transpile js with sourceMaps
gulp.task('babel', function(){
@@ -111,8 +116,7 @@
inject(
gulp.src([
options.tmp + '**/*.js',
- options.api + '*.js',
- options.helpers + '**/*.js'
+ options.helpers + 'ngXosHelpers.js'
])
.pipe(angularFilesort()),
{
@@ -128,7 +132,10 @@
return gulp.src(options.src + 'index.html')
.pipe(
inject(
- gulp.src(options.src + 'css/*.css'),
+ gulp.src([
+ options.src + 'css/*.css',
+ options.static + '../../static/xosNgLib.css'
+ ]),
{
ignorePath: [options.src]
}
diff --git a/views/ngXosViews/diagnostic/gulpfile.js b/views/ngXosViews/diagnostic/gulpfile.js
index 3f1e899..08df554 100644
--- a/views/ngXosViews/diagnostic/gulpfile.js
+++ b/views/ngXosViews/diagnostic/gulpfile.js
@@ -11,8 +11,8 @@
tmp: 'src/.tmp',
dist: 'dist/',
api: '../../ngXosLib/api/',
- helpers: '../../ngXosLib/xosHelpers/src/',
- static: '../../../xos/core/xoslib/static/', // this is the django static folder from dev environment
+ helpers: '../../../xos/core/xoslib/static/js/vendor/',
+ static: '../../../xos/core/xoslib/static/', // this is the django static folder
dashboards: '../../../xos/core/xoslib/dashboards/' // this is the django html folder
};
diff --git a/views/ngXosViews/diagnostic/karma.conf.js b/views/ngXosViews/diagnostic/karma.conf.js
index 5e312fa..44283c8 100644
--- a/views/ngXosViews/diagnostic/karma.conf.js
+++ b/views/ngXosViews/diagnostic/karma.conf.js
@@ -28,7 +28,6 @@
files: bowerComponents.concat([
'../../../xos/core/xoslib/static/js/vendor/ngXosVendor.js',
'../../../xos/core/xoslib/static/js/vendor/ngXosHelpers.js',
- '../../../xos/core/xoslib/static/js/xosApi.js',
'src/js/main.js',
'src/js/**/*.js',
'spec/**/*.mock.js',
diff --git a/views/ngXosViews/diagnostic/src/index.html b/views/ngXosViews/diagnostic/src/index.html
index f728df3..f91ebbb 100644
--- a/views/ngXosViews/diagnostic/src/index.html
+++ b/views/ngXosViews/diagnostic/src/index.html
@@ -1,9 +1,11 @@
<!-- browserSync -->
<!-- bower:css -->
<link rel="stylesheet" href="vendor/bootstrap-css/css/bootstrap.min.css" />
+<link rel="stylesheet" href="vendor/angular-chart.js/dist/angular-chart.css" />
<!-- endbower --><!-- endcss -->
<!-- inject:css -->
<link rel="stylesheet" href="/css/main.css">
+<link rel="stylesheet" href="/../../../xos/core/static/xosNgLib.css">
<!-- endinject -->
<div ng-app="xos.diagnostic" id="xosDiagnostic">
@@ -11,28 +13,21 @@
</div>
<!-- bower:js -->
-<script src="vendor/d3/d3.js"></script>
-<script src="vendor/lodash/lodash.js"></script>
-<script src="vendor/angular/angular.js"></script>
-<script src="vendor/angular-animate/angular-animate.js"></script>
<script src="vendor/jquery/dist/jquery.js"></script>
+<script src="vendor/angular/angular.js"></script>
<script src="vendor/angular-mocks/angular-mocks.js"></script>
<script src="vendor/angular-ui-router/release/angular-ui-router.js"></script>
<script src="vendor/angular-cookies/angular-cookies.js"></script>
+<script src="vendor/angular-animate/angular-animate.js"></script>
<script src="vendor/angular-resource/angular-resource.js"></script>
-<script src="vendor/ng-lodash/build/ng-lodash.js"></script>
+<script src="vendor/lodash/lodash.js"></script>
<script src="vendor/bootstrap-css/js/bootstrap.min.js"></script>
+<script src="vendor/Chart.js/Chart.js"></script>
+<script src="vendor/angular-chart.js/dist/angular-chart.js"></script>
+<script src="vendor/d3/d3.js"></script>
<!-- endbower --><!-- endjs -->
<!-- inject:js -->
-<script src="/xosHelpers/src/xosHelpers.module.js"></script>
-<script src="/xosHelpers/src/ui_components/table/table.component.js"></script>
-<script src="/xosHelpers/src/ui_components/ui-components.module.js"></script>
-<script src="/xosHelpers/src/services/noHyperlinks.interceptor.js"></script>
-<script src="/xosHelpers/src/services/csrfToken.interceptor.js"></script>
-<script src="/xosHelpers/src/services/api.services.js"></script>
-<script src="/api/ng-xoslib.js"></script>
-<script src="/api/ng-xos.js"></script>
-<script src="/api/ng-hpcapi.js"></script>
+<script src="/../../../xos/core/xoslib/static/js/vendor/ngXosHelpers.js"></script>
<script src="/.tmp/main.js"></script>
<script src="/.tmp/subscriber-modal.js"></script>
<script src="/.tmp/serviceTopologyHelper.js"></script>
diff --git a/views/ngXosViews/diagnostic/src/js/rest_services.js b/views/ngXosViews/diagnostic/src/js/rest_services.js
index d8dfaf3..fa2fc8f 100644
--- a/views/ngXosViews/diagnostic/src/js/rest_services.js
+++ b/views/ngXosViews/diagnostic/src/js/rest_services.js
@@ -3,10 +3,10 @@
angular.module('xos.diagnostic')
.service('Services', function($resource){
- return $resource('/xos/services/:id', {id: '@id'});
+ return $resource('/api/core/services/:id', {id: '@id'});
})
.service('Tenant', function($resource){
- return $resource('/xos/tenants', {id: '@id'}, {
+ return $resource('/api/core/tenants', {id: '@id'}, {
queryVsgInstances: {
method: 'GET',
isArray: true,
@@ -124,13 +124,13 @@
}
})
.service('Slice', function($resource){
- return $resource('/xos/slices', {id: '@id'});
+ return $resource('/api/core/slices', {id: '@id'});
})
.service('Instances', function($resource){
- return $resource('/xos/instances/:id', {id: '@id'});
+ return $resource('/api/core/instances/:id', {id: '@id'});
})
.service('Node', function($resource, $q, Instances){
- return $resource('/xos/nodes', {id: '@id'}, {
+ return $resource('/api/core/nodes', {id: '@id'}, {
queryWithInstances: {
method: 'GET',
isArray: true,
diff --git a/views/ngXosViews/truckroll/src/templates/users-list.tpl.html b/views/ngXosViews/diagnostic/src/templates/users-list.tpl.html
similarity index 100%
copy from views/ngXosViews/truckroll/src/templates/users-list.tpl.html
copy to views/ngXosViews/diagnostic/src/templates/users-list.tpl.html
diff --git a/views/ngXosViews/openVPNDashboard/env/default.js b/views/ngXosViews/openVPNDashboard/env/default.js
deleted file mode 100644
index 5f463b3..0000000
--- a/views/ngXosViews/openVPNDashboard/env/default.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://xos.dev:9999/',
- xoscsrftoken: 'rDX21sz1qNQeClOj1zvDu1yMqUBtzl0i',
- xossessionid: '7ouvstt0dgpq2um4cak8uunp1ssl8cs6'
-};
diff --git a/views/ngXosViews/openVPNDashboard/gulp/server.js b/views/ngXosViews/openVPNDashboard/gulp/server.js
index c0678d9..1e40a34 100644
--- a/views/ngXosViews/openVPNDashboard/gulp/server.js
+++ b/views/ngXosViews/openVPNDashboard/gulp/server.js
@@ -10,18 +10,24 @@
var httpProxy = require('http-proxy');
var del = require('del');
var sass = require('gulp-sass');
+var fs = require('fs');
+var path = require('path');
const environment = process.env.NODE_ENV;
-if (environment){
- var conf = require(`../env/${environment}.js`);
-}
-else{
- var conf = require('../env/default.js')
+if(!fs.existsSync(path.join(__dirname, `../../../env/${environment || 'default'}.js`))){
+ if(!environment){
+ throw new Error('You should define a default.js config in /views/env folder.');
+ }
+ else{
+ throw new Error(`Since you are loading a custom environment, you should define a ${environment}.js config in /views/env folder.`);
+ }
}
+var conf = require(path.join(__dirname, `../../../env/${environment || 'default'}.js`));
+
var proxy = httpProxy.createProxyServer({
- target: conf.host || 'http://0.0.0.0:9999'
+ target: conf.host
});
@@ -51,10 +57,6 @@
},
middleware: function(req, res, next){
if(
- // to be removed, deprecated API
- // 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){
diff --git a/views/ngXosViews/openVPNDashboard/src/index.html b/views/ngXosViews/openVPNDashboard/src/index.html
index 96dca68..8a97f14 100644
--- a/views/ngXosViews/openVPNDashboard/src/index.html
+++ b/views/ngXosViews/openVPNDashboard/src/index.html
@@ -5,7 +5,6 @@
<!-- endbower --><!-- endcss -->
<!-- inject:css -->
<link rel="stylesheet" href="/css/main.css">
-<link rel="stylesheet" href="/css/openVPNDashboard.css">
<link rel="stylesheet" href="/../../../xos/core/static/xosNgLib.css">
<!-- endinject -->
diff --git a/views/ngXosViews/serviceGrid/bower.json b/views/ngXosViews/serviceGrid/bower.json
index 0cac826..bae4e4d 100644
--- a/views/ngXosViews/serviceGrid/bower.json
+++ b/views/ngXosViews/serviceGrid/bower.json
@@ -27,6 +27,6 @@
"lodash": "~4.11.1",
"bootstrap-css": "3.3.6",
"angular-chart.js": "~0.10.2",
- "d3": "~3.5.13"
+ "d3": "~3.5.17"
}
}
diff --git a/views/ngXosViews/serviceGrid/env/default.js b/views/ngXosViews/serviceGrid/env/default.js
deleted file mode 100644
index c93b55c..0000000
--- a/views/ngXosViews/serviceGrid/env/default.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://xos.dev:9999/',
- xoscsrftoken: 'QVWEAqnNKBLT7pzsjpgiL10eGSKeCxxN',
- xossessionid: 'qrb3fxh8uz3abxjy59w8uccpm6u2twa8'
-};
diff --git a/views/ngXosViews/serviceGrid/gulp/build.js b/views/ngXosViews/serviceGrid/gulp/build.js
index b582642..2916028 100644
--- a/views/ngXosViews/serviceGrid/gulp/build.js
+++ b/views/ngXosViews/serviceGrid/gulp/build.js
@@ -98,8 +98,8 @@
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(/<!-- bower:css -->(\n^<link.*)*\n<!-- endbower -->/gmi, ''))
+ .pipe(replace(/<!-- bower:js -->(\n^<script.*)*\n<!-- endbower -->/gmi, ''))
// injecting minified files
.pipe(
inject(
@@ -150,6 +150,7 @@
gulp.task('build', function() {
runSequence(
'clean',
+ 'sass',
'templates',
'babel',
'scripts',
diff --git a/views/ngXosViews/serviceGrid/gulp/server.js b/views/ngXosViews/serviceGrid/gulp/server.js
index c0678d9..1e40a34 100644
--- a/views/ngXosViews/serviceGrid/gulp/server.js
+++ b/views/ngXosViews/serviceGrid/gulp/server.js
@@ -10,18 +10,24 @@
var httpProxy = require('http-proxy');
var del = require('del');
var sass = require('gulp-sass');
+var fs = require('fs');
+var path = require('path');
const environment = process.env.NODE_ENV;
-if (environment){
- var conf = require(`../env/${environment}.js`);
-}
-else{
- var conf = require('../env/default.js')
+if(!fs.existsSync(path.join(__dirname, `../../../env/${environment || 'default'}.js`))){
+ if(!environment){
+ throw new Error('You should define a default.js config in /views/env folder.');
+ }
+ else{
+ throw new Error(`Since you are loading a custom environment, you should define a ${environment}.js config in /views/env folder.`);
+ }
}
+var conf = require(path.join(__dirname, `../../../env/${environment || 'default'}.js`));
+
var proxy = httpProxy.createProxyServer({
- target: conf.host || 'http://0.0.0.0:9999'
+ target: conf.host
});
@@ -51,10 +57,6 @@
},
middleware: function(req, res, next){
if(
- // to be removed, deprecated API
- // 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){
diff --git a/views/ngXosViews/truckroll/env/default.js b/views/ngXosViews/truckroll/env/default.js
deleted file mode 100644
index 3cb3cc2..0000000
--- a/views/ngXosViews/truckroll/env/default.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://xos.dev:9999/',
- xoscsrftoken: 'AJkHTtR8zZi8UAZsH7RjEj6qvvV8DjAL',
- xossessionid: '1mtzd7n9l3qkck4hc8tmuii491ovg07w'
-};
diff --git a/views/ngXosViews/truckroll/gulp/server.js b/views/ngXosViews/truckroll/gulp/server.js
index c0678d9..1e40a34 100644
--- a/views/ngXosViews/truckroll/gulp/server.js
+++ b/views/ngXosViews/truckroll/gulp/server.js
@@ -10,18 +10,24 @@
var httpProxy = require('http-proxy');
var del = require('del');
var sass = require('gulp-sass');
+var fs = require('fs');
+var path = require('path');
const environment = process.env.NODE_ENV;
-if (environment){
- var conf = require(`../env/${environment}.js`);
-}
-else{
- var conf = require('../env/default.js')
+if(!fs.existsSync(path.join(__dirname, `../../../env/${environment || 'default'}.js`))){
+ if(!environment){
+ throw new Error('You should define a default.js config in /views/env folder.');
+ }
+ else{
+ throw new Error(`Since you are loading a custom environment, you should define a ${environment}.js config in /views/env folder.`);
+ }
}
+var conf = require(path.join(__dirname, `../../../env/${environment || 'default'}.js`));
+
var proxy = httpProxy.createProxyServer({
- target: conf.host || 'http://0.0.0.0:9999'
+ target: conf.host
});
@@ -51,10 +57,6 @@
},
middleware: function(req, res, next){
if(
- // to be removed, deprecated API
- // 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){
diff --git a/views/ngXosViews/truckroll/spec/sample.test.js b/views/ngXosViews/truckroll/spec/sample.test.js
index 06ebc1b..52ebe84 100644
--- a/views/ngXosViews/truckroll/spec/sample.test.js
+++ b/views/ngXosViews/truckroll/spec/sample.test.js
@@ -26,7 +26,7 @@
isolatedScope = element.isolateScope().vm;
}));
- it('should load 1 users', () => {
+ it('should load 1 subscriber', () => {
httpBackend.flush();
expect(isolatedScope.subscribers.length).toBe(1);
});