From fff849f2f8336212b51194f8141de27c4f38ed36 Mon Sep 17 00:00:00 2001 From: guochuyicmri Date: Sun, 5 May 2019 14:18:30 +0800 Subject: Fix instance instantiation for NS/E2E Change-Id: Ic95e9c067f324b3447c6fded01acfa34b4bc1551 Issue-ID: USECASEUI-252 Signed-off-by: guochuyicmri --- .../e2e-creation/e2e-creation.component.css | 2 +- .../e2e-creation/e2e-creation.component.html | 106 ++++++--------------- .../e2e-creation/e2e-creation.component.ts | 98 ++++++++----------- 3 files changed, 69 insertions(+), 137 deletions(-) diff --git a/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.css b/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.css index f1d359f0..5dce6c92 100644 --- a/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.css +++ b/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.css @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 CMCC, Inc. and others. All rights reserved. + Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.html b/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.html index d85eb167..79b3e371 100644 --- a/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.html +++ b/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.html @@ -35,60 +35,9 @@
  • Description:
  • COS:
  • EBS:
  • -
  • - checkbox - -
    -
    -
    -
    -
    -
  • - - -
    -

    VNF1

    -
      -
    • Name:
    • -
    • Description:
    • -
    • - radio button - - -
      - -
      -
    • -
    • - pull down: - - - - - - -
    • -
    -
    -
    -

    VNF2

    -
      -
    • Name:
    • -
    • Description:
    • -
    • - radio button - - -
      - -
      -
    -
    +

    template Inputs

    • @@ -108,29 +57,31 @@ -->
    -

    nestedTemplate Inputs

    -
    -

    templateName: {{template.name}}

    -
      -
    • - {{input.name}}: - +
    +
    +

    {{template.name}}

    +
      +
    • + {{input.name}}: + -
      id: {{input.name}}
      - vf_location: - - - - -
    • -
    -
    +
    id: {{input.name}}
    + vf_location: + + + + + + + + + + +
    @@ -142,8 +93,7 @@
  • Description:
  • -
    -

    Template Parameters

    +

    template Inputs

    • @@ -163,9 +113,9 @@ -->
    - +
    +

    vnfs Inputs

    -
    • id: {{vnf.vnf_id}}
      diff --git a/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.ts b/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.ts index 3d2bfc57..b025e880 100644 --- a/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.ts +++ b/usecaseui-portal/src/app/components/e2e-creation/e2e-creation.component.ts @@ -59,6 +59,23 @@ export class E2eCreationComponent implements OnInit { inputs2:[], vnfs:[] } + 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', + }; getTemParameters(){ //Get template parameters let type = this.createParams.commonParams.templateType == "E2E Service" ? "e2e" : "ns"; this.myhttp.getTemplateParameters(type,this.createParams.template) @@ -70,6 +87,22 @@ export class E2eCreationComponent implements OnInit { this.templateParameters.nestedTemplates.forEach((item)=>{ item.inputs = item.inputs.filter((input)=>{return input.type !== "sdn_controller"}); }) + this.templateParameters.nestedTemplates.map((item,index) => { + let nsIndex={ + "name": "ns", + "type": "ns", + "children": [] + }; + nsIndex.children=item.nestedTemplates.map((item,index) => { + return { + "name": "vnf", + "type": "vnf", + } + }); + this.roote2e.children.push(nsIndex); + }); + console.log(this.templateParameters); + console.log(this.roote2e) }else if(type == "ns"){ if(typeof data["model"]=='string'){ this.nsTemplateParameters = JSON.parse(data["model"]); @@ -81,6 +114,12 @@ export class E2eCreationComponent implements OnInit { for(let key in inputs){ this.nsTemplateParameters["inputs2"].push({name:key,type:inputs[key].type,value:inputs[key].value}) } + this.rootns.children=this.nsTemplateParameters.vnfs.map((item,index) => { + return { + "name": "vnf", + "type": "vnf", + } + }); console.log(this.nsTemplateParameters); } @@ -217,64 +256,7 @@ export class E2eCreationComponent implements OnInit { this.e2eCloseCreate.emit(); } - 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", - } - ] - }] - } - - rootns = { - "name": "ns", - "type": "ns", - "children": - [ - { - "name": "vnf", - "type": "vnf", - }, - { - "name": "vnf", - "type": "vnf", - } - ] - } - - imgmap = { - '1': './assets/images/create-e2e.png', - '2': './assets/images/create-ns.png', - '3': './assets/images/create-vnf.png', - }; + drawImage(type) { if (type == "e2e") { -- cgit 1.2.3-korg