diff options
Diffstat (limited to 'usecaseui-portal/src/app/views/services/services-list/services-list.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/views/services/services-list/services-list.component.ts | 226 |
1 files changed, 148 insertions, 78 deletions
diff --git a/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts b/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts index 88d99b3a..8b0f5ca1 100644 --- a/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts +++ b/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts @@ -240,7 +240,41 @@ export class ServicesListComponent implements OnInit { return vnfInfo; }) } - } else { + } else if(item["serviceDomain"] === "MDONS") { + if (item["relationship-list"] && item["relationship-list"]["relationship"]) { + let domainServiceList = []; + + for(let i = 0; i < item["relationship-list"]["relationship"].length; i++){ + let domainServiceInfo = { + domainServiceRealtedTo:"", + domainServiceId:"", + domainServiceName:"", + logicalLinkName:"" + } + + if(item["relationship-list"]["relationship"][i]["related-to"] === 'service-instance') { + domainServiceInfo.domainServiceRealtedTo = "Domain Service Instance"; + domainServiceInfo.domainServiceName = item["relationship-list"]["relationship"][i]["related-to-property"][0]["property-value"]; + } else if(item["relationship-list"]["relationship"][i]["related-to"] === 'logical-link'){ + domainServiceInfo.domainServiceRealtedTo = "Logical Link"; + } + let relationshipdata = item["relationship-list"]["relationship"][i]["relationship-data"]; + for (let j=0;j< relationshipdata.length;j++ ) { + if(relationshipdata[j]["relationship-key"] === "service-instance.service-instance-id"){ + domainServiceInfo.domainServiceId = relationshipdata[j]["relationship-value"]; + } + if(relationshipdata[j]["relationship-key"] === "logical-link.link-name"){ + domainServiceInfo.logicalLinkName = relationshipdata[j]["relationship-value"]; + } + } + + domainServiceList.splice(i,0,domainServiceInfo); + } + item["childServiceInstances"]= domainServiceList; + } else { + item["childServiceInstances"] = []; + } + } else{ item["childServiceInstances"] = []; } @@ -330,41 +364,46 @@ export class ServicesListComponent implements OnInit { } } return item; - }) + }); + this.serviceNunber.map(item=>{ + item["Success"] = 0; + item["failed"] = 0; + item["InProgress"] = 0; + }); this.tableData.forEach(item => { if (item.serviceDomain === 'E2E Service') { - if (item.operationResult === 2001) { + if (Number(item.operationResult) === 2001) { this.serviceNunber[0]["Success"] += 1; - } else if (item.operationResult === 2002) { + } else if (Number(item.operationResult) === 2002) { this.serviceNunber[0]["failed"] += 1; - } else if (item.operationResult === 2003) { + } else if (Number(item.operationResult) === 2003) { this.serviceNunber[0]["InProgress"] += 1; } } else if (item.serviceDomain === 'Network Service') { - if (item.operationResult === 2001) { + if (Number(item.operationResult) === 2001) { this.serviceNunber[1]["Success"] += 1; - } else if (item.operationResult === 2002) { + } else if (Number(item.operationResult) === 2002) { this.serviceNunber[1]["failed"] += 1; - } else if (item.operationResult === 2003) { + } else if (Number(item.operationResult) === 2003) { this.serviceNunber[1]["InProgress"] += 1; } } else if (item.serviceDomain === 'CCVPN') { - if (item.operationResult === 2001) { + if (Number(item.operationResult) === 2001) { this.serviceNunber[2]["Success"] += 1; - } else if (item.operationResult === 2002) { + } else if (Number(item.operationResult) === 2002) { this.serviceNunber[2]["failed"] += 1; - } else if (item.operationResult === 2003) { + } else if (Number(item.operationResult) === 2003) { this.serviceNunber[2]["InProgress"] += 1; } } else if (item.serviceDomain === 'MDONS') { - if (item.operationResult === "2001") { + if (Number(item.operationResult) === 2001) { this.serviceNunber[3]["Success"] += 1; - } else if (item.operationResult === "2002") { + } else if (Number(item.operationResult) === 2002) { this.serviceNunber[3]["failed"] += 1; - } else if (item.operationResult === "2003") { + } else if (Number(item.operationResult) === 2003) { this.serviceNunber[3]["InProgress"] += 1; } } @@ -479,13 +518,15 @@ export class ServicesListComponent implements OnInit { service["customer"] = this.customerSelected; service["serviceType"] = this.serviceTypeSelected; - service.childServiceInstances.forEach((item) => { - if (item.serviceDomain === "SITE") { - service.siteSer.push(item); - } else if (item.serviceDomain === "SDWAN") { - service.sdwanSer.push(item); - } - }) + if(service.childServiceInstances !== undefined){ + service.childServiceInstances.forEach((item) => { + if (item.serviceDomain === "SITE") { + service.siteSer.push(item); + } else if (item.serviceDomain === "SDWAN") { + service.sdwanSer.push(item); + } + }) + } if (service["serviceDomain"] === 'CCVPN' || service["serviceDomain"] === 'SOTN') { this.detailCCVPNShow = true; if (typeNum === 1) { @@ -518,9 +559,9 @@ export class ServicesListComponent implements OnInit { if (this.thisService["serviceDomain"] === "Network Service") { this.deleteNsService(obj, this.thisService); } else { - this.deleteService(this.thisService, templateDeleteSuccessFaild); + this.deleteService(this.thisService); } - this.notification1.notificationStart(this.thisService['serviceDomain'], 'deleteStarting', this.thisService["service-instance-name"] || this.thisService["nsInstanceName"]) + this.notification1.notificationStart(this.thisService['serviceDomain'], 'InstanceTeminationStarting', this.thisService["service-instance-name"] || this.thisService["nsInstanceName"]) } deleteSuccessNotification(template: TemplateRef<{}>): void { @@ -537,14 +578,20 @@ export class ServicesListComponent implements OnInit { //ccvpn sotn createservice parentServiceInstanceId = ""; - thisCreateService = {}; - - closeCreate(obj, templateCreatestarting, templateCreateSuccessFaild) { + closeCreate(obj) { if (!obj) { this.createshow = false; //close this.listDisplay = false; //close return false; } + this.pageIndex = 1; + this.customerList.map(item=>{ + if(item.id === obj.service.globalSubscriberId){ + this.customerSelected = Object.assign({},item) + } + }); + this.serviceTypeSelected = { name: obj.service.serviceType }; + this.getTableData(); this.createshow = false; this.listDisplay = false; this.loadingAnimateShow = true; @@ -553,7 +600,7 @@ export class ServicesListComponent implements OnInit { let createParams = "?customerId=" + this.createData['commonParams'].customer.id + "&serviceType=" + this.createData['commonParams'].serviceType.name + "&serviceDomain=" + this.createData['commonParams'].templateType; - this.createService(obj, createParams, templateCreatestarting, templateCreateSuccessFaild).then((data) => { + this.createService(obj, createParams).then((data) => { this.loadingAnimateShow = false; newData = { //Newly created service data in the main form 'service-instance-id': data["serviceId"], @@ -565,9 +612,8 @@ export class ServicesListComponent implements OnInit { statusClass: 1001, tips: "" }; - this.thisCreateService = newData; this.tableData = [newData, ...this.tableData]; - this.createNotification(templateCreatestarting); + this.notification1.notificationStart(newData['serviceDomain'], 'InstanceCreationStarting', newData["service-instance-name"] || newData["nsInstanceName"]); let updata = (prodata) => { newData.rate = prodata.progress; newData.tips = this.listSortMasters["operationTypes"].find((its) => { @@ -584,10 +630,9 @@ export class ServicesListComponent implements OnInit { let queryParams = { serviceId: data["serviceId"], operationId: data["operationId"], operationType: "1001" }; return this.queryProgress(queryParams, updata); }).then((data) => { - newData.rate = 100; newData.status = "Successful"; - this.createSuccessNotification(templateCreateSuccessFaild); + this.notification1.notificationSuccess(newData.serviceDomain, 'InstanceCreatedSuccessfully', newData["service-instance-name"] || newData["nsInstanceName"]); newData.tips = this.listSortMasters["operationTypes"].find((its) => { return its["sortCode"] == newData["statusClass"] && its["language"] == this.language })["sortValue"] + '\xa0\xa0\xa0' + this.listSortMasters["operationResults"].find((its) => { @@ -604,12 +649,20 @@ export class ServicesListComponent implements OnInit { }) } - mdonsCloseCreate(obj, templateCreatestarting, templateCreateSuccessFaild) { + mdonsCloseCreate(obj) { if (!obj) { this.showCreateMDONS = false; // this.listDisplay = false; // return false; } + this.pageIndex = 1; + this.customerList.map(item=>{ + if(item.id === obj.service.globalSubscriberId){ + this.customerSelected = Object.assign({},item) + } + }); + this.serviceTypeSelected = { name: obj.service.serviceType }; + this.getTableData(); this.showCreateMDONS = false; // this.listDisplay = false; // this.loadingAnimateShow = true; @@ -620,7 +673,7 @@ export class ServicesListComponent implements OnInit { "&parentServiceInstanceId=" + "&uuid=" + obj.service.serviceUuid + "&invariantUuuid=" + obj.service.serviceInvariantUuid; - this.createService(obj, createParams, templateCreatestarting, templateCreateSuccessFaild).then((data) => { + this.createService(obj, createParams).then((data) => { this.loadingAnimateShow = false; newData = { 'service-instance-id': data["serviceId"], @@ -635,15 +688,12 @@ export class ServicesListComponent implements OnInit { if (data == "FAILED") { newData.status = "Failed"; newData.tips = "Unavailable"; - this.thisCreateService = newData; this.tableData = [newData, ...this.tableData]; - this.createNotification(templateCreateSuccessFaild); + this.notification1.notificationFailed(newData.serviceDomain, 'InstanceCreationFailed', newData["service-instance-name"] || newData["nsInstanceName"]); return false; } - - this.thisCreateService = newData; this.tableData = [newData, ...this.tableData]; - this.createNotification(templateCreatestarting); + this.notification1.notificationStart(newData['serviceDomain'], 'InstanceCreationStarting', newData["service-instance-name"] || newData["nsInstanceName"]); let updata = (prodata) => { newData.rate = prodata.progress; newData.tips = this.listSortMasters["operationTypes"].find((its) => { @@ -665,7 +715,7 @@ export class ServicesListComponent implements OnInit { } newData.rate = 100; newData.status = "Successful"; - this.createSuccessNotification(templateCreateSuccessFaild); + this.notification1.notificationSuccess(newData.serviceDomain, 'InstanceCreatedSuccessfully', newData["service-instance-name"] || newData["nsInstanceName"]); newData.tips = this.listSortMasters["operationTypes"].find((its) => { return its["sortCode"] == newData["statusClass"] && its["language"] == this.language })["sortValue"] + '\xa0\xa0\xa0' + this.listSortMasters["operationResults"].find((its) => { @@ -683,12 +733,20 @@ export class ServicesListComponent implements OnInit { } - e2eCloseCreate(obj, templateCreatestarting, templateCreateSuccessFaild) { + e2eCloseCreate(obj) { if (!obj) { this.createshow2 = false; // this.listDisplay = false; // return false; } + this.pageIndex = 1; + this.customerList.map(item=>{ + if(item.id === obj.service.globalSubscriberId){ + this.customerSelected = Object.assign({},item) + } + }); + this.serviceTypeSelected = { name: obj.service.serviceType }; + this.getTableData(); this.createshow2 = false; // this.listDisplay = false; // this.loadingAnimateShow = true; @@ -699,7 +757,7 @@ export class ServicesListComponent implements OnInit { "&parentServiceInstanceId=" + "&uuid=" + obj.service.serviceUuid + "&invariantUuuid=" + obj.service.serviceInvariantUuid; - this.createService(obj, createParams, templateCreatestarting, templateCreateSuccessFaild).then((data) => { + this.createService(obj, createParams).then((data) => { this.loadingAnimateShow = false; newData = { // 'service-instance-id': data["serviceId"], @@ -710,10 +768,15 @@ export class ServicesListComponent implements OnInit { statusClass: 1001, rate: 0, tips: "" - } - this.thisCreateService = newData; + }; this.tableData = [newData, ...this.tableData]; - this.createNotification(templateCreatestarting); + this.notification1.notificationStart(newData['serviceDomain'], 'InstanceCreationStarting', newData["service-instance-name"] || newData["nsInstanceName"]); + // if (data.status === "FAILED") { + // newData.status = "Failed"; + // this.notification1.notificationFailed(newData.serviceDomain, 'InstanceCreationFailed', newData["service-instance-name"] || newData["nsInstanceName"]); + // this.getTableData(); + // return false; + // } let updata = (prodata) => { newData.rate = prodata.progress; newData.tips = this.listSortMasters["operationTypes"].find((its) => { @@ -732,7 +795,7 @@ export class ServicesListComponent implements OnInit { }).then((data) => { newData.rate = 100; newData.status = "Successful"; - this.createSuccessNotification(templateCreateSuccessFaild); + this.notification1.notificationSuccess(newData.serviceDomain, 'InstanceCreatedSuccessfully', newData["service-instance-name"] || newData["nsInstanceName"]); newData.tips = this.listSortMasters["operationTypes"].find((its) => { return its["sortCode"] == newData["statusClass"] && its["language"] == this.language })["sortValue"] + '\xa0\xa0\xa0' + this.listSortMasters["operationResults"].find((its) => { @@ -750,12 +813,20 @@ export class ServicesListComponent implements OnInit { } - nsCloseCreate(obj, templateCreatestarting, templateCreateSuccessFaild) { + nsCloseCreate(obj) { if (!obj) { this.createshow2 = false; // this.listDisplay = false; // return false; } + this.pageIndex = 1; + this.customerList.map(item=>{ + if(item.id === obj.step1.context.globalCustomerId){ + this.customerSelected = Object.assign({},item) + } + }); + this.serviceTypeSelected = { name: obj.step1.context.serviceType }; + this.getTableData(); this.createshow2 = false; // this.listDisplay = false; // this.loadingAnimateShow = true; @@ -774,12 +845,12 @@ export class ServicesListComponent implements OnInit { rate: 0, tips: "" } - this.thisCreateService = newData; this.tableData = [newData, ...this.tableData]; - this.createNotification(templateCreatestarting); - if (data.status == "FAILED") { + this.notification1.notificationStart(newData['serviceDomain'], 'InstanceCreationStarting', newData["service-instance-name"] || newData["nsInstanceName"]); + if (data.status === "FAILED") { newData.status = "Failed"; - this.createSuccessNotification(templateCreateSuccessFaild); + this.notification1.notificationFailed(newData.serviceDomain, 'InstanceCreationFailed', newData["service-instance-name"] || newData["nsInstanceName"]); + this.getTableData(); return false; } let createParams = "?ns_instance_id=" + data.nsInstanceId + @@ -789,16 +860,15 @@ export class ServicesListComponent implements OnInit { "&parentServiceInstanceId="; // step2 this.createNsService(createParams, obj.step2).then((jobid) => { - if (jobid == "Failed") { + if (jobid === "Failed") { newData.status = "Failed"; - this.thisCreateService = newData; - this.createSuccessNotification(templateCreateSuccessFaild); newData.tips = this.listSortMasters["operationTypes"].find((its) => { return its["sortCode"] == newData["statusClass"] && its["language"] == this.language })["sortValue"] + '\xa0\xa0\xa0' + this.listSortMasters["operationResults"].find((its) => { return its["sortCode"] == 2002 && its["language"] == this.language })["sortValue"]; - return false; + this.notification1.notificationFailed(newData.serviceDomain, 'InstanceCreationFailed', newData["service-instance-name"] || newData["nsInstanceName"]); + return ; } let operationType = "1001"; let updata = (prodata) => { @@ -815,30 +885,29 @@ export class ServicesListComponent implements OnInit { } } - return this.queryNsProgress(jobid, newData["service-instance-id"], updata, operationType); - }).then((data) => { - newData.rate = 100; - newData.status = "Successful"; - this.thisCreateService = newData; - this.createSuccessNotification(templateCreateSuccessFaild); - newData.tips = this.listSortMasters["operationTypes"].find((its) => { - return its["sortCode"] == newData["statusClass"] && its["language"] == this.language - })["sortValue"] + '\xa0\xa0\xa0' + this.listSortMasters["operationResults"].find((its) => { - return its["sortCode"] == 2001 && its["language"] == this.language - })["sortValue"]; - let hasUndone = this.tableData.some((item) => { - return item.rate < 100; + this.queryNsProgress(jobid, newData["service-instance-id"], updata, operationType).then((data) => { + newData.rate = 100; + newData.status = "Successful"; + this.notification1.notificationSuccess(newData.serviceDomain, 'InstanceCreatedSuccessfully', newData["service-instance-name"] || newData["nsInstanceName"]); + newData.tips = this.listSortMasters["operationTypes"].find((its) => { + return its["sortCode"] == newData["statusClass"] && its["language"] == this.language + })["sortValue"] + '\xa0\xa0\xa0' + this.listSortMasters["operationResults"].find((its) => { + return its["sortCode"] == 2001 && its["language"] == this.language + })["sortValue"]; + let hasUndone = this.tableData.some((item) => { + return item.rate < 100; + }) + if (!hasUndone) { + setTimeout(() => { + this.getTableData(); + }, 1000) + } }) - if (!hasUndone) { - setTimeout(() => { - this.getTableData(); - }, 1000) - } }) }) } - createService(requestBody, createParams, templateCreatestarting, templateCreateSuccessFaild) { + createService(requestBody, createParams) { let mypromise = new Promise((res, rej) => { this.myhttp.createInstance(requestBody, createParams) .subscribe((data) => { @@ -1027,7 +1096,7 @@ export class ServicesListComponent implements OnInit { }) } - deleteService(service: any, templateDeleteSuccessFaild) { + deleteService(service: any) { let allprogress = {}; let querypros = []; service.rate = 0; @@ -1052,6 +1121,7 @@ export class ServicesListComponent implements OnInit { })["sortValue"] + '\xa0\xa0\xa0' + this.listSortMasters["operationResults"].find((its) => { return its["sortCode"] == 2002 && its["language"] == this.language })["sortValue"]; + this.notification1.notificationFailed(service.serviceDomain, 'InstanceTeminationFailed', service["service-instance-name"] || service["nsInstanceName"]) return false; } let obj = { @@ -1089,7 +1159,7 @@ export class ServicesListComponent implements OnInit { })["sortValue"] + this.listSortMasters["operationResults"].find((its) => { return its["sortCode"] == 2001 && its["language"] == this.language })["sortValue"]; - this.deleteSuccessNotification(templateDeleteSuccessFaild); + this.notification1.notificationSuccess(service.serviceDomain, 'InstanceTeminatedSuccessfully', service["service-instance-name"] || service["nsInstanceName"]) let hasUndone = this.tableData.some((item) => { return item.rate < 100; }) @@ -1112,7 +1182,7 @@ export class ServicesListComponent implements OnInit { this.stopNsService(id, obj).then((jobid) => { if (jobid === "Failed") { service.status = "Failed"; - this.notification1.notificationFailed(service.serviceDomain, 'deleteStarting', service["service-instance-name"] || service["nsInstanceName"]) + this.notification1.notificationFailed(service.serviceDomain, 'InstanceTeminationFailed', service["service-instance-name"] || service["nsInstanceName"]) service.tips = this.listSortMasters["operationTypes"].find((its) => { return its["sortCode"] == service.statusClass && its["language"] == this.language })["sortValue"] + this.listSortMasters["operationResults"].find((its) => { @@ -1141,7 +1211,7 @@ export class ServicesListComponent implements OnInit { })["sortValue"] + this.listSortMasters["operationResults"].find((its) => { return its["sortCode"] == 2001 && its["language"] == this.language })["sortValue"]; - this.notification1.notificationSuccess(service.serviceDomain, 'deleteStarting', service["service-instance-name"] || service["nsInstanceName"]) + this.notification1.notificationSuccess(service.serviceDomain, 'InstanceTeminatedSuccessfully', service["service-instance-name"] || service["nsInstanceName"]) } else { service.status = "Failed"; service.tips = this.listSortMasters["operationTypes"].find((its) => { @@ -1149,7 +1219,7 @@ export class ServicesListComponent implements OnInit { })["sortValue"] + this.listSortMasters["operationResults"].find((its) => { return its["sortCode"] == 2002 && its["language"] == this.language })["sortValue"]; - this.notification1.notificationFailed(service.serviceDomain, 'deleteStarting', service["service-instance-name"] || service["nsInstanceName"]) + this.notification1.notificationFailed(service.serviceDomain, 'InstanceTeminationFailed', service["service-instance-name"] || service["nsInstanceName"]) return false; } let hasUndone = this.tableData.some((item) => { |