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
|
import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
import { NzMessageService } from "ng-zorro-antd";
import { intentBaseService } from "../../../../core/services/intentBase.service";
import { Util } from "../../../../shared/utils/utils";
import { COMMUNICATION_FORM_ITEMS } from "../constants";
@Component({
selector: 'app-cloud-leased-line-modal',
templateUrl: './cloud-leased-line-modal.component.html',
styleUrls: ['./cloud-leased-line-modal.component.less']
})
export class CloudLeasedLineModalComponent implements OnInit {
constructor(
private myHttp: intentBaseService,
private nzMessage: NzMessageService,
private Util: Util
) {}
@Input() modelParams: any;
@Input() cloudLeasedLineShowFlag: boolean;
@Output() cancelEmitter = new EventEmitter<boolean>();
comunicationFormItems = COMMUNICATION_FORM_ITEMS;
validateRulesShow: any[] = [];
isLoadingOne = false;
nodeLists: any[] = [];
cloudPointOptions: any[] = [];
cloud_leased_line_info = {
name: '',
instanceId: '',
accessPointOne: {
name: '',
bandwidth: ''
},
cloudPointName: '',
};
ngOnInit(): void {}
ngOnChanges() {
if (this.cloudLeasedLineShowFlag) {
if (this.modelParams) {
this.cloud_leased_line_info = { ...this.modelParams };
} else {
this.getInstanceId();
}
this.queryAccessNodeInfo();
}
}
queryAccessNodeInfo() {
this.myHttp.queryAccessNodeInfo().subscribe(
(response) => {
const { code, data } = response;
if (code !== 200) {
return;
}
this.cloudPointOptions = [...data.cloudAccessNodeList];
this.nodeLists = [...data.accessNodeList];
},
(err) => {
console.log(err);
}
)
}
getInstanceId() {
this.myHttp.getInstanceId().subscribe(
(response) => {
const { code, message, data} = response;
if (code !== 200) {
this.nzMessage.error(message);
return;
}
this.cloud_leased_line_info.instanceId = data && data.instanceId;
},
(err) => {
console.log(err);
}
)
}
submit(): void {
this.myHttp.createIntentInstance({
...this.cloud_leased_line_info
}).subscribe(
(data) => {
console.log(data);
this.cancel();
},
(err) => {
console.log(err);
}
)
}
cancel(): void {
this.cloudLeasedLineShowFlag = false
this.cloud_leased_line_info = {
name: '',
instanceId: '',
accessPointOne: {
name: '',
bandwidth: ''
},
cloudPointName: '',
};
this.cancelEmitter.emit();
}
}
|