diff options
author | cyuamber <xuranyjy@chinamobile.com> | 2019-11-28 14:46:25 +0800 |
---|---|---|
committer | cyuamber <xuranyjy@chinamobile.com> | 2019-11-28 14:46:35 +0800 |
commit | 1f4acde5c38f72327fb02121db57d2ddb9609e99 (patch) | |
tree | a7342ce750c49a2b9769c21823bae78e5c3eb637 /usecaseui-portal/src/app/views | |
parent | a7589978ffc6f942d74b7c45df61c6f090bfa991 (diff) |
Added ability to filter data based on processing status
Change-Id: I39a9cc83651745dda7844ae119429d47aa8a46b4
Issue-ID: USECASEUI-352
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/views')
3 files changed, 59 insertions, 34 deletions
diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.html b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.html index ac350037..40a166c3 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.html +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.html @@ -1,11 +1,9 @@ <div> <div nz-row> - <div nz-col nzSpan="6"> - <span>Status:</span> - <nz-select nzShowSearch nzAllowClear nzPlaceHolder="Select a person" [(ngModel)]="selectedValue"> - <nz-option nzLabel="Jack" nzValue="jack"></nz-option> - <nz-option nzLabel="Lucy" nzValue="lucy"></nz-option> - <nz-option nzLabel="Tom" nzValue="tom"></nz-option> + <div nz-col nzSpan="12" class="task_status"> + <span>Status : </span> + <nz-select nzShowSearch nzAllowClear nzPlaceHolder="Select a processing status" [(ngModel)]="selectedValue" (ngModelChange)="getListOfProcessingStatus()"> + <nz-option *ngFor="let item of statusOptions" [nzLabel]="item.title" [nzValue]="item.value"></nz-option> </nz-select> </div> </div> @@ -31,10 +29,8 @@ <td>{{ data.arrival_time }}</td> <td>{{ data.status }}</td> <td> - <span *ngIf="data.processing_status === 'Planning'">任务处理</span> - <a (click)="showdetail(data)" *ngIf="data.processing_status === 'Waiting to Confirm'">任务处理</a> - <a (click)="showdetail(data)" *ngIf="data.processing_status === 'Creating'">查看进度</a> - <a (click)="showdetail(data)" *ngIf="data.processing_status === 'Completed'">查看结果</a> + <span *ngIf="data.processing_status === 'Planning'" class="task_operation_disabled">{{ data.operation }}</span> + <a (click)="showdetail(data)" *ngIf="data.processing_status !== 'Planning'">{{ data.operation }}</a> </td> </tr> </tbody> diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.less b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.less index 1de685d6..bc14d4ff 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.less +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.less @@ -1,3 +1,13 @@ nz-select { width: 200px; -}
\ No newline at end of file +} +.task_status{ + margin-bottom: 20px; + span{ + margin-right: 5%; + } +} +.task_operation_disabled { + color: #A2ABCE; + cursor: default; +} diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.ts index 3d8efab0..7bba2c07 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import * as moment from 'moment'; -import { ServiceListService } from '.././../../../core/services/serviceList.service' +import { SlicingTaskServices } from '.././../../../core/services/slicingTaskServices'; +import { TASK_PROCESSING_STATUS } from '../../../../../constants/constants'; @Component({ selector: 'app-slicing-task-management', @@ -9,7 +10,7 @@ import { ServiceListService } from '.././../../../core/services/serviceList.serv }) export class SlicingTaskManagementComponent implements OnInit { - constructor(private myhttp: ServiceListService) { } + constructor(private myhttp: SlicingTaskServices) { } ngOnInit() { this.getTaskList() @@ -19,35 +20,53 @@ export class SlicingTaskManagementComponent implements OnInit { detailData: object = {}; moduleTitle: string = ""; listOfData = []; + statusOptions = TASK_PROCESSING_STATUS; + getTaskList (): void{ - this.myhttp.getSlicingTaskList(1,10).subscribe (res => { + this.myhttp.getSlicingTaskList('1', '10').subscribe (res => { + const { result_header: { result_code }, result_body: { slicing_task_list } } = res + if (+result_code === 200) { + this.dataFormatting(slicing_task_list) + } + }) + } + getListOfProcessingStatus():void { + this.myhttp.getTaskProcessingStatus(this.selectedValue, '1', '10').subscribe (res => { const { result_header: { result_code }, result_body: { slicing_task_list } } = res if (+result_code === 200) { - this.listOfData = slicing_task_list.map( item => { - item.arrival_time = moment(+item.arrival_time).format('YYYY-MM-DD hh:mm') - switch (item.processing_status){ - case 'Planning': - item.status = '规划阶段'; - break; - case 'Waiting to Confirm': - item.status = '审核阶段'; - break; - case 'Creating': - item.status = '切片创建中'; - break; - case 'Completed': - item.status = '创建完成'; - break; - } - return item; - }) + this.dataFormatting(slicing_task_list) } }) } + + dataFormatting(list: any):void{ + this.listOfData = list.map( item => { + item.arrival_time = moment(+item.arrival_time).format('YYYY-MM-DD hh:mm') + switch (item.processing_status){ + case 'Planning': + item.status = '规划阶段'; + item.operation = '任务处理' + break; + case 'Waiting to Confirm': + item.status = '审核阶段'; + item.operation = '任务处理' + break; + case 'Creating': + item.status = '切片创建中'; + item.operation = '查看进度' + break; + case 'Completed': + item.status = '创建完成'; + item.operation = '查看结果' + break; + } + return item; + }) + } + showdetail(data: any) { - console.log(data, this.showDetail) this.detailData = data; this.showDetail = true; - this.moduleTitle = data.status === 0 ? "Check Configuration" : "View Progress"; + this.moduleTitle = data.status; } } |