summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/services/slicing-management/slicing-resource-management/nssi-management/nssi-table/nssi-table.component.ts
blob: a6e00b4330135d11cd0e1e54d2c98378e7be2437 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { Component, OnInit } from '@angular/core';
import {BUSINESS_STATUS} from '../../../../../../../constants/constants';
import {SlicingTaskServices} from "../../../../../../core/services/slicingTaskServices";
import { NzModalService } from 'ng-zorro-antd';
import {NssiModelComponent} from "../nssi-model/nssi-model.component";
@Component({
  selector: 'app-nssi-table',
  templateUrl: './nssi-table.component.html',
  styleUrls: ['./nssi-table.component.less']
})
export class NssiTableComponent implements OnInit {

    constructor(
        private myhttp: SlicingTaskServices,
        private modalService: NzModalService
    ) {
    }

  ngOnInit() {
      this.getNssiList()
  }
    selectedValue:string = BUSINESS_STATUS[0];
    listOfData: any[] = [];
    pageIndex: number = 1;
    pageSize: number = 10;
    total: number = 0;
    loading = false;
    isSelect: boolean = false;
    statusOptions: any[] = BUSINESS_STATUS;

    getNssiList (): void{
        this.loading = true;
        this.isSelect = false;
        this.listOfData = [];
        let paramsObj = {
            pageNo: this.pageIndex,
            pageSize: this.pageSize
        };
        if(this.selectedValue !== BUSINESS_STATUS[0]){
            paramsObj["instanceStatus"] = this.selectedValue;
            this.isSelect = true;
        }
        this.myhttp.getSlicingNssiList(paramsObj,this.isSelect).subscribe (res => {
            const { result_header: { result_code }, result_body: { nssi_service_instances,record_number } } = res;
            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;
                }
            }
        },(res) => {
            this.loading = false;
            console.error(res);
        })
    }
    getListOfProcessingStatus(){
        this.pageIndex = 1;
        this.pageSize = 10;
        this.getNssiList();
    }
    searchData(reset: boolean = false) {
        this.getNssiList();
    }
    showdetail(data) {
        const nssiModal = this.modalService.create({
            nzTitle:"Detail",
            nzContent: NssiModelComponent,
            nzWidth:"70%",
            nzOkText: null,
            nzCancelText: null,
            nzComponentParams:{
                nssiId:data.service_instance_id
            }
        })
    }
}