summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/services/services-list
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2019-04-30 11:05:47 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2019-04-30 11:31:10 +0800
commit155cbcf3ecc4157466dee09fe384787d65d58269 (patch)
tree6e21f29b894d7f36ae509e196dce02e8f6f46bc4 /usecaseui-portal/src/app/services/services-list
parent5978085f3b08b836e9db75c83791379b1592dd93 (diff)
Fix instance instantiation for CCVPN
Change-Id: I4261d248704e498565e8337ea5672b16e89e1f8f Issue-ID: USECASEUI-220 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/services/services-list')
-rw-r--r--usecaseui-portal/src/app/services/services-list/services-list.component.html1
-rw-r--r--usecaseui-portal/src/app/services/services-list/services-list.component.ts153
2 files changed, 44 insertions, 110 deletions
diff --git a/usecaseui-portal/src/app/services/services-list/services-list.component.html b/usecaseui-portal/src/app/services/services-list/services-list.component.html
index bb8e5140..f3378d03 100644
--- a/usecaseui-portal/src/app/services/services-list/services-list.component.html
+++ b/usecaseui-portal/src/app/services/services-list/services-list.component.html
@@ -335,7 +335,6 @@
<div class="createComponent" *ngIf="createshow">
<app-ccvpn-creation
[createParams]="createData"
- [namesTranslate]="namesTranslate"
(closeCreate)="closeCreate($event)">
</app-ccvpn-creation>
</div>
diff --git a/usecaseui-portal/src/app/services/services-list/services-list.component.ts b/usecaseui-portal/src/app/services/services-list/services-list.component.ts
index bf1d5d00..0c5c26a9 100644
--- a/usecaseui-portal/src/app/services/services-list/services-list.component.ts
+++ b/usecaseui-portal/src/app/services/services-list/services-list.component.ts
@@ -551,120 +551,55 @@ export class ServicesListComponent implements OnInit {
this.listDisplay = false;
console.log(obj);
let newData; //Newly created service data for the main table
- let stageNum = 0; //Different stages of progress, used to add up subsequent service progress;
- let createParams = "?customerId="+this.customerSelected.id +
- "&serviceType="+this.serviceTypeSelected2.name +
- "&serviceDomain="+this.templateTypeSelected +
- "&parentServiceInstanceId=";
- this.createService(obj.vpnbody,createParams).then((data)=>{
- console.log(data)
- this.parentServiceInstanceId = data["serviceId"]; //------------updata parentServiceInstanceId
- newData = { //
- 'service-instance-id':data["serviceId"],
- 'service-instance-name':obj.vpnbody.service.name,
- serviceDomain:this.templateTypeSelected,
- childServiceInstances:[],
- status:"In Progress",
- rate:0,
- statusClass:1001,
- tips:""
- };
- this.tableData = [newData,...this.tableData];
- let updata = (prodata)=>{
- newData.rate = Math.floor(prodata.progress/3);
- newData.tips = this.listSortMasters["operationTypes"].find((its)=>{ return its["sortCode"]==newData["statusClass"] && its["language"]==this.language})["sortValue"]+newData.rate+"%";
- if(newData["rate"] > 100){
- newData["status"]=prodata.status;
- newData.tips = this.listSortMasters["operationTypes"].find((its)=>{ return its["sortCode"]==newData["statusClass"] && its["language"]==this.language})["sortValue"]+'\xa0\xa0\xa0'+newData["status"];
- }
- }
- let queryParams = {serviceId:data["serviceId"],operationId:data["operationId"],operationType:"1001"};
- return this.queryProgress(queryParams,updata);
- }).then((data)=>{
- console.log(data);
- stageNum = newData.rate; //Phase progress value update;
- let allprogress = {}; //
- let querypros = []; //All the query
- // Additional parameters
- let createParams = "?customerId="+this.customerSelected.id +
- "&serviceType="+this.serviceTypeSelected2.name +
- "&serviceDomain="+"SDWAN" +
- "&parentServiceInstanceId="+this.parentServiceInstanceId;
-
- let createPros = obj.groupbody.map((group)=>{ //
- return this.createService(group,createParams).then((data)=>{
- console.log(data);
- let updata = (prodata)=>{
- allprogress[prodata.operationId] = prodata.progress;
- let average = ((arr)=>{return eval(arr.join("+"))/arr.length})(Object.values(allprogress))
- newData.rate = Math.floor(average/3) + stageNum;
- newData.tips = newData["status"]+newData.rate+"%";
- if(newData["rate"] > 100){
- newData["status"]=prodata.status;
- newData.tips =this.listSortMasters["operationTypes"].find((its)=>{ return its["sortCode"]==newData["statusClass"] && its["language"]==this.language})["sortValue"]+'\xa0\xa0\xa0'+newData["status"];
- }
- }
- let queryParams = {serviceId:data["serviceId"],operationId:data["operationId"],operationType:"1001"};
- querypros.push(this.queryProgress(queryParams,updata))
- })
- })
+ let createParams = "?customerId=" + this.customerSelected.id +
+ "&serviceType=" + this.serviceTypeSelected2.name +
+ "&serviceDomain=" + this.templateTypeSelected;
+ this.createService(obj, createParams).then((data) => {
+ console.log(data)
+ newData = { //Newly created service data in the main form
+ 'service-instance-id': data["serviceId"],
+ 'service-instance-name': obj.service.name,
+ serviceDomain: this.templateTypeSelected,
+ childServiceInstances: [],
+ status: "In Progress",
+ rate: 0,
+ statusClass: 1001,
+ tips: ""
+ };
+ this.tableData = [newData, ...this.tableData];
- return new Promise((res)=>{
- Promise.all(createPros).then(()=>{ //All queries in querypros are added only once created
- Promise.all(querypros).then((data)=>{
+ let updata = (prodata) => {
+ newData.rate = prodata.progress;
+ newData.tips = this.listSortMasters["operationTypes"].find((its) => {
+ return its["sortCode"] == newData["statusClass"] && its["language"] == this.language
+ })["sortValue"] + newData.rate + "%";
+ if (newData["rate"] > 100) {
+ newData["status"] = prodata.status;
+ newData.tips = this.listSortMasters["operationTypes"].find((its) => {
+ return its["sortCode"] == newData["statusClass"] && its["language"] == this.language
+ })["sortValue"] + '\xa0\xa0\xa0' + newData["status"];
+ }
+ };
+ let queryParams = {serviceId: data["serviceId"], operationId: data["operationId"]};
+ return this.queryProgress(queryParams, updata);
+ }).then((data) => {
console.log(data);
- res("site--begin");
- })
- })
- })
- }).then((data)=>{
- console.log(data);
- stageNum = newData.rate; //Phase progress value update;
- let allprogress = {};
- let querypros = []; //All the query
- // Additional parameters
- let createParams = "?customerId="+this.customerSelected.id +
- "&serviceType="+this.serviceTypeSelected2.name +
- "&serviceDomain="+"SITE" +
- "&parentServiceInstanceId="+this.parentServiceInstanceId;
- let createPros = obj.sitebody.map((group)=>{
- return this.createService(group,createParams).then((data)=>{
- console.log(data);
- let updata = (prodata)=>{
- allprogress[prodata.operationId] = prodata.progress;
- let average =((arr)=>{return eval(arr.join("+"))/arr.length})(Object.values(allprogress))
- newData.rate = Math.floor(average/3) + stageNum;
- newData.tips = newData["status"]+newData.rate+"%";
- if(newData["rate"] > 100){
- newData["status"]=prodata.status;
- newData.tips =this.listSortMasters["operationTypes"].find((its)=>{ return its["sortCode"]==newData["statusClass"] && its["language"]==this.language})["sortValue"]+'\xa0\xa0\xa0'+newData["status"];
+ newData.rate = 100;
+ newData.status = "Successful";
+ newData.tips = this.listSortMasters["operationTypes"].find((its) => {
+ return its["sortCode"] == newData["statusClass"] && its["language"] == this.language
+ })["sortValue"] + '\xa0\xa0\xa0' + newData["status"];
+ let hasUndone = this.tableData.some((item) => {
+ return item.rate < 100;
+ });
+ if (!hasUndone) {
+ setTimeout(() => {
+ this.getTableData();
+ }, 1000)
}
- }
- let queryParams = {serviceId:data["serviceId"],operationId:data["operationId"], operationType:"1001"};
- querypros.push(this.queryProgress(queryParams,updata))
})
- })
- console.log(createPros);
- Promise.all(createPros).then(()=>{ //
- Promise.all(querypros).then((data)=>{
- console.log(data);
- newData.rate = 100;
- newData.status = "Successful";
- newData.tips =this.listSortMasters["operationTypes"].find((its)=>{ return its["sortCode"]==newData["statusClass"] && its["language"]==this.language})["sortValue"]+'\xa0\xa0\xa0'+newData["status"];
- let hasUndone = this.tableData.some((item)=>{
- return item.rate < 100;
- })
- if(!hasUndone){
- setTimeout(()=>{
- this.getTableData();
- },1000)
- }
- })
- })
- })
-
- }
+ }
e2eCloseCreate(obj){
if(!obj){