Dashboard and nginx fixes
Change-Id: I4ee34b24779f929f41852d4662018caead860ab6
diff --git a/src/app/views/dashboard/dashboard.html b/src/app/views/dashboard/dashboard.html
new file mode 100644
index 0000000..de4c358
--- /dev/null
+++ b/src/app/views/dashboard/dashboard.html
@@ -0,0 +1,42 @@
+<section class="content">
+ <div class="container-fluid">
+ <!--<h1>Dashboard</h1>-->
+ <div class="row">
+ <div class="col-xs-4">
+ <div class="panel panel-filled">
+ <div class="panel-body text-center">
+ <h2 class="m-b-none">
+ {{vm.nodes}}
+ <!--<span class="slight"><i class="fa fa-play fa-rotate-270 text-warning"> </i> +20%</span>-->
+ </h2>
+ <h4>Nodes</h4>
+ <!--<div class="small">% New Sessions</div>-->
+ <!--<div class="slight m-t-sm"><i class="fa fa-clock-o"> </i> Updated: <span class="c-white">10:22pm</span></div>-->
+ </div>
+ </div>
+ </div>
+
+ <div class="col-xs-4">
+ <div class="panel panel-filled">
+ <div class="panel-body text-center">
+ <h2 class="m-b-none">
+ {{vm.slices}}
+ </h2>
+ <h4>Slices</h4>
+ </div>
+ </div>
+ </div>
+
+ <div class="col-xs-4">
+ <div class="panel panel-filled">
+ <div class="panel-body text-center">
+ <h2 class="m-b-none">
+ {{vm.instances}}
+ </h2>
+ <h4>Instances</h4>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</section>
\ No newline at end of file
diff --git a/src/app/views/dashboard/dashboard.ts b/src/app/views/dashboard/dashboard.ts
new file mode 100644
index 0000000..776acf6
--- /dev/null
+++ b/src/app/views/dashboard/dashboard.ts
@@ -0,0 +1,46 @@
+import {IModelStoreService} from '../../datasources/stores/model.store';
+import {IXosAuthService} from '../../datasources/rest/auth.rest';
+class DashboardController {
+ static $inject = ['$state', 'ModelStore', 'AuthService'];
+
+ public nodes: number;
+ public slices: number;
+ public instances: number;
+
+ constructor(
+ private $state: ng.ui.IStateService,
+ private store: IModelStoreService,
+ private auth: IXosAuthService
+ ) {
+
+ if (!this.auth.isAuthenticated()) {
+ this.$state.go('login');
+ }
+ else {
+ // this.store.query('node')
+ // .subscribe((event) => {
+ // console.log(`node`, event);
+ // this.nodes = event.length;
+ // });
+ this.store.query('slice')
+ .subscribe((event) => {
+ // console.log('slice', event);
+ this.slices = event.length;
+ });
+ // this.store.query('instance')
+ // .subscribe((event) => {
+ // console.log('isntance', event);
+ // this.instances = event.length;
+ // });
+ this.instances = 0;
+ this.nodes = 2;
+ this.slices = 3;
+ }
+ }
+}
+
+export const xosDashboard: angular.IComponentOptions = {
+ template: require('./dashboard.html'),
+ controllerAs: 'vm',
+ controller: DashboardController
+};
diff --git a/src/app/views/index.ts b/src/app/views/index.ts
index 495e2a4..ee87ef9 100644
--- a/src/app/views/index.ts
+++ b/src/app/views/index.ts
@@ -1,8 +1,10 @@
import {xosCore} from '../core/index';
import {xosCrud} from './crud/crud';
+import {xosDashboard} from './dashboard/dashboard';
export const xosViews = 'xosViews';
angular
.module('xosViews', [xosCore])
- .component('xosCrud', xosCrud);
+ .component('xosCrud', xosCrud)
+ .component('xosDashboard', xosDashboard);