summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management
diff options
context:
space:
mode:
authorcyuamber <xuranyjy@chinamobile.com>2020-09-08 09:50:48 +0800
committercyuamber <xuranyjy@chinamobile.com>2020-09-08 10:03:42 +0800
commit43cb242d5a78e86786d4274fc539d81680fc15c4 (patch)
treee4635ef8ee1c7bc7102f6333e3ed2488b27b8cab /usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management
parent926b57b4d540c73f1930e6d2d2070e5ac6939e5d (diff)
feat: Optimize the public request method of axios
Change-Id: Iab9e86c66628c9a0c39e0a9ed56607417805c9d4 Issue-ID: USECASEUI-444 Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management')
-rw-r--r--usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-model/nsi-model.component.ts28
-rw-r--r--usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-table/nsi-table.component.ts22
-rw-r--r--usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-model/nssi-model.component.ts18
-rw-r--r--usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-table/nssi-table.component.ts22
-rw-r--r--usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-model/slicing-business-model.component.ts35
-rw-r--r--usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-table/slicing-business-table.component.ts100
6 files changed, 90 insertions, 135 deletions
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-model/nsi-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-model/nsi-model.component.ts
index 71b3aba9..5deb91b7 100644
--- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-model/nsi-model.component.ts
+++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-model/nsi-model.component.ts
@@ -24,23 +24,19 @@ export class NsiModelComponent implements OnInit {
this.getNsiDetail()
}
getNsiDetail() {
- this.myhttp.getSlicingNsiDetail(this.nsiId).subscribe(res => {
+ this.myhttp.getSlicingNsiDetail(this.nsiId).then(res => {
this.isSpinning = false;
- const {result_header: {result_code}, result_body: {hosted_business_list,included_nssi_list} } = res;
- if (+result_code === 200) {
- this.businessList = hosted_business_list.map((item)=>{
- if(item.service_instance_id !==null){
- return item
- }
- });
- this.nssiList = included_nssi_list.map((item)=>{
- if(item.service_instance_id !==null){
- return item
- }
- });
- }else{
- this.message.error(res.result_header.result_message)
- }
+ const { result_body: {hosted_business_list,included_nssi_list} } = res;
+ this.businessList = hosted_business_list.map((item)=>{
+ if(item.service_instance_id !==null){
+ return item
+ }
+ });
+ this.nssiList = included_nssi_list.map((item)=>{
+ if(item.service_instance_id !==null){
+ return item
+ }
+ });
})
}
showBusinessDetail(data){
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-table/nsi-table.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-table/nsi-table.component.ts
index 08716e98..1567eca5 100644
--- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-table/nsi-table.component.ts
+++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nsi-management/nsi-table/nsi-table.component.ts
@@ -48,21 +48,17 @@ export class NsiTableComponent implements OnInit {
paramsObj["instanceStatus"] = this.selectedValue.toLocaleLowerCase();
this.isSelect = true;
}
- this.myhttp.getSlicingNsiList(paramsObj, this.isSelect).subscribe(res => {
- const {result_header: {result_code}, result_body: {nsi_service_instances, record_number}} = res;
+ let getSlicingNsiListFailedCallback = () => {
this.loading = false;
- if (+result_code === 200) {
- this.total = record_number;
- this.loading = false;
- if (nsi_service_instances !== null && nsi_service_instances.length > 0) {
- this.listOfData = nsi_service_instances;
- }
- }else {
- this.message.error(res.result_header.result_message)
- }
- }, (res) => {
+ }
+ this.myhttp.getSlicingNsiList(paramsObj, this.isSelect, getSlicingNsiListFailedCallback).then(res => {
+ const { result_body: {nsi_service_instances, record_number} } = res;
+ this.loading = false;
+ this.total = record_number;
this.loading = false;
- this.message.error(res);
+ if (nsi_service_instances !== null && nsi_service_instances.length > 0) {
+ this.listOfData = nsi_service_instances;
+ }
})
}
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-model/nssi-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-model/nssi-model.component.ts
index 96abbeca..035a2fd9 100644
--- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-model/nssi-model.component.ts
+++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-model/nssi-model.component.ts
@@ -22,18 +22,14 @@ export class NssiModelComponent implements OnInit {
this.getNssiDetail()
}
getNssiDetail(){
- this.myhttp.getSlicingNssiDetail(this.nssiId).subscribe(res => {
+ this.myhttp.getSlicingNssiDetail(this.nssiId).then(res => {
this.isSpinning = false;
- const {result_header: {result_code}, result_body: {hosted_nsi_list} } = res;
- if (+result_code === 200) {
- this.nsiList = hosted_nsi_list.map((item)=>{
- if(item.service_instance_id !==null){
- return item
- }
- });
- }else{
- this.message.error(res.result_header.result_message)
- }
+ const { result_body: {hosted_nsi_list} } = res;
+ this.nsiList = hosted_nsi_list.map((item)=>{
+ if(item.service_instance_id !==null){
+ return item
+ }
+ });
})
}
showSingleNsiDetail(data){
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-table/nssi-table.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-table/nssi-table.component.ts
index ba2b8971..5fe303b0 100644
--- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-table/nssi-table.component.ts
+++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-table/nssi-table.component.ts
@@ -48,21 +48,17 @@ export class NssiTableComponent implements OnInit {
paramsObj["instanceStatus"] = this.selectedValue.toLocaleLowerCase();
this.isSelect = true;
}
- this.myhttp.getSlicingNssiList(paramsObj, this.isSelect).subscribe(res => {
- const {result_header: {result_code}, result_body: {nssi_service_instances, record_number}} = res;
+ let getSlicingNssiListFailedCallback = () => {
this.loading = false;
- if (+result_code === 200) {
- this.total = record_number;
- this.loading = false;
- if (nssi_service_instances !== null && nssi_service_instances.length > 0) {
- this.listOfData = nssi_service_instances;
- }
- }else{
- this.message.error(res.result_header.result_message)
- }
- }, (res) => {
+ }
+ this.myhttp.getSlicingNssiList(paramsObj, this.isSelect, getSlicingNssiListFailedCallback).then(res => {
+ const { result_body: {nssi_service_instances, record_number} } = res;
this.loading = false;
- this.message.error(res)
+ this.total = record_number;
+ this.loading = false;
+ if (nssi_service_instances !== null && nssi_service_instances.length > 0) {
+ this.listOfData = nssi_service_instances;
+ }
})
}
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-model/slicing-business-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-model/slicing-business-model.component.ts
index b27e5a31..7bed4304 100644
--- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-model/slicing-business-model.component.ts
+++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-model/slicing-business-model.component.ts
@@ -29,27 +29,22 @@ export class SlicingBusinessModelComponent implements OnInit {
}
getDetail() {
- this.myhttp.getSlicingBusinessDetail(this.businessId).subscribe(res => {
+ this.myhttp.getSlicingBusinessDetail(this.businessId).then(res => {
this.isSpinning = false;
- const { result_body, result_header: { result_code } } = res;
- if (+result_code === 200) {
- const { business_demand_info, business_demand_info: { coverage_area_ta_list }, nst_info, nsi_info } = result_body;
- business_demand_info.area = coverage_area_ta_list.map(item => {
- item = item.split(';').join('-');
- return item
- });
- // area : Front-end analog data
- let area = ["Haidian District;Beijing;Beijing", "Xicheng District;Beijing;Beijing", "Changping District;Beijing;Beijing"].map(item => {
- item = item.split(';').join(' - ');
- return item
- });
- this.businessRequirement = [{ ...business_demand_info, area }];
- this.NSTinfo = [nst_info];
- if (nsi_info.nsi_id !== null) {
- this.nsiInfo = [nsi_info];
- }
- }else{
- this.message.error(res.result_header.result_message)
+ const { business_demand_info, business_demand_info: { coverage_area_ta_list }, nst_info, nsi_info } = res.result_body;
+ business_demand_info.area = coverage_area_ta_list.map(item => {
+ item = item.split(';').join('-');
+ return item
+ });
+ // area : Front-end analog data
+ let area = ["Haidian District;Beijing;Beijing", "Xicheng District;Beijing;Beijing", "Changping District;Beijing;Beijing"].map(item => {
+ item = item.split(';').join(' - ');
+ return item
+ });
+ this.businessRequirement = [{ ...business_demand_info, area }];
+ this.NSTinfo = [nst_info];
+ if (nsi_info.nsi_id !== null) {
+ this.nsiInfo = [nsi_info];
}
})
}
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-table/slicing-business-table.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-table/slicing-business-table.component.ts
index 5410a0f4..cf9b221c 100644
--- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-table/slicing-business-table.component.ts
+++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/slicing-business-management/slicing-business-table/slicing-business-table.component.ts
@@ -56,11 +56,13 @@ export class SlicingBusinessTableComponent implements OnInit {
paramsObj["businessStatus"] = this.selectedValue.toLocaleLowerCase();
this.isSelect = true;
}
- this.myhttp.getSlicingBusinessList(paramsObj, this.isSelect).subscribe(res => {
- const { result_header: { result_code }, result_body: { slicing_business_list, record_number } } = res;
+ let getSlicingBusinessListFailedCallback = () => {
this.loading = false;
- if (+result_code === 200) {
- this.total = record_number;
+ }
+ this.myhttp.getSlicingBusinessList(paramsObj, this.isSelect, getSlicingBusinessListFailedCallback).then(res => {
+ const { result_body: { slicing_business_list, record_number } } = res;
+ this.loading = false;
+ this.total = record_number;
if(slicing_business_list !==null && slicing_business_list.length >0){
this.listOfData = slicing_business_list.map((item, index) => {
if (item.last_operation_progress && item.last_operation_type && Number(item.last_operation_progress) < 100) {
@@ -80,7 +82,6 @@ export class SlicingBusinessTableComponent implements OnInit {
return item
});
}
- }
})
}
getListOfProcessingStatus() {
@@ -124,27 +125,18 @@ export class SlicingBusinessTableComponent implements OnInit {
}
changeActivate(paramsObj, isActivate, slicing, activateValue, finished, index) {
this.loading = true;
- this.myhttp.changeActivateSlicingService(paramsObj, isActivate).subscribe(res => {
- const { result_header: { result_code, result_message }, result_body: { operation_id } } = res;
- this.loading = false;
- if (+result_code === 200) {
- this.notification1.notificationSuccess('slicing business', finished, slicing.service_instance_id);
- this.getBusinessList();
- } else {
- let singleSlicing = Object.assign({}, this.listOfData[index]);
- this.listOfData[index] = singleSlicing;
- this.listOfData = [...this.listOfData];
- this.notification1.notificationFailed('slicing business', finished, slicing.service_instance_id);
- this.getBusinessList();
- }
- this.getBusinessList();
- }, () => {
+ let changeActivateFailedCallback = () => {
this.loading = false;
let singleSlicing = Object.assign({}, this.listOfData[index]);
this.listOfData[index] = singleSlicing;
this.listOfData = [...this.listOfData];
this.notification1.notificationFailed('slicing business', finished, slicing.service_instance_id);
this.getBusinessList();
+ }
+ this.myhttp.changeActivateSlicingService(paramsObj, isActivate, changeActivateFailedCallback).then(res => {
+ this.loading = false;
+ this.notification1.notificationSuccess('slicing business', finished, slicing.service_instance_id);
+ this.getBusinessList();
})
}
terminate(slicing,index) {
@@ -156,20 +148,15 @@ export class SlicingBusinessTableComponent implements OnInit {
let paramsObj = { serviceId: slicing.service_instance_id };
this.terminateStart[index] = true;
this.loading = true;
- this.myhttp.terminateSlicingService(paramsObj).subscribe(res => {
- const { result_header: { result_code, result_message }, result_body: { operation_id } } = res;
- this.loading = false;
- if (+result_code === 200) {
- this.notification1.notificationSuccess('slicing business', 'terminate', slicing.service_instance_id);
- this.getBusinessList();
- } else {
- this.notification1.notificationFailed('slicing business', 'terminate', slicing.service_instance_id);
- this.terminateStart[index] = false;
- }
- }, () => {
+ let terminateFailedCallback = () => {
this.loading = false;
this.notification1.notificationFailed('slicing business', 'terminate', slicing.service_instance_id);
this.terminateStart[index] = false;
+ }
+ this.myhttp.terminateSlicingService(paramsObj, terminateFailedCallback).then(res => {
+ this.loading = false;
+ this.notification1.notificationSuccess('slicing business', 'terminate', slicing.service_instance_id);
+ this.getBusinessList();
})
},
nzCancelText: 'No',
@@ -193,44 +180,33 @@ export class SlicingBusinessTableComponent implements OnInit {
queryProgress(obj, action, index, callback) {
return new Promise(res => {
let requery = () => {
- this.myhttp.getSlicingBusinessProgress(obj)
- .subscribe((data) => {
- const { result_header: { result_code, result_message }, result_body: { operation_id } } = data;
- if (+result_code === 200) {
- if (data.result_body.operation_progress && Number(data.result_body.operation_progress) < 100) {
- callback(data.result_body);
- let progressSetTimeOut = setTimeout(() => {
- requery();
- }, 5000);
- this.progressingTimer.push({
- id: obj.serviceId,
- timer: progressSetTimeOut
- })
- } else {
- this.progressingTimer.forEach((item) => {
- if (item.serviceId === obj.serviceId) {
- clearInterval(item.timer);
- }
- });
- res(data.result_body);
- }
+ let queryProgressFailedCallback = () => {
+ this.progressingTimer.forEach((item) => {
+ if (item.serviceId === obj.serviceId) {
+ clearInterval(item.timer);
+ }
+ });
+ this.getBusinessList();
+ }
+ this.myhttp.getSlicingBusinessProgress(obj, queryProgressFailedCallback)
+ .then((data) => {
+ if (data.result_body.operation_progress && Number(data.result_body.operation_progress) < 100) {
+ callback(data.result_body);
+ let progressSetTimeOut = setTimeout(() => {
+ requery();
+ }, 5000);
+ this.progressingTimer.push({
+ id: obj.serviceId,
+ timer: progressSetTimeOut
+ })
} else {
this.progressingTimer.forEach((item) => {
if (item.serviceId === obj.serviceId) {
clearInterval(item.timer);
}
});
- this.getBusinessList();
- this.message.error(result_message);
+ res(data.result_body);
}
- }, (err) => {
- this.progressingTimer.forEach((item) => {
- if (item.serviceId === obj.serviceId) {
- clearInterval(item.timer);
- }
- });
- this.getBusinessList();
- this.message.error(err);
})
};
requery();