Started tutorial implementation

Change-Id: I1624d012735a090c4e7f89d7d79c210ee3617942
diff --git a/views/ngXosViews/UITutorial/.bowerrc b/views/ngXosViews/UITutorial/.bowerrc
new file mode 100644
index 0000000..e491038
--- /dev/null
+++ b/views/ngXosViews/UITutorial/.bowerrc
@@ -0,0 +1,3 @@
+{
+  "directory": "src/vendor/"
+}
\ No newline at end of file
diff --git a/views/ngXosViews/UITutorial/.eslintrc b/views/ngXosViews/UITutorial/.eslintrc
new file mode 100644
index 0000000..c852748
--- /dev/null
+++ b/views/ngXosViews/UITutorial/.eslintrc
@@ -0,0 +1,42 @@
+{
+    "ecmaFeatures": {
+        "blockBindings": true,
+        "forOf": true,
+        "destructuring": true,
+        "arrowFunctions": true,
+        "templateStrings": true
+    },
+    "env": { 
+        "browser": true,
+        "node": true,
+        "es6": true
+    },
+    "plugins": [
+        //"angular"
+    ],
+    "rules": {
+        "quotes": [2, "single"],
+        "camelcase": [1, {"properties": "always"}],
+        "no-underscore-dangle": 1,
+        "eqeqeq": [2, "smart"],
+        "no-alert": 1,
+        "key-spacing": [1, { "beforeColon": false, "afterColon": true }],
+        "indent": [2, 2],
+        "no-irregular-whitespace": 1,
+        "eol-last": 0,
+        "max-nested-callbacks": [2, 4],
+        "comma-spacing": [1, {"before": false, "after": true}],
+        "no-trailing-spaces": [1, { skipBlankLines: true }],
+        "no-unused-vars": [1, {"vars": "all", "args": "after-used"}],
+        "new-cap": 0,
+
+        //"angular/ng_module_name": [2, '/^xos\.*[a-z]*$/'],
+        //"angular/ng_controller_name": [2, '/^[a-z].*Ctrl$/'],
+        //"angular/ng_service_name": [2, '/^[A-Z].*Service$/'],
+        //"angular/ng_directive_name": [2, '/^[a-z]+[[A-Z].*]*$/'],
+        //"angular/ng_di": [0, "function or array"]
+    },
+    "globals" :{
+        "angular": true
+    } 
+}
\ No newline at end of file
diff --git a/views/ngXosViews/UITutorial/.gitignore b/views/ngXosViews/UITutorial/.gitignore
new file mode 100644
index 0000000..567aee4
--- /dev/null
+++ b/views/ngXosViews/UITutorial/.gitignore
@@ -0,0 +1,6 @@
+dist/
+src/vendor
+.tmp
+node_modules
+npm-debug.log
+dist/
\ No newline at end of file
diff --git a/views/ngXosViews/UITutorial/bower.json b/views/ngXosViews/UITutorial/bower.json
new file mode 100644
index 0000000..009304e
--- /dev/null
+++ b/views/ngXosViews/UITutorial/bower.json
@@ -0,0 +1,35 @@
+{
+  "name": "xos-UITutorial",
+  "version": "0.0.0",
+  "authors": [
+    "Matteo Scandolo <matteo.scandolo@gmail.com>"
+  ],
+  "description": "The UITutorial view",
+  "license": "Apache-2.0",
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "static/js/vendor/",
+    "test",
+    "tests"
+  ],
+  "dependencies": {
+    "josh.js": "teone/josh.js#~0.2.10"
+  },
+  "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-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",
+    "angular-recursion": "~1.0.5",
+    "ng-xos-lib": "opencord/ng-xos-lib#~1.0.0"
+  }
+}
diff --git a/views/ngXosViews/UITutorial/gulp/build.js b/views/ngXosViews/UITutorial/gulp/build.js
new file mode 100644
index 0000000..ed8eb07
--- /dev/null
+++ b/views/ngXosViews/UITutorial/gulp/build.js
@@ -0,0 +1,227 @@
+'use strict';
+
+// BUILD
+//
+// The only purpose of this gulpfile is to build a XOS view and copy the correct files into
+// .html => dashboards
+// .js (minified and concat) => static/js
+//
+// The template are parsed and added to js with angular $templateCache
+
+var gulp = require('gulp');
+var ngAnnotate = require('gulp-ng-annotate');
+var uglify = require('gulp-uglify');
+var templateCache = require('gulp-angular-templatecache');
+var runSequence = require('run-sequence');
+var concat = require('gulp-concat-util');
+var del = require('del');
+var wiredep = require('wiredep');
+var angularFilesort = require('gulp-angular-filesort');
+var _ = require('lodash');
+var eslint = require('gulp-eslint');
+var inject = require('gulp-inject');
+var rename = require('gulp-rename');
+var replace = require('gulp-replace');
+var postcss = require('gulp-postcss');
+var autoprefixer = require('autoprefixer');
+var mqpacker = require('css-mqpacker');
+var csswring = require('csswring');
+var yaml = require('js-yaml');
+var colors = require('colors/safe');
+var fs =  require('fs');
+
+const TEMPLATE_FOOTER = `
+angular.module('xos.UITutorial')
+.run(['$location', function(a){
+  a.path('/');
+}])
+`
+
+module.exports = function(options){
+  
+  // delete previous builded file
+  gulp.task('clean', function(){
+    return del(
+      [
+        options.dashboards + 'xosUITutorial.html',
+        options.static + 'css/xosUITutorial.css',
+        options.static + 'images/UITutorial-icon.png',
+        options.static + 'images/UITutorial-icon-active.png'
+      ],
+      {force: true}
+    );
+  });
+
+  // minify css
+  gulp.task('css', function () {
+    var processors = [
+      autoprefixer({browsers: ['last 1 version']}),
+      mqpacker,
+      csswring
+    ];
+
+    gulp.src([
+      `${options.css}**/*.css`,
+      `!${options.css}dev.css`
+    ])
+    .pipe(postcss(processors))
+    .pipe(gulp.dest(options.tmp + '/css/'));
+  });
+
+  // copy css in correct folder
+  gulp.task('copyCss', ['wait'], function(){
+    return gulp.src([`${options.tmp}/css/*.css`])
+    .pipe(concat('xosUITutorial.css'))
+    .pipe(gulp.dest(options.static + 'css/'))
+  });
+
+  // copy images in correct folder
+  gulp.task('copyImages', ['wait'], function(){
+    return gulp.src([`${options.icon}/UITutorial-icon.png`, `${options.icon}/UITutorial-icon-active.png`])
+    .pipe(gulp.dest(options.static + 'images/'))
+  });
+
+  // compile and minify scripts
+  gulp.task('scripts', function() {
+    return gulp.src([
+      options.tmp + '**/*.js'
+    ])
+    .pipe(ngAnnotate())
+    .pipe(angularFilesort())
+    .pipe(concat('xosUITutorial.js'))
+    .pipe(concat.header('//Autogenerated, do not edit!!!\n'))
+    .pipe(concat.footer(TEMPLATE_FOOTER))
+    .pipe(uglify())
+    .pipe(gulp.dest(options.static + 'js/'));
+  });
+
+  // set templates in cache
+  gulp.task('templates', function(){
+    return gulp.src('./src/templates/*.html')
+      .pipe(templateCache({
+        module: 'xos.UITutorial',
+        root: 'templates/'
+      }))
+      .pipe(gulp.dest(options.tmp));
+  });
+
+  // copy html index to Django Folder
+  gulp.task('copyHtml', function(){
+    return gulp.src(options.src + 'index.html')
+      // remove dev dependencies from html
+      .pipe(replace(/<!-- bower:css -->(\n^<link.*)*\n<!-- endbower -->/gmi, ''))
+      .pipe(replace(/<!-- bower:js -->(\n^<script.*)*\n<!-- endbower -->/gmi, ''))
+      // injecting minified files
+      .pipe(
+        inject(
+          gulp.src([
+            options.static + 'vendor/xosUITutorialVendor.js',
+            options.static + 'js/xosUITutorial.js',
+            options.static + 'css/xosUITutorial.css'
+          ]),
+          {ignorePath: '/../../../xos/core/xoslib'}
+        )
+      )
+      .pipe(rename('xosUITutorial.html'))
+      .pipe(gulp.dest(options.dashboards));
+  });
+
+  // minify vendor js files
+  gulp.task('wiredep', function(){
+    var bowerDeps = wiredep().js;
+    if(!bowerDeps){
+      return;
+    }
+
+    // remove angular (it's already loaded)
+    _.remove(bowerDeps, function(dep){
+      return dep.indexOf('angular/angular.js') !== -1;
+    });
+
+    return gulp.src(bowerDeps)
+      .pipe(concat('xosUITutorialVendor.js'))
+      .pipe(uglify())
+      .pipe(gulp.dest(options.static + 'vendor/'));
+  });
+
+  gulp.task('lint', function () {
+    return gulp.src(['src/js/**/*.js'])
+      .pipe(eslint())
+      .pipe(eslint.format())
+      .pipe(eslint.failAfterError());
+  });
+
+  gulp.task('wait', function (cb) {
+    // setTimeout could be any async task
+    setTimeout(function () {
+      cb();
+    }, 1000);
+  });
+
+  gulp.task('tosca', function (cb) {
+
+    // TOSCA to register the dashboard in the system
+    const dashboardJson = {};
+    dashboardJson['UITutorial'] = {
+      type: 'tosca.nodes.DashboardView',
+      properties: {
+        url: 'template:xosUITutorial'
+      }
+    };
+
+    // check for custom icons
+    if(
+      fs.existsSync(`${options.icon}/UITutorial-icon.png`) &&
+      fs.existsSync(`${options.icon}/UITutorial-icon-active.png`)
+    ){
+      dashboardJson['UITutorial'].properties.custom_icon = true;
+    }
+
+    const dashboardTosca = yaml.dump(dashboardJson).replace(/'/gmi, '');
+
+    // TOSCA to add the dashboard to the user
+    const userDashboardJson = {};
+    userDashboardJson['UITutorial_dashboard'] = {
+      node: 'UITutorial',
+      relationship: 'tosca.relationships.UsesDashboard'
+    };
+    const userJson = {
+      'padmin@vicci.org': {
+        type: 'tosca.nodes.User',
+        properties: {
+          'no-create': true,
+          'no-delete': true
+        },
+        requirements: [userDashboardJson]
+      }
+    };
+    const userTosca = yaml.dump(userJson).replace(/'/gmi, '');
+
+
+    // the output is in a timeout so that it get printed after the gulp logs
+    setTimeout(function () {
+      console.log(colors.cyan('\n\n# You can use this recipe to load the dashboard in the system:'));
+      console.log(colors.yellow(dashboardTosca));
+      console.log(colors.cyan('# And this recipe to activate the dashboard for a user:'));
+      console.log(colors.yellow(userTosca));
+    }, 1000);
+    cb();
+  });
+
+  gulp.task('build', function() {
+    runSequence(
+      'clean',
+      'sass',
+      'templates',
+      'babel',
+      'scripts',
+      'wiredep',
+      'css',
+      'copyCss',
+      'copyImages',
+      'copyHtml',
+      'cleanTmp',
+      'tosca'
+    );
+  });
+};
\ No newline at end of file
diff --git a/views/ngXosViews/UITutorial/gulp/server.js b/views/ngXosViews/UITutorial/gulp/server.js
new file mode 100644
index 0000000..36fdded
--- /dev/null
+++ b/views/ngXosViews/UITutorial/gulp/server.js
@@ -0,0 +1,169 @@
+'use strict';
+
+var gulp = require('gulp');
+var browserSync = require('browser-sync').create();
+var inject = require('gulp-inject');
+var runSequence = require('run-sequence');
+var angularFilesort = require('gulp-angular-filesort');
+var babel = require('gulp-babel');
+var wiredep = require('wiredep').stream;
+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(!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
+});
+
+
+proxy.on('error', function(error, req, res) {
+  res.writeHead(500, {
+    'Content-Type': 'text/plain'
+  });
+
+  console.error('[Proxy]', error);
+});
+
+module.exports = function(options){
+
+  gulp.task('browser', function() {
+    browserSync.init({
+      startPath: '#/',
+      snippetOptions: {
+        rule: {
+          match: /<!-- browserSync -->/i
+        }
+      },
+      server: {
+        baseDir: options.src,
+        routes: {
+          '/xos/core/static': options.static + '../../static/'
+        },
+        middleware: function(req, res, next){
+          if(
+            req.url.indexOf('/api/') !== -1
+          ){
+            if(conf.xoscsrftoken && conf.xossessionid){
+              req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
+              req.headers['x-csrftoken'] = conf.xoscsrftoken;
+            }
+            proxy.web(req, res);
+          }
+          else{
+            next();
+          }
+        }
+      }
+    });
+
+    gulp.watch(options.src + 'js/**/*.js', ['js-watch']);
+    gulp.watch(options.src + 'vendor/**/*.js', ['bower'], function(){
+      browserSync.reload();
+    });
+    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();
+    });
+
+    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));
+  });
+
+  // transpile js with sourceMaps
+  gulp.task('babel', function(){
+    return gulp.src(options.scripts + '**/*.js')
+      .pipe(babel({sourceMaps: true}))
+      .pipe(gulp.dest(options.tmp));
+  });
+
+  // inject scripts
+  gulp.task('injectScript', ['cleanTmp', 'babel'], function(){
+    return gulp.src(options.src + 'index.html')
+      .pipe(
+        inject(
+          gulp.src([
+            options.tmp + '**/*.js',
+            options.helpers + 'ngXosHelpers.min.js'
+          ])
+          .pipe(angularFilesort()),
+          {
+            ignorePath: [options.src, '/../../ngXosLib']
+          }
+        )
+      )
+      .pipe(gulp.dest(options.src));
+  });
+
+  // inject CSS
+  gulp.task('injectCss', function(){
+    return gulp.src(options.src + 'index.html')
+      .pipe(
+        inject(
+          gulp.src([
+            options.src + 'css/*.css',
+            options.static + '../../static/xosNgLib.css'
+          ]),
+          {
+            ignorePath: [options.src]
+          }
+          )
+        )
+      .pipe(gulp.dest(options.src));
+  });
+
+  // inject bower dependencies with wiredep
+  gulp.task('bower', function () {
+    return gulp.src(options.src + 'index.html')
+    .pipe(wiredep({devDependencies: true}))
+    .pipe(gulp.dest(options.src));
+  });
+
+  gulp.task('js-watch', ['injectScript'], function(){
+    browserSync.reload();
+  });
+
+  gulp.task('cleanTmp', function(){
+    return del([options.tmp + '**/*']);
+  });
+
+  gulp.task('serve', function() {
+    runSequence(
+      'sass',
+      'bower',
+      'injectScript',
+      'injectCss',
+      ['browser']
+    );
+  });
+};
diff --git a/views/ngXosViews/UITutorial/gulpfile.js b/views/ngXosViews/UITutorial/gulpfile.js
new file mode 100644
index 0000000..c825df8
--- /dev/null
+++ b/views/ngXosViews/UITutorial/gulpfile.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var gulp = require('gulp');
+var wrench = require('wrench');
+
+var options = {
+  src: 'src/',
+  css: 'src/css/',
+  icon: 'src/icons',
+  sass: 'src/sass/',
+  scripts: 'src/js/',
+  tmp: 'src/.tmp',
+  dist: 'dist/',
+  api: '../../ngXosLib/api/',
+  helpers: './src/vendor/ng-xos-lib/dist/',
+  static: '../../../xos/core/xoslib/static/', // this is the django static folder
+  dashboards: '../../../xos/core/xoslib/dashboards/' // this is the django html folder
+};
+
+wrench.readdirSyncRecursive('./gulp')
+.map(function(file) {
+  require('./gulp/' + file)(options);
+});
+
+gulp.task('default', function () {
+  gulp.start('build');
+});
diff --git a/views/ngXosViews/UITutorial/karma.conf.js b/views/ngXosViews/UITutorial/karma.conf.js
new file mode 100644
index 0000000..e5abf39
--- /dev/null
+++ b/views/ngXosViews/UITutorial/karma.conf.js
@@ -0,0 +1,90 @@
+// Karma configuration
+// Generated on Tue Oct 06 2015 09:27:10 GMT+0000 (UTC)
+
+/* eslint indent: [2,2], quotes: [2, "single"]*/
+
+/*eslint-disable*/
+var wiredep = require('wiredep');
+var path = require('path');
+
+var bowerComponents = wiredep( {devDependencies: true} )[ 'js' ].map(function( file ){
+  return path.relative(process.cwd(), file);
+});
+
+module.exports = function(config) {
+/*eslint-enable*/
+  config.set({
+
+    // base path that will be used to resolve all patterns (eg. files, exclude)
+    basePath: '',
+
+
+    // frameworks to use
+    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+    frameworks: ['jasmine'],
+
+
+    // list of files / patterns to load in the browser
+    files: bowerComponents.concat([
+      './src/vendor/ng-xos-lib/dist/ngXosVendor.min.js',
+      './src/vendor/ng-xos-lib/dist/ngXosHelpers.min.js',
+      'src/js/main.js',
+      'src/js/**/*.js',
+      'spec/**/*.mock.js',
+      'spec/**/*.test.js',
+      'src/**/*.html'
+    ]),
+
+
+    // list of files to exclude
+    exclude: [
+    ],
+
+
+    // preprocess matching files before serving them to the browser
+    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+    preprocessors: {
+      'src/js/**/*.js': ['babel'],
+      'spec/**/*.test.js': ['babel'],
+      'spec/**/*.mock.js': ['babel'],
+      'src/**/*.html': ['ng-html2js']
+    },
+
+    ngHtml2JsPreprocessor: {
+      stripPrefix: 'src/', //strip the src path from template url (http://stackoverflow.com/questions/22869668/karma-unexpected-request-when-testing-angular-directive-even-with-ng-html2js)
+      moduleName: 'templates' // define the template module name
+    },
+
+    // test results reporter to use
+    // possible values: 'dots', 'progress'
+    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+    reporters: ['mocha'],
+
+
+    // web server port
+    port: 9876,
+
+
+    // enable / disable colors in the output (reporters and logs)
+    colors: true,
+
+
+    // level of logging
+    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+    logLevel: config.LOG_INFO,
+
+
+    // enable / disable watching file and executing tests whenever any file changes
+    autoWatch: true,
+
+
+    // start these browsers
+    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+    browsers: ['PhantomJS'],
+
+
+    // Continuous Integration mode
+    // if true, Karma captures browsers, runs the tests and exits
+    singleRun: false
+  });
+};
diff --git a/views/ngXosViews/UITutorial/package.json b/views/ngXosViews/UITutorial/package.json
new file mode 100644
index 0000000..a416d30
--- /dev/null
+++ b/views/ngXosViews/UITutorial/package.json
@@ -0,0 +1,66 @@
+{
+  "name": "xos-UITutorial",
+  "version": "1.0.0",
+  "description": "Angular Application for XOS, created with generator-xos",
+  "scripts": {
+    "prestart": "npm install && bower install",
+    "start": "gulp serve",
+    "tosca": "gulp tosca",
+    "prebuild": "npm install && bower install",
+    "build": "gulp",
+    "test": "karma start",
+    "test:ci": "karma start --single-run",
+    "lint": "eslint src/js/"
+  },
+  "keywords": [
+    "XOS",
+    "Angular",
+    "XOSlib"
+  ],
+  "author": "Matteo Scandolo",
+  "license": "Apache-2.0",
+  "dependencies": {},
+  "devDependencies": {
+    "autoprefixer": "^6.3.3",
+    "browser-sync": "^2.9.11",
+    "colors": "^1.1.2",
+    "css-mqpacker": "^4.0.0",
+    "csswring": "^4.2.1",
+    "del": "^2.0.2",
+    "easy-mocker": "^1.2.0",
+    "eslint": "^1.8.0",
+    "eslint-plugin-angular": "linkmesrl/eslint-plugin-angular",
+    "gulp": "^3.9.0",
+    "gulp-angular-filesort": "^1.1.1",
+    "gulp-angular-templatecache": "^1.8.0",
+    "gulp-babel": "^5.3.0",
+    "gulp-concat": "^2.6.0",
+    "gulp-concat-util": "^0.5.5",
+    "gulp-eslint": "^1.0.0",
+    "gulp-inject": "^3.0.0",
+    "gulp-minify-html": "^1.0.4",
+    "gulp-ng-annotate": "^1.1.0",
+    "gulp-postcss": "^6.0.1",
+    "gulp-rename": "^1.2.2",
+    "gulp-replace": "^0.5.4",
+    "gulp-sass": "^2.2.0",
+    "gulp-uglify": "^1.4.2",
+    "http-proxy": "^1.12.0",
+    "ink-docstrap": "^0.5.2",
+    "jasmine-core": "~2.3.4",
+    "js-yaml": "^3.6.1",
+    "karma": "^0.13.14",
+    "karma-babel-preprocessor": "~5.2.2",
+    "karma-coverage": "^0.5.3",
+    "karma-jasmine": "~0.3.6",
+    "karma-mocha-reporter": "~1.1.1",
+    "karma-ng-html2js-preprocessor": "^0.2.0",
+    "karma-phantomjs-launcher": "~0.2.1",
+    "lodash": "^3.10.1",
+    "phantomjs": "^1.9.19",
+    "proxy-middleware": "^0.15.0",
+    "run-sequence": "^1.1.4",
+    "wiredep": "^3.0.0-beta",
+    "wrench": "^1.5.8"
+  }
+}
diff --git a/views/ngXosViews/UITutorial/spec/sample.test.js b/views/ngXosViews/UITutorial/spec/sample.test.js
new file mode 100644
index 0000000..9e16127
--- /dev/null
+++ b/views/ngXosViews/UITutorial/spec/sample.test.js
@@ -0,0 +1,37 @@
+'use strict';
+
+describe('The User List', () => {
+  
+  var scope, element, isolatedScope, httpBackend;
+
+  beforeEach(module('xos.UITutorial'));
+  beforeEach(module('templates'));
+
+  beforeEach(inject(function($httpBackend, $compile, $rootScope){
+    
+    httpBackend = $httpBackend;
+    // Setting up mock request
+    $httpBackend.expectGET('/api/core/users/?no_hyperlinks=1').respond([
+      {
+        email: 'matteo.scandolo@gmail.com',
+        firstname: 'Matteo',
+        lastname: 'Scandolo' 
+      }
+    ]);
+  
+    scope = $rootScope.$new();
+    element = angular.element('<users-list></users-list>');
+    $compile(element)(scope);
+    scope.$digest();
+    isolatedScope = element.isolateScope().vm;
+  }));
+
+  xit('should load 1 users', () => {
+    httpBackend.flush();
+    expect(isolatedScope.users.length).toBe(1);
+    expect(isolatedScope.users[0].email).toEqual('matteo.scandolo@gmail.com');
+    expect(isolatedScope.users[0].firstname).toEqual('Matteo');
+    expect(isolatedScope.users[0].lastname).toEqual('Scandolo');
+  });
+
+});
\ No newline at end of file
diff --git a/views/ngXosViews/UITutorial/src/css/dev.css b/views/ngXosViews/UITutorial/src/css/dev.css
new file mode 100644
index 0000000..a0d1a33
--- /dev/null
+++ b/views/ngXosViews/UITutorial/src/css/dev.css
@@ -0,0 +1,5 @@
+#xosUITutorial{
+  position: absolute;
+  top: 100px;
+  left: 200px;
+}
\ No newline at end of file
diff --git a/views/ngXosViews/UITutorial/src/css/main.css b/views/ngXosViews/UITutorial/src/css/main.css
new file mode 100644
index 0000000..3684934
--- /dev/null
+++ b/views/ngXosViews/UITutorial/src/css/main.css
@@ -0,0 +1,20 @@
+#xosUITutorial {
+  width: 100%; }
+  #xosUITutorial js-shell {
+    display: block; }
+    #xosUITutorial js-shell #shell-panel {
+      width: 100%;
+      height: 400px;
+      background: #002b36;
+      padding: 10px;
+      overflow: scroll; }
+      #xosUITutorial js-shell #shell-panel .prompt {
+        color: #d33682; }
+      #xosUITutorial js-shell #shell-panel .cursor {
+        color: #2aa198; }
+      #xosUITutorial js-shell #shell-panel .error {
+        color: #dc322f; }
+      #xosUITutorial js-shell #shell-panel #shell-view {
+        color: #93a1a1; }
+        #xosUITutorial js-shell #shell-panel #shell-view > div > div {
+          color: #268bd2; }
diff --git a/views/ngXosViews/UITutorial/src/icons/README.md b/views/ngXosViews/UITutorial/src/icons/README.md
new file mode 100644
index 0000000..0d5a787
--- /dev/null
+++ b/views/ngXosViews/UITutorial/src/icons/README.md
@@ -0,0 +1,18 @@
+# Set icon for custom dashboard 
+
+## Path to add images : <dashboard-name>/src/icons
+
+### Add two images with name in following format 
+    <dashboard-name>-icon.png
+    <dashboard-name>-icon-active.png
+
+Examples: 
+    If your dashboard name is `slice`
+    then you will add the images with the name as
+        `slice-icon.png`
+        `slice-icon-active.png`
+        
+        
+        
+        
+Note: If you don't add the custom images, then dashboard will use the default images stored at `/xos/core/xoslib/static/images`
\ No newline at end of file
diff --git a/views/ngXosViews/UITutorial/src/index.html b/views/ngXosViews/UITutorial/src/index.html
new file mode 100644
index 0000000..e790d6e
--- /dev/null
+++ b/views/ngXosViews/UITutorial/src/index.html
@@ -0,0 +1,42 @@
+<!-- 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/dev.css">
+<link rel="stylesheet" href="/css/main.css">
+<link rel="stylesheet" href="/../../../xos/core/static/xosNgLib.css">
+<!-- endinject -->
+
+<div ng-app="xos.UITutorial" id="xosUITutorial" class="container-fluid">
+  <div ui-view></div>
+</div>
+
+<!-- bower:js -->
+<script src="vendor/jquery/dist/jquery.js"></script>
+<script src="vendor/lodash/lodash.js"></script>
+<script src="vendor/josh.js/js/readline.js"></script>
+<script src="vendor/josh.js/js/history.js"></script>
+<script src="vendor/josh.js/js/killring.js"></script>
+<script src="vendor/josh.js/js/input.js"></script>
+<script src="vendor/josh.js/js/pathhandler.js"></script>
+<script src="vendor/josh.js/js/shell.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/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>
+<script src="vendor/angular-recursion/angular-recursion.js"></script>
+<!-- endbower -->
+<!-- endjs -->
+<!-- inject:js -->
+<script src="/vendor/ng-xos-lib/dist/ngXosHelpers.min.js"></script>
+<script src="/.tmp/main.js"></script>
+<!-- endinject -->
\ No newline at end of file
diff --git a/views/ngXosViews/UITutorial/src/js/main.js b/views/ngXosViews/UITutorial/src/js/main.js
new file mode 100644
index 0000000..818d4f5
--- /dev/null
+++ b/views/ngXosViews/UITutorial/src/js/main.js
@@ -0,0 +1,170 @@
+'use strict';
+
+angular.module('xos.UITutorial', [
+  'ngResource',
+  'ngCookies',
+  'ui.router',
+  'xos.helpers'
+])
+.config(($stateProvider) => {
+  $stateProvider
+  .state('shell', {
+    url: '/',
+    template: '<js-shell></js-shell>'
+  });
+})
+.config(function($httpProvider){
+  $httpProvider.interceptors.push('NoHyperlinks');
+})
+.directive('jsShell', function(){
+  return {
+    restrict: 'E',
+    scope: {},
+    bindToController: true,
+    controllerAs: 'vm',
+    templateUrl: 'templates/js-shell.tpl.html',
+    controller: function($injector){
+      var history = new Josh.History({ key: 'helloworld.history'});
+      var shell = Josh.Shell({history: history});
+
+      shell.onNewPrompt(function(callback) {
+        callback('[ngXosLib] $ ');
+      });
+
+      const errorHandler = (msg, done) => {
+        const errorTpl = _.template(`<span class="error">[ERROR] <%= msg %></span>`);
+        done(errorTpl({msg: msg}));
+      }
+
+      const parseResponse = (res, done) => {
+
+        // TODO @Arpit format res (it can be an array or an object),
+        // it is better if the output is a valid JSON (that we can copy and paste)
+        // TODO handle 204/No-Content response
+        if(angular.isArray(res)){
+          res = res.map(i => {
+            return JSON.stringify(i, ['id', 'name', 'max_instances'], 2) + '<br/>';
+          });
+        }
+        else {
+          res = JSON.stringify(res, ['id', 'name', 'max_instances'], 2);
+        }
+
+        done(res);
+      }
+
+      const getAvailableResources = () => {
+        return angular.module('xos.helpers')._invokeQueue
+            .filter((d) => {
+              if(d[1] !== 'service'){
+                return false;
+              }
+              const serviceDeps = d[2][1];
+              return serviceDeps.indexOf('$resource') !== -1;
+            })
+            .reduce((list, i) => list.concat([i[2][0]]), []);
+      }
+
+      const listAvailableResources = (done) => {
+        const resources = getAvailableResources()
+            .reduce((html, i) => `${html}${i}<br/>`, '');
+        done(resources);
+      }
+
+      const consumeResource = (resourceName, method, args, done) => {
+
+        if(getAvailableResources().indexOf(resourceName) === -1){
+          return errorHandler(`Resource "${resourceName}" does not exists`, done);
+        }
+
+        if(['query', 'get', 'save', '$save', 'delete'].indexOf(method) === -1){
+          return errorHandler(`Method "${method}" not allowed`, done);
+        }
+
+        let Resource;
+        try{
+          Resource = $injector.get(resourceName);
+
+          // TODO @Teo if get/delete check for arguments
+          let params = {};
+
+          // if the method require arguments checks for them
+          if(['get', '$save', 'delete'].indexOf(method) !== -1){
+            if(args.length === 0){
+              return errorHandler(`Method "${method}" require parameters`, done);
+            }
+          }
+
+          // if there are arguments parse them
+          if(args.length > 0){
+            params = eval(`(${args[0]})`);
+          }
+
+          // if it is a query is not possible to use id as parameter
+          if(method === 'query' && angular.isDefined(params.id)){
+            return errorHandler(`Is not possible to use "id" as filter in method "${method}", use "get" instead!`, done);
+          }
+
+          Resource[method](params).$promise
+          .then(res => {
+            return parseResponse(res, done);
+          });
+        }
+        catch(e){
+          console.log(e);
+          return errorHandler(`Failed to inject resource "${resourceName}"`, done);
+        }
+      }
+
+      shell.setCommandHandler('resource', {
+        exec: (cmd, args, done) => {
+          switch(args[0]){
+            case 'list':
+              return listAvailableResources(done);
+              break;
+            default:
+              // use the resource
+              const resourceName = args.shift();
+              const method = args.shift();
+              return consumeResource(resourceName, method, args, done);
+          }
+        },
+        completion: function(cmd, arg, line, callback) {
+          const args = ['list'].concat(getAvailableResources());
+          if(line.text.match(/resource\s[A-Z][a-z]+\s/)){
+            // if arg is a resource, then return available methods
+            if(args.indexOf(arg) !== -1){
+              arg = '';
+            }
+            const methods = ['query', 'get', 'save', '$save', 'delete'];
+            return callback(shell.bestMatch(arg, methods));
+          }
+          return callback(shell.bestMatch(arg, args));
+        }
+      })
+
+      shell.setCommandHandler('slices', {
+        exec: (cmd, args, done) => {
+          Slices.query().$promise
+          .then(res => {
+            res = res.map(i => {
+              return JSON.stringify(i, ['id', 'name', 'max_instances'], 2);
+            });
+            
+            res = res.reduce((response, item) => {
+              return `${response},<br>${item}`;
+            });
+
+            done(res);
+          })
+          .catch(err => {
+            console.log(err);
+            done('An error occurred');
+          })
+        }
+      });
+
+      shell.activate();
+    }
+  };
+});
\ No newline at end of file
diff --git a/views/ngXosViews/UITutorial/src/sass/main.scss b/views/ngXosViews/UITutorial/src/sass/main.scss
new file mode 100644
index 0000000..83ea377
--- /dev/null
+++ b/views/ngXosViews/UITutorial/src/sass/main.scss
@@ -0,0 +1,53 @@
+@import '../../../../style/sass/lib/_variables.scss';
+
+// The solarized palette
+
+$background:  #002b36;
+$hl:          #073642;
+$comment:     #586e75;
+$foreground:  #839496;
+$emph:        #93a1a1;
+
+$yellow:  #b58900;
+$orange:  #cb4b16;
+$red:     #dc322f;
+$magenta: #d33682;
+$violet:  #6c71c4;
+$blue:    #268bd2;
+$cyan:    #2aa198;
+$green:   #859900;
+
+#xosUITutorial {
+  width: 100%;
+  js-shell {
+    display: block;
+
+    #shell-panel {
+      width: 100%;
+      height: 400px;
+      background: $background;
+      padding: 10px;
+      overflow: scroll;
+
+      .prompt {
+        color: $magenta;
+      }
+
+      .cursor {
+        color: $cyan;
+      }
+
+      .error {
+        color: $red;
+      }
+
+      #shell-view {
+        color: $emph;
+
+        >div>div{
+          color: $blue;
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/views/ngXosViews/UITutorial/src/templates/js-shell.tpl.html b/views/ngXosViews/UITutorial/src/templates/js-shell.tpl.html
new file mode 100644
index 0000000..543006d
--- /dev/null
+++ b/views/ngXosViews/UITutorial/src/templates/js-shell.tpl.html
@@ -0,0 +1,3 @@
+<div id="shell-panel">
+  <div id="shell-view"></div>
+</div>
\ No newline at end of file