This commit is contained in:
crusader
2018-09-04 01:12:10 +09:00
parent 09b3764f99
commit 160d40b455
20 changed files with 246 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
<div class="home-start">
<div class="start-button">
<div class="start-button" (click)="discoverHost($event)">
<svg version="1.1" viewBox="0 0 200 210">
<path d="M8.3,193.5c0.1,2.4,0.8,4.9,2.1,7.1c4.5,7.7,14.3,10.4,22.1,5.9l152.1-87.8c2-1.3,3.8-3.1,5.1-5.4
c4.5-7.7,1.8-17.6-5.9-22.1L31.6,3.4c-2.2-1.1-4.6-1.7-7.2-1.7c-8.9,0-16.2,7.2-16.2,16.2V193.5z" />

View File

@@ -1,5 +1,14 @@
import { Component, OnInit } from '@angular/core';
import { Observable, Subscription, of } from 'rxjs';
import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
import { ProbeService } from '../../../commons/service/probe.service';
import { Interface } from '@overflow/model/net/nic';
import { Zone, DiscoverHost } from '@overflow/model/discovery';
import { toMetaIPType, MetaIPTypeEnum } from '@overflow/model/meta';
import { Address } from '../../../commons/component/nic-dropdown.component';
@Component({
@@ -12,8 +21,11 @@ export class HomePageComponent implements OnInit {
blockedPanel = false;
blockedDocument = false;
addresses: Address[];
constructor() { }
constructor(
private probeService: ProbeService,
) { }
ngOnInit() {
}
@@ -25,4 +37,53 @@ export class HomePageComponent implements OnInit {
this.blockedDocument = false;
}, 3000);
}
discoverHost() {
const zone: Zone = {
network: '192.168.1.0/24',
iface: 'enp3s0',
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
address: '192.168.1.101',
mac: '44:8a:5b:f1:f1:f3',
};
const discoverHost: DiscoverHost = {
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
firstScanRange: '192.168.1.1',
lastScanRange: '192.168.1.254',
discoveryConfig: {
},
discoverPort: {
firstScanRange: 1,
lastScanRange: 65535,
includeTCP: true,
includeUDP: true,
discoverService: {
}
}
};
this.probeService.send('DiscoveryService.DiscoverHost', 'testRequesterID', zone, discoverHost);
// this.probeService.call<Interface>('MachineService.Interfaces').pipe(
// map((ifaces: Interface[]) => {
// console.log(ifaces);
// this.addresses = [];
// ifaces.forEach(iface => {
// iface.addresses.forEach(address => {
// this.addresses.push({
// label: address.address,
// value: address.address,
// });
// });
// });
// }),
// catchError(error => {
// console.log(error);
// return of();
// }),
// take(1),
// ).subscribe();
}
}

View File

@@ -9,7 +9,7 @@ import {
import { Subscription } from 'rxjs';
const config: WebSocketClientRWCConfig = {
url: 'ws://localhost:60000/'
url: 'ws://localhost:60000/scanner'
};
const rwc = new WebSocketClientRWC(config);
const codec = new JSONClientCodec();