Fixed observer in dashboard
Change-Id: Icdfde7f01a35e066c8a4658872f2d19614aa7df4
diff --git a/src/app/views/dashboard/dashboard.ts b/src/app/views/dashboard/dashboard.ts
index dc4fc1d..72d7f28 100644
--- a/src/app/views/dashboard/dashboard.ts
+++ b/src/app/views/dashboard/dashboard.ts
@@ -1,13 +1,14 @@
import {IModelStoreService} from '../../datasources/stores/model.store';
import {IXosAuthService} from '../../datasources/rest/auth.rest';
class DashboardController {
- static $inject = ['$state', 'ModelStore', 'AuthService'];
+ static $inject = ['$scope', '$state', 'ModelStore', 'AuthService'];
public nodes: number;
public slices: number;
public instances: number;
constructor(
+ private $scope: ng.IScope,
private $state: ng.ui.IStateService,
private store: IModelStoreService,
private auth: IXosAuthService
@@ -17,12 +18,24 @@
this.$state.go('login');
}
else {
- this.store.query('node')
- .subscribe((event) => this.nodes = event.length);
- this.store.query('slice')
- .subscribe((event) => this.slices = event.length);
- this.store.query('instance')
- .subscribe((event) => this.instances = event.length);
+ this.store.query('Node')
+ .subscribe((event) => {
+ this.$scope.$evalAsync(() => {
+ this.nodes = event.length;
+ });
+ });
+ this.store.query('Instance')
+ .subscribe((event) => {
+ this.$scope.$evalAsync(() => {
+ this.instances = event.length;
+ });
+ });
+ this.store.query('Slice')
+ .subscribe((event) => {
+ this.$scope.$evalAsync(() => {
+ this.slices = event.length;
+ });
+ });
this.instances = 0;
this.nodes = 0;
this.slices = 0;