models changed

This commit is contained in:
insanity
2018-06-12 14:45:21 +09:00
parent 0f69c63a98
commit d8cb5f4d41
24 changed files with 132 additions and 266 deletions

View File

@@ -1,8 +1,9 @@
<h1>Discovery</h1>
<div class="ui-g">
<div class="ui-g-12">
<of-probe-selector [probeHostID]="probeHostID" (select)="selectedProbe=$event"></of-probe-selector>
<of-probe-summary *ngIf="selectedProbe" @discoveryFilterAnim [probeHost]="selectedProbe"></of-probe-summary>
<of-zone-selector></of-zone-selector>
<!-- <of-probe-selector [probeHostID]="probeHostID" (select)="selectedProbe=$event"></of-probe-selector> -->
<!-- <of-probe-summary *ngIf="selectedProbe" @discoveryFilterAnim [probeHost]="selectedProbe"></of-probe-summary> -->
</div>
</div>
<div class="ui-g">

View File

@@ -61,10 +61,9 @@ export class DiscoveryComponent implements OnDestroy {
// TODO: fix
const zone: Zone = {
network: '192.168.1.0/24',
ipv4: '192.168.1.103',
address: '192.168.1.103',
iface: 'enp3s0',
mac: '44:8a:5b:44:8c:e8',
hosts: null,
};
this.discoveryService.discoverHost(this.selectedProbe.probe.probeKey, zone, dz.discoverHost);

View File

@@ -36,20 +36,20 @@ export class SearchFilterComponent implements OnInit {
}
addService(service: Service) {
if (service.serviceName.indexOf('Not Supported Service') >= 0) {
const tempName = service.serviceName.split('Perhaps ')[1].split('[')[0];
service.serviceName = '*' + tempName;
if (service.name.indexOf('Not Supported Service') >= 0) {
const tempName = service.name.split('Perhaps ')[1].split('[')[0];
service.name = '*' + tempName;
}
let exist = false;
this.services.forEach(value => {
if (value.serviceName === service.serviceName) {
if (value.name === service.name) {
exist = true;
return;
}
});
if (!exist) {
this.services.push(service);
this.filterServices[service.serviceName] = true;
this.filterServices[service.name] = true;
}
this.serviceSelect.emit(this.filterServices);
}

View File

@@ -12,8 +12,6 @@ import { DiscoverZone, Zone, Host, Port, Service } from '@overflow/commons-types
import { TreeNode, Message, Tree } from 'primeng/primeng';
import { ProbeHost } from '@overflow/commons-typescript/model/probe';
import { Anim } from './animation';
import { DiscoveryNotify } from '../subscriber/discovery.subscriber';
import { InfraHost, InfraService } from '@overflow/commons-typescript/model/infra';
import { TargetService } from '@overflow/target/service/target.service';
import { Target } from '@overflow/commons-typescript/model/target';
@@ -83,11 +81,11 @@ export class SearchResultComponent implements OnInit, OnChanges {
const idx = this.findHostIndex(host);
this.hostNode.splice(idx, 0, {
type: 'HOST',
label: host.ipv4,
label: host.address,
data: {
exist: false,
ip: this.convertIPtoNumber(host.ipv4),
ipv6: host.ipv6,
ip: this.convertIPtoNumber(host.address),
ipv6: host.address,
mac: host.mac,
openPorts: [],
target: host
@@ -102,22 +100,22 @@ export class SearchResultComponent implements OnInit, OnChanges {
const idx = this.findServiceIndex(targetHostNode.children, service);
targetHostNode.children.splice(idx, 0, {
type: 'SERVICE',
label: service.serviceName + ' (' + service.port.portNumber + ')',
label: service.name + ' (' + service.port.portNumber + ')',
data: {
name: service.serviceName,
portType: service.port.portType,
name: service.name,
portType: service.port.metaPortTypeKey,
portNumber: service.port.portNumber,
target: service
},
});
}
addPort(port: Port) {
this.hostNode.forEach(node => {
if (node.data.id === port.host.id) {
node.data.openPorts.push(port);
return;
}
});
// this.hostNode.forEach(node => {
// if (node.data.id === port.host.id) {
// node.data.openPorts.push(port);
// return;
// }
// });
}
onTargetSelect(e, node: TreeNode) {
@@ -134,7 +132,7 @@ export class SearchResultComponent implements OnInit, OnChanges {
findHostIndex(host: Host): number {
let index = 0;
this.hostNode.forEach(node => {
if (node.data.ip < this.convertIPtoNumber(host.ipv4)) {
if (node.data.ip < this.convertIPtoNumber(host.address)) {
index++;
}
});
@@ -147,7 +145,7 @@ export class SearchResultComponent implements OnInit, OnChanges {
// if (node.data.portNumber < service.port.portNumber) {
// index++;
// }
if (node.data.name.toUpperCase().localeCompare(service.serviceName.toUpperCase()) === -1) {
if (node.data.name.toUpperCase().localeCompare(service.name.toUpperCase()) === -1) {
index++;
}
});
@@ -157,7 +155,7 @@ export class SearchResultComponent implements OnInit, OnChanges {
findHostNodeByService(service: Service) {
let targetHost = null;
this.hostNode.forEach((value, i) => {
if (value.data.ip === this.convertIPtoNumber(service.port.host.ipv4)) {
if (value.data.ip === this.convertIPtoNumber(service.port.host.address)) {
targetHost = value;
return;
}