Moved Content Provider Dashboard to new generator
diff --git a/views/ngXosLib/karma.conf.views.js b/views/ngXosLib/karma.conf.views.js
index b1dcc6c..a337b77 100644
--- a/views/ngXosLib/karma.conf.views.js
+++ b/views/ngXosLib/karma.conf.views.js
@@ -14,7 +14,7 @@
 let viewFiles = fs.readdirSync(viewDir);
 
 // hack to avoid testing backbone implementation (they need to be removed)
-viewFiles = viewFiles.filter(f => f.indexOf('xosAdminSite') === -1);
+viewFiles = viewFiles.filter(f => f.indexOf('xosAdminSite') === -1).filter(f => f.indexOf('xosCord') === -1);
 
 viewFiles = viewFiles.filter(f => f.indexOf('js') >= 0).filter(f => f.match(/^xos[A-Z][a-z]+/)).map(f => `${viewDir}${f}`);
 
diff --git a/views/ngXosViews/contentProvider/README.md b/views/ngXosViews/contentProvider/README.md
new file mode 100644
index 0000000..2a34bd7
--- /dev/null
+++ b/views/ngXosViews/contentProvider/README.md
@@ -0,0 +1,9 @@
+# Content Provider Dashboard
+
+To enable the needed backend for this dashboard:
+
+- Enter `xos` with `make enter-xos` (from `xos/configuration/frontend` folder)
+- `cd /opt/xos/tosca`
+- `python ./run.py padmin@vicci.org samples/cdn.yaml`
+
+And it will enable the `xoslib/hpcapi` endpoint
\ No newline at end of file
diff --git a/views/ngXosViews/contentProvider/bower.json b/views/ngXosViews/contentProvider/bower.json
index 720005f..b8a92a7 100644
--- a/views/ngXosViews/contentProvider/bower.json
+++ b/views/ngXosViews/contentProvider/bower.json
@@ -2,7 +2,7 @@
   "name": "xos-contentProvider",
   "version": "0.0.0",
   "authors": [
-    "Matteo Scandolo <matteo.scandolo@link-me.it>"
+    "Matteo Scandolo <teo@onlab.us>"
   ],
   "description": "The contentProvider view",
   "license": "MIT",
@@ -22,8 +22,11 @@
     "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",
-    "ng-lodash": "0.3.0",
-    "bootstrap-css": "~3.3.6"
+    "lodash": "~4.11.1",
+    "bootstrap-css": "3.3.6",
+    "angular-chart.js": "~0.10.2",
+    "d3": "~3.5.17"
   }
 }
diff --git a/views/ngXosViews/contentProvider/env/default.js b/views/ngXosViews/contentProvider/env/default.js
index 6370c0c..5f463b3 100644
--- a/views/ngXosViews/contentProvider/env/default.js
+++ b/views/ngXosViews/contentProvider/env/default.js
@@ -7,7 +7,7 @@
 // (works only for local environment as both application are served on the same domain)
 
 module.exports = {
-  host: 'http://apt020.apt.emulab.net:9999/',
-  xoscsrftoken: 'H6rV67DUIoxw9nBfWlCuUWPckyj10Hx2',
-  xossessionid: 'q7oc8zw5g2awk7n7hme7pmftukkwtf9d'
+  host: 'http://xos.dev:9999/',
+  xoscsrftoken: 'rDX21sz1qNQeClOj1zvDu1yMqUBtzl0i',
+  xossessionid: '7ouvstt0dgpq2um4cak8uunp1ssl8cs6'
 };
diff --git a/views/ngXosViews/contentProvider/gulp/build.js b/views/ngXosViews/contentProvider/gulp/build.js
index c38adfc..6bef382 100644
--- a/views/ngXosViews/contentProvider/gulp/build.js
+++ b/views/ngXosViews/contentProvider/gulp/build.js
@@ -13,7 +13,7 @@
 var uglify = require('gulp-uglify');
 var templateCache = require('gulp-angular-templatecache');
 var runSequence = require('run-sequence');
-var concat = require('gulp-concat');
+var concat = require('gulp-concat-util');
 var del = require('del');
 var wiredep = require('wiredep');
 var angularFilesort = require('gulp-angular-filesort');
@@ -22,21 +22,54 @@
 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 TEMPLATE_FOOTER = `}]);
-angular.module('xos.contentProvider').run(function($location){$location.path('/')});
-angular.bootstrap(angular.element('#xosContentProvider'), ['xos.contentProvider']);`;
+const TEMPLATE_FOOTER = `
+angular.module('xos.contentProvider')
+.run(['$location', function(a){
+  a.path('/');
+}])
+`
 
 module.exports = function(options){
   
   // delete previous builded file
   gulp.task('clean', function(){
     return del(
-      [options.dashboards + 'xosContentProvider.html'],
+      [
+        options.dashboards + 'xosContentProvider.html',
+        options.static + 'css/xosContentProvider.css'
+      ],
       {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('xosContentProvider.css'))
+    .pipe(gulp.dest(options.static + 'css/'))
+  });
+
   // compile and minify scripts
   gulp.task('scripts', function() {
     return gulp.src([
@@ -45,6 +78,8 @@
     .pipe(ngAnnotate())
     .pipe(angularFilesort())
     .pipe(concat('xosContentProvider.js'))
+    .pipe(concat.header('//Autogenerated, do not edit!!!\n'))
+    .pipe(concat.footer(TEMPLATE_FOOTER))
     .pipe(uglify())
     .pipe(gulp.dest(options.static + 'js/'));
   });
@@ -54,25 +89,24 @@
     return gulp.src('./src/templates/*.html')
       .pipe(templateCache({
         module: 'xos.contentProvider',
-        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(
           gulp.src([
             options.static + 'js/vendor/xosContentProviderVendor.js',
-            options.static + 'js/xosContentProvider.js'
+            options.static + 'js/xosContentProvider.js',
+            options.static + 'css/xosContentProvider.css'
           ]),
           {ignorePath: '/../../../xos/core/xoslib'}
         )
@@ -106,12 +140,23 @@
       .pipe(eslint.failAfterError());
   });
 
+  gulp.task('wait', function (cb) {
+    // setTimeout could be any async task
+    setTimeout(function () {
+      cb();
+    }, 1000);
+  });
+
   gulp.task('build', function() {
     runSequence(
+      'clean',
+      'sass',
       'templates',
       'babel',
       'scripts',
       'wiredep',
+      'css',
+      'copyCss',
       'copyHtml',
       'cleanTmp'
     );
diff --git a/views/ngXosViews/contentProvider/gulp/server.js b/views/ngXosViews/contentProvider/gulp/server.js
index f16d6f2..78c1620 100644
--- a/views/ngXosViews/contentProvider/gulp/server.js
+++ b/views/ngXosViews/contentProvider/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;
 
@@ -34,12 +35,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: {
@@ -49,14 +46,16 @@
       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
+            // 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){
               req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
@@ -78,6 +77,26 @@
     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
@@ -94,8 +113,7 @@
         inject(
           gulp.src([
             options.tmp + '**/*.js',
-            options.api + '*.js',
-            options.helpers + '**/*.js'
+            options.helpers + 'ngXosHelpers.js'
           ])
           .pipe(angularFilesort()),
           {
@@ -111,7 +129,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]
           }
@@ -137,10 +158,11 @@
 
   gulp.task('serve', function() {
     runSequence(
+      'sass',
       'bower',
       'injectScript',
       'injectCss',
       ['browser']
     );
   });
-};
\ No newline at end of file
+};
diff --git a/views/ngXosViews/contentProvider/gulpfile.js b/views/ngXosViews/contentProvider/gulpfile.js
index b2cdab8..08df554 100644
--- a/views/ngXosViews/contentProvider/gulpfile.js
+++ b/views/ngXosViews/contentProvider/gulpfile.js
@@ -5,11 +5,13 @@
 
 var options = {
   src: 'src/',
+  css: 'src/css/',
+  sass: 'src/sass/',
   scripts: 'src/js/',
   tmp: 'src/.tmp',
   dist: 'dist/',
   api: '../../ngXosLib/api/',
-  helpers: '../../ngXosLib/xosHelpers/src/',
+  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/contentProvider/karma.conf.js b/views/ngXosViews/contentProvider/karma.conf.js
index b4d5d33..4123be9 100644
--- a/views/ngXosViews/contentProvider/karma.conf.js
+++ b/views/ngXosViews/contentProvider/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/**/*.js',
       'spec/**/*.mock.js',
       'spec/**/*.test.js',
diff --git a/views/ngXosViews/contentProvider/package.json b/views/ngXosViews/contentProvider/package.json
index ee09c4c..b626ef7 100644
--- a/views/ngXosViews/contentProvider/package.json
+++ b/views/ngXosViews/contentProvider/package.json
@@ -8,6 +8,7 @@
     "prebuild": "npm install && bower install",
     "build": "gulp",
     "test": "karma start",
+    "test:ci": "karma start --single-run",
     "lint": "eslint src/js/"
   },
   "keywords": [
@@ -19,8 +20,12 @@
   "license": "MIT",
   "dependencies": {},
   "devDependencies": {
+    "autoprefixer": "^6.3.3",
     "browser-sync": "^2.9.11",
+    "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",
@@ -28,16 +33,20 @@
     "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",
-    "jasmine-core": "^2.4.1",
-    "karma": "^0.13.22",
+    "ink-docstrap": "^0.5.2",
+    "jasmine-core": "~2.3.4",
+    "karma": "^0.13.14",
     "karma-babel-preprocessor": "~5.2.2",
     "karma-coverage": "^0.5.3",
     "karma-jasmine": "~0.3.6",
@@ -45,7 +54,7 @@
     "karma-ng-html2js-preprocessor": "^0.2.0",
     "karma-phantomjs-launcher": "~0.2.1",
     "lodash": "^3.10.1",
-    "phantomjs": "^2.1.3",
+    "phantomjs": "^1.9.19",
     "proxy-middleware": "^0.15.0",
     "run-sequence": "^1.1.4",
     "wiredep": "^3.0.0-beta",
diff --git a/views/ngXosViews/contentProvider/spec/sample.test.js b/views/ngXosViews/contentProvider/spec/sample.test.js
new file mode 100644
index 0000000..6e9c34f
--- /dev/null
+++ b/views/ngXosViews/contentProvider/spec/sample.test.js
@@ -0,0 +1,37 @@
+'use strict';
+
+describe('The User List', () => {
+  
+  var scope, element, isolatedScope, httpBackend;
+
+  beforeEach(module('xos.contentProvider'));
+  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: 'teo@onlab.us',
+        firstname: 'Matteo',
+        lastname: 'Scandolo' 
+      }
+    ]);
+  
+    scope = $rootScope.$new();
+    element = angular.element('<users-list></users-list>');
+    $compile(element)(scope);
+    scope.$digest();
+    isolatedScope = element.isolateScope().vm;
+  }));
+
+  it('should load 1 users', () => {
+    httpBackend.flush();
+    expect(isolatedScope.users.length).toBe(1);
+    expect(isolatedScope.users[0].email).toEqual('teo@onlab.us');
+    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/contentProvider/src/css/main.css b/views/ngXosViews/contentProvider/src/css/main.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/views/ngXosViews/contentProvider/src/css/main.css
diff --git a/views/ngXosViews/contentProvider/src/index.html b/views/ngXosViews/contentProvider/src/index.html
index 0b9ccf2..accd37d 100644
--- a/views/ngXosViews/contentProvider/src/index.html
+++ b/views/ngXosViews/contentProvider/src/index.html
@@ -1,9 +1,12 @@
 <!-- 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.contentProvider" id="xosContentProvider">
@@ -16,19 +19,15 @@
 <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>
 <!-- endinject -->
diff --git a/views/ngXosViews/contentProvider/src/sass/main.scss b/views/ngXosViews/contentProvider/src/sass/main.scss
new file mode 100644
index 0000000..e9d81df
--- /dev/null
+++ b/views/ngXosViews/contentProvider/src/sass/main.scss
@@ -0,0 +1,5 @@
+@import '../../../../style/sass/lib/_variables.scss';
+
+#xosContentProvider {
+  
+}
\ No newline at end of file
diff --git a/views/ngXosViews/contentProvider/src/templates/cp_list.html b/views/ngXosViews/contentProvider/src/templates/cp_list.html
index e6301f5..9c22e8c 100644
--- a/views/ngXosViews/contentProvider/src/templates/cp_list.html
+++ b/views/ngXosViews/contentProvider/src/templates/cp_list.html
@@ -1,4 +1,4 @@
-<xos-table data="vm.contentProviderList" config="vm.config"/>
+<!-- <xos-table data="vm.contentProviderList" config="vm.config"/> -->
 
 <table class="table table-striped" ng-show="vm.contentProviderList.length > 0">
   <thead>
@@ -22,7 +22,7 @@
       {$ item.enabled $}
     </td>
     <td class="text-right">
-      <a ng-click="vm.deleteCp(item.id)" class="btn btn-danger"><i class="icon icon-remove"></i></a></td>
+      <a ng-click="vm.deleteCp(item.id)" class="btn btn-danger"><i class="glyphicon glyphicon-remove"></i></a></td>
   </tr>
 </table>
 <div class="alert alert-error" ng-show="vm.contentProviderList.length == 0">
diff --git a/views/ngXosViews/contentProvider/src/templates/users-list.tpl.html b/views/ngXosViews/contentProvider/src/templates/users-list.tpl.html
deleted file mode 100644
index 2983ad0..0000000
--- a/views/ngXosViews/contentProvider/src/templates/users-list.tpl.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<div class="row">
-  <h1>Users List</h1>
-  <p>This is only an example view.</p>
-</div>
-<div class="row">
-  <div class="span4">Email</div>
-  <div class="span4">First Name</div>
-  <div class="span4">Last Name</div>
-</div>  
-<div class="row" ng-repeat="user in vm.users">
-  <div class="span4">{{user.email}}</div>
-  <div class="span4">{{user.firstname}}</div>
-  <div class="span4">{{user.lastname}}</div>
-</div>  
\ No newline at end of file
diff --git a/xos/core/xoslib/dashboards/xosContentProvider.html b/xos/core/xoslib/dashboards/xosContentProvider.html
index f298f57..cdaeac4 100644
--- a/xos/core/xoslib/dashboards/xosContentProvider.html
+++ b/xos/core/xoslib/dashboards/xosContentProvider.html
@@ -1,14 +1,14 @@
 <!-- browserSync -->
-
+<!-- endcss -->
 <!-- inject:css -->
-<link rel="stylesheet" href="/css/dev.css">
+<link rel="stylesheet" href="/static/css/xosContentProvider.css">
 <!-- endinject -->
 
-<div id="xosContentProvider">
+<div ng-app="xos.contentProvider" id="xosContentProvider">
     <div ui-view></div>
 </div>
 
-
+<!-- endjs -->
 <!-- inject:js -->
 <script src="/static/js/xosContentProvider.js"></script>
 <!-- endinject -->
diff --git a/xos/core/xoslib/static/css/xosContentProvider.css b/xos/core/xoslib/static/css/xosContentProvider.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/xos/core/xoslib/static/css/xosContentProvider.css
diff --git a/xos/core/xoslib/static/js/xosContentProvider.js b/xos/core/xoslib/static/js/xosContentProvider.js
index 8573934..4d968fe 100644
--- a/xos/core/xoslib/static/js/xosContentProvider.js
+++ b/xos/core/xoslib/static/js/xosContentProvider.js
@@ -1 +1 @@
-"use strict";angular.module("xos.contentProvider",["ngResource","ngCookies","xos.helpers","ui.router","xos.xos"]).config(["$stateProvider",function(n){n.state("list",{url:"/",template:"<content-provider-list></content-provider-list>"}).state("details",{url:"/contentProvider/:id",template:"<content-provider-detail></content-provider-detail>"}).state("cdn",{url:"/contentProvider/:id/cdn_prefix",template:"<content-provider-cdn></content-provider-cdn>"}).state("server",{url:"/contentProvider/:id/origin_server",template:"<content-provider-server></content-provider-server>"}).state("users",{url:"/contentProvider/:id/users",template:"<content-provider-users></content-provider-users>"})}]).config(["$httpProvider",function(n){n.interceptors.push("SetCSRFToken"),n.interceptors.push("NoHyperlinks")}]).service("ContentProvider",["$resource",function(n){return n("/hpcapi/contentproviders/:id/",{id:"@id"},{update:{method:"PUT"}})}]).service("ServiceProvider",["$resource",function(n){return n("/hpcapi/serviceproviders/:id/",{id:"@id"})}]).service("CdnPrefix",["$resource",function(n){return n("/hpcapi/cdnprefixs/:id/",{id:"@id"})}]).service("OriginServer",["$resource",function(n){return n("/hpcapi/originservers/:id/",{id:"@id"})}]).service("User",["$resource",function(n){return n("/xos/users/:id/",{id:"@id"})}]).directive("cpActions",["ContentProvider","$location",function(n,e){return{restrict:"E",scope:{id:"=id"},bindToController:!0,controllerAs:"vm",templateUrl:"templates/cp_actions.html",controller:function(){this.deleteCp=function(t){n["delete"]({id:t}).$promise.then(function(){e.url("/")})}}}}]).directive("contentProviderList",["ContentProvider","_",function(n,e){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_list.html",controller:function(){this.tableConfig={columns:[{label:"Name",field:"humanReadableName"},{label:"Description",field:"description"},{label:"Status",field:"enabled"}],enableActions:!0};var t=this;n.query().$promise.then(function(n){t.contentProviderList=n})["catch"](function(n){throw new Error(n)}),this.deleteCp=function(s){n["delete"]({id:s}).$promise.then(function(){e.remove(t.contentProviderList,{id:s})})}}}}]).directive("contentProviderDetail",["ContentProvider","ServiceProvider","$stateParams","$location",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_detail.html",controller:function(){this.pageName="detail";var i=this;t.id?n.get({id:t.id}).$promise.then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}):i.cp=new n,e.query().$promise.then(function(n){i.sp=n}),this.saveContentProvider=function(n){var e,t=!1;n.id?e=n.$update():(t=!0,n.name=n.humanReadableName,e=n.$save()),e.then(function(n){i.result={status:1,msg:"Content Provider Saved"},t&&s.url("contentProvider/"+n.id+"/")})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderCdn",["$stateParams","CdnPrefix","ContentProvider","_",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_cdn_prefix.html",controller:function(){var i=this;this.pageName="cdn",n.id&&t.get({id:n.id}).$promise.then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),e.query().$promise.then(function(e){i.prf=e,i.cp_prf=s.where(e,{contentProvider:parseInt(n.id)})})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),this.addPrefix=function(t){t.contentProvider=n.id;var s=new e(t);s.$save().then(function(n){i.cp_prf.push(n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})},this.removePrefix=function(n){n.$delete().then(function(){s.remove(i.cp_prf,n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderServer",["$stateParams","OriginServer","ContentProvider","_",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_origin_server.html",controller:function(){this.pageName="server",this.protocols={http:"HTTP",rtmp:"RTMP",rtp:"RTP",shout:"SHOUTcast"};var i=this;n.id&&t.get({id:n.id}).$promise.then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),e.query({contentProvider:n.id}).$promise.then(function(n){i.cp_os=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),this.addOrigin=function(t){t.contentProvider=n.id;var s=new e(t);s.$save().then(function(n){i.cp_os.push(n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})},this.removeOrigin=function(n){n.$delete().then(function(){s.remove(i.cp_os,n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderUsers",["$stateParams","ContentProvider","User","_",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_user.html",controller:function(){var i=this;this.pageName="user",this.cp_users=[],n.id&&t.query().$promise.then(function(t){return i.users=t,e.get({id:n.id}).$promise}).then(function(n){return n.users=i.populateUser(n.users,i.users),n}).then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),this.populateUser=function(n,e){for(var t=0;t<n.length;t++)n[t]=s.find(e,{id:n[t]});return n},this.addUserToCp=function(n){i.cp.users.push(n)},this.removeUserFromCp=function(n){s.remove(i.cp.users,n)},this.saveContentProvider=function(n){n.users=s.pluck(n.users,"id"),n.$update().then(function(n){i.cp.users=i.populateUser(n.users,i.users),i.result={status:1,msg:"Content Provider Saved"}})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]),angular.module("xos.contentProvider").run(["$templateCache",function(n){n.put("templates/cp_actions.html",'<a href="#/" class="btn btn-default">\n  <i class="icon icon-arrow-left"></i>Back\n</a>\n<a href="#/contentProvider/" class="btn btn-success">\n  <i class="icon icon-plus"></i>Create\n</a>\n<a ng-click="vm.deleteCp(vm.id)" class="btn btn-danger">\n  <i class="icon icon-remove"></i>Remove\n</a>'),n.put("templates/cp_cdn_prefix.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp_prf" class="well">\n      <div class="row-fluid">\n        <div class="span4">\n          {{item.humanReadableName}}\n        </div>\n        <div class="span6">\n          <!-- TODO show the name instead that id -->\n          {{item.defaultOriginServer}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removePrefix(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.addPrefix(vm.new_prf)">\n      <div class="row-fluid">\n        <div class="span4">\n          <label>Prefix</label>\n          <input type="text" ng-model="vm.new_prf.prefix" required style="max-width: 90%">\n        </div>\n        <div class="span6">\n          <label>Default Origin Server</label>\n          <select ng-model="vm.new_prf.defaultOriginServer" style="max-width: 100%">\n            <option ng-repeat="prf in vm.prf" ng-value="prf.id">{$ prf.humanReadableName $}</option>\n          </select>\n        </div>\n        <div class="span2 text-right">\n          <button class="btn btn-success margin-wells">\n            <i class="icon icon-plus"></i>\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("templates/cp_detail.html",'<div class="row">\n  <div class="col-xs-6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="col-xs-6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row">\n  <div ng-show="vm.cp.id" class="col-xs-2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div ng-class="{\'col-xs-10\': vm.cp.id, \'col-xs-12\': !vm.cp.id}">\n  <!-- TODO hide form on not found -->\n    <form ng-submit="vm.saveContentProvider(vm.cp)">\n      <fieldset>\n        <div class="row">\n          <div class="col-xs-6">\n            <label>Name:</label>\n            <input class="form-control" type="text" ng-model="vm.cp.humanReadableName" required/>\n          </div>\n          <div class="col-xs-6">\n            <label class="checkbox">\n              <input class="form-control" type="checkbox" ng-model="vm.cp.enabled" /> Enabled\n            </label>\n          </div>\n        </div>\n        <div class="row">\n          <div class="col-xs-12">\n            <label>Description</label>\n            <textarea class="form-control" ng-model="vm.cp.description"></textarea>\n          </div>\n        </div>\n        <div class="row">\n          <div class="col-xs-12">\n            <label>Service provider</label>\n            <select class="form-control" required ng-model="vm.cp.serviceProvider" ng-options="sp.id as sp.humanReadableName for sp in vm.sp"></select>\n          </div>\n        </div>\n        <div class="row">\n          <div class="col-xs-12">\n            <button class="btn btn-success">\n              <span ng-show="vm.cp.id">Save</span>\n              <span ng-show="!vm.cp.id">Create</span>\n            </button>\n          </div>\n        </div>\n      </fieldset>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-danger\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("templates/cp_list.html",'<xos-table data="vm.contentProviderList" config="vm.config"/>\n\n<table class="table table-striped" ng-show="vm.contentProviderList.length > 0">\n  <thead>\n    <tr>\n      <th>\n        Name\n      </th>\n      <th>Description</th>\n      <th>Status</th>\n      <th></th>\n    </tr>\n  </thead>\n  <tr ng-repeat="item in vm.contentProviderList">\n    <td>\n      <a ui-sref="details({ id: item.id })">{$ item.humanReadableName $}</a>\n    </td>\n    <td>\n      {$ item.description $}\n    </td>\n    <td>\n      {$ item.enabled $}\n    </td>\n    <td class="text-right">\n      <a ng-click="vm.deleteCp(item.id)" class="btn btn-danger"><i class="icon icon-remove"></i></a></td>\n  </tr>\n</table>\n<div class="alert alert-error" ng-show="vm.contentProviderList.length == 0">\n  No Content Provider defined\n</div>\n\n<div class="row">\n  <div class="span12 text-right">\n    <a class="btn btn-success"href="#/contentProvider/">Create</a>\n  </div>\n</div>'),n.put("templates/cp_origin_server.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp_os" class="well">\n      <div class="row-fluid">\n        <div class="span4">\n          {{item.humanReadableName}}\n        </div>\n        <div class="span6">\n          <!-- TODO shoe the name instead that url -->\n          {{item.defaultOriginServer}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removeOrigin(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.addOrigin(vm.new_os)">\n      <div class="row-fluid">\n        <div class="span4">\n          <label>Protocol</label>\n          <select ng-model="vm.new_os.protocol" ng-options="k as v for (k,v) in vm.protocols" style="max-width: 100%;"></select>\n        </div>\n        <div class="span6">\n          <label>Url</label>\n          <input type="text" ng-model="vm.new_os.url" required>\n        </div>\n        <div class="span2 text-right">\n          <button class="btn btn-success margin-wells">\n            <i class="icon icon-plus"></i>\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("templates/cp_side_nav.html",'<ul class="nav nav-list">\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'detail\'}" href="#/contentProvider/{$ vm.cp.id $}">Details</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'cdn\'}" href="#/contentProvider/{$ vm.cp.id $}/cdn_prefix">Cdn Prexix</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'server\'}" href="#/contentProvider/{$ vm.cp.id $}/origin_server">Origin Server</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'user\'}" href="#/contentProvider/{$ vm.cp.id $}/users">Users</a>\n  </li>\n</ul>'),n.put("templates/cp_user.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp.users" class="well">\n      <div class="row-fluid">\n        <div class="span3">\n          {{item.firstname}}\n        </div>\n        <div class="span3">\n          {{item.lastname}}\n        </div>\n        <div class="span4">\n          {{item.email}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removeUserFromCp(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.saveContentProvider(vm.cp)">\n      <div class="row-fluid">\n        <div class="span8">\n          <label>Select user:</label>\n          <select ng-model="vm.user" ng-options="u as u.username for u in vm.users" ng-change="vm.addUserToCp(vm.user)"></select>\n        </div>  \n        <div class="span4 text-right">\n          <button class="btn btn-success margin-wells">\n            Save\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("templates/users-list.tpl.html",'<div class="row">\n  <h1>Users List</h1>\n  <p>This is only an example view.</p>\n</div>\n<div class="row">\n  <div class="span4">Email</div>\n  <div class="span4">First Name</div>\n  <div class="span4">Last Name</div>\n</div>  \n<div class="row" ng-repeat="user in vm.users">\n  <div class="span4">{{user.email}}</div>\n  <div class="span4">{{user.firstname}}</div>\n  <div class="span4">{{user.lastname}}</div>\n</div>  ')}]),angular.module("xos.contentProvider").run(["$location",function(n){n.path("/")}]),angular.bootstrap(angular.element("#xosContentProvider"),["xos.contentProvider"]);
\ No newline at end of file
+"use strict";angular.module("xos.contentProvider",["ngResource","ngCookies","xos.helpers","ui.router"]).config(["$stateProvider",function(n){n.state("list",{url:"/",template:"<content-provider-list></content-provider-list>"}).state("details",{url:"/contentProvider/:id",template:"<content-provider-detail></content-provider-detail>"}).state("cdn",{url:"/contentProvider/:id/cdn_prefix",template:"<content-provider-cdn></content-provider-cdn>"}).state("server",{url:"/contentProvider/:id/origin_server",template:"<content-provider-server></content-provider-server>"}).state("users",{url:"/contentProvider/:id/users",template:"<content-provider-users></content-provider-users>"})}]).config(["$httpProvider",function(n){n.interceptors.push("SetCSRFToken"),n.interceptors.push("NoHyperlinks")}]).service("ContentProvider",["$resource",function(n){return n("/hpcapi/contentproviders/:id/",{id:"@id"},{update:{method:"PUT"}})}]).service("ServiceProvider",["$resource",function(n){return n("/hpcapi/serviceproviders/:id/",{id:"@id"})}]).service("CdnPrefix",["$resource",function(n){return n("/hpcapi/cdnprefixs/:id/",{id:"@id"})}]).service("OriginServer",["$resource",function(n){return n("/hpcapi/originservers/:id/",{id:"@id"})}]).service("User",["$resource",function(n){return n("/xos/users/:id/",{id:"@id"})}]).directive("cpActions",["ContentProvider","$location",function(n,e){return{restrict:"E",scope:{id:"=id"},bindToController:!0,controllerAs:"vm",templateUrl:"templates/cp_actions.html",controller:function(){this.deleteCp=function(t){n["delete"]({id:t}).$promise.then(function(){e.url("/")})}}}}]).directive("contentProviderList",["ContentProvider","_",function(n,e){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_list.html",controller:function(){this.tableConfig={columns:[{label:"Name",field:"humanReadableName"},{label:"Description",field:"description"},{label:"Status",field:"enabled"}],enableActions:!0};var t=this;n.query().$promise.then(function(n){t.contentProviderList=n})["catch"](function(n){throw new Error(n)}),this.deleteCp=function(s){n["delete"]({id:s}).$promise.then(function(){e.remove(t.contentProviderList,{id:s})})}}}}]).directive("contentProviderDetail",["ContentProvider","ServiceProvider","$stateParams","$location",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_detail.html",controller:function(){this.pageName="detail";var i=this;t.id?n.get({id:t.id}).$promise.then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}):i.cp=new n,e.query().$promise.then(function(n){i.sp=n}),this.saveContentProvider=function(n){var e,t=!1;n.id?e=n.$update():(t=!0,n.name=n.humanReadableName,e=n.$save()),e.then(function(n){i.result={status:1,msg:"Content Provider Saved"},t&&s.url("contentProvider/"+n.id+"/")})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderCdn",["$stateParams","CdnPrefix","ContentProvider","_",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_cdn_prefix.html",controller:function(){var i=this;this.pageName="cdn",n.id&&t.get({id:n.id}).$promise.then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),e.query().$promise.then(function(e){i.prf=e,i.cp_prf=s.where(e,{contentProvider:parseInt(n.id)})})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),this.addPrefix=function(t){t.contentProvider=n.id;var s=new e(t);s.$save().then(function(n){i.cp_prf.push(n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})},this.removePrefix=function(n){n.$delete().then(function(){s.remove(i.cp_prf,n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderServer",["$stateParams","OriginServer","ContentProvider","_",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_origin_server.html",controller:function(){this.pageName="server",this.protocols={http:"HTTP",rtmp:"RTMP",rtp:"RTP",shout:"SHOUTcast"};var i=this;n.id&&t.get({id:n.id}).$promise.then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),e.query({contentProvider:n.id}).$promise.then(function(n){i.cp_os=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),this.addOrigin=function(t){t.contentProvider=n.id;var s=new e(t);s.$save().then(function(n){i.cp_os.push(n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})},this.removeOrigin=function(n){n.$delete().then(function(){s.remove(i.cp_os,n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderUsers",["$stateParams","ContentProvider","User","_",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_user.html",controller:function(){var i=this;this.pageName="user",this.cp_users=[],n.id&&t.query().$promise.then(function(t){return i.users=t,e.get({id:n.id}).$promise}).then(function(n){return n.users=i.populateUser(n.users,i.users),n}).then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),this.populateUser=function(n,e){for(var t=0;t<n.length;t++)n[t]=s.find(e,{id:n[t]});return n},this.addUserToCp=function(n){i.cp.users.push(n)},this.removeUserFromCp=function(n){s.remove(i.cp.users,n)},this.saveContentProvider=function(n){n.users=s.pluck(n.users,"id"),n.$update().then(function(n){i.cp.users=i.populateUser(n.users,i.users),i.result={status:1,msg:"Content Provider Saved"}})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]),angular.module("xos.contentProvider").run(["$templateCache",function(n){n.put("templates/cp_actions.html",'<a href="#/" class="btn btn-default">\n  <i class="icon icon-arrow-left"></i>Back\n</a>\n<a href="#/contentProvider/" class="btn btn-success">\n  <i class="icon icon-plus"></i>Create\n</a>\n<a ng-click="vm.deleteCp(vm.id)" class="btn btn-danger">\n  <i class="icon icon-remove"></i>Remove\n</a>'),n.put("templates/cp_cdn_prefix.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp_prf" class="well">\n      <div class="row-fluid">\n        <div class="span4">\n          {{item.humanReadableName}}\n        </div>\n        <div class="span6">\n          <!-- TODO show the name instead that id -->\n          {{item.defaultOriginServer}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removePrefix(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.addPrefix(vm.new_prf)">\n      <div class="row-fluid">\n        <div class="span4">\n          <label>Prefix</label>\n          <input type="text" ng-model="vm.new_prf.prefix" required style="max-width: 90%">\n        </div>\n        <div class="span6">\n          <label>Default Origin Server</label>\n          <select ng-model="vm.new_prf.defaultOriginServer" style="max-width: 100%">\n            <option ng-repeat="prf in vm.prf" ng-value="prf.id">{$ prf.humanReadableName $}</option>\n          </select>\n        </div>\n        <div class="span2 text-right">\n          <button class="btn btn-success margin-wells">\n            <i class="icon icon-plus"></i>\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("templates/cp_detail.html",'<div class="row">\n  <div class="col-xs-6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="col-xs-6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row">\n  <div ng-show="vm.cp.id" class="col-xs-2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div ng-class="{\'col-xs-10\': vm.cp.id, \'col-xs-12\': !vm.cp.id}">\n  <!-- TODO hide form on not found -->\n    <form ng-submit="vm.saveContentProvider(vm.cp)">\n      <fieldset>\n        <div class="row">\n          <div class="col-xs-6">\n            <label>Name:</label>\n            <input class="form-control" type="text" ng-model="vm.cp.humanReadableName" required/>\n          </div>\n          <div class="col-xs-6">\n            <label class="checkbox">\n              <input class="form-control" type="checkbox" ng-model="vm.cp.enabled" /> Enabled\n            </label>\n          </div>\n        </div>\n        <div class="row">\n          <div class="col-xs-12">\n            <label>Description</label>\n            <textarea class="form-control" ng-model="vm.cp.description"></textarea>\n          </div>\n        </div>\n        <div class="row">\n          <div class="col-xs-12">\n            <label>Service provider</label>\n            <select class="form-control" required ng-model="vm.cp.serviceProvider" ng-options="sp.id as sp.humanReadableName for sp in vm.sp"></select>\n          </div>\n        </div>\n        <div class="row">\n          <div class="col-xs-12">\n            <button class="btn btn-success">\n              <span ng-show="vm.cp.id">Save</span>\n              <span ng-show="!vm.cp.id">Create</span>\n            </button>\n          </div>\n        </div>\n      </fieldset>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-danger\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("templates/cp_list.html",'<!-- <xos-table data="vm.contentProviderList" config="vm.config"/> -->\n\n<table class="table table-striped" ng-show="vm.contentProviderList.length > 0">\n  <thead>\n    <tr>\n      <th>\n        Name\n      </th>\n      <th>Description</th>\n      <th>Status</th>\n      <th></th>\n    </tr>\n  </thead>\n  <tr ng-repeat="item in vm.contentProviderList">\n    <td>\n      <a ui-sref="details({ id: item.id })">{$ item.humanReadableName $}</a>\n    </td>\n    <td>\n      {$ item.description $}\n    </td>\n    <td>\n      {$ item.enabled $}\n    </td>\n    <td class="text-right">\n      <a ng-click="vm.deleteCp(item.id)" class="btn btn-danger"><i class="glyphicon glyphicon-remove"></i></a></td>\n  </tr>\n</table>\n<div class="alert alert-error" ng-show="vm.contentProviderList.length == 0">\n  No Content Provider defined\n</div>\n\n<div class="row">\n  <div class="span12 text-right">\n    <a class="btn btn-success"href="#/contentProvider/">Create</a>\n  </div>\n</div>'),n.put("templates/cp_origin_server.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp_os" class="well">\n      <div class="row-fluid">\n        <div class="span4">\n          {{item.humanReadableName}}\n        </div>\n        <div class="span6">\n          <!-- TODO shoe the name instead that url -->\n          {{item.defaultOriginServer}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removeOrigin(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.addOrigin(vm.new_os)">\n      <div class="row-fluid">\n        <div class="span4">\n          <label>Protocol</label>\n          <select ng-model="vm.new_os.protocol" ng-options="k as v for (k,v) in vm.protocols" style="max-width: 100%;"></select>\n        </div>\n        <div class="span6">\n          <label>Url</label>\n          <input type="text" ng-model="vm.new_os.url" required>\n        </div>\n        <div class="span2 text-right">\n          <button class="btn btn-success margin-wells">\n            <i class="icon icon-plus"></i>\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("templates/cp_side_nav.html",'<ul class="nav nav-list">\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'detail\'}" href="#/contentProvider/{$ vm.cp.id $}">Details</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'cdn\'}" href="#/contentProvider/{$ vm.cp.id $}/cdn_prefix">Cdn Prexix</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'server\'}" href="#/contentProvider/{$ vm.cp.id $}/origin_server">Origin Server</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'user\'}" href="#/contentProvider/{$ vm.cp.id $}/users">Users</a>\n  </li>\n</ul>'),n.put("templates/cp_user.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp.users" class="well">\n      <div class="row-fluid">\n        <div class="span3">\n          {{item.firstname}}\n        </div>\n        <div class="span3">\n          {{item.lastname}}\n        </div>\n        <div class="span4">\n          {{item.email}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removeUserFromCp(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.saveContentProvider(vm.cp)">\n      <div class="row-fluid">\n        <div class="span8">\n          <label>Select user:</label>\n          <select ng-model="vm.user" ng-options="u as u.username for u in vm.users" ng-change="vm.addUserToCp(vm.user)"></select>\n        </div>  \n        <div class="span4 text-right">\n          <button class="btn btn-success margin-wells">\n            Save\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>')}]),angular.module("xos.contentProvider").run(["$location",function(n){n.path("/")}]);
\ No newline at end of file