7536a8310fbfc81376f3f4273603c4963aaba17e
[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             this.loading = false;
45             if (+result_code === 200) {
46                 this.total = record_number;
47                 this.loading = false;
48                 this.listOfData = nssi_service_instances;
49             }
50         },(res) => {
51             this.loading = false;
52             console.error(res);
53         })
54     }
55     getListOfProcessingStatus(){
56         this.pageIndex = 1;
57         this.pageSize = 10;
58         this.getNssiList();
59     }
60     searchData(reset: boolean = false) {
61         this.getNssiList();
62     }
63     showdetail(data) {
64         const nssiModal = this.modalService.create({
65             nzTitle:"Detail",
66             nzContent: NssiModelComponent,
67             nzWidth:"70%",
68             nzOkText: null,
69             nzCancelText: null,
70             nzComponentParams:{
71                 nssiId:data.service_instance_id
72             }
73         })
74     }
75 }