0e3e6e145bd34c91cb8ee8f8abe8c8c086871832
[eliot.git] / blueprints / common / eliot-ui / frontend-src / src / app / nodes / nodes.component.ts
1 import { Component, OnInit, ViewChild } from '@angular/core';
2 import { MatPaginator } from '@angular/material/paginator';
3 import {MatTableDataSource} from '@angular/material/table';
4 import { nodeDetailss, nodinfo } from './../../app/datainterface';
5 import { nodeDetails } from './../datainterface';
6 import { MyserviceService } from './../myservice.service';
7
8
9 @Component({
10   selector: 'app-nodes',
11   templateUrl: './nodes.component.html',
12   styleUrls: ['./nodes.component.scss']
13 })
14
15
16
17 export class NodesComponent implements OnInit {
18
19   nodeInfo = {} as nodeDetails;
20
21   nodeArray = {} as nodinfo;
22   display: boolean;
23   message: string;
24   variable: any;
25
26   nodeColumns: string [] = ['nodeName','nodeStatus','nodeRole','age','version','internalIp','externalIp','osImage','kernel','containerRuntime'];
27
28   nodeDataSource= new MatTableDataSource<nodinfo>(NODE_INFO_LIST);
29   nodeArrayList = [];
30
31   @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
32
33   constructor(private serviceobj:MyserviceService) { }
34
35   ngOnInit() {
36     this.display = true;
37     this.nodeDataSource.paginator = this.paginator;
38     this.getNodes();
39   }
40
41   nodeFilter(filterValue: string) {
42     this.nodeDataSource.filter = filterValue.trim().toLowerCase();
43   }
44
45   getNodes() {
46
47     this.serviceobj.getNodesInfoo()
48        .subscribe(data => {
49         debugger;
50         this.nodeInfo = data;
51         this.nodeArrayList = this.nodeInfo.eliotNodes;
52         this.nodeDataSource = new MatTableDataSource(this.nodeArrayList);
53         this.nodeDataSource.paginator = this.paginator;
54         
55        },
56        error => console.log(error));
57   }
58
59 }
60
61 const NODE_LIST: nodeDetailss[] = [
62   {position: 1, nodeName: 'eliot-master', role: 'master', nodeStatus: 'Ready'},
63   {position: 2, nodeName: 'eliot-worker01', role: 'worker', nodeStatus: 'NotReady'},
64   {position: 3, nodeName: 'eliot-worker02', role: 'worker', nodeStatus: 'Ready'}
65 ];
66
67 const NODE_INFO_LIST: nodinfo[] = [
68   { nodeName: '', nodeStatus: '', nodeRole: '', age: '', version: '', internalIp: '', externalIp: '', osImage: '', kernel: '', containerRuntime: ''}
69 ];