Newer
Older
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
import {Component, OnInit} from '@angular/core';
import {TopologyService} from '../../topology.service';
import {LocalStorageService} from 'ngx-webstorage';
import {NzMessageService} from 'ng-zorro-antd';
declare let editor: any;
@Component({
selector: 'smart-line',
templateUrl: './line.component.html',
styles: []
})
export class LineComponent implements OnInit {
isLine = false;
hostIds = [];
inPageNum = 1;
outPageNum = 1;
inPageCount = 10;
outPageCount = 10;
totalNum;
inList;
inSelect = [];
outList;
outSelect = [];
constructor(private topologySer: TopologyService, private message: NzMessageService, private localStorage: LocalStorageService,) {
}
//in
incurrentPageDataChange($event: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }>): void {
this.inList = $event;
}
inselectItem(item,e){
if(e){
this.inSelect = item;
}else{
this.inSelect = null;
}
}
indeleteSelect(index){
this.inSelect = null;
}
changePageIn(e){
}
//out
outcurrentPageDataChange($event: Array<{ key1: string; key2: number; key3: string; key4: string; checked: boolean }>): void {
}
outselectItem(item,e){
if(e){
this.outSelect = item;
}else{
this.outSelect = null;
}
}
outdeleteSelect(index){
this.outSelect = null;
}
changePageOut(e){
this.isLine = true;
this.getOutList();
this.getInList();
}
getInList(){
const data = {
search:"",
type:"in",
pageNum:this.inPageNum,
pageCount:this.inPageCount
}
this.topologySer.findFlowItemByHost(data).subscribe(
(res)=>{
this.totalNum = res.data.totalNum;
this.inList = res.data.data;
}
)
}
getOutList(){
const data = {
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
search:"",
type:"out",
pageNum:this.outPageNum,
pageCount:this.outPageCount
}
this.topologySer.findFlowItemByHost(data).subscribe(
(res)=>{
this.totalNum = res.data.totalNum;
this.outList = res.data.data;
}
)
}
//进出口流量
handleLineCancel() {
this.inList = [];
this.outList = [];
this.isLine = false;
localStorage.setItem("line",'false');
}
handleLineOk() {
this.inList = [];
this.outList = [];
this.isLine = false;
editor.utils.setLink(this.inSelect,this.outSelect);
localStorage.setItem("line",'false');
}
}