summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-management.component.ts
blob: 3d8efab04aa79712a7b16beb457b38a750cc8f98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { Component, OnInit } from '@angular/core';
import * as moment from 'moment';
import { ServiceListService } from '.././../../../core/services/serviceList.service'

@Component({
  selector: 'app-slicing-task-management',
  templateUrl: './slicing-task-management.component.html',
  styleUrls: ['./slicing-task-management.component.less']
})
export class SlicingTaskManagementComponent implements OnInit {

  constructor(private myhttp: ServiceListService) { }

  ngOnInit() { 
    this.getTaskList()
  }
  showDetail: boolean = false;
  selectedValue = null;
  detailData: object = {};
  moduleTitle: string = "";
  listOfData = []; 
  getTaskList (): void{
    this.myhttp.getSlicingTaskList(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;
        })
      }
    })
  }
  showdetail(data: any) {
    console.log(data, this.showDetail)
    this.detailData = data;
    this.showDetail = true;
    this.moduleTitle = data.status === 0 ? "Check Configuration" : "View Progress";
  }
}