X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=blueprints%2Fcommon%2Feliot-ui%2Ffrontend-src%2Fsrc%2Fapp%2Fdashboard%2Fdashboard.component.ts;fp=blueprints%2Fcommon%2Feliot-ui%2Ffrontend-src%2Fsrc%2Fapp%2Fdashboard%2Fdashboard.component.ts;h=c52ee2aebcb8f0be1f79daa9b60133c5af365500;hb=5c2048d4d3e672783eea4f306aa9a03f33a1a9f2;hp=0000000000000000000000000000000000000000;hpb=59f512662c02a16c1d5c45b090b185d2e773310f;p=eliot.git diff --git a/blueprints/common/eliot-ui/frontend-src/src/app/dashboard/dashboard.component.ts b/blueprints/common/eliot-ui/frontend-src/src/app/dashboard/dashboard.component.ts new file mode 100644 index 0000000..c52ee2a --- /dev/null +++ b/blueprints/common/eliot-ui/frontend-src/src/app/dashboard/dashboard.component.ts @@ -0,0 +1,132 @@ +import { Component, OnInit } from '@angular/core'; +import { EliotserviceService } from '../eliotservice.service'; +import { dashboardInfo,appDeployStatus,stabilityStatus,historyStatus } from '../datainterface'; +import { debug } from 'util'; + +@Component({ + selector: 'app-dashboard', + templateUrl: './dashboard.component.html', + styleUrls: ['./dashboard.component.scss'] +}) +export class DashboardComponent implements OnInit { + + /**chart properties of dashboard */ + + public appChartType: string = 'doughnut'; + public podsNodesChartType: string = 'doughnut'; + public historyChartType: string = 'line'; + + public appChartDatasets: Array = [ + { data: [], label: 'My First dataset' } + ]; + + public podsNodesChartDatasets: Array = [ + { data: [], label: 'My Firstfe dataset' } + ]; + + public historyChartDatasets: Array = [ + { + data: [], + label: 'Successful Deployment Dataset' + } + ]; + + // public podsNodesChartLabels: Array = ['Pods-stable', 'Pods-unstable', 'nods-stable', 'nodes-unstable', 'services-running']; + // public appChartLabels: Array = ['Deployed-Successful', 'Deployment-Failed', 'Deployment-pending']; + // public historyChartLabels: Array = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November','December']; + public podsNodesChartLabels: Array = [] + public appChartLabels: Array = []; + public historyChartLabels: Array = []; + + public appChartColors: Array = [ + { + backgroundColor: ['#46BFBD', '#F7464A', '#FDB45C'], + hoverBackgroundColor: ['#5AD3D1', '#FF5A5E', '#FFC870'], + borderWidth: 2, + } + ]; + public podsNodesChartColors: Array = [ + { + backgroundColor: ['#58bf28', '#ed5807', '#FDB45C', '#ede613', '#13f2ce'], + hoverBackgroundColor: ['#63d62d', '#ff5a00', '#FFC870', '#fff714', '#17ffd9'], + borderWidth: 2, + } + ]; + public historyChartColors: Array = [ + { + backgroundColor: 'rgba(255, 88, 33, .2)', + borderColor: 'rgba(200, 99, 132, .7)', + borderWidth: 2, + } + ]; + + dashInfo = {} as dashboardInfo; + appStatus = {} as appDeployStatus; + stableStatus = {} as stabilityStatus; + historyCountStatus = {} as historyStatus; + + constructor(private serviceobj:EliotserviceService) { } + + ngOnInit() { + this.getDashboardStatus(); + } + + /* Chart properties of dashboard */ + + public appChartOptions: any = { + responsive: true + }; + public podsNodesChartOptions: any = { + responsive: true + }; + public historyChartOptions: any = { + responsive: true + }; + + /* Chart functions of dashboard */ + + public appChartClicked(e: any): void { } + public podsNodesChartClicked(e: any): void { } + public appChartHovered(e: any): void { } + public podsNodesChartHovered(e: any): void { } + public historyChartClicked(e: any): void { } + public historyChartHovered(e: any): void { } + + + // getNodes() { + // this.serviceobj.getNodesArray() + // .subscribe(data => { + // debugger; + // console.log(data); + // this.nodewise = data; + // this.nodesArray = this.nodewise.nodesArray; + // }, + // error => console.log(error)); + // } + + getDashboardStatus() { + + this.serviceobj.getDashboardData() + .subscribe(data => { + console.log(data); + this.appChartLabels = Object.keys(data.appDeployStatus); + this.historyChartLabels = Object.keys(data.historyStatus); + this.podsNodesChartLabels = Object.keys(data.stabilityStatus); + console.log(this.podsNodesChartDatasets); + // this.podsNodesChartDatasets.forEach( + // (data)=> { + + // } + // ) + this.podsNodesChartDatasets[0].data=Object.values(data.stabilityStatus); + this.appChartDatasets[0].data=Object.values(data.appDeployStatus); + this.historyChartDatasets[0].data=Object.values(data.historyStatus); + Object.values(data.appDeployStatus); + Object.values(data.historyStatus); + Object.values(data.stabilityStatus); + debugger; + }, + error => console.log(error)); + } + +}