034b9a5e06cba0a830418c52b1189ada45c59b6d
[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 { NzModalService } from 'ng-zorro-antd';
5 import {NssiModelComponent} from "../nssi-model/nssi-model.component";
6 @Component({
7   selector: 'app-nssi-table',
8   templateUrl: './nssi-table.component.html',
9   styleUrls: ['./nssi-table.component.less']
10 })
11 export class NssiTableComponent implements OnInit {
12
13     constructor(
14         private myhttp: SlicingTaskServices,
15         private modalService: NzModalService
16     ) {
17     }
18
19   ngOnInit() {
20       this.getNssiList()
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     getNssiList (): void{
32         this.loading = true;
33         this.isSelect = false;
34         let paramsObj = {
35             pageNo: this.pageIndex,
36             pageSize: this.pageSize
37         };
38         if(this.selectedValue !== BUSINESS_STATUS[0]){
39             paramsObj["instanceStatus"] = this.selectedValue;
40             this.isSelect = true;
41         }
42         this.myhttp.getSlicingNssiList(paramsObj,this.isSelect).subscribe (res => {
43             const { result_header: { result_code }, result_body: { nssi_service_instances,record_number } } = res;
44             if (+result_code === 200) {
45                 this.total = record_number;
46                 this.loading = false;
47                 this.listOfData = nssi_service_instances;
48             }
49         })
50     }
51     getListOfProcessingStatus(){
52         this.pageIndex = 1;
53         this.pageSize = 10;
54         this.getNssiList();
55     }
56     searchData(reset: boolean = false) {
57         this.getNssiList();
58     }
59     showdetail(data) {
60         const nssiModal = this.modalService.create({
61             nzTitle:"Detail",
62             nzContent: NssiModelComponent,
63             nzWidth:"70%",
64             nzOkText: null,
65             nzCancelText: null,
66             nzComponentParams:{
67                 nssiId:data.service_instance_id
68             }
69         })
70     }
71 }