const { result_body, result_header: { result_code } } = res;
if (+result_code === 200) {
this.data = [];
- Object.keys(result_body).forEach(item => {
- let currentProgress = 1
- let status = 'process';
- if (+result_body[item] === 100) {
- currentProgress = 3;
- status = 'finish'
- }
- const title = item === 'an_progress' ? 'An' : (item === 'tn_progress' ? 'Tn' : 'Cn')
- let obj = { [item]: result_body[item], currentProgress, title, status };
- if (result_body[item]) {
+ const nssiList: string[] = ['an', 'tn', 'cn'];
+ nssiList.forEach( item => {
+ const progress: number = +result_body[item +'_progress'];
+ const title: string = item.charAt(0).toUpperCase() + item.slice(1);
+ let status: string = result_body[item +'_status'];
+ if ((progress || progress === 0) && status) {
+ let currentProgress = 1
+ if (progress === 100 && status === 'finished') {
+ currentProgress = 3;
+ status = 'finish'
+ }
+ const obj = { progress, currentProgress, title, status };
this.data.push(obj)
}
})
this.data = [this.data];
let flag: boolean = false;
- Object.values(result_body).forEach(item => {
- if (+item !== 100 && typeof item !== 'object') {
+ nssiList.forEach(item => {
+ if (result_body[item +'_status'] === 'processing' && result_body[item +'_progress'] !== 0) {
flag = true;
}
})
}
getautidInfo(): void {
- this.http.getAuditInfo(this.taskId).subscribe(res => {
- const { result_header: { result_code } } = res;
+ this.http.getAuditInfo(this.taskId).subscribe( res => {
+ const { result_header: { result_code, result_message } } = res;
this.isSpinning = false;
if (+result_code === 200) {
const {
cn_area_traffic_cap_ul
};
} else {
- this.message.error('Failed to get data')
+ this.message.error(result_message || 'Failed to get data')
}
}, ({ status, statusText }) => {
this.message.error(status + ' (' + statusText + ')');
getSlicingInstances(pageNo: string, pageSize: string): void {
this.slicingInstances.isLoading = true;
this.http.getSlicingInstance(pageNo, pageSize).subscribe(res => {
- const { result_header: { result_code }, result_body } = res;
+ const { result_header: { result_code, result_message }, result_body } = res;
setTimeout(() => {
if (+result_code === 200) {
const { nsi_service_instances, record_number } = result_body;
this.slicingInstances.total = record_number;
this.slicingInstances.list.push(...nsi_service_instances);
} else {
- this.message.error('Failed to get slicing instance ID')
+ this.message.error(result_message || 'Failed to get slicing instance ID')
}
this.slicingInstances.isLoading = false;
this.slicingInstances.flag = false;
this.selectedServiceName = '';
// 获取切片子网实例数据
this.http.getSlicingSubnetInstance(this.selectedServiceId).subscribe(res => {
- const { result_header: { result_code }, result_body, record_number } = res;
+ const { result_header: { result_code, result_message }, result_body, record_number} = res;
if (+result_code === 200) {
- this.subnetDataFormatting(result_body, record_number);
+ this.subnetDataFormatting(result_body, record_number)
} else {
this.subnetDataFormatting({}, 1);
- this.message.error('Failed to get slicing subnet instance ID');
+ this.message.error(result_message || 'Failed to get slicing subnet instance ID')
}
}, ({ status, statusText }) => {
this.message.error(status + ' (' + statusText + ')');
})
}
- subnetDataFormatting(subnetData: any, total: number): void {
+ subnetDataFormatting ( subnetData?: any, total?: number): void{
const { an_suggest_nssi_id, an_suggest_nssi_name, tn_suggest_nssi_id, tn_suggest_nssi_name, cn_suggest_nssi_id, cn_suggest_nssi_name } = subnetData;
this.slicingSubnet[0].slicingId = an_suggest_nssi_id;
this.slicingSubnet[0].slicingName = an_suggest_nssi_name;
instance.isLoading = true;
const { context, currentPage, pageSize } = instance;
this.http.getSubnetInContext(context, currentPage, pageSize).subscribe(res => {
- const { result_header: { result_code }, result_body } = res;
+ const { result_header: { result_code, result_message }, result_body } = res;
if (+result_code === 200) {
const { nssi_service_instances, record_number } = result_body;
this.slicingSubnet.map(item => {
}
})
} else {
- this.message.error('Failed to get slicing subnet instance ID');
+ this.message.error(result_message || 'Failed to get slicing subnet instance ID');
}
instance.isLoading = false;
instance.flag = false;