aboutsummaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2019-05-24 09:33:28 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2019-05-24 09:33:33 +0800
commitf63ac5da45f5e99f2034cbadbc79cc466e9f28eb (patch)
tree55dbe5c5474db2f9a98f1dfd578903ed97098763 /usecaseui-portal/src
parent1321f2095d4259a2b985030702f713d95feee715 (diff)
Fix instance detail for CCVPN
Change-Id: I98ed4cd2f5a454ba22353fd8364be82ed0aaee76 Issue-ID: USECASEUI-222 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src')
-rw-r--r--usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.html6
-rw-r--r--usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.ts161
2 files changed, 127 insertions, 40 deletions
diff --git a/usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.html b/usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.html
index 44646234..8a3a73a1 100644
--- a/usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.html
+++ b/usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.html
@@ -202,6 +202,10 @@
<td>{{item.sdwanvpn_topology}}</td>
<td>
<span class="action" (click)="showstonVpnDetail(i+1)"><i class="anticon anticon-bars"></i></span>
+ <span class="action" (click)="editUpdateSotnVpn(i+1)" *ngIf="sotnvpnnum[i]"><i class="anticon anticon-edit"></i></span>
+ &nbsp;
+ <span class="action" (click)="deleteUpdateSotnVpn(i+1)" *ngIf="upDateShow"><i
+ class="anticon anticon-delete"></i></span>
</td>
</tr>
</tbody>
@@ -212,7 +216,7 @@
<div class="site">
<div style="height: 10px">
<h3 style="float: left;color: #3C4F8C">Site List</h3>
- <button nz-button *ngIf="upDateShow" (click)="addSite()" class="addListBtn"
+ <button nz-button *ngIf="upDateShow" (click)="updateSite()" class="addListBtn"
style="float: right;margin-right: 10px"><i class="anticon anticon-plus"
style="transform: scale(1.2);font-weight: 700"></i>{{"i18nTextDefine_Add" | translate}}
</button>
diff --git a/usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.ts b/usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.ts
index f599e82b..1af2b437 100644
--- a/usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.ts
+++ b/usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.ts
@@ -59,6 +59,8 @@ export class CcvpnDetailComponent implements OnInit {
sdwansitewan_list: []
}
};
+ bodyTemplateParameter = {};
+
// SOTN VPN List
sotnVpnTableData = [];
sotnInfo = {};//sotnmodel The first part of sotnInfo
@@ -94,48 +96,68 @@ export class CcvpnDetailComponent implements OnInit {
serviceUuid: this.input_parameters.service["serviceUuid"]
};
let inputs = this.input_parameters.service.parameters.requestInputs;
- //筛选 分离 sotnvpn数据
- inputs["sdwanvpnresource_list"].map((item, index) => {
- this.sotnVpnTableData.push(item);
- this.sotnvpnnum.push(false);
- });
- let sdwanvpnresource_list = inputs["sdwanvpnresource_list"][0];
- Object.keys(sdwanvpnresource_list).forEach((its) => {
- let input = {};
- if(its =="sdwansitelan_list"){
- this.templateParameters["sotnvpn"]["sdwansitelan_list"] = sdwanvpnresource_list[its]
- }else if(its !="sdwansitelan_list"){
- input[its] = sdwanvpnresource_list[its];
- this.templateParameters["sotnvpn"]["sdwanvpnresource_list"].push(input);
+ Object.keys(inputs).map((items) => {
+ if (items.search("vpn") != -1) {
+ this.bodyTemplateParameter[items] = [];
+ inputs[items].map((item, index) => {
+ this.sotnVpnTableData.push(item);
+ this.sotnvpnnum.push(false);
+ });
+ let sdwanvpnresource_list = inputs[items][0];
+ Object.keys(sdwanvpnresource_list).forEach((its) => {
+ let input = {};
+ if(its.search("sitelan") != -1 && sdwanvpnresource_list[its] instanceof Array === true){
+ Object.keys(sdwanvpnresource_list[its][0]).forEach((i) => {
+ let input1 = {};
+ input1[i] = sdwanvpnresource_list[its][i];
+ this.templateParameters["sotnvpn"]["sdwansitelan_list"].push(input1);
+ })
+ let sitelanKey = {};
+ sitelanKey[its] = [];
+ console.log(123456)
+ this.bodyTemplateParameter[items].push(sitelanKey);
+ }
+ if(its.search("sitelan") == -1 && sdwanvpnresource_list[its] instanceof Array === false){
+ input[its] = sdwanvpnresource_list[its];
+ this.templateParameters["sotnvpn"]["sdwanvpnresource_list"].push(input);
+ }
+ });
}
- });
-
- console.log( this.templateParameters.sotnvpn);
- console.log(this.sotnVpnTableData);
-
- //筛选 分离 site数据
- inputs["sdwansiteresource_list"].map((item, index) => {
- this.siteTableData.push(item);
- this.sitenum.push(false);
- });
+ if (items.search("site") != -1) {
+ this.bodyTemplateParameter[items] = [];
+ inputs[items].map((item, index) => {
+ this.siteTableData.push(item);
+ this.sitenum.push(false);
+ });
+ let sdwansiteresource_list = inputs[items][0];
+ Object.keys(sdwansiteresource_list).forEach((its) => {
+ let input2 = {};
+ if(its.search("device") != -1 && sdwansiteresource_list[its] instanceof Array === true){
+ Object.keys(sdwansiteresource_list[its][0]).forEach((i) => {
+ let input1 = {};
+ input1[i] = sdwansiteresource_list[its][i];
+ this.templateParameters["site"]["sdwandevice_list"].push(input1);
+ })
+ let sitelanKey = {};
+ sitelanKey[its] = [];
+ this.bodyTemplateParameter[items].push(sitelanKey);
+ }
+ if(its.search("site") != -1 && sdwansiteresource_list[its] instanceof Array === true){
+ this.templateParameters["site"]["sdwansitewan_list"][0] = sdwansiteresource_list[its][0];
+ let sitelanKey = {};
+ sitelanKey[its] = [];
+ this.bodyTemplateParameter[items].push(sitelanKey);
+ }
+ if(its.search("device") == -1 && sdwansiteresource_list[its] instanceof Array === false){
+ input2[its] = sdwansiteresource_list[its];
+ this.templateParameters["site"]["sdwansiteresource_list"].push(input2);
+ }
+ });
- let sdwansiteresource_list = inputs["sdwansiteresource_list"][0];
- Object.keys(sdwansiteresource_list).forEach((its) => {
- let input2 = {};
- if(its =="sdwandevice_list"){
- Object.keys(sdwansiteresource_list[its][0]).forEach((i) => {
- let input1 = {};
- input1[i] = sdwansiteresource_list[its][i];
- this.templateParameters["site"]["sdwandevice_list"].push(input1);
- })
- }else if(its =="sdwansitewan_list"){
- this.templateParameters["site"]["sdwansitewan_list"] = sdwansiteresource_list[its]
- }else if(its !="sdwandevice_list" && its !="sdwansitewan_list"){
- input2[its] = sdwansiteresource_list[its];
- this.templateParameters["site"]["sdwansiteresource_list"].push(input2);
}
});
+
console.log( this.templateParameters.site);
console.log(this.siteTableData);
@@ -170,6 +192,9 @@ export class CcvpnDetailComponent implements OnInit {
}
});
this.sotnSdwansitelanData.push(this.sotnSdwansitelanParams);
+ this.sotnSdwansitelanData.map((item, index) => {
+ this.tabInputShowSdwansitelan[index] = true;
+ });
}
//Site data, after combining the structure, rendering the template to the page
@@ -702,6 +727,13 @@ export class CcvpnDetailComponent implements OnInit {
}
];
+ modifyJosnKey(json,oddkey,newkey){
+
+ let val=json[oddkey];
+ delete json[oddkey];
+ json[newkey]=val;
+ }
+
submitUpdate() {
let globalCustomerId = this.detailParams.customer.id;
let globalServiceType = this.detailParams.serviceType.name;
@@ -723,8 +755,59 @@ export class CcvpnDetailComponent implements OnInit {
}
}
};
- servicebody.service.parameters.requestInputs.sdwanvpnresource_list = servicebody.service.parameters.requestInputs.sdwanvpnresource_list.concat(this.sotnVpnTableData);
- servicebody.service.parameters.requestInputs.sdwansiteresource_list = servicebody.service.parameters.requestInputs.sdwansiteresource_list.concat(this.siteTableData);
+ console.log(this.bodyTemplateParameter)
+ console.log(this.sotnVpnTableData,"before fixing")
+ console.log(this.siteTableData,'"before fixing"')
+ let siteresource = null, sitewan = null,device = null,vpnresource = null,sitelan = null;
+ Object.keys(this.bodyTemplateParameter).map((item,index) => {
+ if(item.search("site") != -1){
+ siteresource = item;
+ this.bodyTemplateParameter[item].map((items,index) => {
+ if(Object.keys(items)[0].search("site") != -1){
+ sitewan = Object.keys(items)[0]
+ }
+ if(Object.keys(items)[0].search("device") != -1){
+ device = Object.keys(items)[0]
+ }
+ });
+ }
+ if(item.search("vpn") != -1){
+ vpnresource = item;
+ this.bodyTemplateParameter[item].map((items,index) => {
+ if(Object.keys(items)[0].search("site") != -1){
+ sitelan = Object.keys(items)[0]
+ }
+ });
+ }
+ });
+ this.sotnVpnTableData.forEach((item, index) => {
+ Object.keys(item).map((items,index) => {
+ if(items.search("site") != -1 && item[items] instanceof Array === true){
+ this.modifyJosnKey(item,items,sitelan)
+ }
+ });
+ });
+ this.siteTableData.forEach((item, index) => {
+ Object.keys(item).map((items,index) => {
+ if(items.search("site") != -1 && item[items] instanceof Array === true){
+ this.modifyJosnKey(item,items,sitewan)
+ }
+ if(items.search("device") != -1){
+ this.modifyJosnKey(item,items,device)
+ }
+ });
+ });
+ console.log(siteresource,sitewan,device,vpnresource,sitelan);
+ console.log(this.sotnVpnTableData,"After modification")
+ console.log(this.siteTableData,"After modification")
+ Object.keys(this.bodyTemplateParameter).map((item,index) => {
+ if(item.search("site") != -1){
+ servicebody.service.parameters.requestInputs[item] = [].concat(this.siteTableData);
+ }
+ if(item.search("vpn") != -1){
+ servicebody.service.parameters.requestInputs[item] = [].concat(this.sotnVpnTableData);
+ }
+ });
console.log(servicebody);
this.closeUpdate.emit(servicebody);
}