1 import { Component, OnInit } from "@angular/core";
2 import { Router } from "@angular/router";
3 import { NzMessageService } from "ng-zorro-antd";
4 import { intentBaseService } from "../../../../core/services/intentBase.service";
7 selector: 'app-cloud-leased-line',
8 templateUrl: './cloud-leased-line.component.html',
9 styleUrls: ['./cloud-leased-line.component.less']
11 export class CloudLeasedLineComponent implements OnInit {
14 private router:Router,
15 private myHttp: intentBaseService,
16 private nzMessage: NzMessageService
24 this.getCloudLeasedLineList();
36 listOfData: any[] = [];
37 // pageSize or pageNum
38 pageIndex: number = 1;
39 pageSize: number = 10;
42 // cantrol dialog show or hidden
43 cloudLeasedLineShowFlag: boolean = false;
44 smartCloudLeasedLineShowFlag: boolean = false;
46 resolveResult: any = null;
47 intervalTime: number = 5000;
48 progressingTimer: any[] = [];
51 getCloudLeasedLineList(): void {
52 this.myHttp.getInstanceList({
53 currentPage: this.pageIndex,
54 pageSize: this.pageSize
55 }).subscribe((response) => {
56 const { code, message, data } = response;
58 this.nzMessage.error(message);
61 this.total = data.totalRecords;
62 if (data.list === 0) {
66 this.listOfData = data.list.map((item, index) => {
67 if (item.status === 'Incomplete') {
68 const updateStatus = (prodata) => {
69 item.status = prodata.status || item.status;
72 const obj = { serviceId: item.id };
73 this.queryStatus(obj, index, updateStatus).then(() => {
74 item.status = "Completed";
75 this.getCloudLeasedLineList();
85 queryStatus(obj: any, index: number, callback: any) {
86 return new Promise((res) => {
87 const requery = () => {
88 const param = [obj.id];
89 this.myHttp.getInstanceStatus(param).subscribe((response) => {
91 response.data.status && response.data.status === 'Incomplete') {
92 callback(response.data);
93 let progressSetTimeOut = setTimeout(() => {
95 }, this.intervalTime);
96 this.progressingTimer.push({
98 timer: progressSetTimeOut,
101 this.progressingTimer.forEach((item) => {
102 if (item.serviceId === obj.serviceId) {
103 clearInterval(item.timer);
114 // change page message
116 this.getCloudLeasedLineList();
120 cloudLeasedLineShow(): void {
121 this.cloudLeasedLineShowFlag = true;
124 cloudLeasedLineClose(): void {
125 this.cloudLeasedLineShowFlag = false;
128 this.getCloudLeasedLineList();
131 smartCloudLeasedLineShow(): void {
132 this.smartCloudLeasedLineShowFlag = true;
134 // smart dialog close
135 smartCloudLeasedLineClose(data): void {
136 this.smartCloudLeasedLineShowFlag = false;
141 this.resolveResult = {
143 instanceId: '123456',
148 cloudPointName: 'aaa',
151 this.cloudLeasedLineShowFlag = true;
154 goMonitorService(): void {
155 this.router.navigateByUrl('/fcaps/monitor_service');
158 activeCloudLeasedLine(row): void {
159 this.myHttp.activeIntentInstance({
160 instanceId: row.instanceId
161 }).subscribe((data) => {
168 inactiveCloudLeasedLine(row): void {
169 this.myHttp.invalidIntentInstance({
170 instanceId: row.instanceId
171 }).subscribe((data) => {
178 deleteCloudLeasedLine(row): void {
179 this.myHttp.deleteIntentInstance(row.instanceId).subscribe((data) => {