1 import { Component, OnInit } from '@angular/core';
2 import { Network, Node, Edge } from 'vis';
3 import { HttpClient, HttpHeaders } from '@angular/common/http';
4 import { Observable } from 'rxjs/Observable';
5 import { baseUrl } from '../../../../datainterface';
6 import { getLocaleDateFormat } from '@angular/common';
8 selector: 'app-monitor-service',
9 templateUrl: './monitor-service.component.html',
10 styleUrls: ['./monitor-service.component.less']
12 export class MonitorServiceComponent implements OnInit {
14 selectedSubscriptionType: string = "";
15 serviceSubscriptionList = [] as Array<any>;
16 selectedServiceInstance: string = "" ;
17 serviceInstanceList = [] as Array<any>;
19 selectedTopology:string = 'i18nTextDefine_serviceTopology';
20 baseUrl = baseUrl.baseUrl
25 public network: Network;
26 public serviceList: any;
27 public vpnBindingList:any;
30 public selectedNode: any;
31 public selectedNodeIds: any;
35 isdisabled:boolean = true;
36 serviceTopologyList:any = [
38 topologyType:"i18nTextDefine_serviceTopology",
41 topologyType:"i18nTextDefine_resourceTopology",
57 font: { color: '#eeeeee' }
65 hideEdgesOnDrag: true,
66 navigationButtons: false,
72 constructor(private http: HttpClient) { }
75 returnResponse: boolean = true;
78 if(this.serviceList.length > 0) {
83 this.isdisabled = true;
86 //Get SubscriptionType
88 this.serviceList = [];
89 this.vpnBindingList = [];
90 this.isdisabled = true;
92 headers: new HttpHeaders({
93 'Content-Type': 'application/json'
96 let url = this.baseUrl + "/uui-lcm/customers/service-subscriptions";
97 this.http.get<any>(url, httpOptions).subscribe((data) => {
98 this.serviceSubscriptionList = data.subscriptions;
104 //Get subscription instanceID by calling With Subscription Type
105 getServiceInstanceList(subscriptionType) {
106 this.serviceList = [];
107 this.vpnBindingList = [];
108 this.isdisabled = true;
109 this.serviceInstanceList = [];
110 this.selectedServiceInstance="";
112 headers: new HttpHeaders({
113 'Content-Type': 'application/json'
116 let url = this.baseUrl + "/uui-lcm/Sotnservices/ServiceInstances/" + subscriptionType;
117 this.http.get<any>(url,httpOptions).subscribe((data) => {
118 this.serviceInstanceList = data.serviceInstanceList;
124 getTopologyInfo (topo) {
125 this.selectedTopology = topo;
127 this.refreshData("");
129 //Get subscription instanceID by calling With Subscription Type
131 this.container = document.getElementById('mynetwork');
132 this.getSubscribeTypes();
142 var network = new Network(this.container, data1, this.networkOptions);
143 network.on('doubleClick', function (selection) {
144 var selectedvpnid = selection.nodes[0];
145 com.getData(selectedvpnid)
146 this.selectedNodeIds = selection.nodes[0]; // array of selected node's ids
147 var filteredNode = data1.nodes.filter(item => (
148 item.id == this.selectedNodeIds
150 var t1 = '<div class="tblDiv">\
151 <nz-form-label class="lblCls">Node Information</nz-form-label>\
152 <table class="monitor-table">\
155 <th class="monitor-table-td-th ">Specification</th>\
156 <th class="monitor-table-td-th ">Value</th>\
161 Object.entries(filteredNode[0].dataNode).forEach(entry => {
162 if( entry[1] !== "null")
164 t1 += '<tr class="popup-table-row">\
165 <td class="monitor-table-td-th ">'+ entry[0] + ':</td>\
166 <td class="monitor-table-td-th ">'+ entry[1] + '</td>\
175 document.getElementById('nodeDetails').innerHTML = t1;
177 network.on("afterDrawing", function (this) {
186 if(this.vpnBindingList.length > 0) {
187 this.refreshData(this.vpnBindingList)
189 url = this.baseUrl+'/uui-lcm/Sotnservices/vpnbindingTopology/service/service-subscriptions/service-subscription/'+this.selectedSubscriptionType.toLowerCase()+'/service-instances/service-instance/'+this.selectedServiceInstance+'/vpn-informations/vpn-information/'+ vpnid;
192 if(this.serviceList.length > 0 && vpnid == "") {
193 this.refreshData(this.serviceList);
195 url = this.baseUrl+'/uui-lcm/Sotnservices/serviceTopology/service/service-subscriptions/service-subscription/'+this.selectedSubscriptionType.toLowerCase()+'/service-instances/service-instance/'+this.selectedServiceInstance;
199 headers: new HttpHeaders({
200 'Content-Type': 'application/json'
203 this.http.get<any>(url, httpOptions).subscribe((data) => {
205 this.serviceList = data;
207 this.vpnBindingList = data;
208 this.isdisabled = false;
210 comp.refreshData(data);
216 // Getting sitedata Based On Type and ID
217 getSelectedsubscriptionInfo() {
219 if (this.intervalData) {
220 clearInterval(this.intervalData);
226 console.log('clear interval');
227 if (this.intervalData) {
228 clearInterval(this.intervalData);
234 console.log('clear interval');
235 if (this.intervalData) {
236 clearInterval(this.intervalData);