bug fix
This commit is contained in:
parent
ec1de8c6e7
commit
ef1a1f19ef
|
@ -1,4 +1,4 @@
|
|||
<div *ngIf="!preProbe">
|
||||
<p-dropdown [options]="probes" optionLabel="displayName" placeholder="Select a Probe" (onChange)="onProbeSelect($event)"
|
||||
<p-dropdown #dropdown [options]="probes" optionLabel="displayName" placeholder="Select a Probe" [(ngModel)]="selected" (onChange)="onProbeSelect($event)"
|
||||
[style]="{'width':'300px'}"></p-dropdown>
|
||||
</div>
|
|
@ -1,4 +1,7 @@
|
|||
import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy } from '@angular/core';
|
||||
import {
|
||||
Component, OnInit, Input, AfterContentInit, Output,
|
||||
EventEmitter, OnDestroy, OnChanges, SimpleChanges, ViewChild
|
||||
} from '@angular/core';
|
||||
import { Store, select, StateObservable } from '@ngrx/store';
|
||||
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
||||
import * as ListStore from 'packages/probe/store/list';
|
||||
|
@ -7,18 +10,22 @@ import { Subscription } from 'rxjs/Subscription';
|
|||
import { Probe } from '@overflow/commons-typescript/model/probe';
|
||||
import { AuthSelector } from 'packages/member/store';
|
||||
import { Domain } from '@overflow/commons-typescript/model/domain';
|
||||
import { Dropdown } from 'primeng/primeng';
|
||||
|
||||
@Component({
|
||||
selector: 'of-probe-selector',
|
||||
templateUrl: './probe-selector.component.html',
|
||||
})
|
||||
export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges {
|
||||
|
||||
@Input() visible: boolean;
|
||||
@Input() preProbe: Probe;
|
||||
probesSubscription$: Subscription;
|
||||
probes$: StateObservable;
|
||||
probes: Probe[];
|
||||
|
||||
selected: Probe;
|
||||
|
||||
@Output() probeSelected = new EventEmitter<Probe>();
|
||||
|
||||
constructor(
|
||||
|
@ -31,6 +38,7 @@ export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestr
|
|||
this.probesSubscription$ = this.probes$.subscribe(
|
||||
(list: Probe[]) => {
|
||||
if (list !== null) {
|
||||
console.log('what the hell');
|
||||
this.probes = list;
|
||||
}
|
||||
},
|
||||
|
@ -41,6 +49,23 @@ export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestr
|
|||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
this.getProbes();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.probesSubscription$) {
|
||||
this.probesSubscription$.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes['visible']) {
|
||||
this.selected = null;
|
||||
this.getProbes();
|
||||
}
|
||||
}
|
||||
|
||||
getProbes() {
|
||||
this.listStore.select(AuthSelector.select('domain')).subscribe(
|
||||
(domain: Domain) => {
|
||||
this.listStore.dispatch(new ListStore.ReadAllByDomain(domain));
|
||||
|
@ -51,13 +76,8 @@ export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestr
|
|||
);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.probesSubscription$) {
|
||||
this.probesSubscription$.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
onProbeSelect(event) {
|
||||
this.probeSelected.emit(event.value);
|
||||
this.selected = event.value;
|
||||
this.probeSelected.emit(this.selected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
</div>
|
||||
|
||||
<div *ngIf="!started; else result">
|
||||
<of-probe-selector [preProbe]="probe" (probeSelected)="onProbeSelect($event)"></of-probe-selector>
|
||||
<of-probe-selector [preProbe]="probe" [visible]="visible" (probeSelected)="onProbeSelect($event)"></of-probe-selector>
|
||||
|
||||
<p-blockUI [target]="df" [blocked]="!selectedProbe && !probe"></p-blockUI>
|
||||
<p-panel #df [showHeader]="false">
|
||||
|
|
|
@ -31,6 +31,7 @@ import { Subscription } from 'rxjs/Subscription';
|
|||
})
|
||||
export class SettingComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges {
|
||||
|
||||
@Input() visible: boolean;
|
||||
@Input() probe: Probe;
|
||||
@Output() close = new EventEmitter();
|
||||
private requestStart = false;
|
||||
|
@ -65,8 +66,8 @@ export class SettingComponent implements OnInit, AfterContentInit, OnDestroy, On
|
|||
}
|
||||
|
||||
onDiscoveryStart(discoverZone: DiscoverZone) {
|
||||
// this.discoverStore.dispatch(new DiscoverStore.DiscoverZone(
|
||||
// { probeID: this.selectedProbe.probeKey, discoverZone: discoverZone }));
|
||||
this.discoverStore.dispatch(new DiscoverStore.DiscoverZone(
|
||||
{ probeID: this.selectedProbe.probeKey, discoverZone: discoverZone }));
|
||||
|
||||
setTimeout(() => {
|
||||
this.started = true;
|
||||
|
@ -75,9 +76,10 @@ export class SettingComponent implements OnInit, AfterContentInit, OnDestroy, On
|
|||
}
|
||||
|
||||
onCancel() {
|
||||
this.close.emit();
|
||||
this.started = false;
|
||||
this.selectedProbe = null;
|
||||
this.probe = null;
|
||||
this.started = false;
|
||||
this.close.emit();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<p-dialog [showHeader]="false" [closeOnEscape]="false" [modal]="true" header="Discovery" [width]="800" [(visible)]="display" [dismissableMask]="true">
|
||||
<of-discovery-setting (close)="closeDialog()"></of-discovery-setting>
|
||||
<of-discovery-setting [visible]="display" (close)="closeDialog()"></of-discovery-setting>
|
||||
</p-dialog>
|
||||
|
||||
<div class="ui-g">
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<h1>Info</h1>
|
||||
|
||||
<p-dialog [showHeader]="false" [closeOnEscape]="false" [modal]="true" header="Discovery" [width]="800" [height]="738" [(visible)]="display"
|
||||
<p-dialog [showHeader]="false" [closeOnEscape]="false" [modal]="true" header="Discovery" [width]="800" [(visible)]="display"
|
||||
[dismissableMask]="true">
|
||||
<of-discovery-setting [probe]="probe" (close)="onDiscoveryClose()"></of-discovery-setting>
|
||||
<of-discovery-setting [probe]="probe" [visible]="display" (close)="onDiscoveryClose()"></of-discovery-setting>
|
||||
</p-dialog>
|
||||
<div class="ui-g ui-bottom-space-10">
|
||||
<p-panel [showHeader]="false" class="nopad">
|
||||
|
|
Loading…
Reference in New Issue
Block a user