hiding instances per site chart when not needed
diff --git a/views/ngXosViews/developer/src/js/main.js b/views/ngXosViews/developer/src/js/main.js
index c47b9ef..944e74b 100644
--- a/views/ngXosViews/developer/src/js/main.js
+++ b/views/ngXosViews/developer/src/js/main.js
@@ -23,7 +23,7 @@
bindToController: true,
controllerAs: 'vm',
templateUrl: 'templates/developer-dashboard.tpl.html',
- controller: function($scope, $timeout, SlicesPlus, _){
+ controller: function($timeout, SlicesPlus, _){
this.instancePerSliceConfig = {
resource: 'Instances',
@@ -80,6 +80,9 @@
SlicesPlus.query().$promise
.then(slices => {
+ // formatting data in this way sucks.
+ // Provide a way to just pass data to the chart if needed [smartPie].
+
// retrieving network per slices
let networkPerSlice = _.reduce(slices, (list, s) => {
if( s.networks.length > 1){
@@ -104,12 +107,12 @@
return list;
}, []);
+ this.sites = Object.keys(_.groupBy(instancePerSite, 'site'));
+
$timeout(() => {
- console.log(instancePerSite, networkPerSlice);
this.instancePerSiteConfig.data = instancePerSite;
this.networkPerSliceConfig.data = networkPerSlice;
- $scope.$apply();
- }, 1);
+ }, 0);
this.slices = slices;
})
diff --git a/views/ngXosViews/developer/src/templates/developer-dashboard.tpl.html b/views/ngXosViews/developer/src/templates/developer-dashboard.tpl.html
index 3a40727..f1688fb 100644
--- a/views/ngXosViews/developer/src/templates/developer-dashboard.tpl.html
+++ b/views/ngXosViews/developer/src/templates/developer-dashboard.tpl.html
@@ -1,13 +1,13 @@
<div class="row">
- <div class="col-sm-4 text-center">
+ <div ng-class="{'col-sm-4': vm.sites.length > 1, 'col-sm-6': vm.sites.length <= 1}" class="text-center">
<h3>Instances per Slice</h3>
<xos-smart-pie ng-if="vm.slices" config="vm.instancePerSliceConfig"></xos-smart-pie>
</div>
- <div class="col-sm-4 text-center">
+ <div ng-if="vm.sites.length > 1" class="col-sm-4 text-center">
<h3>Instances per Site</h3>
<xos-smart-pie ng-if="vm.instancePerSiteConfig.data.length > 0" config="vm.instancePerSiteConfig"></xos-smart-pie>
</div>
- <div class="col-sm-4 text-center">
+ <div ng-class="{'col-sm-4': vm.sites.length > 1, 'col-sm-6': vm.sites.length <= 1}" class="text-center">
<h3>Network per Slice</h3>
<xos-smart-pie ng-if="vm.networkPerSliceConfig.data.length > 0" config="vm.networkPerSliceConfig"></xos-smart-pie>
</div>