test
This commit is contained in:
parent
9497df0ad9
commit
e571e54b36
|
@ -1,5 +1,5 @@
|
||||||
<div *ngIf="showIntro" class="home-start">
|
<div *ngIf="showIntro" class="home-start">
|
||||||
<div class="start-button" (click)="discoverHost($event)">
|
<div class="start-button" (click)="startDiscovery($event)">
|
||||||
<svg version="1.1" viewBox="0 0 200 210">
|
<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
|
<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" />
|
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" />
|
||||||
|
|
|
@ -4,8 +4,7 @@ import { Component, OnInit, OnDestroy, ViewChild, ElementRef, ChangeDetectorRef
|
||||||
|
|
||||||
import { ProbeService, requesterID } from '../../../commons/service/probe.service';
|
import { ProbeService, requesterID } from '../../../commons/service/probe.service';
|
||||||
|
|
||||||
import { Zone, Host, Port, Service } from '@overflow/model/discovery';
|
import { Zone, Host, Port, Service, DiscoverHost } from '@overflow/model/discovery';
|
||||||
import { toMetaIPType, MetaIPTypeEnum } from '@overflow/model/meta';
|
|
||||||
import { RPCSubscriber } from '@overflow/commons/ui/decorator/RPCSubscriber';
|
import { RPCSubscriber } from '@overflow/commons/ui/decorator/RPCSubscriber';
|
||||||
import { DiscoveryConfigService } from '../../../commons/service/discovery-config.service';
|
import { DiscoveryConfigService } from '../../../commons/service/discovery-config.service';
|
||||||
|
|
||||||
|
@ -17,8 +16,12 @@ const vis = require('vis');
|
||||||
styleUrls: ['./home-page.component.scss'],
|
styleUrls: ['./home-page.component.scss'],
|
||||||
})
|
})
|
||||||
export class HomePageComponent implements OnInit, OnDestroy {
|
export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
private discoveryTargetRef: ElementRef;
|
private discoveryTargetRef: ElementRef;
|
||||||
|
|
||||||
|
zone: Zone;
|
||||||
|
discoverHost: DiscoverHost;
|
||||||
|
|
||||||
@ViewChild('discoveryTarget') set discoveryTarget(content: ElementRef) {
|
@ViewChild('discoveryTarget') set discoveryTarget(content: ElementRef) {
|
||||||
this.discoveryTargetRef = content;
|
this.discoveryTargetRef = content;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +47,18 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
// this.probeService.subscribeNotification(this);
|
// this.probeService.subscribeNotification(this);
|
||||||
// this.discoverHost("");
|
// this.startDiscovery("");
|
||||||
|
this.discoveryConfigService.zone.subscribe(res => {
|
||||||
|
this.zone = res as Zone;
|
||||||
|
});
|
||||||
|
this.discoveryConfigService.discoverHost.subscribe(res => {
|
||||||
|
this.discoverHost = res as DiscoverHost;
|
||||||
|
});
|
||||||
|
this.discoveryConfigService.started.subscribe(res => {
|
||||||
|
if (res) {
|
||||||
|
this.startDiscovery();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
@ -58,7 +72,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
discoverHost() {
|
startDiscovery() {
|
||||||
this.showIntro = false;
|
this.showIntro = false;
|
||||||
this.changeDetector.detectChanges();
|
this.changeDetector.detectChanges();
|
||||||
|
|
||||||
|
@ -97,12 +111,12 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.probeService.send(
|
// this.probeService.send(
|
||||||
'DiscoveryService.DiscoverHost',
|
// 'DiscoveryService.DiscoverHost',
|
||||||
requesterID,
|
// requesterID,
|
||||||
this.discoveryConfigService.getZone(),
|
// this.discoveryConfigService.getZone(),
|
||||||
this.discoveryConfigService.getDiscoverHost()
|
// this.discoveryConfigService.getDiscoverHost()
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { CommonsUIModule } from '@overflow/commons/ui/commons-ui.module';
|
||||||
import { HomePageComponent } from './home-page.component';
|
import { HomePageComponent } from './home-page.component';
|
||||||
import { HomePageRoutingModule } from './home-page-routing.module';
|
import { HomePageRoutingModule } from './home-page-routing.module';
|
||||||
import { CommonsModule } from '../../../commons/commons.module';
|
import { CommonsModule } from '../../../commons/commons.module';
|
||||||
import { DiscoveryConfigService } from '../../../commons/service/discovery-config.service';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -18,8 +17,5 @@ import { DiscoveryConfigService } from '../../../commons/service/discovery-confi
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
],
|
],
|
||||||
declarations: [HomePageComponent],
|
declarations: [HomePageComponent],
|
||||||
providers: [
|
|
||||||
DiscoveryConfigService
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
export class HomePageModule { }
|
export class HomePageModule { }
|
||||||
|
|
|
@ -363,10 +363,7 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
onStart() {
|
onStart() {
|
||||||
this.probeService.send('DiscoveryService.DiscoverHost',
|
this.discoveryConfigService.setStarted(true);
|
||||||
requesterID,
|
|
||||||
this.discoveryConfigService.getZone(),
|
|
||||||
this.discoveryConfigService.getDiscoverHost());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import { CommonsModule } from '../../commons/commons.module';
|
||||||
import { PagesComponent } from './pages.component';
|
import { PagesComponent } from './pages.component';
|
||||||
import { PagesRoutingModule } from './pages-routing.module';
|
import { PagesRoutingModule } from './pages-routing.module';
|
||||||
import { DiscoveryConfigService } from '../../commons/service/discovery-config.service';
|
import { DiscoveryConfigService } from '../../commons/service/discovery-config.service';
|
||||||
import { ProbeService } from '../../commons/service/probe.service';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
|
|
@ -1,27 +1,37 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { DiscoverHost, Zone } from "@overflow/model/discovery";
|
import { DiscoverHost, Zone } from "@overflow/model/discovery";
|
||||||
|
import { Observable, BehaviorSubject } from "rxjs";
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class DiscoveryConfigService {
|
export class DiscoveryConfigService {
|
||||||
|
|
||||||
discoverHost: DiscoverHost;
|
private discoverHostSubject = new BehaviorSubject<DiscoverHost>(null);
|
||||||
zone: Zone;
|
private zoneSubject = new BehaviorSubject<Zone>(null);
|
||||||
|
private startSubject = new BehaviorSubject<boolean>(false);
|
||||||
|
|
||||||
public setZone(zone: Zone): void {
|
discoverHost: Observable<DiscoverHost>;
|
||||||
this.zone = zone;
|
zone: Observable<Zone>;
|
||||||
|
started: Observable<boolean>;
|
||||||
|
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.discoverHost = this.discoverHostSubject.asObservable();
|
||||||
|
this.zone = this.zoneSubject.asObservable();
|
||||||
|
this.started = this.startSubject.asObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getZone(): Zone {
|
public setZone(zone: Zone): void {
|
||||||
return this.zone;
|
this.zoneSubject.next(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setDiscoverHost(discoverHost: DiscoverHost): void {
|
public setDiscoverHost(discoverHost: DiscoverHost): void {
|
||||||
this.discoverHost = discoverHost;
|
this.discoverHostSubject.next(discoverHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getDiscoverHost(): DiscoverHost {
|
public setStarted(isStarted: boolean): void {
|
||||||
return this.discoverHost;
|
this.startSubject.next(isStarted);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user