summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/ccvpn-creation
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2019-05-15 09:45:28 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2019-05-15 09:45:33 +0800
commit4ae5d325db70282d453a27c6790433e3ff0ed2f9 (patch)
treeb5d2cd08136eb5b64fe9fbf62872b29859de6ebd /usecaseui-portal/src/app/ccvpn-creation
parenta22870df797dd0e52a956e26bba4e1d35d3492ae (diff)
Fix instance instantiation for CCVPN
Change-Id: Idf597d27f6da4e24162b679773f8b3e6267563f9 Issue-ID: USECASEUI-220 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/ccvpn-creation')
-rw-r--r--usecaseui-portal/src/app/ccvpn-creation/ccvpn-creation.component.ts70
1 files changed, 42 insertions, 28 deletions
diff --git a/usecaseui-portal/src/app/ccvpn-creation/ccvpn-creation.component.ts b/usecaseui-portal/src/app/ccvpn-creation/ccvpn-creation.component.ts
index f2f35221..08307fa7 100644
--- a/usecaseui-portal/src/app/ccvpn-creation/ccvpn-creation.component.ts
+++ b/usecaseui-portal/src/app/ccvpn-creation/ccvpn-creation.component.ts
@@ -79,35 +79,49 @@ export class CcvpnCreationComponent implements OnInit {
getccvpnTemParameters(data) { //Get template parameters
console.log(this.createParams);
- let inputs = data["inputs"];
- this.templateParameters.service = {
- name: data.metadata.name,
- description: data.metadata.description,
- serviceInvariantUuid: data.metadata.invariantUUID,
- serviceUuid: data.metadata.UUID
- };
- //Screening separation sotnvpn data
- inputs["vpnresourcelist"].map((item,index) => {
- if(item["required"] !=undefined){
- this.templateParameters["sotnvpn"]["sdwanvpnresource_list"].push(item);
- }
- if (item["sitelanlist"] != undefined && item["sitelanlist"] instanceof Array === true) {
- this.templateParameters["sotnvpn"]["sdwansitelan_list"] = item["sitelanlist"]
- }
- });
+ if (typeof data["model"] == 'string') {
+ data = JSON.parse(data["model"]);
+ }
+ console.log(data);
+ let inputss = data["inputs"];
+ let inputs = {};
+ this.templateParameters.service = {
+ name: data.metadata["name"],
+ description: data.metadata.description,
+ serviceInvariantUuid: data.metadata.invariantUUID,
+ serviceUuid: data.metadata.UUID
+ };
+ //Screening separation sotnvpn data
+ Object.keys(inputss).map((item) => {
+ if (item.search("vpn")) {
+ inputs["vpnresourcelist"] = inputss[item];
+ }
+ if (item.search("site")) {
+ inputs["sitereourcelist"] = inputss[item];
+ }
+ });
+ console.log(inputs);
+ inputs["vpnresourcelist"].map((item, index) => {
+ if (item["required"] != undefined) {
+ this.templateParameters["sotnvpn"]["sdwanvpnresource_list"].push(item);
+ }
+ if(item["required"] == undefined && Object.keys(item).length == 1 && Object.keys(item)[0].search("sitelan") && item[Object.keys(item)[0]] instanceof Array === true){
+ this.templateParameters["sotnvpn"]["sdwansitelan_list"] = item[Object.keys(item)[0]]
+ }
+ });
- //Screening separation site data
- inputs["sitereourcelist"].map((item,index) => {
- if(item["required"] !=undefined){
- this.templateParameters["site"]["sdwansiteresource_list"].push(item);
- }
- if (item["deviceList"] != undefined && item["deviceList"] instanceof Array === true) {
- this.templateParameters["site"]["sdwandevice_list"] = item["deviceList"]
- }
- if (item["sitewanlist"] != undefined && item["sitewanlist"] instanceof Array === true) {
- this.templateParameters["site"]["sdwansitewan_list"] = item["sitewanlist"]
- }
- });
+ //Screening separation site data
+ inputs["sitereourcelist"].map((item, index) => {
+ if (item["required"] != undefined) {
+ this.templateParameters["site"]["sdwansiteresource_list"].push(item);
+ }
+ if(item["required"] == undefined && Object.keys(item).length == 1 && Object.keys(item)[0].search("device") && item[Object.keys(item)[0]] instanceof Array === true){
+ this.templateParameters["site"]["sdwandevice_list"] = item[Object.keys(item)[0]];
+ }
+ if(item["required"] == undefined && Object.keys(item).length == 1 && Object.keys(item)[0].search("sitewan") && item[Object.keys(item)[0]] instanceof Array === true){
+ this.templateParameters["site"]["sdwansitewan_list"] = item[Object.keys(item)[0]];
+ }
+ });
this.showTemParametersSotnVpn();
this.showTemParametersSite();