Changes to xos dumbComponent
diff --git a/views/ngXosViews/tenant/src/css/main.css b/views/ngXosViews/tenant/src/css/main.css
new file mode 100644
index 0000000..a22d515
--- /dev/null
+++ b/views/ngXosViews/tenant/src/css/main.css
@@ -0,0 +1,2 @@
+#xosTenant a {
+ margin-bottom: 15px; }
diff --git a/views/ngXosViews/tenant/src/index.html b/views/ngXosViews/tenant/src/index.html
new file mode 100644
index 0000000..16822bf
--- /dev/null
+++ b/views/ngXosViews/tenant/src/index.html
@@ -0,0 +1,40 @@
+<!-- browserSync -->
+<!-- bower:css -->
+<link rel="stylesheet" href="vendor/bootstrap-css/css/bootstrap.min.css" />
+<link rel="stylesheet" href="vendor/angular-chart.js/dist/angular-chart.css" />
+<!-- endbower -->
+<!-- endcss -->
+<!-- inject:css -->
+<link rel="stylesheet" href="/css/main.css">
+<link rel="stylesheet" href="/../../../xos/core/static/xosNgLib.css">
+<!-- endinject -->
+<p>
+ hello
+</p>
+
+<div ng-app="xos.tenant" id="xosTenant" class="container-fluid">
+ <div ui-sref="createslice"></div>
+ <div ui-view></div>
+ <div></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-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="/../../../xos/core/xoslib/static/js/vendor/ngXosHelpers.js"></script>
+<script src="/.tmp/main.js"></script>
+<!-- endinject -->
\ No newline at end of file
diff --git a/views/ngXosViews/tenant/src/js/main.js b/views/ngXosViews/tenant/src/js/main.js
new file mode 100644
index 0000000..105e54e
--- /dev/null
+++ b/views/ngXosViews/tenant/src/js/main.js
@@ -0,0 +1,547 @@
+'use strict';
+
+angular.module('xos.tenant', [
+ 'ngResource',
+ 'ngCookies',
+ 'ui.router',
+ 'xos.helpers'
+])
+.config(($stateProvider) => {
+ $stateProvider
+ .state('user-list', {
+ url: '/',
+ template: '<users-list></users-list>'
+ })
+ .state('site', {
+ url:'/site/:id',
+ template:'<site-detail></site-detail>'
+
+ })
+ .state('createslice', {
+ url:'/site/:site/slice/',
+ template:'<create-slice></create-slice>'
+
+ })
+ .state('editslice', {
+ url:'/site/:site/slice/:id?',
+ template:'<edit-slice></edit-slice>'
+
+ });;
+
+})
+.config(function($httpProvider){
+ $httpProvider.interceptors.push('NoHyperlinks');
+})
+.directive('usersList', function(){
+ return {
+ //sites : {},
+ restrict: 'E',
+ scope: {},
+ bindToController: true,
+ controllerAs: 'vm',
+ templateUrl: 'templates/users-list.tpl.html',
+ controller: function(Sites,SlicesPlus){
+
+
+
+ this.tableConfig = {
+ columns: [
+ {
+ label: 'Site1',
+ prop: 'name',
+ link: item => `/#/site/${item.id}`
+ },
+ {
+ label: 'Allocated',
+ prop: 'instance_total'
+ },
+ {
+ label: 'Ready',
+ prop: 'instance_total_ready'
+ }
+ ]
+ };
+
+ var sites;
+ // retrieving user list
+ Sites.query().$promise
+ .then((users) => {
+ this.sites = users;
+ return SlicesPlus.query().$promise
+ })
+ .then((users) => {
+ this.slices = users;
+ //console.log(this.sites,this.slices);
+ this.site_list = this.returnData(this.sites,this.slices);
+ })
+ .catch((e) => {
+ throw new Error(e);
+ });
+ //console.log(sites);
+
+
+ this.returnData = (sites,slices) => {
+ //console.log(sites,slices);
+ //console.log(sites.length)
+ var i,j=0;
+ var site_list=[];
+ var slice_list = [];
+
+ for(i = 0; i<sites.length; i++){
+ var instance_t = 0;
+ var instance_t_r = 0;
+ for(j=0;j<slices.length;j++){
+ if (sites[i].id != null && slices[j].site !=null && sites[i].id == slices[j].site){
+ console.log(sites[i].id,slices[j].id);
+ instance_t = instance_t + slices[j].instance_total;
+ instance_t_r = instance_t_r + slices[j].instance_total_ready;
+ }
+ }
+ var data_sites = {
+ 'id': sites[i].id,
+ 'name': sites[i].name,
+ 'instance_total' :instance_t,
+ 'instance_total_ready' : instance_t_r
+ };
+ //console.log(sites[i].id);
+ site_list.push(data_sites);
+ }
+ return site_list
+ //this.site_list = site_list;
+ }
+ }
+ };
+})
+.directive('siteDetail', function(){
+ return {
+ restrict: 'E',
+ scope: {},
+ bindToController: true,
+ controllerAs: 'sl',
+ templateUrl: 'templates/slicelist.html',
+ controller: function(SlicesPlus,$stateParams){
+ console.log($stateParams);
+ this.siteId = $stateParams.id;
+ this.tableConfig = {
+ columns: [
+ {
+ label: 'Slice List',
+ prop: 'name',
+ link: item => `/#/site/${item.site}/slice/${item.id}`
+ },
+ {
+ label: 'Allocated',
+ prop: 'instance_total'
+ },
+ {
+ label: 'Ready',
+ prop: 'instance_total_ready'
+ }
+ ]
+ };
+
+ // retrieving user list
+ SlicesPlus.query({
+ site:$stateParams.id
+ }).$promise
+ .then((users) => {
+ this.users = users;
+ })
+ .catch((e) => {
+ throw new Error(e);
+ });
+ }
+ };
+})
+.directive('createSlice', function(){
+ return {
+ //sites : {},
+ restrict: 'E',
+ scope: {},
+ bindToController: true,
+ controllerAs: 'cs',
+ templateUrl: 'templates/createslice.html',
+ controller: function(Slices,SlicesPlus,$stateParams){
+ //var sites;
+ //console.log(this.users.name);
+
+ //console.log(this.config);
+ this.config = {
+ exclude: ['password', 'last_login'],
+ formName: 'SliceDetails',
+ actions: [
+ {
+ label: 'Save',
+ icon: 'ok', // refers to bootstraps glyphicon
+ cb: (user) => { // receive the model
+ console.log(user);
+ },
+ class: 'success'
+ },{
+ label: 'Save and continue editing',
+ icon: 'ok', // refers to bootstraps glyphicon
+ cb: (user) => { // receive the model
+ console.log(user);
+ },
+ class: 'primary'
+ },{
+ label: 'Save and add another',
+ icon: 'ok', // refers to bootstraps glyphicon
+ cb: (user) => { // receive the model
+ console.log(user);
+ },
+ class: 'primary'
+ }
+ ],
+ fields:
+ {
+ site_select : {
+ label:'Site',
+ type:'select',
+ validators:{ required: true,},
+ hint : 'The Site this Slice belongs to',
+ options:[
+ {
+ id:0,
+ label:"---Site---"
+ },
+ {
+ id:1,
+ label:"---Site1---"
+ }],
+
+ },
+ first_name: {
+ label:'Name',
+ type: 'string',
+ hint: 'The Name of the Slice',
+ validators: {
+ required: true
+ }
+ },
+ service_class : {
+ label:'ServiceClass',
+ type:'select',
+ validators:{ required: true,},
+ hint : 'The Site this Slice belongs to',
+ options:[
+ {
+ id:0,
+ label:"Best effort"
+ },
+ ],
+ },
+ enabled: {
+ label: 'Enabled',
+ type : 'boolean',
+ hint:'Status for this Slice'
+ },
+ description: {
+ label: 'Description',
+ type : 'string',
+ hint:'High level description of the slice and expected activities',
+ validators: {
+ required: false,
+ minlength: 10
+ }
+ },
+ service : {
+ label:'Service',
+ type:'select',
+ validators:{ required: false,},
+ options:[
+ {
+ id:0,
+ label:"--------"
+ },
+ ],
+ },
+ slice_url: {
+ label: 'Slice url',
+ type : 'string',
+ validators: {
+ required: false,
+ minlength: 10
+ }
+ },
+ max_instances: {
+ type: 'Max Instances',
+ validators: {
+ required: false,
+ min: 0
+ }
+ },
+ default_isolation : {
+ label:'Default Isolation',
+ type:'select',
+ validators:{ required: false,},
+ options:[
+ {
+ id:0,
+ label:"Virtual Machine"
+ },{
+ id:1,
+ label:"Container"
+ },{
+ id:2,
+ label:"Container in VM"
+ },
+ ],
+ },
+ default_image : {
+ label:'Default image',
+ type:'select',
+ validators:{ required: false,},
+ options:[
+ {
+ id:0,
+ label:"trusty-server-multi-nic"
+ },
+ ],
+ },
+ network : {
+ label:'Network',
+ type:'select',
+ validators:{ required: false,},
+ options:[
+ {
+ id:0,
+ label:"Default"
+ },
+ {
+ id:1,
+ label:"Host"
+ },
+ {
+ id:2,
+ label:"Bridged"
+ },
+ {
+ id:3,
+ label:"No Automatic Networks"
+ },
+ ],
+ },
+
+ }
+ };
+
+ var data;
+ // retrieving user list
+
+
+ //Slices.get({id :$stateParams.id}).$promise
+ //.then((users) => {
+ // this.users = users;
+ // //console.log(users.name);
+ // data = users;
+ //})
+ //.catch((e) => {
+ // throw new Error(e);
+ //});
+
+ //console.log(this.users);
+//console.log(this.config.fields.site_select.options);
+ this.model = {
+ };
+ }
+ };
+})
+.directive('editSlice', function(){
+ return {
+ //sites : {},
+ restrict: 'E',
+ scope: {},
+ bindToController: true,
+ controllerAs: 'cs',
+ templateUrl: 'templates/createslice.html',
+ controller: function(Slices,SlicesPlus,$stateParams){
+ //var sites;
+ //console.log(this.users.name);
+
+ //console.log(this.config);
+ this.config = {
+ exclude: ['password', 'last_login'],
+ formName: 'SliceDetails',
+ actions: [
+ {
+ label: 'Save',
+ icon: 'ok', // refers to bootstraps glyphicon
+ cb: (user) => { // receive the model
+ console.log(user);
+ },
+ class: 'success'
+ },{
+ label: 'Save and continue editing',
+ icon: 'ok', // refers to bootstraps glyphicon
+ cb: (user) => { // receive the model
+ console.log(user);
+ },
+ class: 'primary'
+ },{
+ label: 'Save and add another',
+ icon: 'ok', // refers to bootstraps glyphicon
+ cb: (user) => { // receive the model
+ console.log(user);
+ },
+ class: 'primary'
+ }
+ ],
+ fields:
+ {
+ site_select : {
+ label:'Site',
+ type:'select',
+ validators:{ required: true,},
+ hint : 'The Site this Slice belongs to',
+ options:[
+ {
+ id:0,
+ label:"---Site---"
+ },
+ {
+ id:1,
+ label:"---Site1---"
+ }],
+
+ },
+ first_name: {
+ label:'Name',
+ type: 'string',
+ hint: 'The Name of the Slice',
+ validators: {
+ required: true
+ }
+ },
+ service_class : {
+ label:'ServiceClass',
+ type:'select',
+ validators:{ required: true,},
+ hint : 'The Site this Slice belongs to',
+ options:[
+ {
+ id:0,
+ label:"Best effort"
+ },
+ ],
+ },
+ enabled: {
+ label: 'Enabled',
+ type : 'boolean',
+ hint:'Status for this Slice'
+ },
+ description: {
+ label: 'Description',
+ type : 'string',
+ hint:'High level description of the slice and expected activities',
+ validators: {
+ required: false,
+ minlength: 10
+ }
+ },
+ service : {
+ label:'Service',
+ type:'select',
+ validators:{ required: false,},
+ options:[
+ {
+ id:0,
+ label:"--------"
+ },
+ ],
+ },
+ slice_url: {
+ label: 'Slice url',
+ type : 'string',
+ validators: {
+ required: false,
+ minlength: 10
+ }
+ },
+ max_instances: {
+ type: 'Max Instances',
+ validators: {
+ required: false,
+ min: 0
+ }
+ },
+ default_isolation : {
+ label:'Default Isolation',
+ type:'select',
+ validators:{ required: false,},
+ options:[
+ {
+ id:0,
+ label:"Virtual Machine"
+ },{
+ id:1,
+ label:"Container"
+ },{
+ id:2,
+ label:"Container in VM"
+ },
+ ],
+ },
+ default_image : {
+ label:'Default image',
+ type:'select',
+ validators:{ required: false,},
+ options:[
+ {
+ id:0,
+ label:"trusty-server-multi-nic"
+ },
+ ],
+ },
+ network : {
+ label:'Network',
+ type:'select',
+ validators:{ required: false,},
+ options:[
+ {
+ id:0,
+ label:"Default"
+ },
+ {
+ id:1,
+ label:"Host"
+ },
+ {
+ id:2,
+ label:"Bridged"
+ },
+ {
+ id:3,
+ label:"No Automatic Networks"
+ },
+ ],
+ },
+
+ }
+ };
+
+ var data;
+ // retrieving user list
+
+
+ Slices.get({id :$stateParams.id}).$promise
+ .then((users) => {
+ this.users = users;
+ //console.log(users.name);
+ data = users;
+ })
+ .catch((e) => {
+ throw new Error(e);
+ });
+
+ //console.log(this.users);
+//console.log(this.config.fields.site_select.options);
+ this.model = {
+ first_name : "Teo"
+ };
+ }
+ };
+});
+
+
+
diff --git a/views/ngXosViews/tenant/src/sass/main.scss b/views/ngXosViews/tenant/src/sass/main.scss
new file mode 100644
index 0000000..268f1b4
--- /dev/null
+++ b/views/ngXosViews/tenant/src/sass/main.scss
@@ -0,0 +1,9 @@
+@import '../../../../style/sass/lib/_variables.scss';
+@import '../../../../../views/style/sass/bootstrap/bootstrap/_variables.scss';
+
+
+#xosTenant {
+ a{
+ margin-bottom: $form-group-margin-bottom;
+ }
+}
\ No newline at end of file
diff --git a/views/ngXosViews/tenant/src/templates/createslice.html b/views/ngXosViews/tenant/src/templates/createslice.html
new file mode 100644
index 0000000..b04ee28
--- /dev/null
+++ b/views/ngXosViews/tenant/src/templates/createslice.html
@@ -0,0 +1,11 @@
+<!--<xos-table config="cs.tableConfig" data="cs.sites"></xos-table>-->
+<h2>Slice Details</h2>
+<hr></hr>
+<xos-form ng-model="cs.model" config="cs.config" ></xos-form>
+
+<!--<pre>-->
+<!--<!–{{cs.users | json}}–>-->
+
+<!--{{cs.users.name | json}}-->
+
+<!--</pre>-->
\ No newline at end of file
diff --git a/views/ngXosViews/tenant/src/templates/slicelist.html b/views/ngXosViews/tenant/src/templates/slicelist.html
new file mode 100644
index 0000000..555d3dc
--- /dev/null
+++ b/views/ngXosViews/tenant/src/templates/slicelist.html
@@ -0,0 +1,6 @@
+<!--<span ng-bind="siteNameSe"></span>-->
+<!--<xos-field></xos-field>-->
+
+<a class="addlink btn btn-info" ui-sref="createslice({site: sl.siteId})"><i class="glyphicon glyphicon-plus-sign"></i> Create Slice</a>
+<xos-table config="sl.tableConfig" data="sl.users"></xos-table>
+<!--<div ui-view="sliceDetails"></div>-->
\ No newline at end of file
diff --git a/views/ngXosViews/tenant/src/templates/users-list.tpl.html b/views/ngXosViews/tenant/src/templates/users-list.tpl.html
new file mode 100644
index 0000000..1242734
--- /dev/null
+++ b/views/ngXosViews/tenant/src/templates/users-list.tpl.html
@@ -0,0 +1 @@
+<xos-table config="vm.tableConfig" data="vm.site_list"></xos-table>
\ No newline at end of file