Enabled CORS
Fetching info from L-XOS
Change-Id: I6293f15adeb7716cc31499b18d35bdedf8f7cde1
diff --git a/views/ngXosViews/globalXos/.bowerrc b/views/ngXosViews/globalXos/.bowerrc
new file mode 100644
index 0000000..e491038
--- /dev/null
+++ b/views/ngXosViews/globalXos/.bowerrc
@@ -0,0 +1,3 @@
+{
+ "directory": "src/vendor/"
+}
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/.eslintrc b/views/ngXosViews/globalXos/.eslintrc
new file mode 100644
index 0000000..c852748
--- /dev/null
+++ b/views/ngXosViews/globalXos/.eslintrc
@@ -0,0 +1,42 @@
+{
+ "ecmaFeatures": {
+ "blockBindings": true,
+ "forOf": true,
+ "destructuring": true,
+ "arrowFunctions": true,
+ "templateStrings": true
+ },
+ "env": {
+ "browser": true,
+ "node": true,
+ "es6": true
+ },
+ "plugins": [
+ //"angular"
+ ],
+ "rules": {
+ "quotes": [2, "single"],
+ "camelcase": [1, {"properties": "always"}],
+ "no-underscore-dangle": 1,
+ "eqeqeq": [2, "smart"],
+ "no-alert": 1,
+ "key-spacing": [1, { "beforeColon": false, "afterColon": true }],
+ "indent": [2, 2],
+ "no-irregular-whitespace": 1,
+ "eol-last": 0,
+ "max-nested-callbacks": [2, 4],
+ "comma-spacing": [1, {"before": false, "after": true}],
+ "no-trailing-spaces": [1, { skipBlankLines: true }],
+ "no-unused-vars": [1, {"vars": "all", "args": "after-used"}],
+ "new-cap": 0,
+
+ //"angular/ng_module_name": [2, '/^xos\.*[a-z]*$/'],
+ //"angular/ng_controller_name": [2, '/^[a-z].*Ctrl$/'],
+ //"angular/ng_service_name": [2, '/^[A-Z].*Service$/'],
+ //"angular/ng_directive_name": [2, '/^[a-z]+[[A-Z].*]*$/'],
+ //"angular/ng_di": [0, "function or array"]
+ },
+ "globals" :{
+ "angular": true
+ }
+}
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/.gitignore b/views/ngXosViews/globalXos/.gitignore
new file mode 100644
index 0000000..567aee4
--- /dev/null
+++ b/views/ngXosViews/globalXos/.gitignore
@@ -0,0 +1,6 @@
+dist/
+src/vendor
+.tmp
+node_modules
+npm-debug.log
+dist/
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/README.md b/views/ngXosViews/globalXos/README.md
new file mode 100644
index 0000000..b8044ad
--- /dev/null
+++ b/views/ngXosViews/globalXos/README.md
@@ -0,0 +1,21 @@
+# Global XOS View
+
+To onboard this view, use:
+```
+# You can use this recipe to load the dashboard in the system:
+GlobalXos:
+ type: tosca.nodes.DashboardView
+ properties:
+ url: template:xosGlobalXos
+
+# And this recipe to activate the dashboard for a user:
+padmin@vicci.org:
+ type: tosca.nodes.User
+ properties:
+ no-create: true
+ no-delete: true
+ requirements:
+ - globalXos_dashboard:
+ node: GlobalXos
+ relationship: tosca.relationships.UsesDashboard
+```
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/bower.json b/views/ngXosViews/globalXos/bower.json
new file mode 100644
index 0000000..1f7c07a
--- /dev/null
+++ b/views/ngXosViews/globalXos/bower.json
@@ -0,0 +1,35 @@
+{
+ "name": "xos-globalXos",
+ "version": "0.0.0",
+ "authors": [
+ "Matteo Scandolo <matteo.scandolo@gmail.com>"
+ ],
+ "description": "The globalXos view",
+ "license": "Apache-2.0",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "static/js/vendor/",
+ "test",
+ "tests"
+ ],
+ "dependencies": {
+ "angular-bootstrap": "~2.2.0"
+ },
+ "devDependencies": {
+ "jquery": "2.1.4",
+ "angular-mocks": "1.4.7",
+ "angular": "1.4.7",
+ "angular-ui-router": "0.2.15",
+ "angular-cookies": "1.4.7",
+ "angular-animate": "1.4.7",
+ "angular-resource": "1.4.7",
+ "lodash": "~4.11.1",
+ "bootstrap-css": "3.3.6",
+ "angular-chart.js": "~0.10.2",
+ "d3": "~3.5.17",
+ "angular-recursion": "~1.0.5",
+ "ng-xos-lib": "opencord/ng-xos-lib#~1.0.0"
+ }
+}
diff --git a/views/ngXosViews/globalXos/gulp/build.js b/views/ngXosViews/globalXos/gulp/build.js
new file mode 100644
index 0000000..e53042c
--- /dev/null
+++ b/views/ngXosViews/globalXos/gulp/build.js
@@ -0,0 +1,227 @@
+'use strict';
+
+// BUILD
+//
+// The only purpose of this gulpfile is to build a XOS view and copy the correct files into
+// .html => dashboards
+// .js (minified and concat) => static/js
+//
+// The template are parsed and added to js with angular $templateCache
+
+var gulp = require('gulp');
+var ngAnnotate = require('gulp-ng-annotate');
+var uglify = require('gulp-uglify');
+var templateCache = require('gulp-angular-templatecache');
+var runSequence = require('run-sequence');
+var concat = require('gulp-concat-util');
+var del = require('del');
+var wiredep = require('wiredep');
+var angularFilesort = require('gulp-angular-filesort');
+var _ = require('lodash');
+var eslint = require('gulp-eslint');
+var inject = require('gulp-inject');
+var rename = require('gulp-rename');
+var replace = require('gulp-replace');
+var postcss = require('gulp-postcss');
+var autoprefixer = require('autoprefixer');
+var mqpacker = require('css-mqpacker');
+var csswring = require('csswring');
+var yaml = require('js-yaml');
+var colors = require('colors/safe');
+var fs = require('fs');
+
+const TEMPLATE_FOOTER = `
+angular.module('xos.globalXos')
+.run(['$location', function(a){
+ a.path('/');
+}])
+`
+
+module.exports = function(options){
+
+ // delete previous builded file
+ gulp.task('clean', function(){
+ return del(
+ [
+ options.dashboards + 'xosGlobalXos.html',
+ options.static + 'css/xosGlobalXos.css',
+ options.static + 'images/globalXos-icon.png',
+ options.static + 'images/globalXos-icon-active.png'
+ ],
+ {force: true}
+ );
+ });
+
+ // minify css
+ gulp.task('css', function () {
+ var processors = [
+ autoprefixer({browsers: ['last 1 version']}),
+ mqpacker,
+ csswring
+ ];
+
+ gulp.src([
+ `${options.css}**/*.css`,
+ `!${options.css}dev.css`
+ ])
+ .pipe(postcss(processors))
+ .pipe(gulp.dest(options.tmp + '/css/'));
+ });
+
+ // copy css in correct folder
+ gulp.task('copyCss', ['wait'], function(){
+ return gulp.src([`${options.tmp}/css/*.css`])
+ .pipe(concat('xosGlobalXos.css'))
+ .pipe(gulp.dest(options.static + 'css/'))
+ });
+
+ // copy images in correct folder
+ gulp.task('copyImages', ['wait'], function(){
+ return gulp.src([`${options.icon}/globalXos-icon.png`, `${options.icon}/globalXos-icon-active.png`])
+ .pipe(gulp.dest(options.static + 'images/'))
+ });
+
+ // compile and minify scripts
+ gulp.task('scripts', function() {
+ return gulp.src([
+ options.tmp + '**/*.js'
+ ])
+ .pipe(ngAnnotate())
+ .pipe(angularFilesort())
+ .pipe(concat('xosGlobalXos.js'))
+ .pipe(concat.header('//Autogenerated, do not edit!!!\n'))
+ .pipe(concat.footer(TEMPLATE_FOOTER))
+ .pipe(uglify())
+ .pipe(gulp.dest(options.static + 'js/'));
+ });
+
+ // set templates in cache
+ gulp.task('templates', function(){
+ return gulp.src('./src/templates/*.html')
+ .pipe(templateCache({
+ module: 'xos.globalXos',
+ root: 'templates/'
+ }))
+ .pipe(gulp.dest(options.tmp));
+ });
+
+ // copy html index to Django Folder
+ gulp.task('copyHtml', function(){
+ return gulp.src(options.src + 'index.html')
+ // remove dev dependencies from html
+ .pipe(replace(/<!-- bower:css -->(\n^<link.*)*\n<!-- endbower -->/gmi, ''))
+ .pipe(replace(/<!-- bower:js -->(\n^<script.*)*\n<!-- endbower -->/gmi, ''))
+ // injecting minified files
+ .pipe(
+ inject(
+ gulp.src([
+ options.static + 'vendor/xosGlobalXosVendor.js',
+ options.static + 'js/xosGlobalXos.js',
+ options.static + 'css/xosGlobalXos.css'
+ ]),
+ {ignorePath: '/../../../xos/core/xoslib'}
+ )
+ )
+ .pipe(rename('xosGlobalXos.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('xosGlobalXosVendor.js'))
+ .pipe(uglify())
+ .pipe(gulp.dest(options.static + 'vendor/'));
+ });
+
+ gulp.task('lint', function () {
+ return gulp.src(['src/js/**/*.js'])
+ .pipe(eslint())
+ .pipe(eslint.format())
+ .pipe(eslint.failAfterError());
+ });
+
+ gulp.task('wait', function (cb) {
+ // setTimeout could be any async task
+ setTimeout(function () {
+ cb();
+ }, 1000);
+ });
+
+ gulp.task('tosca', function (cb) {
+
+ // TOSCA to register the dashboard in the system
+ const dashboardJson = {};
+ dashboardJson['GlobalXos'] = {
+ type: 'tosca.nodes.DashboardView',
+ properties: {
+ url: 'template:xosGlobalXos'
+ }
+ };
+
+ // check for custom icons
+ if(
+ fs.existsSync(`${options.icon}/globalXos-icon.png`) &&
+ fs.existsSync(`${options.icon}/globalXos-icon-active.png`)
+ ){
+ dashboardJson['GlobalXos'].properties.custom_icon = true;
+ }
+
+ const dashboardTosca = yaml.dump(dashboardJson).replace(/'/gmi, '');
+
+ // TOSCA to add the dashboard to the user
+ const userDashboardJson = {};
+ userDashboardJson['globalXos_dashboard'] = {
+ node: 'GlobalXos',
+ relationship: 'tosca.relationships.UsesDashboard'
+ };
+ const userJson = {
+ 'padmin@vicci.org': {
+ type: 'tosca.nodes.User',
+ properties: {
+ 'no-create': true,
+ 'no-delete': true
+ },
+ requirements: [userDashboardJson]
+ }
+ };
+ const userTosca = yaml.dump(userJson).replace(/'/gmi, '');
+
+
+ // the output is in a timeout so that it get printed after the gulp logs
+ setTimeout(function () {
+ console.log(colors.cyan('\n\n# You can use this recipe to load the dashboard in the system:'));
+ console.log(colors.yellow(dashboardTosca));
+ console.log(colors.cyan('# And this recipe to activate the dashboard for a user:'));
+ console.log(colors.yellow(userTosca));
+ }, 1000);
+ cb();
+ });
+
+ gulp.task('build', function() {
+ runSequence(
+ 'clean',
+ 'sass',
+ 'templates',
+ 'babel',
+ 'scripts',
+ 'wiredep',
+ 'css',
+ 'copyCss',
+ 'copyImages',
+ 'copyHtml',
+ 'cleanTmp',
+ 'tosca'
+ );
+ });
+};
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/gulp/server.js b/views/ngXosViews/globalXos/gulp/server.js
new file mode 100644
index 0000000..36fdded
--- /dev/null
+++ b/views/ngXosViews/globalXos/gulp/server.js
@@ -0,0 +1,169 @@
+'use strict';
+
+var gulp = require('gulp');
+var browserSync = require('browser-sync').create();
+var inject = require('gulp-inject');
+var runSequence = require('run-sequence');
+var angularFilesort = require('gulp-angular-filesort');
+var babel = require('gulp-babel');
+var wiredep = require('wiredep').stream;
+var httpProxy = require('http-proxy');
+var del = require('del');
+var sass = require('gulp-sass');
+var fs = require('fs');
+var path = require('path');
+
+const environment = process.env.NODE_ENV;
+
+if(!fs.existsSync(path.join(__dirname, `../../../env/${environment || 'default'}.js`))){
+ if(!environment){
+ throw new Error('You should define a default.js config in /views/env folder.');
+ }
+ else{
+ throw new Error(`Since you are loading a custom environment, you should define a ${environment}.js config in /views/env folder.`);
+ }
+}
+
+var conf = require(path.join(__dirname, `../../../env/${environment || 'default'}.js`));
+
+var proxy = httpProxy.createProxyServer({
+ target: conf.host
+});
+
+
+proxy.on('error', function(error, req, res) {
+ res.writeHead(500, {
+ 'Content-Type': 'text/plain'
+ });
+
+ console.error('[Proxy]', error);
+});
+
+module.exports = function(options){
+
+ gulp.task('browser', function() {
+ browserSync.init({
+ startPath: '#/',
+ snippetOptions: {
+ rule: {
+ match: /<!-- browserSync -->/i
+ }
+ },
+ server: {
+ baseDir: options.src,
+ routes: {
+ '/xos/core/static': options.static + '../../static/'
+ },
+ middleware: function(req, res, next){
+ if(
+ req.url.indexOf('/api/') !== -1
+ ){
+ if(conf.xoscsrftoken && conf.xossessionid){
+ req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
+ req.headers['x-csrftoken'] = conf.xoscsrftoken;
+ }
+ proxy.web(req, res);
+ }
+ else{
+ next();
+ }
+ }
+ }
+ });
+
+ gulp.watch(options.src + 'js/**/*.js', ['js-watch']);
+ gulp.watch(options.src + 'vendor/**/*.js', ['bower'], function(){
+ browserSync.reload();
+ });
+ gulp.watch(options.src + '**/*.html', function(){
+ browserSync.reload();
+ });
+ gulp.watch(options.css + '**/*.css', function(){
+ browserSync.reload();
+ });
+ gulp.watch(`${options.sass}/**/*.scss`, ['sass'], function(){
+ browserSync.reload();
+ });
+
+ gulp.watch([
+ options.helpers + 'ngXosHelpers.js',
+ options.static + '../../static/xosNgLib.css'
+ ], function(){
+ browserSync.reload();
+ });
+ });
+
+ // compile sass
+ gulp.task('sass', function () {
+ return gulp.src(`${options.sass}/**/*.scss`)
+ .pipe(sass().on('error', sass.logError))
+ .pipe(gulp.dest(options.css));
+ });
+
+ // transpile js with sourceMaps
+ gulp.task('babel', function(){
+ return gulp.src(options.scripts + '**/*.js')
+ .pipe(babel({sourceMaps: true}))
+ .pipe(gulp.dest(options.tmp));
+ });
+
+ // inject scripts
+ gulp.task('injectScript', ['cleanTmp', 'babel'], function(){
+ return gulp.src(options.src + 'index.html')
+ .pipe(
+ inject(
+ gulp.src([
+ options.tmp + '**/*.js',
+ options.helpers + 'ngXosHelpers.min.js'
+ ])
+ .pipe(angularFilesort()),
+ {
+ ignorePath: [options.src, '/../../ngXosLib']
+ }
+ )
+ )
+ .pipe(gulp.dest(options.src));
+ });
+
+ // inject CSS
+ gulp.task('injectCss', function(){
+ return gulp.src(options.src + 'index.html')
+ .pipe(
+ inject(
+ gulp.src([
+ options.src + 'css/*.css',
+ options.static + '../../static/xosNgLib.css'
+ ]),
+ {
+ ignorePath: [options.src]
+ }
+ )
+ )
+ .pipe(gulp.dest(options.src));
+ });
+
+ // inject bower dependencies with wiredep
+ gulp.task('bower', function () {
+ return gulp.src(options.src + 'index.html')
+ .pipe(wiredep({devDependencies: true}))
+ .pipe(gulp.dest(options.src));
+ });
+
+ gulp.task('js-watch', ['injectScript'], function(){
+ browserSync.reload();
+ });
+
+ gulp.task('cleanTmp', function(){
+ return del([options.tmp + '**/*']);
+ });
+
+ gulp.task('serve', function() {
+ runSequence(
+ 'sass',
+ 'bower',
+ 'injectScript',
+ 'injectCss',
+ ['browser']
+ );
+ });
+};
diff --git a/views/ngXosViews/globalXos/gulpfile.js b/views/ngXosViews/globalXos/gulpfile.js
new file mode 100644
index 0000000..c825df8
--- /dev/null
+++ b/views/ngXosViews/globalXos/gulpfile.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var gulp = require('gulp');
+var wrench = require('wrench');
+
+var options = {
+ src: 'src/',
+ css: 'src/css/',
+ icon: 'src/icons',
+ sass: 'src/sass/',
+ scripts: 'src/js/',
+ tmp: 'src/.tmp',
+ dist: 'dist/',
+ api: '../../ngXosLib/api/',
+ helpers: './src/vendor/ng-xos-lib/dist/',
+ static: '../../../xos/core/xoslib/static/', // this is the django static folder
+ dashboards: '../../../xos/core/xoslib/dashboards/' // this is the django html folder
+};
+
+wrench.readdirSyncRecursive('./gulp')
+.map(function(file) {
+ require('./gulp/' + file)(options);
+});
+
+gulp.task('default', function () {
+ gulp.start('build');
+});
diff --git a/views/ngXosViews/globalXos/karma.conf.js b/views/ngXosViews/globalXos/karma.conf.js
new file mode 100644
index 0000000..e5abf39
--- /dev/null
+++ b/views/ngXosViews/globalXos/karma.conf.js
@@ -0,0 +1,90 @@
+// Karma configuration
+// Generated on Tue Oct 06 2015 09:27:10 GMT+0000 (UTC)
+
+/* eslint indent: [2,2], quotes: [2, "single"]*/
+
+/*eslint-disable*/
+var wiredep = require('wiredep');
+var path = require('path');
+
+var bowerComponents = wiredep( {devDependencies: true} )[ 'js' ].map(function( file ){
+ return path.relative(process.cwd(), file);
+});
+
+module.exports = function(config) {
+/*eslint-enable*/
+ config.set({
+
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: '',
+
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['jasmine'],
+
+
+ // list of files / patterns to load in the browser
+ files: bowerComponents.concat([
+ './src/vendor/ng-xos-lib/dist/ngXosVendor.min.js',
+ './src/vendor/ng-xos-lib/dist/ngXosHelpers.min.js',
+ 'src/js/main.js',
+ 'src/js/**/*.js',
+ 'spec/**/*.mock.js',
+ 'spec/**/*.test.js',
+ 'src/**/*.html'
+ ]),
+
+
+ // list of files to exclude
+ exclude: [
+ ],
+
+
+ // preprocess matching files before serving them to the browser
+ // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+ preprocessors: {
+ 'src/js/**/*.js': ['babel'],
+ 'spec/**/*.test.js': ['babel'],
+ 'spec/**/*.mock.js': ['babel'],
+ 'src/**/*.html': ['ng-html2js']
+ },
+
+ ngHtml2JsPreprocessor: {
+ stripPrefix: 'src/', //strip the src path from template url (http://stackoverflow.com/questions/22869668/karma-unexpected-request-when-testing-angular-directive-even-with-ng-html2js)
+ moduleName: 'templates' // define the template module name
+ },
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress'
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+ reporters: ['mocha'],
+
+
+ // web server port
+ port: 9876,
+
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: true,
+
+
+ // start these browsers
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+ browsers: ['PhantomJS'],
+
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: false
+ });
+};
diff --git a/views/ngXosViews/globalXos/mock-cfg.json b/views/ngXosViews/globalXos/mock-cfg.json
new file mode 100644
index 0000000..d48ce51
--- /dev/null
+++ b/views/ngXosViews/globalXos/mock-cfg.json
@@ -0,0 +1,14 @@
+{
+ "endpoints": [
+ {
+ "url": "controllers",
+ "base": "api/core/",
+ "methods": ["GET"]
+ },
+ {
+ "url": "slices",
+ "base": "api/core/",
+ "methods": ["GET"]
+ }
+ ]
+}
diff --git a/views/ngXosViews/globalXos/mocks/controllers.json b/views/ngXosViews/globalXos/mocks/controllers.json
new file mode 100644
index 0000000..16afd85
--- /dev/null
+++ b/views/ngXosViews/globalXos/mocks/controllers.json
@@ -0,0 +1,38 @@
+[
+ {
+ "humanReadableName": "CloudLab OpenStack Juno",
+ "id": 1,
+ "name": "CloudLab",
+ "backend_type": "OpenStack",
+ "version": "Juno",
+ "auth_url": "http://sample/v2",
+ "admin_user": "admin",
+ "admin_password": "adminpassword",
+ "admin_tenant": "admin",
+ "domain": "Default"
+ },
+ {
+ "humanReadableName": "Local XOS 1",
+ "id": 1,
+ "name": "Local XOS 1",
+ "backend_type": "XOS",
+ "version": "1.0",
+ "auth_url": "http://xos.dev:9999/",
+ "admin_user": "padmin@vicci.org",
+ "admin_password": "letmein",
+ "admin_tenant": "admin",
+ "domain": "Default"
+ },
+ {
+ "humanReadableName": "Local XOS 2",
+ "id": 2,
+ "name": "Local XOS 2",
+ "backend_type": "XOS",
+ "version": "1.0",
+ "auth_url": "http://c220g2-011001.wisc.cloudlab.us:9999/",
+ "admin_user": "padmin@vicci.org",
+ "admin_password": "letmein",
+ "admin_tenant": "admin",
+ "domain": "Default"
+ }
+]
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/mocks/slices.json b/views/ngXosViews/globalXos/mocks/slices.json
new file mode 100644
index 0000000..a314e2a
--- /dev/null
+++ b/views/ngXosViews/globalXos/mocks/slices.json
@@ -0,0 +1,35 @@
+[
+ {
+ "humanReadableName": "arizona_test",
+ "id": 1,
+ "created": "2016-10-21T08:29:16.204941Z",
+ "updated": "2016-10-26T12:37:32.146751Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": false,
+ "no_policy": false,
+ "name": "arizona_test",
+ "enabled": true,
+ "omf_friendly": false,
+ "description": "",
+ "slice_url": "",
+ "site": 1,
+ "max_instances": 10,
+ "service": null,
+ "network": null,
+ "exposed_ports": null,
+ "serviceClass": 1,
+ "creator": 1,
+ "default_flavor": null,
+ "default_image": null,
+ "default_node": null,
+ "mount_data_sets": "GenBank",
+ "default_isolation": "vm",
+ "networks": []
+ }
+]
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/package.json b/views/ngXosViews/globalXos/package.json
new file mode 100644
index 0000000..167ea52
--- /dev/null
+++ b/views/ngXosViews/globalXos/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "xos-globalXos",
+ "version": "1.0.0",
+ "description": "Angular Application for XOS, created with generator-xos",
+ "scripts": {
+ "prestart": "npm install && bower install",
+ "start": "gulp serve",
+ "tosca": "gulp tosca",
+ "prebuild": "npm install && bower install",
+ "build": "gulp",
+ "test": "karma start",
+ "test:ci": "karma start --single-run",
+ "mock": "easy-mocker -c mock-cfg.json -d mocks/",
+ "lint": "eslint src/js/"
+ },
+ "keywords": [
+ "XOS",
+ "Angular",
+ "XOSlib"
+ ],
+ "author": "Matteo Scandolo",
+ "license": "Apache-2.0",
+ "dependencies": {},
+ "devDependencies": {
+ "autoprefixer": "^6.3.3",
+ "browser-sync": "^2.9.11",
+ "colors": "^1.1.2",
+ "css-mqpacker": "^4.0.0",
+ "csswring": "^4.2.1",
+ "del": "^2.0.2",
+ "easy-mocker": "^1.3.1",
+ "eslint": "^1.8.0",
+ "eslint-plugin-angular": "linkmesrl/eslint-plugin-angular",
+ "gulp": "^3.9.0",
+ "gulp-angular-filesort": "^1.1.1",
+ "gulp-angular-templatecache": "^1.8.0",
+ "gulp-babel": "^5.3.0",
+ "gulp-concat": "^2.6.0",
+ "gulp-concat-util": "^0.5.5",
+ "gulp-eslint": "^1.0.0",
+ "gulp-inject": "^3.0.0",
+ "gulp-minify-html": "^1.0.4",
+ "gulp-ng-annotate": "^1.1.0",
+ "gulp-postcss": "^6.0.1",
+ "gulp-rename": "^1.2.2",
+ "gulp-replace": "^0.5.4",
+ "gulp-sass": "^2.2.0",
+ "gulp-uglify": "^1.4.2",
+ "http-proxy": "^1.12.0",
+ "ink-docstrap": "^0.5.2",
+ "jasmine-core": "~2.3.4",
+ "js-yaml": "^3.6.1",
+ "karma": "^0.13.14",
+ "karma-babel-preprocessor": "~5.2.2",
+ "karma-coverage": "^0.5.3",
+ "karma-jasmine": "~0.3.6",
+ "karma-mocha-reporter": "~1.1.1",
+ "karma-ng-html2js-preprocessor": "^0.2.0",
+ "karma-phantomjs-launcher": "~0.2.1",
+ "lodash": "^3.10.1",
+ "phantomjs": "^1.9.19",
+ "proxy-middleware": "^0.15.0",
+ "run-sequence": "^1.1.4",
+ "wiredep": "^3.0.0-beta",
+ "wrench": "^1.5.8"
+ }
+}
diff --git a/views/ngXosViews/globalXos/spec/sample.test.js b/views/ngXosViews/globalXos/spec/sample.test.js
new file mode 100644
index 0000000..6f21d7c
--- /dev/null
+++ b/views/ngXosViews/globalXos/spec/sample.test.js
@@ -0,0 +1,37 @@
+'use strict';
+
+describe('The User List', () => {
+
+ var scope, element, isolatedScope, httpBackend;
+
+ beforeEach(module('xos.globalXos'));
+ beforeEach(module('templates'));
+
+ beforeEach(inject(function($httpBackend, $compile, $rootScope){
+
+ httpBackend = $httpBackend;
+ // Setting up mock request
+ $httpBackend.expectGET('/api/core/users/?no_hyperlinks=1').respond([
+ {
+ email: 'matteo.scandolo@gmail.com',
+ firstname: 'Matteo',
+ lastname: 'Scandolo'
+ }
+ ]);
+
+ scope = $rootScope.$new();
+ element = angular.element('<users-list></users-list>');
+ $compile(element)(scope);
+ scope.$digest();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+ it('should load 1 users', () => {
+ httpBackend.flush();
+ expect(isolatedScope.users.length).toBe(1);
+ expect(isolatedScope.users[0].email).toEqual('matteo.scandolo@gmail.com');
+ expect(isolatedScope.users[0].firstname).toEqual('Matteo');
+ expect(isolatedScope.users[0].lastname).toEqual('Scandolo');
+ });
+
+});
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/src/css/dev.css b/views/ngXosViews/globalXos/src/css/dev.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/views/ngXosViews/globalXos/src/css/dev.css
diff --git a/views/ngXosViews/globalXos/src/css/main.css b/views/ngXosViews/globalXos/src/css/main.css
new file mode 100644
index 0000000..be8d4bf
--- /dev/null
+++ b/views/ngXosViews/globalXos/src/css/main.css
@@ -0,0 +1,7 @@
+#xosGlobalXos ui-view,
+#xosGlobalXos xos-list {
+ display: block; }
+
+#xosGlobalXos .well.active {
+ background: #337ab7;
+ color: #fff; }
diff --git a/views/ngXosViews/globalXos/src/icons/README.md b/views/ngXosViews/globalXos/src/icons/README.md
new file mode 100644
index 0000000..0d5a787
--- /dev/null
+++ b/views/ngXosViews/globalXos/src/icons/README.md
@@ -0,0 +1,18 @@
+# Set icon for custom dashboard
+
+## Path to add images : <dashboard-name>/src/icons
+
+### Add two images with name in following format
+ <dashboard-name>-icon.png
+ <dashboard-name>-icon-active.png
+
+Examples:
+ If your dashboard name is `slice`
+ then you will add the images with the name as
+ `slice-icon.png`
+ `slice-icon-active.png`
+
+
+
+
+Note: If you don't add the custom images, then dashboard will use the default images stored at `/xos/core/xoslib/static/images`
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/src/index.html b/views/ngXosViews/globalXos/src/index.html
new file mode 100644
index 0000000..4f2206e
--- /dev/null
+++ b/views/ngXosViews/globalXos/src/index.html
@@ -0,0 +1,38 @@
+<!-- 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.globalXos" id="xosGlobalXos" class="container-fluid">
+ <div ui-view></div>
+</div>
+
+<!-- bower:js -->
+<script src="vendor/angular/angular.js"></script>
+<script src="vendor/angular-bootstrap/ui-bootstrap-tpls.js"></script>
+<script src="vendor/jquery/dist/jquery.js"></script>
+<script src="vendor/angular-mocks/angular-mocks.js"></script>
+<script src="vendor/angular-ui-router/release/angular-ui-router.js"></script>
+<script src="vendor/angular-cookies/angular-cookies.js"></script>
+<script src="vendor/angular-animate/angular-animate.js"></script>
+<script src="vendor/angular-resource/angular-resource.js"></script>
+<script src="vendor/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>
+<script src="vendor/angular-recursion/angular-recursion.js"></script>
+<!-- endbower -->
+<!-- endjs -->
+<!-- inject:js -->
+<script src="/vendor/ng-xos-lib/dist/ngXosHelpers.min.js"></script>
+<script src="/.tmp/main.js"></script>
+<script src="/.tmp/rest.js"></script>
+<!-- endinject -->
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/src/js/main.js b/views/ngXosViews/globalXos/src/js/main.js
new file mode 100644
index 0000000..b512ad4
--- /dev/null
+++ b/views/ngXosViews/globalXos/src/js/main.js
@@ -0,0 +1,360 @@
+'use strict';
+
+angular.module('xos.globalXos', [
+ 'ngResource',
+ 'ngCookies',
+ 'ui.router',
+ 'xos.helpers',
+ 'ui.bootstrap.modal',
+ 'ui.bootstrap.tpls'
+])
+.config(($stateProvider) => {
+ $stateProvider
+ .state('xos-list', {
+ url: '/',
+ template: '<xos-list></xos-list>'
+ });
+})
+.config(function($httpProvider){
+ $httpProvider.interceptors.push('NoHyperlinks');
+})
+.value('LXOS', [])
+.directive('xosList', function(){
+ return {
+ restrict: 'E',
+ scope: {},
+ bindToController: true,
+ controllerAs: 'vm',
+ templateUrl: 'templates/xos-list.tpl.html',
+ controller: function($window, $q, _, Controllers, LXOS, LocalAuth, LocalSlices, LocalUsers, $uibModal, Slices){
+ const self = this;
+ $q.all([
+ Controllers.query({backend_type: 'XOS'}).$promise,
+ Slices.query().$promise // NOTE why this is queryFromAll??
+ ])
+ .then(res => {
+ [this.xoss, this.gSlices] = res;
+ });
+
+ this.openLocally = (itemKind) => {
+ return (item) => {
+ $window.open(`${item.xos.auth_url}admin/core/${itemKind}/${item.id}`, '_blank');
+ }
+ };
+
+ const baseSliceCols = [
+ {
+ label: 'Name',
+ prop: 'name',
+ },
+ {
+ label: 'Mount Data Sets',
+ prop: 'mount_data_sets'
+ }
+ ];
+
+ const lXosSliceCols = [
+ {
+ label: 'Max Instances',
+ prop: 'max_instances'
+ },
+ {
+ label: 'Instances',
+ prop: 'instance_total'
+ },
+ {
+ label: 'L-XOS',
+ type: 'custom',
+ formatter: item => item.xos.name
+ }
+ ];
+
+ this.gSliceTableCgf = {
+ columns: baseSliceCols,
+ filter: 'field',
+ order: true,
+ actions: [
+ {
+ label: 'Get Instances',
+ icon: 'search',
+ cb: (item) => {
+ $uibModal.open({
+ animation: true,
+ size: 'lg',
+ templateUrl: 'listInstances.html',
+ controllerAs: 'vm',
+ resolve: {
+ slice: function () {
+ return {
+ name: item.name,
+ xos: {
+ name: 'G-XOS'
+ }
+ };
+ }
+ },
+ controller: function($uibModalInstance, slice, LocalInstances, LocalSlices) {
+ this.slice = slice;
+
+ this.config = {
+ columns: [
+ {
+ label: 'Name',
+ prop: 'name',
+ }
+ ]
+ };
+
+ LocalSlices.queryFromAll(self.xoss).$promise
+ .then(slices => {
+ // keep only the slice that match the name
+ this.slicesId = slices
+ .filter(s => s.name.indexOf(this.slice.name) > -1)
+ .reduce((o, s) => {
+ o[s.xos.id] = s.id;
+ return o;
+ }, {});
+ return LocalInstances.queryFromAll(self.xoss).$promise;
+ })
+ .then(instances => {
+ this.instances = instances.filter(i => this.slicesId[i.xos.id] === i.slice);
+ })
+ .catch(e => {
+ this.instances = [];
+ });
+
+ this.close = () => {
+ $uibModalInstance.dismiss('cancel');
+ }
+ }
+ })
+ }
+ },
+ ]
+ };
+
+ this.sliceTableCfg = {
+ columns: baseSliceCols.concat(lXosSliceCols),
+ actions: [
+ {
+ label: 'open locally',
+ icon: 'open',
+ cb: this.openLocally('slice')
+ },
+ {
+ label: 'Get Instances',
+ icon: 'search',
+ cb: (item) => {
+ $uibModal.open({
+ animation: true,
+ size: 'lg',
+ templateUrl: 'listInstances.html',
+ controllerAs: 'vm',
+ resolve: {
+ slice: function () {
+ return item;
+ }
+ },
+ controller: function($uibModalInstance, slice, LocalInstances) {
+ this.slice = slice;
+
+ this.config = {
+ columns: [
+ {
+ label: 'Name',
+ prop: 'name',
+ },
+ {
+ label: 'deployment',
+ prop: 'deployment',
+ },
+ ]
+ };
+
+ LocalInstances.getFromLocal(slice.xos)
+ .then(instances => {
+ this.instances = instances.filter(i => i.slice === slice.id);
+ });
+
+ this.close = () => {
+ $uibModalInstance.dismiss('cancel');
+ }
+ }
+ })
+ }
+ },
+ {
+ label: 'Add Instance',
+ icon: 'plus',
+ cb: (item) => {
+ $uibModal.open({
+ animation: true,
+ size: 'lg',
+ templateUrl: 'addInstance.html',
+ controller: function($uibModalInstance, slice, LocalInstances){
+ this.slice = slice;
+
+ this.model = {};
+
+ LocalInstances.getLocalInfo(slice.xos)
+ .then((res) => {
+ [
+ this.config.fields['deployment'].options,
+ this.config.fields['image'].options,
+ this.config.fields['flavor'].options,
+ this.config.fields['node'].options
+ ] = res;
+ });
+
+ this.config = {
+ formName: 'instanceForm',
+ excludedFields: ['xos', 'slice'],
+ actions: [
+ {
+ label: 'Save',
+ icon: 'ok',
+ cb: (instance) => {
+ instance.xos = slice.xos;
+ instance.slice = slice.id;
+ instance.creator = instance.xos.user.id;
+ LocalInstances.createOnLocal(instance)
+ .then(res => {
+ slice.instance_total = slice.instance_total + 1;
+ $uibModalInstance.close();
+ });
+ },
+ class: 'success'
+ },
+ {
+ label: 'Cancel',
+ icon: 'remove',
+ cb: () => {
+ $uibModalInstance.dismiss('cancel');
+ },
+ class: 'warning'
+ }
+ ],
+ fields: {
+ name: {
+ type: 'text',
+ validators: {
+ required: true
+ }
+ },
+ deployment: {
+ type: 'select',
+ validators: {
+ required: true
+ }
+ },
+ node: {
+ type: 'select',
+ validators: {
+ required: true
+ }
+ },
+ image: {
+ type: 'select',
+ validators: {
+ required: true,
+ }
+ },
+ flavor: {
+ type: 'select',
+ validators: {
+ required: true,
+ }
+ },
+ isolation: {
+ type: 'select',
+ options: [
+ {id: 'vm', label: 'VM'},
+ {id: 'container', label: 'Container'},
+ {id: 'container_vm', label: 'Container in VM'}
+ ],
+ validators: {
+ required: true,
+ }
+ },
+ }
+ };
+ },
+ controllerAs: 'vm',
+ resolve: {
+ slice: function () {
+ return item;
+ }
+ }
+ });
+ }
+ }
+ ],
+ filter: 'field',
+ order: true
+ };
+
+ this.usersTableCfg = {
+ columns: [
+ {
+ label: 'Name',
+ type: 'custom',
+ formatter: item => `${item.firstname} ${item.lastname}`
+ },
+ {
+ label: 'E-Mail',
+ prop: 'email'
+ },
+ {
+ label: 'User Name',
+ prop: 'username'
+ },
+ {
+ label: 'Time Zone',
+ prop: 'timezone'
+ },
+ {
+ label: 'L-XOS',
+ type: 'custom',
+ formatter: item => item.xos.name
+ }
+ ],
+ actions: [
+ {
+ label: 'open locally',
+ icon: 'open',
+ cb: this.openLocally('user')
+ }
+ ],
+ filter: 'field',
+ order: true
+ };
+
+ this.toggleXos = (xos) => {
+ if(_.findIndex(LXOS, {id: xos.id}) > -1){
+ xos.active = false;
+ _.remove(LXOS, {id: xos.id});
+ }
+ else{
+ xos.active = true;
+ LXOS.push(xos);
+ }
+
+ // authenticate on L-XOS
+ LocalAuth.login()
+ .then(() => {
+ // fetch slices
+ return $q.all([
+ LocalSlices.queryFromAll().$promise,
+ LocalUsers.queryFromAll().$promise,
+ ]);
+ })
+ .then(res => {
+ [this.localSlices, this.localUsers] = res;
+ })
+ .catch(e => {
+ console.log(e);
+ });
+ }
+ }
+ };
+});
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/src/js/rest.js b/views/ngXosViews/globalXos/src/js/rest.js
new file mode 100644
index 0000000..012daa8
--- /dev/null
+++ b/views/ngXosViews/globalXos/src/js/rest.js
@@ -0,0 +1,268 @@
+/**
+ * © OpenCORD
+ *
+ * Visit http://guide.xosproject.org/devguide/addview/ for more information
+ *
+ * Created by teone on 10/20/16.
+ */
+
+(function () {
+ 'use strict';
+ angular.module('xos.globalXos')
+ .service('Controllers', function($resource){
+ return $resource('/api/core/controllers/:id', {id: '@id'});
+ })
+ .service('GXOS', function($q, $resource, _, LXOS){
+ this.attachXosToItem = (items, target = LXOS) => {
+ return _.map(items, (lxos, i) => {
+ let currentXos = target[i];
+ return _.map(lxos, (item) => {
+ item.xos = currentXos;
+ return item;
+ });
+ })
+ };
+
+ this.buildQueryEndpoint = (baseUrl, target = LXOS) => {
+ return () => {
+ const d = $q.defer();
+
+ // store generated $resource for each L-XOS
+ let r = [];
+
+ let p = [];
+ _.forEach(target, (xos, i) => {
+ let resource = $resource(`${xos.auth_url}${baseUrl}`, {id: '@id'}, {
+ query: {
+ isArray: true,
+ headers: {
+ Authorization: `Basic ${btoa(xos.admin_user + ':' + xos.admin_password)}`
+ }
+ }
+ });
+ r.push(resource);
+ p.push(r[i].query().$promise);
+ });
+
+ $q.all(p)
+ .then(res => {
+ res = this.attachXosToItem(res, target);
+ d.resolve(_.flatten(res));
+ })
+ .catch(d.reject);
+
+ return {$promise: d.promise};
+ };
+ };
+
+ // TODO evaluate
+ this.buildLocalResource = (baseUrl, xos) => {
+ const headers = {
+ Authorization: `Basic ${btoa(xos.admin_user + ':' + xos.admin_password)}`
+ };
+ const resource = $resource(`${xos.auth_url}${baseUrl}`, {id: '@id'}, {
+ query: {
+ isArray: true,
+ headers: headers
+ }
+ });
+ return resource;
+ }
+ })
+ .service('LocalAuth', function ($q, $http, _, LXOS) {
+ const baseUrl = `api/utility/login/`;
+ this.login = () => {
+ const d = $q.defer();
+
+ let p = [];
+ _.forEach(LXOS, (xos, i) => {
+ let loginRequest = $http.post(`${xos.auth_url}${baseUrl}`, {username: xos.admin_user, password: xos.admin_password});
+ p.push(loginRequest);
+ });
+
+ $q.all(p)
+ .then(auths => {
+ _.forEach(auths, (auth, i) => {
+ LXOS[i].xoscsrftoken = auth.data.xoscsrftoken;
+ LXOS[i].xossessionid = auth.data.xossessionid;
+ LXOS[i].user = JSON.parse(auth.data.user);
+ });
+ d.resolve();
+ })
+ .catch(e => {
+ d.reject(e);
+ });
+
+ return d.promise;
+ }
+ })
+ .service('LocalSlices', function(GXOS){
+ const baseUrl = `api/utility/slicesplus/`;
+
+ // TODO build a global resource
+ this.queryFromAll = (targets) => {
+ return GXOS.buildQueryEndpoint(baseUrl, targets)();
+ };
+ })
+ .service('LocalUsers', function(GXOS){
+ const baseUrl = `api/core/users/`;
+
+ // TODO build a global resource
+ this.queryFromAll = GXOS.buildQueryEndpoint(baseUrl);
+ })
+ .service('LocalInstances', function($q, $http, GXOS, LocalDeployments, LocalImages, LocalFlavor, LocalNode){
+ const baseUrl = `api/core/instances/`;
+
+ // NOTE Evaluate to dinamically create a resource targeted to a L-XOS
+
+ this.queryFromAll = (targets) => {
+ return GXOS.buildQueryEndpoint(baseUrl, targets)();
+ };
+ this.createOnLocal = (instance) => {
+ const d = $q.defer();
+ const xos = instance.xos;
+ delete instance.xos;
+ $http.post(`${xos.auth_url}${baseUrl}`, instance, {
+ headers: {
+ Authorization: `Basic ${btoa(xos.admin_user + ':' + xos.admin_password)}`
+ }
+ })
+ .then((inst) => {
+ d.resolve(inst);
+ })
+ .catch(e => {
+ d.reject(e);
+ });
+
+ return d.promise;
+ };
+
+ this.getFromLocal = (xos, params) => {
+ const d = $q.defer();
+ $http.get(`${xos.auth_url}${baseUrl}`, {
+ params: params,
+ headers: {
+ Authorization: `Basic ${btoa(xos.admin_user + ':' + xos.admin_password)}`
+ }
+ })
+ .then((inst) => {
+ d.resolve(inst.data);
+ })
+ .catch(e => {
+ d.reject(e);
+ });
+
+ return d.promise;
+ };
+
+ this.getLocalInfo = (xos) => {
+ const d = $q.defer();
+ $q.all([
+ LocalDeployments.queryFromLocal(xos),
+ LocalImages.queryFromLocal(xos),
+ LocalFlavor.queryFromLocal(xos),
+ LocalNode.queryFromLocal(xos)
+ ])
+ .then((res) => {
+ res = _.map(res, collection => {
+ return _.map(collection, item => {
+ return {id: item.id, label: item.name}
+ });
+ });
+ d.resolve(res);
+ })
+ .catch(d.reject);
+ return d.promise;
+ };
+
+ })
+ .service('LocalDeployments', function($q, $http){
+
+ const baseUrl = `api/core/deployments/`;
+
+ this.queryFromLocal = (xos) => {
+ const d = $q.defer();
+
+ $http.get(`${xos.auth_url}${baseUrl}`, {
+ headers: {
+ Authorization: `Basic ${btoa(xos.admin_user + ':' + xos.admin_password)}`
+ }
+ })
+ .then((res) => {
+ d.resolve(res.data);
+ })
+ .catch(e => {
+ d.reject(e);
+ });
+
+ return d.promise;
+ }
+ })
+ .service('LocalImages', function($q, $http){
+
+ const baseUrl = `api/core/images/`;
+
+ this.queryFromLocal = (xos) => {
+ const d = $q.defer();
+
+ $http.get(`${xos.auth_url}${baseUrl}`, {
+ headers: {
+ Authorization: `Basic ${btoa(xos.admin_user + ':' + xos.admin_password)}`
+ }
+ })
+ .then((res) => {
+ d.resolve(res.data);
+ })
+ .catch(e => {
+ d.reject(e);
+ });
+
+ return d.promise;
+ }
+ })
+ .service('LocalFlavor', function($q, $http){
+
+ const baseUrl = `api/core/flavors/`;
+
+ this.queryFromLocal = (xos) => {
+ const d = $q.defer();
+
+ $http.get(`${xos.auth_url}${baseUrl}`, {
+ headers: {
+ Authorization: `Basic ${btoa(xos.admin_user + ':' + xos.admin_password)}`
+ }
+ })
+ .then((res) => {
+ d.resolve(res.data);
+ })
+ .catch(e => {
+ d.reject(e);
+ });
+
+ return d.promise;
+ }
+ })
+ .service('LocalNode', function($q, $http){
+
+ const baseUrl = `api/core/nodes/`;
+
+ this.queryFromLocal = (xos) => {
+ const d = $q.defer();
+
+ $http.get(`${xos.auth_url}${baseUrl}`, {
+ headers: {
+ Authorization: `Basic ${btoa(xos.admin_user + ':' + xos.admin_password)}`
+ }
+ })
+ .then((res) => {
+ d.resolve(res.data);
+ })
+ .catch(e => {
+ d.reject(e);
+ });
+
+ return d.promise;
+ }
+ });
+})();
+
diff --git a/views/ngXosViews/globalXos/src/sass/main.scss b/views/ngXosViews/globalXos/src/sass/main.scss
new file mode 100644
index 0000000..4ecf82d
--- /dev/null
+++ b/views/ngXosViews/globalXos/src/sass/main.scss
@@ -0,0 +1,13 @@
+@import '../../../../style/sass/lib/_variables.scss';
+
+#xosGlobalXos {
+ ui-view,
+ xos-list{
+ display: block;
+ }
+
+ .well.active{
+ background: $brand-primary;
+ color: #fff;
+ }
+}
\ No newline at end of file
diff --git a/views/ngXosViews/globalXos/src/templates/xos-list.tpl.html b/views/ngXosViews/globalXos/src/templates/xos-list.tpl.html
new file mode 100644
index 0000000..6299ba0
--- /dev/null
+++ b/views/ngXosViews/globalXos/src/templates/xos-list.tpl.html
@@ -0,0 +1,72 @@
+<div class="container">
+ <div class="row">
+ <h2>Select XOS to synch:</h2>
+ </div>
+ <div class="row">
+ <div class="col-xs-12">
+ <h2>G-XOS Slices:</h2>
+ </div>
+ <div class="col-xs-12">
+ <xos-table
+ config="vm.gSliceTableCgf"
+ data="vm.gSlices">
+ </xos-table>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-xs-12">
+ <h2>Get L-XOS details:</h2>
+ </div>
+ <div
+ ng-repeat="xos in vm.xoss"
+ class="col-sm-2">
+ <div
+ class="well"
+ ng-class="{active: xos.active}"
+ ng-click="vm.toggleXos(xos)">
+ {{xos.humanReadableName || xos.name}}
+ </div>
+ </div>
+ </div>
+ <div class="row" ng-if="vm.localSlices.length > 0">
+ <div class="col-xs-12">
+ <h2>L-XOS Slices:</h2>
+ </div>
+ <div class="col-xs-12">
+ <xos-table
+ config="vm.sliceTableCfg"
+ data="vm.localSlices">
+ </xos-table>
+ </div>
+ </div>
+ <div class="row" ng-if="vm.localSlices.length > 0">
+ <div class="col-xs-12">
+ <h2>L-XOS Users:</h2>
+ </div>
+ <div class="col-xs-12">
+ <xos-table
+ config="vm.usersTableCfg"
+ data="vm.localUsers">
+ </xos-table>
+ </div>
+ </div>
+</div>
+<script type="text/ng-template" id="addInstance.html">
+ <div class="modal-header">
+ <h3 class="modal-title" id="modal-title">Add Instance to {{vm.slice.name}} on {{vm.slice.xos.name}}</h3>
+ </div>
+ <div class="modal-body" id="modal-body">
+ <xos-form ng-model="vm.model" config="vm.config"></xos-form>
+ </div>
+</script>
+<script type="text/ng-template" id="listInstances.html">
+ <div class="modal-header">
+ <h3 class="modal-title" id="modal-title">Get Instances from {{vm.slice.name}} on {{vm.slice.xos.name}}</h3>
+ </div>
+ <div class="modal-body" id="modal-body">
+ <xos-table data="vm.instances" config="vm.config"></xos-table>
+ </div>
+ <div class="modal-footer">
+ <a ng-click="vm.close()" class="btn btn-warning">Close</a>
+ </div>
+</script>
\ No newline at end of file