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">
<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">
<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>
</ng-template>
</p-pickList>

View File

@ -30,11 +30,12 @@ export class ServiceSelectorComponent implements OnInit, AfterContentInit, OnDes
this.crawlersSubscription$ = this.crawlers$.subscribe(
(list: MetaCrawler[]) => {
if (list !== null) {
this.crawlers = list;
this.crawlers = [];
this.includeServices = list;
}
},
(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(
(zones: Map<string, Zone>) => {
if (zones !== undefined && zones !== null) {
console.log(zones);
this.treeNodes = this.convertTreeViewZone(zones);
this.zones = zones;
}
@ -64,7 +65,7 @@ export class ResultComponent implements OnInit, AfterContentInit, OnDestroy {
);
this.startedSubscription$ = this.started$.subscribe(
(isStart: boolean) => {
if (isStart !== undefined && isStart !== null) {
if (isStart !== undefined && isStart !== null && isStart) {
this.inProgress = true;
console.log('##Discovery has started.##');
}
@ -75,7 +76,7 @@ export class ResultComponent implements OnInit, AfterContentInit, OnDestroy {
);
this.endedSubscription$ = this.ended$.subscribe(
(isEnd: boolean) => {
if (isEnd !== undefined && isEnd !== null) {
if (isEnd !== undefined && isEnd !== null && isEnd) {
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">
<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">
<of-discovery-filter [probe]="selectedProbe" [requestStart]="requestStart" (discoveryRequested)="onDiscoveryStart($event)"></of-discovery-filter>
</p-panel>
<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>
</div>
</div>

View File

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

View File

@ -1,6 +1,6 @@
<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">
<of-discovery-setting [probe]="probe" (close)="onDiscoveryClose()"></of-discovery-setting>
</p-dialog>

View File

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