1 import { Component, OnInit } from '@angular/core';
2 import { Network, Node, Edge } from 'vis';
5 selector: 'app-monitor-service',
6 templateUrl: './monitor-service.component.html',
7 styleUrls: ['./monitor-service.component.less']
9 export class MonitorServiceComponent implements OnInit {
11 selectedSubscriptionType:string = "SOTN";
12 serviceSubscriptionList:any = [{
15 selectedServiceInstance:string = "SiteService-5011";
16 serviceInstanceList:any = [
18 serviceInstance: "SiteService-5011",
19 serviceInstancename: "SiteService-5011"
22 serviceInstance: "ISAAC-IS0333",
23 serviceInstancename: "ISAAC-IS0333"
26 selectedTopology:string = 'i18nTextDefine_networkTopology';
27 serviceTopologyList:any = [
29 topologyType:"i18nTextDefine_networkTopology",
32 topologyType:"i18nTextDefine_resourceTopology",
39 public network: Network;
40 public serviceList: any;
43 public selectedNode: any;
44 public selectedNodeIds: any;
59 font: { color: '#eeeeee' }
67 hideEdgesOnDrag: true,
68 navigationButtons: false,
78 "shape": "circularImage",
79 "image": "./assets/images/edge.png",
83 "ethtSvcName": "sotn-021-VS-monitored",
86 "couplingFlag": "true",
94 "shape": "circularImage",
95 "image": "./assets/images/logicallink.png",
96 "label": "Logical Link",
99 "ethtSvcName": "sotn-021-VS-monitored",
100 "colorAware": "true",
102 "couplingFlag": "true",
110 "shape": "circularImage",
111 "image": "./assets/images/edge.png",
116 "siteName": "hubtravel",
117 "description": "desc",
118 "location": "laptop-5",
139 "shape": "circularImage",
140 "image": "./assets/images/tpoint.png",
141 "label": "Termination Point",
147 "shape": "circularImage",
148 "image": "./assets/images/edge.png",
152 "ethtSvcName": "sotn-021-VS-monitored",
153 "colorAware": "true",
155 "couplingFlag": "true",
163 "shape": "circularImage",
164 "image": "./assets/images/logicallink.png",
165 "label": "Logical Link",
168 "ethtSvcName": "sotn-021-VS-monitored",
169 "colorAware": "true",
171 "couplingFlag": "true",
179 "shape": "circularImage",
180 "image": "./assets/images/edge.png",
185 "siteName": "hubtravel",
186 "description": "desc",
187 "location": "laptop-5",
193 "shape": "circularImage",
194 "image": "./assets/images/tpoint.png",
195 "label": "Termination Point",
198 "accessltpid": "155",
199 "siteName": "hubtravel",
200 "description": "desc",
201 "accessnodeid": "10.10.10.10",
229 returnResponse: boolean = true;
231 //Get SubscriptionType
232 getSubscribeTypes() {
233 this.getTopologyInfo('i18nTextDefine_networkTopology');
236 getTopologyInfo (topo) {
237 this.selectedTopology = topo;
242 //Get subscription instanceID by calling With Subscription Type
243 getServiceInstanceList(subscriptionType) {
244 this.getSelectedsubscriptionInfo(subscriptionType);
247 this.container = document.getElementById('mynetwork');
248 this.getSubscribeTypes();
254 nodes: this.serviceList.nodes,
255 edges: this.serviceList.edges
258 var network = new Network(this.container, data1, this.networkOptions);
261 network.on('select', function (selection) {
262 this.selectedNodeIds = selection.nodes[0]; // array of selected node's ids
263 var filteredNode = data1.nodes.filter(item => (
264 item.id == this.selectedNodeIds
266 var t1 = '<div class="tblDiv">\
267 <nz-form-label class="lblCls">Node Information</nz-form-label>\
268 <table class="table table-striped table-bordered">\
271 <th class="clr-primary padding-2p">Specification</th>\
272 <th class="clr-primary padding-2p">Value</th>\
277 Object.entries(filteredNode[0].dataNode).forEach(entry => {
278 if( entry[1] !== "null")
280 t1 += '<tr class="popup-table-row">\
281 <td class="popup-table-header clr-primary padding-2p">'+ entry[0] + ':</td>\
282 <td class="popup-table-data clr-primary padding-2p">'+ entry[1] + '</td>\
291 document.getElementById('nodeDetails').innerHTML = t1;
293 network.on("afterDrawing", function (this) {
300 if (this.selectedTopology == 'i18nTextDefine_networkTopology') {
301 this.serviceList = this.node1;
303 this.serviceList = this.node2;
306 // Getting sitedata Based On Type and ID
307 getSelectedsubscriptionInfo() {
310 if (this.intervalData) {
311 clearInterval(this.intervalData);
316 console.log('clear interval');
317 if (this.intervalData) {
318 clearInterval(this.intervalData);
324 console.log('clear interval');
325 if (this.intervalData) {
326 clearInterval(this.intervalData);