This commit is contained in:
insanity 2017-06-08 11:10:30 +09:00
parent f23fcb9cf7
commit f41b887f96

View File

@ -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;
if (type === "host") {
obj = {
"id": id,
"seq": seq,
"ip": host.ip,
"port": 0,
"portType": "",
@ -76,7 +76,7 @@ export class DiscoveryResult extends React.Component<any, any> {
};
} else {
obj = {
"id": id,
"seq": seq,
"ip": host.ip,
"port": port.portNumber,
"portType": port.portType,
@ -88,7 +88,7 @@ export class DiscoveryResult extends React.Component<any, any> {
this.list.push(obj);
} else {
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);
}
}
@ -104,7 +104,7 @@ export class DiscoveryResult extends React.Component<any, any> {
return <div style={{ marginLeft: 20 }}>
{zone.hosts.map((host: any, index: number) => (
<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)}
</div>
))}
@ -118,7 +118,7 @@ export class DiscoveryResult extends React.Component<any, any> {
return <div style={{ marginLeft: 20 }}>
{host.ports.map((port: any, index: number) => (
<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>;
@ -163,7 +163,7 @@ export class Row extends React.Component<any, any> {
}
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() {