From c6dfa07021b6d34063aaa554e53ad40bb68a8793 Mon Sep 17 00:00:00 2001 From: cyuamber Date: Tue, 28 Apr 2020 19:02:23 +0800 Subject: fix: Fix the bug the create model msg info of services-list Change-Id: I4f6e57b5a731524258c511316773b0a63c60f6d9 Issue-ID: USECASEUI-370 Signed-off-by: cyuamber --- .../services-list/services-list.component.html | 102 +------------- .../services-list/services-list.component.ts | 150 +++++++++++++-------- 2 files changed, 96 insertions(+), 156 deletions(-) (limited to 'usecaseui-portal/src/app/views/services') diff --git a/usecaseui-portal/src/app/views/services/services-list/services-list.component.html b/usecaseui-portal/src/app/views/services/services-list/services-list.component.html index 206ce2d6..99c137e9 100644 --- a/usecaseui-portal/src/app/views/services/services-list/services-list.component.html +++ b/usecaseui-portal/src/app/views/services/services-list/services-list.component.html @@ -197,100 +197,6 @@ - - -
-
- - instance temination is starting - -
- {{ thisService['serviceDomain'] }}   {{"i18nTextDefine_InstanceCreationStarting" | - translate}} -
-
E2E   - {{"i18nTextDefine_InstanceCreationStarting" | translate}} -
-
NS   - {{"i18nTextDefine_InstanceCreationStarting" | translate}} -
-
-
-

{{"i18nTextDefine_InstanceName" | translate}} :

- {{ thisCreateService["service-instance-name"] }} - -
-
-

{{"i18nTextDefine_Customer" | translate}} :

- {{ createData['commonParams']['customer'].name }} -
-
-

{{"i18nTextDefine_UseCase" | translate}} :

- {{ createData['commonParams']['templateType'] }} -
-
-
{{"i18nTextDefine_Close" | translate}}
-
-
-
- -
-
- - instance temination is starting - instance temination is starting - -
- {{ thisCreateService['serviceDomain'] }}   {{"i18nTextDefine_InstanceCreatedSuccessfully" | - translate}} -
-
- E2E   {{"i18nTextDefine_InstanceCreatedSuccessfully" | translate}} -
-
- NS   {{"i18nTextDefine_InstanceCreatedSuccessfully" | translate}} -
-
- {{ thisCreateService['serviceDomain'] }}   {{"i18nTextDefine_InstanceCreationFailed" | - translate}} -
-
- E2E   {{"i18nTextDefine_InstanceCreationFailed" | translate}} -
-
- NS   {{"i18nTextDefine_InstanceCreationFailed" | translate}} -
-
-
-

{{"i18nTextDefine_InstanceName" | translate}} :

- {{ thisCreateService["service-instance-name"] || - thisCreateService["nsInstanceName"] }} - -
-
-

{{"i18nTextDefine_Customer" | translate}} :

- {{ createData['commonParams']['customer'].name }} -
-
-

{{"i18nTextDefine_UseCase" | translate}} :

- {{ thisCreateService["serviceDomain"] }} -
-
-
{{"i18nTextDefine_Close" | translate}}
-
-
-
@@ -526,18 +432,18 @@
+ (closeCreate)="closeCreate($event)">
+ (nsCloseCreate)="nsCloseCreate($event)" + (e2eCloseCreate)="e2eCloseCreate($event)">
+ (mdonsCloseCreate)="mdonsCloseCreate($event)">
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 8ee1785b..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 @@ -364,7 +364,12 @@ 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 (Number(item.operationResult) === 2001) { @@ -554,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 { @@ -573,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; @@ -589,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"], @@ -601,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) => { @@ -620,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) => { @@ -640,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; @@ -656,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"], @@ -671,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) => { @@ -701,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) => { @@ -719,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; @@ -735,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"], @@ -746,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) => { @@ -768,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) => { @@ -786,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; @@ -810,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 + @@ -825,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) => { @@ -851,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) => { @@ -1063,7 +1096,7 @@ export class ServicesListComponent implements OnInit { }) } - deleteService(service: any, templateDeleteSuccessFaild) { + deleteService(service: any) { let allprogress = {}; let querypros = []; service.rate = 0; @@ -1088,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 = { @@ -1125,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; }) @@ -1148,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) => { @@ -1177,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) => { @@ -1185,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) => { -- cgit 1.2.3-korg