blob: 776acf65510add62160f9c891767698c5b1df9e7 [file] [log] [blame]
Matteo Scandolod62ea792016-12-22 14:02:28 -08001import {IModelStoreService} from '../../datasources/stores/model.store';
2import {IXosAuthService} from '../../datasources/rest/auth.rest';
3class DashboardController {
4 static $inject = ['$state', 'ModelStore', 'AuthService'];
5
6 public nodes: number;
7 public slices: number;
8 public instances: number;
9
10 constructor(
11 private $state: ng.ui.IStateService,
12 private store: IModelStoreService,
13 private auth: IXosAuthService
14 ) {
15
16 if (!this.auth.isAuthenticated()) {
17 this.$state.go('login');
18 }
19 else {
20 // this.store.query('node')
21 // .subscribe((event) => {
22 // console.log(`node`, event);
23 // this.nodes = event.length;
24 // });
25 this.store.query('slice')
26 .subscribe((event) => {
27 // console.log('slice', event);
28 this.slices = event.length;
29 });
30 // this.store.query('instance')
31 // .subscribe((event) => {
32 // console.log('isntance', event);
33 // this.instances = event.length;
34 // });
35 this.instances = 0;
36 this.nodes = 2;
37 this.slices = 3;
38 }
39 }
40}
41
42export const xosDashboard: angular.IComponentOptions = {
43 template: require('./dashboard.html'),
44 controllerAs: 'vm',
45 controller: DashboardController
46};