summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.ts
blob: bf046545770887788da32fc121d9b37bb456de26 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { NzMessageService } from "ng-zorro-antd";
import { intentBaseService } from "../../../../core/services/intentBase.service";

@Component({
  selector: 'app-cloud-leased-line',
  templateUrl: './cloud-leased-line.component.html',
  styleUrls: ['./cloud-leased-line.component.less']
})
export class CloudLeasedLineComponent implements OnInit {

  constructor(
    private router:Router,
    private myHttp: intentBaseService,
    private nzMessage: NzMessageService 
  ) {}

	ngOnChanges() {}

	ngOnInit() {
    this.pageIndex = 1;
    this.pageSize = 10;
    this.getCloudLeasedLineList();
  }

	ngOnDestroy() {}

  statusObj: any = {
    0: 'Incomplete',
    1: 'Completed',
    2: 'Deleted',
    3: 'Inactive'
  }
  // 列表数据源
	listOfData: any[] = [];
  // 分页信息及总数
	pageIndex: number = 1;
	pageSize: number = 10;
	total: number = 0;
	loading = false;
  // 控制弹窗展示变量
  cloudLeasedLineShowFlag: boolean = false;
  smartCloudLeasedLineShowFlag: boolean = false;
  // 初始化查询数据源
	getCloudLeasedLineList(): void {
    this.myHttp.getInstanceList({
      currentPage: this.pageIndex,
      pageSize: this.pageSize
    }).subscribe((response) => {
      const { code, message, data } = response;
      if (code !== 200) {
        this.nzMessage.error(message);
				return;
      }
      this.total = data.totalRecords;
      this.listOfData = [...data.list];
    }, (err) => {
      console.log(err);
    });
  }
  // 分页信息变更查询数据
  searchData(): void {
    this.getCloudLeasedLineList();
  }
  // 解析结果传递到create弹窗
  resolveResult: any;
  // 弹窗加载
	cloudLeasedLineShow(): void {
	  this.cloudLeasedLineShowFlag = true;
	}
  // 弹窗关闭
	cloudLeasedLineClose(): void {
    this.cloudLeasedLineShowFlag = false;
    this.pageIndex = 1;
    this.pageSize = 10;
    this.getCloudLeasedLineList();
  }
  // smart 弹窗加载
	smartCloudLeasedLineShow(): void {
	  this.smartCloudLeasedLineShowFlag = true;
	}
  // smart 弹窗关闭
	smartCloudLeasedLineClose(data): void {
    this.smartCloudLeasedLineShowFlag = false;
    if (data.cancel) {
      return;
    }
    this.cloudLeasedLineShowFlag = true;
    this.resolveResult = {
      name: 'test',
      instanceId: '123456',
      accessPointOne: {
        name: 'aaa',
        bandwidth: '20'
      },
      cloudPointName: 'aaa',
    };
  }
  // 跳转监控管理页面
  goMonitorService(): void {
    this.router.navigateByUrl('/fcaps/monitor_service');
  }

  activeCloudLeasedLine(row): void {
    this.myHttp.activeIntentInstance({
      instanceId: row.instanceId
    }).subscribe((data) => {
      console.log(data);
    }, (err) => {
      console.log(err);
    });
  }

  inactiveCloudLeasedLine(row): void {
    this.myHttp.invalidIntentInstance({
      instanceId: row.instanceId
    }).subscribe((data) => {
      console.log(data);
    }, (err) => {
      console.log(err);
    });
  }

  deleteCloudLeasedLine(row): void {
    this.myHttp.deleteIntentInstance(row.instanceId).subscribe((data) => {
      console.log(data);
    }, (err) => {
      console.log(err);
    });
  }
}