From dba6524875ebb7c0835d4eace5bc27c03763d4a1 Mon Sep 17 00:00:00 2001 From: "phani.y" Date: Wed, 25 Mar 2020 15:42:53 +0530 Subject: Service Topology Changes Issue-ID: USECASEUI-419 Signed-off-by: phani.y Change-Id: I4f2d8a5a6309de92acd9384d499a285306036ebf --- .../monitor-service/monitor-service.component.html | 12 ++- .../monitor-service/monitor-service.component.less | 4 +- .../monitor-service/monitor-service.component.ts | 120 +++++++++++++++------ 3 files changed, 100 insertions(+), 36 deletions(-) (limited to 'usecaseui-portal/src/app/views/services/sotn-management/monitor-service') diff --git a/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.html b/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.html index 39bfa1bf..3637d3c9 100644 --- a/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.html +++ b/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.html @@ -29,15 +29,19 @@ - + - -
-
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.less b/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.less index 9ebe3741..bfdcfdeb 100644 --- a/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.less +++ b/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.less @@ -95,4 +95,6 @@ #subscriptionType, #serviceInstance { width: 250px; - } \ No newline at end of file + } + + \ No newline at end of file diff --git a/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.ts b/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.ts index 48c90b63..4903b102 100644 --- a/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.ts +++ b/usecaseui-portal/src/app/views/services/sotn-management/monitor-service/monitor-service.component.ts @@ -1,8 +1,9 @@ import { Component, OnInit } from '@angular/core'; import { Network, Node, Edge } from 'vis'; -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import { baseUrl } from '../../../../datainterface'; +import { getLocaleDateFormat } from '@angular/common'; @Component({ selector: 'app-monitor-service', templateUrl: './monitor-service.component.html', @@ -16,14 +17,6 @@ export class MonitorServiceComponent implements OnInit { serviceInstanceList = [] as Array; selectedTopology:string = 'i18nTextDefine_serviceTopology'; - serviceTopologyList:any = [ - { - topologyType:"i18nTextDefine_serviceTopology", - }, - { - topologyType:"i18nTextDefine_resourceTopology", - } - ]; baseUrl = baseUrl.baseUrl title = 'Network'; @@ -31,6 +24,7 @@ export class MonitorServiceComponent implements OnInit { public edges: Edge; public network: Network; public serviceList: any; + public vpnBindingList:any; public tempNode: any; public tempEdge: any; public selectedNode: any; @@ -38,9 +32,20 @@ export class MonitorServiceComponent implements OnInit { public x: any; public abc = []; container: any; + isdisabled:boolean = true; + serviceTopologyList:any = [ + { + topologyType:"i18nTextDefine_serviceTopology", + }, + { + topologyType:"i18nTextDefine_resourceTopology", + } + ]; + + networkOptions = { layout: { - randomSeed: 15 + randomSeed: 15 }, nodes: { borderWidth: 13, @@ -52,7 +57,7 @@ export class MonitorServiceComponent implements OnInit { font: { color: '#eeeeee' } }, edges: { - color: 'lightgray' + color: 'lightgray', }, interaction: { @@ -69,12 +74,27 @@ export class MonitorServiceComponent implements OnInit { intervalData: any; returnResponse: boolean = true; - + onBack(){ + if(this.serviceList.length > 0) { + this.refreshData(""); + } else { + this.getData(""); + } + this.isdisabled = true; + }; //Get SubscriptionType getSubscribeTypes() { + this.serviceList = []; + this.vpnBindingList = []; + this.isdisabled = true; + let httpOptions = { + headers: new HttpHeaders({ + 'Content-Type': 'application/json' + }) + }; let url = this.baseUrl + "/uui-lcm/customers/service-subscriptions"; - this.http.get(url, {}).subscribe((data) => { + this.http.get(url, httpOptions).subscribe((data) => { this.serviceSubscriptionList = data.subscriptions; }, (err) => { console.log(err); @@ -83,10 +103,19 @@ export class MonitorServiceComponent implements OnInit { //Get subscription instanceID by calling With Subscription Type getServiceInstanceList(subscriptionType) { + debugger + this.serviceList = []; + this.vpnBindingList = []; + this.isdisabled = true; this.serviceInstanceList = []; this.selectedServiceInstance=""; + let httpOptions = { + headers: new HttpHeaders({ + 'Content-Type': 'application/json' + }) + }; let url = this.baseUrl + "/uui-lcm/Sotnservices/ServiceInstances/" + subscriptionType; - this.http.get(url,{}).subscribe((data) => { + this.http.get(url,httpOptions).subscribe((data) => { this.serviceInstanceList = data.serviceInstanceList; }, (err) => { console.log(err); @@ -95,8 +124,8 @@ export class MonitorServiceComponent implements OnInit { getTopologyInfo (topo) { this.selectedTopology = topo; - this.getData(); - this.refreshData(); + this.getData(""); + this.refreshData(""); } //Get subscription instanceID by calling With Subscription Type ngOnInit() { @@ -104,24 +133,28 @@ export class MonitorServiceComponent implements OnInit { this.getSubscribeTypes(); } - refreshData() { + refreshData(data) { + const com = this + var id ; var data1 = { - nodes: this.serviceList.nodes, - edges: this.serviceList.edges + nodes: data.nodes, + edges: data.edges }; var network = new Network(this.container, data1, this.networkOptions); - network.on('select', function (selection) { + network.on('doubleClick', function (selection) { + var selectedvpnid = selection.nodes[0]; + com.getData(selectedvpnid) this.selectedNodeIds = selection.nodes[0]; // array of selected node's ids var filteredNode = data1.nodes.filter(item => ( item.id == this.selectedNodeIds )); var t1 = '
\ Node Information\ - \ +
\ \ \ - \ - \ + \ + \ \ \ \ @@ -130,8 +163,8 @@ export class MonitorServiceComponent implements OnInit { if( entry[1] !== "null") { t1 += '\ - \ - \ + \ + \ \ '; } @@ -147,24 +180,49 @@ export class MonitorServiceComponent implements OnInit { }); } - getData (){ + getData (vpnid){ var comp = this; - this.http.get(this.baseUrl+'/uui-lcm/Sotnservices/resourceTopology/service/service-subscriptions/service-subscription/'+this.selectedSubscriptionType.toLowerCase()+'/service-instances/service-instance/'+this.selectedServiceInstance, {}).subscribe((data) => { + let url = ""; + if(vpnid != "" ) { + if(this.vpnBindingList.length > 0) { + this.refreshData(this.vpnBindingList) + } else { + 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; + } + } else { + if(this.serviceList.length > 0 && vpnid == "") { + this.refreshData(this.serviceList); + } else { + url = this.baseUrl+'/uui-lcm/Sotnservices/serviceTopology/service/service-subscriptions/service-subscription/'+this.selectedSubscriptionType.toLowerCase()+'/service-instances/service-instance/'+this.selectedServiceInstance; + } + } + let httpOptions = { + headers: new HttpHeaders({ + 'Content-Type': 'application/json' + }) + }; + this.http.get(url, httpOptions).subscribe((data) => { + if(vpnid == "") { this.serviceList = data; - comp.refreshData(); - }, (err) => { + } else { + this.vpnBindingList = data; + this.isdisabled = false; + } + comp.refreshData(data); + }, (err) => { console.log(err); }); } + // Getting sitedata Based On Type and ID getSelectedsubscriptionInfo() { - this.getData(); - this.refreshData(); + this.getData(""); if (this.intervalData) { clearInterval(this.intervalData); } } + ngOnDestroy() { console.log('clear interval'); if (this.intervalData) { -- cgit 1.2.3-korg
SpecificationValueSpecificationValue