6ac2941761aceb52a4d2b89361b490eeb85458ae
[usecase-ui.git] /
1 import { Component, OnInit } from '@angular/core';
2 import {BUSINESS_STATUS} from '../../../../../../../constants/constants';
3 import {SlicingTaskServices} from "../../../../../../core/services/slicingTaskServices";
4 import {NsiModelComponent} from "../nsi-model/nsi-model.component";
5 import { NzModalService } from 'ng-zorro-antd';
6 @Component({
7   selector: 'app-nsi-table',
8   templateUrl: './nsi-table.component.html',
9   styleUrls: ['./nsi-table.component.less']
10 })
11 export class NsiTableComponent implements OnInit {
12
13     constructor(
14         private myhttp: SlicingTaskServices,
15         private modalService: NzModalService
16     ) {
17     }
18
19   ngOnInit() {
20       this.getNsiList()
21   }
22     selectedValue:string = BUSINESS_STATUS[0];
23     listOfData: any[] = [];
24     pageIndex: number = 1;
25     pageSize: number = 10;
26     total: number = 0;
27     loading = false;
28     isSelect: boolean = false;
29     statusOptions: any[] = BUSINESS_STATUS;
30
31     getNsiList (): void{
32         this.loading = true;
33         this.isSelect = false;
34         this.listOfData = [];
35         let paramsObj = {
36             pageNo: this.pageIndex,
37             pageSize: this.pageSize
38         };
39         if(this.selectedValue !== BUSINESS_STATUS[0]){
40             paramsObj["instanceStatus"] = this.selectedValue.toLocaleLowerCase();
41             this.isSelect = true;
42         }
43         this.myhttp.getSlicingNsiList(paramsObj,this.isSelect).subscribe (res => {
44             const { result_header: { result_code }, result_body: { nsi_service_instances,record_number } } = res;
45             this.loading = false;
46             if (+result_code === 200) {
47                 this.total = record_number;
48                 this.loading = false;
49                 if(nsi_service_instances !== null  && nsi_service_instances.length >0) {
50                     this.listOfData = nsi_service_instances;
51                 }
52             }
53         }, (res) => {
54             this.loading = false;
55             console.error(res);
56         })
57     }
58     getListOfProcessingStatus(){
59         this.pageIndex = 1;
60         this.pageSize = 10;
61         this.getNsiList();
62     }
63     searchData(reset: boolean = false) {
64         this.getNsiList();
65     }
66     showdetail(data) {
67         const nsiModal = this.modalService.create({
68             nzTitle:"Detail",
69             nzContent: NsiModelComponent,
70             nzWidth:"70%",
71             nzOkText: null,
72             nzCancelText: null,
73             nzComponentParams:{
74                 nsiId:data.service_instance_id
75             }
76         })
77     }
78 }