From 6f9ea798f25f2d91f1be14300027d64ee664c178 Mon Sep 17 00:00:00 2001 From: cyuamber Date: Mon, 9 Dec 2019 10:19:45 +0800 Subject: feat: Added loading and error prompts for dialog components Change-Id: Ibd1a086c30a7147a7224c65daf1606a089c87c49 Issue-ID: USECASEUI-368 Signed-off-by: cyuamber --- .../check-process-model.component.html | 70 ++++---- .../check-process-model.component.ts | 22 ++- .../slicing-task-model.component.html | 185 +++++++++++---------- .../slicing-task-model.component.ts | 7 +- 4 files changed, 155 insertions(+), 129 deletions(-) (limited to 'usecaseui-portal/src') diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.html b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.html index 07599bfb..ebe1e15b 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.html +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.html @@ -5,39 +5,39 @@ (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()" > - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.ts index 77a36a06..4656c32e 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/check-process-model/check-process-model.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { NzMessageService } from 'ng-zorro-antd'; import { SlicingTaskServices } from '../../../../../core/services/slicingTaskServices' @Component({ @@ -14,7 +15,7 @@ export class CheckProcessModelComponent implements OnInit { @Output() cancel = new EventEmitter(); - constructor(private http: SlicingTaskServices) { } + constructor(private http: SlicingTaskServices, private message: NzMessageService) { } checkDetail: any[]; businessRequirement: any[]; @@ -22,20 +23,29 @@ export class CheckProcessModelComponent implements OnInit { data: any[]; currentProgress: number = 1; timer: any = null; + isSpinning: boolean = false; + isGetData: boolean = false; ngOnInit() { } ngOnChanges() { if (this.showProcess) { + this.isSpinning = true; this.getInfo(); this.getProgress(); }else { clearTimeout(this.timer); + this.isGetData = false; } } getInfo(): void { this.http.getSlicingBasicInfo(this.taskId).subscribe(res => { + if (this.isGetData) { + this.isSpinning = false; + } else { + this.isGetData = true; + } const { result_body, result_header: { result_code } } = res; if (+result_code === 200) { const { @@ -53,12 +63,20 @@ export class CheckProcessModelComponent implements OnInit { this.businessRequirement = [business_demand_info]; // 匹配NST信息 this.NSTinfo = [nst_info]; + } else { + const errorMessage = this.moduleTitle === '切片创建中' ? 'Failed to get data' : 'Viewing results failed'; + this.message.error(errorMessage) } }) } getProgress(): void { this.http.getSlicingCreateProgress(this.taskId).subscribe(res => { + if (this.isGetData) { + this.isSpinning = false; + } else { + this.isGetData = true; + } const { result_body, result_header: {result_code } } = res; if (+result_code === 200) { this.data = []; @@ -85,6 +103,8 @@ export class CheckProcessModelComponent implements OnInit { this.getProgress() }, 5000) } + } else { + this.message.error('Failed to get progress') } }) } diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.html b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.html index 666fa16b..62b01134 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.html +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.html @@ -1,100 +1,101 @@ - - - -
- - -
- 切片实例 ID: - - + + +
+ + +
+ 切片实例 ID: + - {{item.service_instance_name + ' -- '}} {{item.service_instance_id}} - - - - Loading Data... - - -
-
- 切片实例名称:{{ selectedServiceName }} -
-
- -
-
- -

匹配的共享切片子网实例:

- -
-
- 切片子网实例 ID: - - {{item.service_instance_name + ' -- '}} {{item.service_instance_id}} + + + + Loading Data... + + +
+
+ 切片实例名称:{{ selectedServiceName }} +
+
+ +
+ + +

匹配的共享切片子网实例:

+ +
+
+ 切片子网实例 ID: + - {{item.service_instance_name + ' -- '}} {{item.service_instance_id}} - - - - Loading Data... - - + + {{item.service_instance_name + ' -- '}} {{item.service_instance_id}} + + + + Loading Data... + + +
+
+ 切片子网实例名称:{{item.slicingName}} +
+
+ + +
-
- 切片子网实例名称:{{item.slicingName}} -
-
- - -
-
-
-
-
-
- - - + + + +
+ + + + \ No newline at end of file diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts index ff64dfe1..b55844bc 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts @@ -71,13 +71,15 @@ export class SlicingTaskModelComponent implements OnInit { isShowParams: boolean; paramsTitle: string; params: any; - + // 获取数据loading + isSpinning: boolean = false; ngOnInit() { } ngOnChanges() { if (this.showDetail) { + this.isSpinning = true; this.getautidInfo(); } else { this.isDisabled = true; @@ -87,6 +89,7 @@ export class SlicingTaskModelComponent implements OnInit { getautidInfo(): void { this.http.getAuditInfo(this.taskId).subscribe( res => { const { result_header: { result_code } } = res; + this.isSpinning = false; if (+result_code === 200) { const { task_id, @@ -159,6 +162,8 @@ export class SlicingTaskModelComponent implements OnInit { cn_area_traffic_cap_dl, cn_area_traffic_cap_ul }; + } else { + this.message.error('Failed to get data') } }) } -- cgit 1.2.3-korg