summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2019-05-23 20:08:02 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2019-05-23 20:08:24 +0800
commit1321f2095d4259a2b985030702f713d95feee715 (patch)
tree6c22b0339b91ec6b4b5e4458a35d84ecce24637b /usecaseui-portal
parentd045d2d97b28dab10805a257e1747e926e43d0fa (diff)
Fix instance instantiation for CCVPN
Change-Id: I2d8a9b4e868bb74d4409540d46ce87e604e17c57 Issue-ID: USECASEUI-220 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
Diffstat (limited to 'usecaseui-portal')
-rw-r--r--usecaseui-portal/src/app/app.component.ts5
-rw-r--r--usecaseui-portal/src/app/ccvpn-creation/ccvpn-creation.component.ts154
-rw-r--r--usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.ts14
-rw-r--r--usecaseui-portal/src/app/homes.service.ts2
4 files changed, 122 insertions, 53 deletions
diff --git a/usecaseui-portal/src/app/app.component.ts b/usecaseui-portal/src/app/app.component.ts
index 01206873..29555943 100644
--- a/usecaseui-portal/src/app/app.component.ts
+++ b/usecaseui-portal/src/app/app.component.ts
@@ -36,9 +36,10 @@ export class AppComponent {
currentloginId = null;
currentLanguage = "en";
currentLanguageGet() {
- this.currentloginId = sessionStorage.getItem("loginId") || null;
+ this.currentloginId = sessionStorage.getItem("userId") || null;
+ console.log(this.currentloginId,"this.currentloginId","loginId");
if (this.currentloginId != null) {
- console.log(this.currentloginId);
+ console.log(this.currentloginId,"this.currentloginId","loginId","you id");
this.myhttp.getCurrentLanguage(this.currentloginId)
.subscribe(
(data) => {
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 12066fca..719dc52e 100644
--- a/usecaseui-portal/src/app/ccvpn-creation/ccvpn-creation.component.ts
+++ b/usecaseui-portal/src/app/ccvpn-creation/ccvpn-creation.component.ts
@@ -58,6 +58,8 @@ export class CcvpnCreationComponent implements OnInit {
}
};
+ bodyTemplateParameter = {};
+
// SOTN VPN List
sotnVpnTableData = [];
sotnInfo = {};//sotnmodel The first part of sotnInfo
@@ -91,38 +93,46 @@ export class CcvpnCreationComponent implements OnInit {
serviceInvariantUuid: data.metadata.invariantUUID,
serviceUuid: data.metadata.UUID
};
+
//Screening separation sotnvpn data
- Object.keys(inputss).map((item) => {
- if (item.search("vpn")!=-1) {
- inputs["vpnresourcelist"] = inputss[item];
+ Object.keys(inputss).map((items) => {
+ if (items.search("vpn") != -1) {
+ this.bodyTemplateParameter[items] = [];
+ inputss[items].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") != -1 && item[Object.keys(item)[0]] instanceof Array === true) {
+ this.templateParameters["sotnvpn"]["sdwansitelan_list"] = item[Object.keys(item)[0]]
+ let sitelanKey = {};
+ sitelanKey[Object.keys(item)[0]] = [];
+ this.bodyTemplateParameter[items].push(sitelanKey);
+ }
+ });
}
- if (item.search("site")!=-1) {
- inputs["sitereourcelist"] = inputss[item];
+ if (items.search("site") != -1) {
+ this.bodyTemplateParameter[items] = [];
+ inputss[items].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") != -1 && item[Object.keys(item)[0]] instanceof Array === true) {
+ this.templateParameters["site"]["sdwandevice_list"] = item[Object.keys(item)[0]];
+ let sitelanKey = {};
+ sitelanKey[Object.keys(item)[0]] = [];
+ this.bodyTemplateParameter[items].push(sitelanKey);
+ }
+ if (item["required"] == undefined && Object.keys(item).length == 1 && Object.keys(item)[0].search("sitewan") != -1 && item[Object.keys(item)[0]] instanceof Array === true) {
+ this.templateParameters["site"]["sdwansitewan_list"] = item[Object.keys(item)[0]];
+ let sitelanKey = {};
+ sitelanKey[Object.keys(item)[0]] = [];
+ this.bodyTemplateParameter[items].push(sitelanKey);
+ }
+ });
}
});
console.log(inputss);
- 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")!=-1 && 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["required"] == undefined && Object.keys(item).length == 1 && Object.keys(item)[0].search("device")!=-1 && 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")!=-1 && item[Object.keys(item)[0]] instanceof Array === true){
- this.templateParameters["site"]["sdwansitewan_list"] = item[Object.keys(item)[0]];
- }
- });
+ console.log(this.bodyTemplateParameter);
this.showTemParametersSotnVpn();
this.showTemParametersSite();
@@ -588,29 +598,87 @@ export class CcvpnCreationComponent implements OnInit {
}
+ modifyJosnKey(json,oddkey,newkey){
+
+ let val=json[oddkey];
+ delete json[oddkey];
+ json[newkey]=val;
+ }
+
// submit createData
submit() {
let globalCustomerId = this.createParams.commonParams.customer.id;
let globalServiceType = this.createParams.commonParams.serviceType.name;
let servicebody={
- name: this.templateParameters.service["name"],
- description: this.templateParameters.service["description"],
- serviceInvariantUuid: this.templateParameters.service["serviceInvariantUuid"],
- serviceUuid:this.templateParameters.service["serviceUuid"],
- globalSubscriberId: globalCustomerId, //customer.id
- serviceType: globalServiceType, //serviceType.value
- parameters: {
- locationConstraints: [
- ],
- },
- resources:[],
- requestInputs: {
- sdwanvpnresource_list:[],
- sdwansiteresource_list:[]
+ service: {
+ name: this.templateParameters.service["name"],
+ description: this.templateParameters.service["description"],
+ serviceInvariantUuid: this.templateParameters.service["serviceInvariantUuid"],
+ serviceUuid: this.templateParameters.service["serviceUuid"],
+ globalSubscriberId: globalCustomerId, //customer.id
+ serviceType: globalServiceType, //serviceType.value
+ parameters: {
+ locationConstraints: [],
+ resources: [],
+ requestInputs: {}
+ },
}
};
- servicebody.requestInputs.sdwanvpnresource_list=servicebody.requestInputs.sdwanvpnresource_list.concat(this.sotnVpnTableData);
- servicebody.requestInputs.sdwansiteresource_list=servicebody.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);
+ }
+ });
+ // 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(servicebody);
this.closeCreate.emit(servicebody);
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 0b138575..f599e82b 100644
--- a/usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.ts
+++ b/usecaseui-portal/src/app/ccvpn-detail/ccvpn-detail.component.ts
@@ -715,16 +715,16 @@ export class CcvpnDetailComponent implements OnInit {
serviceType: globalServiceType, //serviceType.value
parameters: {
locationConstraints: [],
- },
- resources: [],
- requestInputs: {
- sdwanvpnresource_list: [],
- sdwansiteresource_list: []
+ resources: [],
+ requestInputs: {
+ sdwanvpnresource_list: [],
+ sdwansiteresource_list: []
+ }
}
}
};
- servicebody.service.requestInputs.sdwanvpnresource_list = servicebody.service.requestInputs.sdwanvpnresource_list.concat(this.sotnVpnTableData);
- servicebody.service.requestInputs.sdwansiteresource_list = servicebody.service.requestInputs.sdwansiteresource_list.concat(this.siteTableData);
+ 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(servicebody);
this.closeUpdate.emit(servicebody);
}
diff --git a/usecaseui-portal/src/app/homes.service.ts b/usecaseui-portal/src/app/homes.service.ts
index dc0b5cef..04b1199c 100644
--- a/usecaseui-portal/src/app/homes.service.ts
+++ b/usecaseui-portal/src/app/homes.service.ts
@@ -35,7 +35,7 @@ export class HomesService {
home_servicebarpnfData: this.baseUrlbar + "pnf-packages",
sourceNames: this.baseUrl + "/alarm/getSourceNames",
listSortMasters:this.baseUrl+"/listSortMasters",
- currentLanguage:this.baseUrl+"/ONAPPORTAL/auxapi/languageSetting/user/",
+ currentLanguage:"/api/portal-auxapi/languageSetting/user/",
}