diff options
author | guochuyicmri <guochuyi@chinamobile.com> | 2019-05-14 15:44:41 +0800 |
---|---|---|
committer | guochuyicmri <guochuyi@chinamobile.com> | 2019-05-14 15:44:45 +0800 |
commit | e044dfe80bcefb9004c8b6d3156d15ac56426dad (patch) | |
tree | 71754401eb4e1bbb0945d0383dedeee28ab27ad9 /usecaseui-portal/src/app/components/e2e-detail/e2e-detail.component.ts | |
parent | 14e41af3117a7c8c758cf887da5918356720c730 (diff) |
Fix instance instantiation for NS
Change-Id: I8979b70ca2efd8a09d37eb74233e15093a15806a
Issue-ID: USECASEUI-255
Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/components/e2e-detail/e2e-detail.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/components/e2e-detail/e2e-detail.component.ts | 193 |
1 files changed, 115 insertions, 78 deletions
diff --git a/usecaseui-portal/src/app/components/e2e-detail/e2e-detail.component.ts b/usecaseui-portal/src/app/components/e2e-detail/e2e-detail.component.ts index a592e169..cfcaae6c 100644 --- a/usecaseui-portal/src/app/components/e2e-detail/e2e-detail.component.ts +++ b/usecaseui-portal/src/app/components/e2e-detail/e2e-detail.component.ts @@ -28,87 +28,125 @@ export class E2eDetailComponent implements OnInit { constructor(private myhttp: MyhttpService) { } - ngOnInit() { - // this.getDetails(); - this.dataInit(); - this.drawImage("E2E Service"); - } - - @Input() detailParams; - @Input() namesTranslate; - @Output() closeDetail = new EventEmitter(); - templateParameters: any; - serviceInstanceName: any; - serviceType: any; - - dataInit() { - console.log(this.detailParams); - this.serviceInstanceName = this.detailParams['service-instance-name']; - } - - goback() { - this.closeDetail.emit(); - } - + ngOnInit() { + // this.getDetails(); + this.dataInit(); + } - roote2e = { - "name": "e2e", - "type": "e2e", - "children": - [ - { - "name": "ns", - "type": "ns", - "children": - [ - { - "name": "vnf", - "type": "vnf", - }, - { - "name": "vnf", - "type": "vnf", - } - ] - }, - { - "name": "ns", - "type": "ns", - "children": - [ - { - "name": "vnf", - "type": "vnf", - }, - { - "name": "vnf", - "type": "vnf", - } - ] - }] - } + @Input() detailParams; + + @Output() closeDetail = new EventEmitter(); + serviceInstanceName: any; + serviceType: any; + input_parameters: any; + nsinput_parameters: any; + + // e2e + service = { + name: "", + description: "", + }; + e2e_nestedTemplates = []; + e2e_requestInputs: any; + + ns_service = { + name:"", + description:"" + } + ns_nestedTemplates = []; + ns_requestInputs = {}; + roote2e = { + "name": "e2e", + "type": "e2e", + "children": [] + }; + + rootns = { + "name": "ns", + "type": "ns", + "children": [] + }; + + imgmap = { + '1': './assets/images/create-e2e.png', + '2': './assets/images/create-ns.png', + '3': './assets/images/create-vnf.png', + }; + + getKeys(item) { + return Object.keys(item); + } - rootns = { - "name": "ns", - "type": "ns", - "children": - [ - { - "name": "vnf", - "type": "vnf", - }, - { - "name": "vnf", - "type": "vnf", + dataInit() { + console.log(this.detailParams); + this.serviceInstanceName = this.detailParams['service-instance-name'] || this.detailParams["nsName"]; + if (this.detailParams.serviceDomain == 'E2E Service'){ + this.input_parameters = JSON.stringify(this.detailParams['input-parameters']); + this.input_parameters = JSON.parse(this.input_parameters); + console.log(this.input_parameters); + this.service = { + name:this.input_parameters.service.name, + description: this.input_parameters.service.description, + }; + if(this.input_parameters.service.parameters.requestInputs!=undefined && Object.keys(this.input_parameters.service.parameters.requestInputs).length>0){ + this.e2e_requestInputs = this.input_parameters.service.parameters.requestInputs; + } + if(this.input_parameters.service.parameters.resources!=undefined && this.input_parameters.service.parameters.resources.length>0){ + this.input_parameters.service.parameters.resources.map((item,i) => { + let nestedTemplates={ + name:null, + vnfs:[] + }; + nestedTemplates.name= item.resourceName; + item.parameters.locationConstraints.map((its,k) => { + nestedTemplates.vnfs.push({ + "vf_location":its.locationConstraints.cloudOwner + }) + }); + this.e2e_nestedTemplates.push(nestedTemplates); + + let nsIndex={ + "name": "ns", + "type": "ns", + "children": [] + }; + nsIndex.children=item.parameters.locationConstraints.map((itemits,index) => { + return { + "name": "vnf", + "type": "vnf", + } + }); + this.roote2e.children.push(nsIndex); + }); + console.log(this.e2e_nestedTemplates); + console.log(this.e2e_requestInputs); + console.log(this.roote2e) + } + }else if(this.detailParams.serviceDomain == 'Network Service'){ + this.ns_service = { + name:this.detailParams.name, + description: this.detailParams.description, + }; + if(this.detailParams.requestInputs!=undefined && Object.keys(this.detailParams.requestInputs).length>0){ + this.ns_requestInputs = this.detailParams.requestInputs; + } + this.ns_nestedTemplates = this.detailParams.vnfInfo; + this.rootns.children=this.ns_nestedTemplates.map((item,index) => { + return { + "name": "vnf", + "type": "vnf", + } + }); + console.log(this.ns_nestedTemplates); + console.log(this.ns_requestInputs); + console.log(this.rootns) } - ] - } + this.drawImage(this.detailParams.serviceDomain) + } - imgmap = { - '1': './assets/images/create-e2e.png', - '2': './assets/images/create-ns.png', - '3': './assets/images/create-vnf.png', - }; + goback() { + this.closeDetail.emit(); + } drawImage(type) { if (type == "E2E Service") { @@ -129,7 +167,6 @@ export class E2eDetailComponent implements OnInit { .projection(function (d) { return [d.x-18, d.y+40]; }); - console.log(diagonal) var svg = d3.select("svg"); //marker |