discovery

This commit is contained in:
insanity 2018-05-03 22:27:11 +09:00
parent 77dd195550
commit ec1de8c6e7
7 changed files with 20 additions and 10 deletions

View File

@ -1,9 +1,9 @@
<div class="ui-g-12"> <div class="ui-g-12">
<p-pickList [disabled]="disabled" [source]="crawlers" [target]="includeServices" sourceHeader="Available" targetHeader="Selected" [responsive]="true" <p-pickList [disabled]="disabled" [source]="crawlers" [target]="includeServices" sourceHeader="Available" targetHeader="Selected" [responsive]="true"
filterBy="brand" dragdrop="true" dragdropScope="services" [sourceStyle]="{'height':'200px'}" [targetStyle]="{'height':'200px'}" [showTargetControls]="false" [showSourceControls]="false"> filterBy="description" dragdrop="true" dragdropScope="services" [sourceStyle]="{'height':'200px'}" [targetStyle]="{'height':'200px'}" [showTargetControls]="false" [showSourceControls]="false">
<ng-template let-crawler pTemplate="item"> <ng-template let-crawler pTemplate="item">
<div class="ui-helper-clearfix"> <div class="ui-helper-clearfix">
<div style="font-size:14px;margin:0;padding: 0;">{{crawler.name}}</div> <div style="font-size:14px;margin:0;padding: 0;">{{crawler.description}}</div>
</div> </div>
</ng-template> </ng-template>
</p-pickList> </p-pickList>

View File

@ -30,11 +30,12 @@ export class ServiceSelectorComponent implements OnInit, AfterContentInit, OnDes
this.crawlersSubscription$ = this.crawlers$.subscribe( this.crawlersSubscription$ = this.crawlers$.subscribe(
(list: MetaCrawler[]) => { (list: MetaCrawler[]) => {
if (list !== null) { if (list !== null) {
this.crawlers = list; this.crawlers = [];
this.includeServices = list;
} }
}, },
(error: RPCClientError) => { (error: RPCClientError) => {
console.log(error.response.message); console.log(error);
} }
); );
} }

View File

@ -54,6 +54,7 @@ export class ResultComponent implements OnInit, AfterContentInit, OnDestroy {
this.resultSubscription$ = this.result$.subscribe( this.resultSubscription$ = this.result$.subscribe(
(zones: Map<string, Zone>) => { (zones: Map<string, Zone>) => {
if (zones !== undefined && zones !== null) { if (zones !== undefined && zones !== null) {
console.log(zones);
this.treeNodes = this.convertTreeViewZone(zones); this.treeNodes = this.convertTreeViewZone(zones);
this.zones = zones; this.zones = zones;
} }
@ -64,7 +65,7 @@ export class ResultComponent implements OnInit, AfterContentInit, OnDestroy {
); );
this.startedSubscription$ = this.started$.subscribe( this.startedSubscription$ = this.started$.subscribe(
(isStart: boolean) => { (isStart: boolean) => {
if (isStart !== undefined && isStart !== null) { if (isStart !== undefined && isStart !== null && isStart) {
this.inProgress = true; this.inProgress = true;
console.log('##Discovery has started.##'); console.log('##Discovery has started.##');
} }
@ -75,7 +76,7 @@ export class ResultComponent implements OnInit, AfterContentInit, OnDestroy {
); );
this.endedSubscription$ = this.ended$.subscribe( this.endedSubscription$ = this.ended$.subscribe(
(isEnd: boolean) => { (isEnd: boolean) => {
if (isEnd !== undefined && isEnd !== null) { if (isEnd !== undefined && isEnd !== null && isEnd) {
console.log('##Discovery has done.##'); console.log('##Discovery has done.##');
} }
}, },

View File

@ -1,14 +1,17 @@
<div dir="rtl">
<p-button (onClick)="onCancel()" icon="fa fa-fw fa-close"></p-button>
</div>
<div *ngIf="!started; else result"> <div *ngIf="!started; else result">
<of-probe-selector [preProbe]="probe" (probeSelected)="onProbeSelect($event)"></of-probe-selector> <of-probe-selector [preProbe]="probe" (probeSelected)="onProbeSelect($event)"></of-probe-selector>
<p-blockUI [target]="df" [blocked]="!selectedProbe"></p-blockUI> <p-blockUI [target]="df" [blocked]="!selectedProbe && !probe"></p-blockUI>
<p-panel #df [showHeader]="false"> <p-panel #df [showHeader]="false">
<of-discovery-filter [probe]="selectedProbe" [requestStart]="requestStart" (discoveryRequested)="onDiscoveryStart($event)"></of-discovery-filter> <of-discovery-filter [probe]="selectedProbe" [requestStart]="requestStart" (discoveryRequested)="onDiscoveryStart($event)"></of-discovery-filter>
</p-panel> </p-panel>
<div dir="rtl"> <div dir="rtl">
<button [disabled]="!selectedProbe" pButton type="button" label="Start" icon="fa-check" class="ui-button-width-fit" (click)="requestStart = true"></button> <button [disabled]="!selectedProbe && !probe" pButton type="button" label="Start" icon="fa-check" class="ui-button-width-fit" (click)="requestStart = true"></button>
<button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary ui-button-width-fit" (click)="onCancel()"></button> <button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary ui-button-width-fit" (click)="onCancel()"></button>
</div> </div>
</div> </div>

View File

@ -37,6 +37,7 @@ export class SettingComponent implements OnInit, AfterContentInit, OnDestroy, On
private started = false; private started = false;
private selectedProbe: Probe; private selectedProbe: Probe;
private height: number;
constructor( constructor(
private discoverStore: Store<DiscoverStore.State>, private discoverStore: Store<DiscoverStore.State>,
@ -44,6 +45,7 @@ export class SettingComponent implements OnInit, AfterContentInit, OnDestroy, On
} }
ngOnInit() { ngOnInit() {
this.height = window.innerHeight;
} }
ngAfterContentInit() { ngAfterContentInit() {
@ -75,6 +77,7 @@ export class SettingComponent implements OnInit, AfterContentInit, OnDestroy, On
onCancel() { onCancel() {
this.close.emit(); this.close.emit();
this.started = false; this.started = false;
this.selectedProbe = null;
} }
} }

View File

@ -1,6 +1,6 @@
<h1>Info</h1> <h1>Info</h1>
<p-dialog [showHeader]="false" [closeOnEscape]="false" [modal]="true" header="Discovery" [width]="800" [(visible)]="display" <p-dialog [showHeader]="false" [closeOnEscape]="false" [modal]="true" header="Discovery" [width]="800" [height]="738" [(visible)]="display"
[dismissableMask]="true"> [dismissableMask]="true">
<of-discovery-setting [probe]="probe" (close)="onDiscoveryClose()"></of-discovery-setting> <of-discovery-setting [probe]="probe" (close)="onDiscoveryClose()"></of-discovery-setting>
</p-dialog> </p-dialog>

View File

@ -8,6 +8,7 @@ import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { DiscoveryModule } from 'packages/discovery/discovery.module'; import { DiscoveryModule } from 'packages/discovery/discovery.module';
import { KeyValueModule } from 'app/commons/component/key-value/key-value.module'; import { KeyValueModule } from 'app/commons/component/key-value/key-value.module';
import { MetaCrawlerModule } from '../meta/crawler/crawler.module';
@NgModule({ @NgModule({
imports: [ imports: [
@ -16,7 +17,8 @@ import { KeyValueModule } from 'app/commons/component/key-value/key-value.module
ProbeStoreModule, ProbeStoreModule,
FormsModule, FormsModule,
DiscoveryModule, DiscoveryModule,
KeyValueModule KeyValueModule,
MetaCrawlerModule
], ],
declarations: [ declarations: [
COMPONENTS, COMPONENTS,