Updated generator to read parent env config
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/diagnostic/src/templates/users-list.tpl.html b/views/ngXosViews/diagnostic/src/templates/users-list.tpl.html
new file mode 100644
index 0000000..1fee0e2
--- /dev/null
+++ b/views/ngXosViews/diagnostic/src/templates/users-list.tpl.html
@@ -0,0 +1 @@
+<xos-table config="vm.tableConfig" data="vm.users"></xos-table>
\ No newline at end of file