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) {
107 this.serviceList = [];
108 this.vpnBindingList = [];
109 this.isdisabled = true;
110 this.serviceInstanceList = [];
111 this.selectedServiceInstance="";
113 headers: new HttpHeaders({
114 'Content-Type': 'application/json'
117 let url = this.baseUrl + "/uui-lcm/Sotnservices/ServiceInstances/" + subscriptionType;
118 this.http.get<any>(url,httpOptions).subscribe((data) => {
119 this.serviceInstanceList = data.serviceInstanceList;
125 getTopologyInfo (topo) {
126 this.selectedTopology = topo;
128 this.refreshData("");
130 //Get subscription instanceID by calling With Subscription Type
132 this.container = document.getElementById('mynetwork');
133 this.getSubscribeTypes();
143 var network = new Network(this.container, data1, this.networkOptions);
144 network.on('doubleClick', function (selection) {
145 var selectedvpnid = selection.nodes[0];
146 com.getData(selectedvpnid)
147 this.selectedNodeIds = selection.nodes[0]; // array of selected node's ids
148 var filteredNode = data1.nodes.filter(item => (
149 item.id == this.selectedNodeIds
151 var t1 = '<div class="tblDiv">\
152 <nz-form-label class="lblCls">Node Information</nz-form-label>\
153 <table class="monitor-table">\
156 <th class="monitor-table-td-th ">Specification</th>\
157 <th class="monitor-table-td-th ">Value</th>\
162 Object.entries(filteredNode[0].dataNode).forEach(entry => {
163 if( entry[1] !== "null")
165 t1 += '<tr class="popup-table-row">\
166 <td class="monitor-table-td-th ">'+ entry[0] + ':</td>\
167 <td class="monitor-table-td-th ">'+ entry[1] + '</td>\
176 document.getElementById('nodeDetails').innerHTML = t1;
178 network.on("afterDrawing", function (this) {
187 if(this.vpnBindingList.length > 0) {
188 this.refreshData(this.vpnBindingList)
190 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;
193 if(this.serviceList.length > 0 && vpnid == "") {
194 this.refreshData(this.serviceList);
196 url = this.baseUrl+'/uui-lcm/Sotnservices/serviceTopology/service/service-subscriptions/service-subscription/'+this.selectedSubscriptionType.toLowerCase()+'/service-instances/service-instance/'+this.selectedServiceInstance;
200 headers: new HttpHeaders({
201 'Content-Type': 'application/json'
204 this.http.get<any>(url, httpOptions).subscribe((data) => {
206 this.serviceList = data;
208 this.vpnBindingList = data;
209 this.isdisabled = false;
211 comp.refreshData(data);
217 // Getting sitedata Based On Type and ID
218 getSelectedsubscriptionInfo() {
220 if (this.intervalData) {
221 clearInterval(this.intervalData);
227 console.log('clear interval');
228 if (this.intervalData) {
229 clearInterval(this.intervalData);
235 console.log('clear interval');
236 if (this.intervalData) {
237 clearInterval(this.intervalData);