Moved ngViews and ngLib to gui folder
diff --git a/gui/ngXosViews/contentProvider/.bowerrc b/gui/ngXosViews/contentProvider/.bowerrc
new file mode 100644
index 0000000..e491038
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/.bowerrc
@@ -0,0 +1,3 @@
+{
+ "directory": "src/vendor/"
+}
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/.eslintrc b/gui/ngXosViews/contentProvider/.eslintrc
new file mode 100644
index 0000000..c852748
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/.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/gui/ngXosViews/contentProvider/.gitignore b/gui/ngXosViews/contentProvider/.gitignore
new file mode 100644
index 0000000..567aee4
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/.gitignore
@@ -0,0 +1,6 @@
+dist/
+src/vendor
+.tmp
+node_modules
+npm-debug.log
+dist/
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/bower.json b/gui/ngXosViews/contentProvider/bower.json
new file mode 100644
index 0000000..9c85e88
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/bower.json
@@ -0,0 +1,29 @@
+{
+ "name": "xos-contentProvider",
+ "version": "0.0.0",
+ "authors": [
+ "Matteo Scandolo <matteo.scandolo@link-me.it>"
+ ],
+ "description": "The contentProvider view",
+ "license": "MIT",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "static/js/vendor/",
+ "test",
+ "tests"
+ ],
+ "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",
+ "ng-lodash": "~0.3.0",
+ "bootstrap-css": "2.3.2"
+ }
+}
diff --git a/gui/ngXosViews/contentProvider/gulp/build.js b/gui/ngXosViews/contentProvider/gulp/build.js
new file mode 100644
index 0000000..9af8074
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/gulp/build.js
@@ -0,0 +1,118 @@
+'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');
+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 TEMPLATE_FOOTER = `}]);
+angular.module('xos.contentProvider').run(function($location){$location.path('/')});
+angular.bootstrap(angular.element('#xosContentProvider'), ['xos.contentProvider']);`;
+
+module.exports = function(options){
+
+ // delete previous builded file
+ gulp.task('clean', function(){
+ return del(
+ [options.dashboards + 'xosContentProvider.html'],
+ {force: true}
+ );
+ });
+
+ // compile and minify scripts
+ gulp.task('scripts', function() {
+ return gulp.src([
+ options.tmp + '**/*.js'
+ ])
+ .pipe(ngAnnotate())
+ .pipe(angularFilesort())
+ .pipe(concat('xosContentProvider.js'))
+ .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.contentProvider',
+ root: 'templates/',
+ templateFooter: TEMPLATE_FOOTER
+ }))
+ .pipe(gulp.dest(options.tmp));
+ });
+
+ // copy html index to Django Folder
+ gulp.task('copyHtml', ['clean'], function(){
+ return gulp.src(options.src + 'index.html')
+ // remove dev dependencies from html
+ .pipe(replace(/<!-- bower:css -->(\n.*)*\n<!-- endbower --><!-- endcss -->/, ''))
+ .pipe(replace(/<!-- bower:js -->(\n.*)*\n<!-- endbower --><!-- endjs -->/, ''))
+ .pipe(replace(/ng-app=".*"\s/, ''))
+ // injecting minified files
+ .pipe(
+ inject(
+ gulp.src([
+ options.static + 'js/vendor/xosContentProviderVendor.js',
+ options.static + 'js/xosContentProvider.js'
+ ])
+ )
+ )
+ .pipe(rename('xosContentProvider.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('xosContentProviderVendor.js'))
+ .pipe(uglify())
+ .pipe(gulp.dest(options.static + 'js/vendor/'));
+ });
+
+ gulp.task('lint', function () {
+ return gulp.src(['src/js/**/*.js'])
+ .pipe(eslint())
+ .pipe(eslint.format())
+ .pipe(eslint.failAfterError());
+ });
+
+ gulp.task('build', function() {
+ runSequence(
+ 'templates',
+ 'babel',
+ 'scripts',
+ 'wiredep',
+ 'copyHtml',
+ 'cleanTmp'
+ );
+ });
+};
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/gulp/server.js b/gui/ngXosViews/contentProvider/gulp/server.js
new file mode 100644
index 0000000..8eab1bf
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/gulp/server.js
@@ -0,0 +1,133 @@
+'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 proxy = httpProxy.createProxyServer({
+ target: 'http://0.0.0.0:9999'
+});
+
+
+proxy.on('error', function(error, req, res) {
+ res.writeHead(500, {
+ 'Content-Type': 'text/plain'
+ });
+
+ console.error('[Proxy]', error);
+});
+
+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: {
+ match: /<!-- browserSync -->/i
+ }
+ },
+ server: {
+ baseDir: options.src,
+ routes: {
+ '/api': options.api,
+ '/xosHelpers/src': options.helpers
+ },
+ middleware: function(req, res, next){
+ if(
+ req.url.indexOf('/xos/') !== -1 ||
+ req.url.indexOf('/xoslib/') !== -1 ||
+ req.url.indexOf('/hpcapi/') !== -1
+ ){
+ 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();
+ });
+ });
+
+ // 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.api + '*.js',
+ options.helpers + '**/*.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'),
+ {
+ 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(
+ 'bower',
+ 'injectScript',
+ 'injectCss',
+ ['browser']
+ );
+ });
+};
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/gulpfile.js b/gui/ngXosViews/contentProvider/gulpfile.js
new file mode 100644
index 0000000..b2cdab8
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/gulpfile.js
@@ -0,0 +1,24 @@
+'use strict';
+
+var gulp = require('gulp');
+var wrench = require('wrench');
+
+var options = {
+ src: 'src/',
+ scripts: 'src/js/',
+ tmp: 'src/.tmp',
+ dist: 'dist/',
+ api: '../../ngXosLib/api/',
+ helpers: '../../ngXosLib/xosHelpers/src/',
+ 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/gui/ngXosViews/contentProvider/karma.conf.js b/gui/ngXosViews/contentProvider/karma.conf.js
new file mode 100644
index 0000000..83d3f63
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/karma.conf.js
@@ -0,0 +1,88 @@
+// 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([
+ '../../static/js/xosApi.js',
+ '../../static/js/vendor/ngXosHelpers.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'],
+ '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/gui/ngXosViews/contentProvider/package.json b/gui/ngXosViews/contentProvider/package.json
new file mode 100644
index 0000000..80d34f9
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "xos-contentProvider",
+ "version": "1.0.0",
+ "description": "Angular Application for XOS, created with generator-xos",
+ "scripts": {
+ "prestart": "npm install && bower install",
+ "start": "gulp serve",
+ "prebuild": "npm install && bower install",
+ "build": "gulp",
+ "test": "karma start",
+ "lint": "eslint src/js/"
+ },
+ "keywords": [
+ "XOS",
+ "Angular",
+ "XOSlib"
+ ],
+ "author": "Matteo Scandolo",
+ "license": "MIT",
+ "dependencies": {},
+ "devDependencies": {
+ "browser-sync": "^2.9.11",
+ "del": "^2.0.2",
+ "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-inject": "^3.0.0",
+ "gulp-minify-html": "^1.0.4",
+ "gulp-rename": "^1.2.2",
+ "gulp-replace": "^0.5.4",
+ "gulp-uglify": "^1.4.2",
+ "http-proxy": "^1.12.0",
+ "proxy-middleware": "^0.15.0",
+ "run-sequence": "^1.1.4",
+ "wiredep": "^3.0.0-beta",
+ "wrench": "^1.5.8",
+ "gulp-ng-annotate": "^1.1.0",
+ "lodash": "^3.10.1",
+ "eslint": "^1.8.0",
+ "eslint-plugin-angular": "linkmesrl/eslint-plugin-angular",
+ "gulp-eslint": "^1.0.0"
+ }
+}
diff --git a/gui/ngXosViews/contentProvider/spec/contentprovider.test.js b/gui/ngXosViews/contentProvider/spec/contentprovider.test.js
new file mode 100644
index 0000000..b19ce0c
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/spec/contentprovider.test.js
@@ -0,0 +1,247 @@
+'use strict';
+
+describe('The Content Provider SPA', () => {
+
+ var scope, element, isolatedScope, httpBackend, mockLocation, httpProvider;
+
+ var token = 'fakeToken';
+
+ // injecting main module
+ beforeEach(module('xos.contentProvider'));
+
+ beforeEach(module('templates'));
+
+ beforeEach(function(){
+ module(function($provide, $httpProvider){
+
+ httpProvider = $httpProvider;
+
+ // mocking stateParams to pass 1 as id
+ $provide.provider('$stateParams', function(){
+ /* eslint-disable no-invalid-this*/
+ this.$get = function(){
+ return {id: 1};
+ };
+ /* eslint-enable no-invalid-this*/
+ });
+
+ //mock $cookie to return a fake xoscsrftoken
+ $provide.service('$cookies', function(){
+ /* eslint-disable no-invalid-this*/
+ this.get = () => {
+ return token;
+ };
+ /* eslint-enable no-invalid-this*/
+ });
+ });
+ });
+
+ beforeEach(inject(function(_$location_, $httpBackend){
+ spyOn(_$location_, 'url');
+ mockLocation = _$location_;
+ httpBackend = $httpBackend;
+ // Setting up mock request
+ $httpBackend.whenGET('/hpcapi/contentproviders/?no_hyperlinks=1').respond(CPmock.CPlist);
+ $httpBackend.whenGET('/hpcapi/serviceproviders/?no_hyperlinks=1').respond(CPmock.SPlist);
+ $httpBackend.whenDELETE('/hpcapi/contentproviders/1/?no_hyperlinks=1').respond();
+ }));
+
+ it('should set the $http interceptor', () => {
+ expect(httpProvider.interceptors).toContain('SetCSRFToken');
+ });
+
+ it('should add no_hyperlink param', inject(($http, $httpBackend) => {
+ $http.get('www.example.com');
+ $httpBackend.expectGET('www.example.com?no_hyperlinks=1').respond(200);
+ $httpBackend.flush();
+ }));
+
+ it('should set token in the headers', inject(($http, $httpBackend) => {
+ $http.post('http://example.com');
+ $httpBackend.expectPOST('http://example.com?no_hyperlinks=1', undefined, function(headers){
+ // if this condition is false the httpBackend expectation fail
+ return headers['X-CSRFToken'] === token;
+ }).respond(200, {name: 'example'});
+ httpBackend.flush();
+ }));
+
+ describe('the action directive', () => {
+ beforeEach(inject(function($compile, $rootScope){
+ scope = $rootScope.$new();
+
+ element = angular.element('<cp-actions id="\'1\'"></cp-actions>');
+ $compile(element)(scope);
+ scope.$digest();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+ it('should delete an element and redirect to list', () => {
+ isolatedScope.deleteCp(1);
+ httpBackend.flush();
+ expect(mockLocation.url).toHaveBeenCalled();
+ });
+ });
+
+ describe('the contentProvider list', () => {
+ beforeEach(inject(function($compile, $rootScope){
+ scope = $rootScope.$new();
+
+ element = angular.element('<content-provider-list></content-provider-list>');
+ $compile(element)(scope);
+ scope.$digest();
+ httpBackend.flush();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+
+ it('should load 2 contentProvider', () => {
+ expect(isolatedScope.contentProviderList.length).toBe(2);
+ });
+
+ it('should delete a contentProvider', () => {
+ isolatedScope.deleteCp(1);
+ httpBackend.flush();
+ expect(isolatedScope.contentProviderList.length).toBe(1);
+ });
+ });
+
+ describe('the contentProviderDetail directive', () => {
+
+ beforeEach(inject(function($compile, $rootScope){
+ scope = $rootScope.$new();
+ element = angular.element('<content-provider-detail></content-provider-detail>');
+ $compile(element)(scope);
+ httpBackend.expectGET('/hpcapi/contentproviders/1/?no_hyperlinks=1').respond(CPmock.CPlist[0]);
+ scope.$digest();
+ httpBackend.flush();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+ describe('when an id is set in the route', () => {
+
+ beforeEach(() => {
+ // spy the instance update method
+ spyOn(isolatedScope.cp, '$update').and.callThrough();
+ });
+
+ it('should request the correct contentProvider', () => {
+ expect(isolatedScope.cp.name).toEqual(CPmock.CPlist[0].name);
+ });
+
+ it('should update a contentProvider', () => {
+ isolatedScope.cp.name = 'new name';
+ isolatedScope.saveContentProvider(isolatedScope.cp);
+ expect(isolatedScope.cp.$update).toHaveBeenCalled();
+ });
+ });
+ });
+
+ describe('the contentProviderCdn directive', () => {
+ beforeEach(inject(($compile, $rootScope) => {
+ scope = $rootScope.$new();
+ element = angular.element('<content-provider-cdn></content-provider-cdn>');
+ $compile(element)(scope);
+ httpBackend.expectGET('/hpcapi/contentproviders/1/?no_hyperlinks=1').respond(CPmock.CPlist[0]);
+ // httpBackend.expectGET('/hpcapi/cdnprefixs/?no_hyperlinks=1&contentProvider=1').respond([CPmock.CDNlist[0]]);
+ httpBackend.expectGET('/hpcapi/cdnprefixs/?no_hyperlinks=1').respond(CPmock.CDNlist);
+ httpBackend.whenPOST('/hpcapi/cdnprefixs/?no_hyperlinks=1').respond(CPmock.CDNlist[0]);
+ httpBackend.whenDELETE('/hpcapi/cdnprefixs/5/?no_hyperlinks=1').respond();
+ scope.$digest();
+ httpBackend.flush();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+ it('should load associated CDN prefix', () => {
+ expect(isolatedScope.cp_prf.length).toBe(1);
+ expect(isolatedScope.prf.length).toBe(2);
+ });
+
+ it('should add a CDN Prefix', () => {
+ isolatedScope.addPrefix({prefix: 'test.io', defaultOriginServer: '/hpcapi/originservers/2/'});
+ httpBackend.flush();
+ expect(isolatedScope.cp_prf.length).toBe(2);
+ });
+
+ it('should remove a CDN Prefix', () => {
+ isolatedScope.removePrefix(isolatedScope.cp_prf[0]);
+ httpBackend.flush();
+ expect(isolatedScope.cp_prf.length).toBe(0);
+ });
+ });
+
+ describe('the contentProviderServer directive', () => {
+ beforeEach(inject(($compile, $rootScope) => {
+ scope = $rootScope.$new();
+ element = angular.element('<content-provider-server></content-provider-server>');
+ $compile(element)(scope);
+ httpBackend.expectGET('/hpcapi/contentproviders/1/?no_hyperlinks=1').respond(CPmock.CPlist[0]);
+ httpBackend.expectGET('/hpcapi/originservers/?no_hyperlinks=1&contentProvider=1').respond(CPmock.OSlist);
+ httpBackend.whenPOST('/hpcapi/originservers/?no_hyperlinks=1').respond(CPmock.OSlist[0]);
+ httpBackend.whenDELETE('/hpcapi/originservers/8/?no_hyperlinks=1').respond();
+ scope.$digest();
+ httpBackend.flush();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+ it('should load associated OriginServer', () => {
+ expect(isolatedScope.cp_os.length).toBe(4);
+ });
+
+ it('should add a OriginServer', () => {
+ isolatedScope.addOrigin({protocol: 'http', url: 'test.io'});
+ httpBackend.flush();
+ expect(isolatedScope.cp_os.length).toBe(5);
+ });
+
+ it('should remove a OriginServer', () => {
+ isolatedScope.removeOrigin(isolatedScope.cp_os[0]);
+ httpBackend.flush();
+ expect(isolatedScope.cp_os.length).toBe(3);
+ });
+ });
+
+ describe('the contentProviderUsers directive', () => {
+ beforeEach(inject(($compile, $rootScope) => {
+ scope = $rootScope.$new();
+ element = angular.element('<content-provider-users></content-provider-users>');
+ $compile(element)(scope);
+ httpBackend.expectGET('/xos/users/?no_hyperlinks=1').respond(CPmock.UserList);
+ httpBackend.expectGET('/hpcapi/contentproviders/1/?no_hyperlinks=1').respond(CPmock.CPlist[0]);
+ httpBackend.whenPUT('/hpcapi/contentproviders/1/?no_hyperlinks=1').respond(CPmock.CPlist[0]);
+ scope.$digest();
+ httpBackend.flush();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+ it('should render one user', () => {
+ expect(isolatedScope.cp.users.length).toBe(1);
+ expect(typeof isolatedScope.cp.users[0]).toEqual('object');
+ });
+
+ it('should add a user', () => {
+ isolatedScope.addUserToCp({name: 'teo'});
+ expect(isolatedScope.cp.users.length).toBe(2);
+ });
+
+ it('should remove a user', () => {
+ isolatedScope.addUserToCp({name: 'teo'});
+ expect(isolatedScope.cp.users.length).toBe(2);
+ isolatedScope.removeUserFromCp({name: 'teo'});
+ expect(isolatedScope.cp.users.length).toBe(1);
+ });
+
+ it('should save and reformat users', () => {
+ // add a user
+ isolatedScope.cp.users.push(1);
+
+ //trigger save
+ isolatedScope.saveContentProvider(isolatedScope.cp);
+
+ httpBackend.flush();
+
+ // I'll get one as the BE is mocked, the important is to check the conversion
+ expect(isolatedScope.cp.users.length).toBe(1);
+ expect(typeof isolatedScope.cp.users[0]).toEqual('object');
+ });
+ });
+});
diff --git a/gui/ngXosViews/contentProvider/spec/mocks/contentProvider.mock.js b/gui/ngXosViews/contentProvider/spec/mocks/contentProvider.mock.js
new file mode 100644
index 0000000..46a0b0e
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/spec/mocks/contentProvider.mock.js
@@ -0,0 +1,910 @@
+/* eslint-disable key-spacing, no-unused-vars */
+
+var CPmock = {
+ CPlist: [
+ {
+ 'humanReadableName':'on_lab_content',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'name':[
+ 'notBlank'
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'serviceProvider':[
+ 'notBlank'
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'content_provider_id':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':1,
+ 'created':'2015-10-22T19:33:55.078Z',
+ 'updated':'2015-10-22T19:33:55.078Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'content_provider_id':null,
+ 'name':'on_lab_content',
+ 'enabled':true,
+ 'description':null,
+ users: [2],
+ 'serviceProvider':'http://0.0.0.0:9000/hpcapi/serviceproviders/1/'
+ },
+ {
+ 'humanReadableName':'test',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'name':[
+ 'notBlank'
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'serviceProvider':[
+ 'notBlank'
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'content_provider_id':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':2,
+ 'created':'2015-10-23T10:50:37.482Z',
+ 'updated':'2015-10-23T10:52:56.232Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'content_provider_id':null,
+ 'name':'test',
+ 'enabled':true,
+ 'description':'',
+ 'serviceProvider':'http://0.0.0.0:9000/hpcapi/serviceproviders/1/'
+ }
+ ],
+ SPlist: [
+ {
+ 'humanReadableName':'main_service_provider',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'name':[
+ 'notBlank'
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'hpcService':[
+ 'notBlank'
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'service_provider_id':[
+
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':1,
+ 'created':'2015-10-22T19:33:55.048Z',
+ 'updated':'2015-10-22T19:33:55.048Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'hpcService':'http://0.0.0.0:9000/hpcapi/hpcservices/1/',
+ 'service_provider_id':null,
+ 'name':'main_service_provider',
+ 'description':null,
+ 'enabled':true
+ }
+ ],
+ CDNlist: [
+ {
+ 'humanReadableName':'onlab.vicci.org',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'contentProvider':[
+ 'notBlank'
+ ],
+ 'policed':[
+
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'cdn_prefix_id':[
+
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'prefix':[
+ 'notBlank'
+ ],
+ 'defaultOriginServer':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':5,
+ 'created':'2015-10-26T13:09:44.343Z',
+ 'updated':'2015-10-26T13:09:44.343Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'cdn_prefix_id':null,
+ 'prefix':'onlab.vicci.org',
+ 'contentProvider':1,
+ 'description':null,
+ 'defaultOriginServer':'http://0.0.0.0:9000/hpcapi/originservers/2/',
+ 'enabled':true
+ },
+ {
+ 'humanReadableName':'downloads.onosproject.org',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'contentProvider':[
+ 'notBlank'
+ ],
+ 'policed':[
+
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'cdn_prefix_id':[
+
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'prefix':[
+ 'notBlank'
+ ],
+ 'defaultOriginServer':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':1,
+ 'created':'2015-10-26T13:09:44.196Z',
+ 'updated':'2015-10-26T13:09:44.196Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'cdn_prefix_id':null,
+ 'prefix':'downloads.onosproject.org',
+ 'contentProvider':2,
+ 'description':null,
+ 'defaultOriginServer':'http://0.0.0.0:9000/hpcapi/originservers/1/',
+ 'enabled':true
+ }
+ ],
+ OSlist: [
+ {
+ 'humanReadableName':'another.it',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'contentProvider':[
+ 'notBlank'
+ ],
+ 'origin_server_id':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'redirects':[
+
+ ],
+ 'protocol':[
+ 'notBlank'
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'url':[
+ 'notBlank'
+ ],
+ 'authenticated':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':8,
+ 'created':'2015-10-26T13:40:36.878Z',
+ 'updated':'2015-10-26T13:40:36.878Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'origin_server_id':null,
+ 'url':'another.it',
+ 'contentProvider':'http://0.0.0.0:9000/hpcapi/contentproviders/1/',
+ 'authenticated':false,
+ 'enabled':true,
+ 'protocol':'http',
+ 'redirects':true,
+ 'description':null
+ },
+ {
+ 'humanReadableName':'test.it',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'contentProvider':[
+ 'notBlank'
+ ],
+ 'origin_server_id':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'redirects':[
+
+ ],
+ 'protocol':[
+ 'notBlank'
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'url':[
+ 'notBlank'
+ ],
+ 'authenticated':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':7,
+ 'created':'2015-10-26T13:36:42.567Z',
+ 'updated':'2015-10-26T13:36:42.567Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'origin_server_id':null,
+ 'url':'test.it',
+ 'contentProvider':'http://0.0.0.0:9000/hpcapi/contentproviders/1/',
+ 'authenticated':false,
+ 'enabled':true,
+ 'protocol':'http',
+ 'redirects':true,
+ 'description':null
+ },
+ {
+ 'humanReadableName':'onlab.vicci.org',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'contentProvider':[
+ 'notBlank'
+ ],
+ 'origin_server_id':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'redirects':[
+
+ ],
+ 'protocol':[
+ 'notBlank'
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'url':[
+ 'notBlank'
+ ],
+ 'authenticated':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':2,
+ 'created':'2015-10-26T13:09:44.286Z',
+ 'updated':'2015-10-26T13:09:44.286Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'origin_server_id':null,
+ 'url':'onlab.vicci.org',
+ 'contentProvider':'http://0.0.0.0:9000/hpcapi/contentproviders/1/',
+ 'authenticated':false,
+ 'enabled':true,
+ 'protocol':'HTTP',
+ 'redirects':true,
+ 'description':null
+ },
+ {
+ 'humanReadableName':'downloads.onosproject.org',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'contentProvider':[
+ 'notBlank'
+ ],
+ 'origin_server_id':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'redirects':[
+
+ ],
+ 'protocol':[
+ 'notBlank'
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'url':[
+ 'notBlank'
+ ],
+ 'authenticated':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':1,
+ 'created':'2015-10-26T13:09:44.182Z',
+ 'updated':'2015-10-26T13:09:44.182Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'origin_server_id':null,
+ 'url':'downloads.onosproject.org',
+ 'contentProvider':'http://0.0.0.0:9000/hpcapi/contentproviders/1/',
+ 'authenticated':false,
+ 'enabled':true,
+ 'protocol':'HTTP',
+ 'redirects':true,
+ 'description':null
+ }
+ ],
+ UserList: [
+ {
+ 'humanReadableName':'teo@onlab.us',
+ 'validators':{
+ 'policed':[
+ 'notBlank'
+ ],
+ 'site':[
+ 'notBlank'
+ ],
+ 'is_appuser':[
+
+ ],
+ 'is_staff':[
+
+ ],
+ 'timezone':[
+ 'notBlank'
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'is_registering':[
+
+ ],
+ 'last_login':[
+ 'notBlank'
+ ],
+ 'email':[
+ 'notBlank'
+ ],
+ 'username':[
+ 'notBlank'
+ ],
+ 'updated':[
+
+ ],
+ 'login_page':[
+
+ ],
+ 'firstname':[
+ 'notBlank'
+ ],
+ 'user_url':[
+ 'url'
+ ],
+ 'deleted':[
+
+ ],
+ 'lastname':[
+ 'notBlank'
+ ],
+ 'is_active':[
+
+ ],
+ 'phone':[
+
+ ],
+ 'is_admin':[
+
+ ],
+ 'password':[
+ 'notBlank'
+ ],
+ 'enacted':[
+ 'notBlank'
+ ],
+ 'public_key':[
+
+ ],
+ 'is_readonly':[
+
+ ],
+ 'created':[
+
+ ],
+ 'write_protect':[
+
+ ]
+ },
+ 'id':2,
+ 'password':'pbkdf2_sha256$12000$2Uzp1YCyjEBO$uU2irK//ZpEZYOIgLzanuApFoPnwfG1jNol2jD273wQ=',
+ 'last_login':'2015-10-26T14:11:27.625Z',
+ 'email':'teo@onlab.us',
+ 'username':'teo@onlab.us',
+ 'firstname':'Matteo',
+ 'lastname':'Scandolo',
+ 'phone':'',
+ 'user_url':null,
+ 'site':1,
+ 'public_key':'',
+ 'is_active':true,
+ 'is_admin':false,
+ 'is_staff':true,
+ 'is_readonly':false,
+ 'is_registering':false,
+ 'is_appuser':false,
+ 'login_page':null,
+ 'created':'2015-10-26T14:11:27.699Z',
+ 'updated':'2015-10-26T14:11:27.699Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_status':'Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'timezone':'America/New_York'
+ },
+ {
+ 'humanReadableName':'padmin@vicci.org',
+ 'validators':{
+ 'policed':[
+ 'notBlank'
+ ],
+ 'site':[
+ 'notBlank'
+ ],
+ 'is_appuser':[
+
+ ],
+ 'is_staff':[
+
+ ],
+ 'timezone':[
+ 'notBlank'
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'is_registering':[
+
+ ],
+ 'last_login':[
+ 'notBlank'
+ ],
+ 'email':[
+ 'notBlank'
+ ],
+ 'username':[
+ 'notBlank'
+ ],
+ 'updated':[
+
+ ],
+ 'login_page':[
+
+ ],
+ 'firstname':[
+ 'notBlank'
+ ],
+ 'user_url':[
+ 'url'
+ ],
+ 'deleted':[
+
+ ],
+ 'lastname':[
+ 'notBlank'
+ ],
+ 'is_active':[
+
+ ],
+ 'phone':[
+
+ ],
+ 'is_admin':[
+
+ ],
+ 'password':[
+ 'notBlank'
+ ],
+ 'enacted':[
+ 'notBlank'
+ ],
+ 'public_key':[
+
+ ],
+ 'is_readonly':[
+
+ ],
+ 'created':[
+
+ ],
+ 'write_protect':[
+
+ ]
+ },
+ 'id':1,
+ 'password':'pbkdf2_sha256$12000$Qufx9iqtaYma$xs0YurPOcj9qYQna/Qrb3K+im9Yr2XEVr0J4Kqek7AE=',
+ 'last_login':'2015-10-27T10:07:09.065Z',
+ 'email':'padmin@vicci.org',
+ 'username':'padmin@vicci.org',
+ 'firstname':'XOS',
+ 'lastname':'admin',
+ 'phone':null,
+ 'user_url':null,
+ 'site':1,
+ 'public_key':null,
+ 'is_active':true,
+ 'is_admin':true,
+ 'is_staff':true,
+ 'is_readonly':false,
+ 'is_registering':false,
+ 'is_appuser':false,
+ 'login_page':null,
+ 'created':'2015-02-17T22:06:38.059Z',
+ 'updated':'2015-10-27T09:00:44.672Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_status':'Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'timezone':'America/New_York'
+ }
+ ]
+};
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/spec/sample.test.js b/gui/ngXosViews/contentProvider/spec/sample.test.js
new file mode 100644
index 0000000..177bc7d
--- /dev/null
+++ b/gui/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('/xos/users/?no_hyperlinks=1').respond([
+ {
+ email: 'matteo.scandolo@link-me.it',
+ 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('matteo.scandolo@link-me.it');
+ expect(isolatedScope.users[0].firstname).toEqual('Matteo');
+ expect(isolatedScope.users[0].lastname).toEqual('Scandolo');
+ });
+
+});
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/src/css/dev.css b/gui/ngXosViews/contentProvider/src/css/dev.css
new file mode 100644
index 0000000..1457e38
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/css/dev.css
@@ -0,0 +1,5 @@
+#xosContentProvider{
+ position: absolute;
+ top: 100px;
+ left: 200px;
+}
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/src/index.html b/gui/ngXosViews/contentProvider/src/index.html
new file mode 100644
index 0000000..b203c67
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/index.html
@@ -0,0 +1,32 @@
+<!-- browserSync -->
+<!-- bower:css -->
+<link rel="stylesheet" href="vendor/bootstrap-css/css/bootstrap.css" />
+<!-- endbower --><!-- endcss -->
+<!-- inject:css -->
+<link rel="stylesheet" href="/css/dev.css">
+<!-- endinject -->
+
+<div ng-app="xos.contentProvider" id="xosContentProvider">
+ <div ui-view></div>
+</div>
+
+<!-- bower:js -->
+<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-resource/angular-resource.js"></script>
+<script src="vendor/ng-lodash/build/ng-lodash.js"></script>
+<script src="vendor/bootstrap-css/js/bootstrap.js"></script>
+<!-- endbower --><!-- endjs -->
+<!-- inject:js -->
+<script src="/xosHelpers/src/xosHelpers.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="/.tmp/main.js"></script>
+<!-- endinject -->
diff --git a/gui/ngXosViews/contentProvider/src/js/main.js b/gui/ngXosViews/contentProvider/src/js/main.js
new file mode 100644
index 0000000..6f93c0a
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/js/main.js
@@ -0,0 +1,369 @@
+'use strict';
+
+angular.module('xos.contentProvider', [
+ 'ngResource',
+ 'ngCookies',
+ 'ngLodash',
+ 'xos.helpers',
+ 'ui.router',
+ 'xos.xos'
+])
+.config(($stateProvider, $urlRouterProvider) => {
+
+ $stateProvider
+ .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(function($httpProvider){
+ // add X-CSRFToken header for update, create, delete (!GET)
+ $httpProvider.interceptors.push('SetCSRFToken');
+ $httpProvider.interceptors.push('NoHyperlinks');
+})
+.service('ContentProvider', function($resource){
+ return $resource('/hpcapi/contentproviders/:id/', {id: '@id'}, {
+ 'update': {method: 'PUT'}
+ });
+})
+.service('ServiceProvider', function($resource){
+ return $resource('/hpcapi/serviceproviders/:id/', {id: '@id'});
+})
+.service('CdnPrefix', function($resource){
+ return $resource('/hpcapi/cdnprefixs/:id/', {id: '@id'});
+})
+.service('OriginServer', function($resource){
+ return $resource('/hpcapi/originservers/:id/', {id: '@id'});
+})
+.service('User', function($resource){
+ return $resource('/xos/users/:id/', {id: '@id'});
+})
+.directive('cpActions', function(ContentProvider, $location){
+ return {
+ restrict: 'E',
+ scope: {
+ id: '=id',
+ },
+ bindToController: true,
+ controllerAs: 'vm',
+ templateUrl: 'templates/cp_actions.html',
+ controller: function(){
+ this.deleteCp = function(id){
+ ContentProvider.delete({id: id}).$promise
+ .then(function(){
+ $location.url('/');
+ });
+ };
+ }
+ };
+})
+.directive('contentProviderList', function(ContentProvider, lodash){
+ return {
+ restrict: 'E',
+ controllerAs: 'vm',
+ scope: {},
+ templateUrl: 'templates/cp_list.html',
+ controller: function(){
+ var self = this;
+
+ ContentProvider.query().$promise
+ .then(function(cp){
+ self.contentProviderList = cp;
+ })
+ .catch(function(e){
+ throw new Error(e);
+ });
+
+ this.deleteCp = function(id){
+ ContentProvider.delete({id: id}).$promise
+ .then(function(){
+ lodash.remove(self.contentProviderList, {id: id});
+ });
+ };
+ }
+ };
+})
+.directive('contentProviderDetail', function(ContentProvider, ServiceProvider, $stateParams, $location){
+ return {
+ restrict: 'E',
+ controllerAs: 'vm',
+ scope: {},
+ templateUrl: 'templates/cp_detail.html',
+ controller: function(){
+ this.pageName = 'detail';
+ var self = this;
+
+ if($stateParams.id){
+ ContentProvider.get({id: $stateParams.id}).$promise
+ .then(function(cp){
+ self.cp = cp;
+ }).catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+ }
+ else{
+ self.cp = new ContentProvider();
+ }
+
+ ServiceProvider.query().$promise
+ .then(function(sp){
+ self.sp = sp;
+ });
+
+ this.saveContentProvider = function(cp){
+ var p, isNew = false;
+
+ if(cp.id){
+ p = cp.$update();
+ }
+ else{
+ isNew = true;
+ cp.name = cp.humanReadableName;
+ p = cp.$save();
+ }
+
+ p.then(function(res){
+ self.result = {
+ status: 1,
+ msg: 'Content Provider Saved'
+ };
+ if(isNew){
+ $location.url('contentProvider/' + res.id + '/');
+ }
+ })
+ .catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+ };
+ }
+ };
+})
+.directive('contentProviderCdn', function($stateParams, CdnPrefix, ContentProvider, lodash){
+ return{
+ restrict: 'E',
+ controllerAs: 'vm',
+ scope: {},
+ templateUrl: 'templates/cp_cdn_prefix.html',
+ controller: function(){
+ var self = this;
+
+ this.pageName = 'cdn';
+
+ if($stateParams.id){
+ ContentProvider.get({id: $stateParams.id}).$promise
+ .then(function(cp){
+ self.cp = cp;
+ }).catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+ }
+
+ CdnPrefix.query().$promise
+ .then(function(prf){
+ self.prf = prf;
+ // set the active CdnPrefix for this contentProvider
+ self.cp_prf = lodash.where(prf, {contentProvider: parseInt($stateParams.id)});
+ }).catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+
+ this.addPrefix = function(prf){
+ prf.contentProvider = $stateParams.id;
+
+ var item = new CdnPrefix(prf);
+
+ item.$save()
+ .then(function(res){
+ self.cp_prf.push(res);
+ })
+ .catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+ };
+
+ this.removePrefix = function(item){
+ item.$delete()
+ .then(function(){
+ lodash.remove(self.cp_prf, item);
+ })
+ .catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+ };
+ }
+ };
+})
+.directive('contentProviderServer', function($stateParams, OriginServer, ContentProvider, lodash){
+ 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 self = this;
+
+ if($stateParams.id){
+ ContentProvider.get({id: $stateParams.id}).$promise
+ .then(function(cp){
+ self.cp = cp;
+ }).catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+ }
+
+ OriginServer.query({contentProvider: $stateParams.id}).$promise
+ .then(function(cp_os){
+ self.cp_os = cp_os;
+ }).catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+
+ this.addOrigin = function(os){
+ os.contentProvider = $stateParams.id;
+
+ var item = new OriginServer(os);
+
+ item.$save()
+ .then(function(res){
+ self.cp_os.push(res);
+ })
+ .catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+ };
+
+ this.removeOrigin = function(item){
+ item.$delete()
+ .then(function(){
+ lodash.remove(self.cp_os, item);
+ })
+ .catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+ };
+ }
+ };
+})
+.directive('contentProviderUsers', function($stateParams, ContentProvider, User, lodash){
+ return{
+ restrict: 'E',
+ controllerAs: 'vm',
+ scope: {},
+ templateUrl: 'templates/cp_user.html',
+ controller: function(){
+ var self = this;
+
+ this.pageName = 'user';
+
+ this.cp_users = [];
+
+ if($stateParams.id){
+ User.query().$promise
+ .then(function(users){
+ self.users = users;
+ return ContentProvider.get({id: $stateParams.id}).$promise;
+ })
+ .then(function(res){
+ res.users = self.populateUser(res.users, self.users);
+ return res;
+ })
+ .then(function(cp){
+ self.cp = cp;
+ }).catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+ }
+
+ this.populateUser = function(ids, list){
+ for(var i = 0; i < ids.length; i++){
+ ids[i] = lodash.find(list, {id: ids[i]});
+ }
+ return ids;
+ };
+
+ this.addUserToCp = function(user){
+ self.cp.users.push(user);
+ };
+
+ this.removeUserFromCp = function(user){
+ lodash.remove(self.cp.users, user);
+ };
+
+ this.saveContentProvider = function(cp){
+
+ // flatten the user to id of array
+ cp.users = lodash.pluck(cp.users, 'id');
+
+ cp.$update()
+ .then(function(res){
+
+ self.cp.users = self.populateUser(res.users, self.users);
+
+ self.result = {
+ status: 1,
+ msg: 'Content Provider Saved'
+ };
+
+ })
+ .catch(function(e){
+ self.result = {
+ status: 0,
+ msg: e.data.detail
+ };
+ });
+ };
+ }
+ };
+});
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/src/templates/cp_actions.html b/gui/ngXosViews/contentProvider/src/templates/cp_actions.html
new file mode 100644
index 0000000..8c6ae97
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/templates/cp_actions.html
@@ -0,0 +1,9 @@
+<a href="#/" class="btn btn-default">
+ <i class="icon icon-arrow-left"></i>Back
+</a>
+<a href="#/contentProvider/" class="btn btn-success">
+ <i class="icon icon-plus"></i>Create
+</a>
+<a ng-click="vm.deleteCp(vm.id)" class="btn btn-danger">
+ <i class="icon icon-remove"></i>Remove
+</a>
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/src/templates/cp_cdn_prefix.html b/gui/ngXosViews/contentProvider/src/templates/cp_cdn_prefix.html
new file mode 100644
index 0000000..8532e6a
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/templates/cp_cdn_prefix.html
@@ -0,0 +1,55 @@
+<div class="row-fluid">
+ <div class="span6">
+ <h1>{$ vm.cp.humanReadableName $}</h1>
+ </div>
+ <div class="span6 text-right">
+ <cp-actions id="vm.cp.id"></cp-actions>
+ </div>
+</div>
+<hr>
+<div class="row-fluid">
+ <div class="span2">
+ <div ng-include="'templates/cp_side_nav.html'"></div>
+ </div>
+ <div class="span10">
+ <div ng-repeat="item in vm.cp_prf" class="well">
+ <div class="row-fluid">
+ <div class="span4">
+ {{item.humanReadableName}}
+ </div>
+ <div class="span6">
+ <!-- TODO show the name instead that id -->
+ {{item.defaultOriginServer}}
+ </div>
+ <div class="span2">
+ <a ng-click="vm.removePrefix(item)" class="btn btn-danger pull-right">
+ <i class="icon icon-remove"></i>
+ </a>
+ </div>
+ </div>
+ </div>
+ <hr>
+ <form ng-submit="vm.addPrefix(vm.new_prf)">
+ <div class="row-fluid">
+ <div class="span4">
+ <label>Prefix</label>
+ <input type="text" ng-model="vm.new_prf.prefix" required style="max-width: 90%">
+ </div>
+ <div class="span6">
+ <label>Default Origin Server</label>
+ <select ng-model="vm.new_prf.defaultOriginServer" style="max-width: 100%">
+ <option ng-repeat="prf in vm.prf" ng-value="prf.id">{$ prf.humanReadableName $}</option>
+ </select>
+ </div>
+ <div class="span2 text-right">
+ <button class="btn btn-success margin-wells">
+ <i class="icon icon-plus"></i>
+ </button>
+ </div>
+ </div>
+ </form>
+ <div class="alert" ng-show="vm.result" ng-class="{'alert-success': vm.result.status === 1,'alert-error': vm.result.status === 0}">
+ {$ vm.result.msg $}
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/src/templates/cp_detail.html b/gui/ngXosViews/contentProvider/src/templates/cp_detail.html
new file mode 100644
index 0000000..89d8daf
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/templates/cp_detail.html
@@ -0,0 +1,55 @@
+<div class="row-fluid">
+ <div class="span6">
+ <h1>{$ vm.cp.humanReadableName $}</h1>
+ </div>
+ <div class="span6 text-right">
+ <cp-actions id="vm.cp.id"></cp-actions>
+ </div>
+</div>
+<hr>
+<div class="row-fluid">
+ <div ng-show="vm.cp.id" class="span2">
+ <div ng-include="'templates/cp_side_nav.html'"></div>
+ </div>
+ <div ng-class="{span10: vm.cp.id, span12: !vm.cp.id}">
+ <!-- TODO hide form on not found -->
+ <form ng-submit="vm.saveContentProvider(vm.cp)">
+ <fieldset>
+ <div class="row-fluid">
+ <div class="span6">
+ <label>Name:</label>
+ <input type="text" ng-model="vm.cp.humanReadableName" required/>
+ </div>
+ <div class="span6">
+ <label class="checkbox">
+ <input type="checkbox" ng-model="vm.cp.enabled" /> Enabled
+ </label>
+ </div>
+ </div>
+ <div class="row-fluid">
+ <div class="span12">
+ <label>Description</label>
+ <textarea style="width: 100%" ng-model="vm.cp.description"></textarea>
+ </div>
+ </div>
+ <div class="row-fluid">
+ <div class="span12">
+ <label>Service provider</label>
+ <select required ng-model="vm.cp.serviceProvider" ng-options="sp.id as sp.humanReadableName for sp in vm.sp"></select>
+ </div>
+ </div>
+ <div class="row-fluid">
+ <div class="span12">
+ <button class="btn btn-success">
+ <span ng-show="vm.cp.id">Save</span>
+ <span ng-show="!vm.cp.id">Create</span>
+ </button>
+ </div>
+ </div>
+ </fieldset>
+ </form>
+ <div class="alert" ng-show="vm.result" ng-class="{'alert-success': vm.result.status === 1,'alert-error': vm.result.status === 0}">
+ {$ vm.result.msg $}
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/src/templates/cp_list.html b/gui/ngXosViews/contentProvider/src/templates/cp_list.html
new file mode 100644
index 0000000..e54ebe6
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/templates/cp_list.html
@@ -0,0 +1,34 @@
+<table class="table table-striped" ng-show="vm.contentProviderList.length > 0">
+ <thead>
+ <tr>
+ <th>
+ Name
+ </th>
+ <th>Description</th>
+ <th>Status</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tr ng-repeat="item in vm.contentProviderList">
+ <td>
+ <a ui-sref="details({ id: item.id })">{$ item.humanReadableName $}</a>
+ </td>
+ <td>
+ {$ item.description $}
+ </td>
+ <td>
+ {$ 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>
+ </tr>
+</table>
+<div class="alert alert-error" ng-show="vm.contentProviderList.length == 0">
+ No Content Provider defined
+</div>
+
+<div class="row">
+ <div class="span12 text-right">
+ <a class="btn btn-success"href="#/contentProvider/">Create</a>
+ </div>
+</div>
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/src/templates/cp_origin_server.html b/gui/ngXosViews/contentProvider/src/templates/cp_origin_server.html
new file mode 100644
index 0000000..49cd175
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/templates/cp_origin_server.html
@@ -0,0 +1,53 @@
+<div class="row-fluid">
+ <div class="span6">
+ <h1>{$ vm.cp.humanReadableName $}</h1>
+ </div>
+ <div class="span6 text-right">
+ <cp-actions id="vm.cp.id"></cp-actions>
+ </div>
+</div>
+<hr>
+<div class="row-fluid">
+ <div class="span2">
+ <div ng-include="'templates/cp_side_nav.html'"></div>
+ </div>
+ <div class="span10">
+ <div ng-repeat="item in vm.cp_os" class="well">
+ <div class="row-fluid">
+ <div class="span4">
+ {{item.humanReadableName}}
+ </div>
+ <div class="span6">
+ <!-- TODO shoe the name instead that url -->
+ {{item.defaultOriginServer}}
+ </div>
+ <div class="span2">
+ <a ng-click="vm.removeOrigin(item)" class="btn btn-danger pull-right">
+ <i class="icon icon-remove"></i>
+ </a>
+ </div>
+ </div>
+ </div>
+ <hr>
+ <form ng-submit="vm.addOrigin(vm.new_os)">
+ <div class="row-fluid">
+ <div class="span4">
+ <label>Protocol</label>
+ <select ng-model="vm.new_os.protocol" ng-options="k as v for (k,v) in vm.protocols" style="max-width: 100%;"></select>
+ </div>
+ <div class="span6">
+ <label>Url</label>
+ <input type="text" ng-model="vm.new_os.url" required>
+ </div>
+ <div class="span2 text-right">
+ <button class="btn btn-success margin-wells">
+ <i class="icon icon-plus"></i>
+ </button>
+ </div>
+ </div>
+ </form>
+ <div class="alert" ng-show="vm.result" ng-class="{'alert-success': vm.result.status === 1,'alert-error': vm.result.status === 0}">
+ {$ vm.result.msg $}
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/src/templates/cp_side_nav.html b/gui/ngXosViews/contentProvider/src/templates/cp_side_nav.html
new file mode 100644
index 0000000..a2c8633
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/templates/cp_side_nav.html
@@ -0,0 +1,14 @@
+<ul class="nav nav-list">
+ <li>
+ <a class="btn" ng-class="{'btn-primary': vm.pageName == 'detail'}" href="#/contentProvider/{$ vm.cp.id $}">Details</a>
+ </li>
+ <li>
+ <a class="btn" ng-class="{'btn-primary': vm.pageName == 'cdn'}" href="#/contentProvider/{$ vm.cp.id $}/cdn_prefix">Cdn Prexix</a>
+ </li>
+ <li>
+ <a class="btn" ng-class="{'btn-primary': vm.pageName == 'server'}" href="#/contentProvider/{$ vm.cp.id $}/origin_server">Origin Server</a>
+ </li>
+ <li>
+ <a class="btn" ng-class="{'btn-primary': vm.pageName == 'user'}" href="#/contentProvider/{$ vm.cp.id $}/users">Users</a>
+ </li>
+</ul>
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/src/templates/cp_user.html b/gui/ngXosViews/contentProvider/src/templates/cp_user.html
new file mode 100644
index 0000000..2b82e1c
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/templates/cp_user.html
@@ -0,0 +1,51 @@
+<div class="row-fluid">
+ <div class="span6">
+ <h1>{$ vm.cp.humanReadableName $}</h1>
+ </div>
+ <div class="span6 text-right">
+ <cp-actions id="vm.cp.id"></cp-actions>
+ </div>
+</div>
+<hr>
+<div class="row-fluid">
+ <div class="span2">
+ <div ng-include="'templates/cp_side_nav.html'"></div>
+ </div>
+ <div class="span10">
+ <div ng-repeat="item in vm.cp.users" class="well">
+ <div class="row-fluid">
+ <div class="span3">
+ {{item.firstname}}
+ </div>
+ <div class="span3">
+ {{item.lastname}}
+ </div>
+ <div class="span4">
+ {{item.email}}
+ </div>
+ <div class="span2">
+ <a ng-click="vm.removeUserFromCp(item)" class="btn btn-danger pull-right">
+ <i class="icon icon-remove"></i>
+ </a>
+ </div>
+ </div>
+ </div>
+ <hr>
+ <form ng-submit="vm.saveContentProvider(vm.cp)">
+ <div class="row-fluid">
+ <div class="span8">
+ <label>Select user:</label>
+ <select ng-model="vm.user" ng-options="u as u.username for u in vm.users" ng-change="vm.addUserToCp(vm.user)"></select>
+ </div>
+ <div class="span4 text-right">
+ <button class="btn btn-success margin-wells">
+ Save
+ </button>
+ </div>
+ </div>
+ </form>
+ <div class="alert" ng-show="vm.result" ng-class="{'alert-success': vm.result.status === 1,'alert-error': vm.result.status === 0}">
+ {$ vm.result.msg $}
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/gui/ngXosViews/contentProvider/src/templates/users-list.tpl.html b/gui/ngXosViews/contentProvider/src/templates/users-list.tpl.html
new file mode 100644
index 0000000..2983ad0
--- /dev/null
+++ b/gui/ngXosViews/contentProvider/src/templates/users-list.tpl.html
@@ -0,0 +1,14 @@
+<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