11
This commit is contained in:
parent
f23fcb9cf7
commit
f41b887f96
@ -64,11 +64,11 @@ export class DiscoveryResult extends React.Component<any, any> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTargetCheck = (id: number, type: string, checked: boolean, host: any, port: any) => {
|
handleTargetCheck = (seq: number, type: string, checked: boolean, host: any, port: any) => {
|
||||||
let obj: any;
|
let obj: any;
|
||||||
if (type === "host") {
|
if (type === "host") {
|
||||||
obj = {
|
obj = {
|
||||||
"id": id,
|
"seq": seq,
|
||||||
"ip": host.ip,
|
"ip": host.ip,
|
||||||
"port": 0,
|
"port": 0,
|
||||||
"portType": "",
|
"portType": "",
|
||||||
@ -76,7 +76,7 @@ export class DiscoveryResult extends React.Component<any, any> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
obj = {
|
obj = {
|
||||||
"id": id,
|
"seq": seq,
|
||||||
"ip": host.ip,
|
"ip": host.ip,
|
||||||
"port": port.portNumber,
|
"port": port.portNumber,
|
||||||
"portType": port.portType,
|
"portType": port.portType,
|
||||||
@ -88,7 +88,7 @@ export class DiscoveryResult extends React.Component<any, any> {
|
|||||||
this.list.push(obj);
|
this.list.push(obj);
|
||||||
} else {
|
} else {
|
||||||
for (var i = 0; i < this.list.length; i++) {
|
for (var i = 0; i < this.list.length; i++) {
|
||||||
if (this.list[i].id === id) {
|
if (this.list[i].seq === seq) {
|
||||||
this.list.splice(i, 1);
|
this.list.splice(i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ export class DiscoveryResult extends React.Component<any, any> {
|
|||||||
return <div style={{ marginLeft: 20 }}>
|
return <div style={{ marginLeft: 20 }}>
|
||||||
{zone.hosts.map((host: any, index: number) => (
|
{zone.hosts.map((host: any, index: number) => (
|
||||||
<div key={index}>
|
<div key={index}>
|
||||||
<Row type='host' id={num++} host={host} name={Utils.int2ip(host.ip)} desc={host.mac} onCheck={this.handleTargetCheck.bind(this)} />
|
<Row type='host' seq={num++} host={host} name={Utils.int2ip(host.ip)} desc={host.mac} onCheck={this.handleTargetCheck.bind(this)} />
|
||||||
{this.renderPorts(host, num)}
|
{this.renderPorts(host, num)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
@ -118,7 +118,7 @@ export class DiscoveryResult extends React.Component<any, any> {
|
|||||||
return <div style={{ marginLeft: 20 }}>
|
return <div style={{ marginLeft: 20 }}>
|
||||||
{host.ports.map((port: any, index: number) => (
|
{host.ports.map((port: any, index: number) => (
|
||||||
<div key={index}>
|
<div key={index}>
|
||||||
<Row type='service' id={num++} host={host} port={port} name={port.portType + port.portNumber} desc={port.services[0].serviceName} onCheck={this.handleTargetCheck.bind(this)} />
|
<Row type='service' seq={num++} host={host} port={port} name={port.portType + port.portNumber} desc={port.services[0].serviceName} onCheck={this.handleTargetCheck.bind(this)} />
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>;
|
</div>;
|
||||||
@ -163,7 +163,7 @@ export class Row extends React.Component<any, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleCheck(ev: any, checked: boolean) {
|
handleCheck(ev: any, checked: boolean) {
|
||||||
this.props.onCheck(this.props.id, this.props.type, checked, this.props.host, this.props.port);
|
this.props.onCheck(this.props.seq, this.props.type, checked, this.props.host, this.props.port);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user