1 import { Component, OnInit } from '@angular/core';
2 import { Network, Node, Edge } from 'vis';
3 import { HttpClient } from '@angular/common/http';
4 import { Observable } from 'rxjs/Observable';
5 import { baseUrl } from '../../../../datainterface';
7 selector: 'app-monitor-service',
8 templateUrl: './monitor-service.component.html',
9 styleUrls: ['./monitor-service.component.less']
11 export class MonitorServiceComponent implements OnInit {
13 selectedSubscriptionType: string = "";
14 serviceSubscriptionList = [] as Array<any>;
15 selectedServiceInstance: string = "" ;
16 serviceInstanceList = [] as Array<any>;
18 selectedTopology:string = 'i18nTextDefine_serviceTopology';
19 serviceTopologyList:any = [
21 topologyType:"i18nTextDefine_serviceTopology",
24 topologyType:"i18nTextDefine_resourceTopology",
27 baseUrl = baseUrl.baseUrl
32 public network: Network;
33 public serviceList: any;
36 public selectedNode: any;
37 public selectedNodeIds: any;
52 font: { color: '#eeeeee' }
60 hideEdgesOnDrag: true,
61 navigationButtons: false,
67 constructor(private http: HttpClient) { }
70 returnResponse: boolean = true;
74 //Get SubscriptionType
76 let url = this.baseUrl + "/uui-lcm/customers/service-subscriptions";
77 this.http.get<any>(url, {}).subscribe((data) => {
78 this.serviceSubscriptionList = data.subscriptions;
84 //Get subscription instanceID by calling With Subscription Type
85 getServiceInstanceList(subscriptionType) {
86 this.serviceInstanceList = [];
87 this.selectedServiceInstance="";
88 let url = this.baseUrl + "/uui-lcm/Sotnservices/ServiceInstances/" + subscriptionType;
89 this.http.get<any>(url,{}).subscribe((data) => {
90 this.serviceInstanceList = data.serviceInstanceList;
96 getTopologyInfo (topo) {
97 this.selectedTopology = topo;
101 //Get subscription instanceID by calling With Subscription Type
103 this.container = document.getElementById('mynetwork');
104 this.getSubscribeTypes();
109 nodes: this.serviceList.nodes,
110 edges: this.serviceList.edges
112 var network = new Network(this.container, data1, this.networkOptions);
113 network.on('select', function (selection) {
114 this.selectedNodeIds = selection.nodes[0]; // array of selected node's ids
115 var filteredNode = data1.nodes.filter(item => (
116 item.id == this.selectedNodeIds
118 var t1 = '<div class="tblDiv">\
119 <nz-form-label class="lblCls">Node Information</nz-form-label>\
120 <table class="table table-striped table-bordered">\
123 <th class="clr-primary padding-2p">Specification</th>\
124 <th class="clr-primary padding-2p">Value</th>\
129 Object.entries(filteredNode[0].dataNode).forEach(entry => {
130 if( entry[1] !== "null")
132 t1 += '<tr class="popup-table-row">\
133 <td class="popup-table-header clr-primary padding-2p">'+ entry[0] + ':</td>\
134 <td class="popup-table-data clr-primary padding-2p">'+ entry[1] + '</td>\
143 document.getElementById('nodeDetails').innerHTML = t1;
145 network.on("afterDrawing", function (this) {
152 this.http.get<any>(this.baseUrl+'/uui-lcm/Sotnservices/resourceTopology/service/service-subscriptions/service-subscription/'+this.selectedSubscriptionType.toLowerCase()+'/service-instances/service-instance/'+this.selectedServiceInstance, {}).subscribe((data) => {
153 this.serviceList = data;
159 // Getting sitedata Based On Type and ID
160 getSelectedsubscriptionInfo() {
163 if (this.intervalData) {
164 clearInterval(this.intervalData);
169 console.log('clear interval');
170 if (this.intervalData) {
171 clearInterval(this.intervalData);
177 console.log('clear interval');
178 if (this.intervalData) {
179 clearInterval(this.intervalData);