This commit is contained in:
crusader 2018-06-01 18:56:00 +09:00
parent 46c1c55d61
commit 8ae4d26843
2 changed files with 13 additions and 50 deletions

View File

@ -1,5 +1,5 @@
import {
Component, Input, Output, EventEmitter,
Component, Input, Output, EventEmitter, OnDestroy,
} from '@angular/core';
import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe';
import { Anim } from './animation';
@ -15,7 +15,7 @@ import { DiscoverySubscriber, DiscoveryNotify } from '../subscriber/discovery.su
templateUrl: './discovery.component.html',
animations: Anim,
})
export class DiscoveryComponent {
export class DiscoveryComponent implements OnDestroy {
@Input() probeHostID;
pending$: Observable<boolean>;
@ -33,10 +33,16 @@ export class DiscoveryComponent {
) {
}
ngOnDestroy(): void {
if (null !== this.discoverySubscription) {
this.discoverySubscription.unsubscribe();
}
}
onRequestDiscovery(dz: DiscoverZone) {
this.requested = true;
this.discoverZone = dz;
this.discoverySubscriber.observable().pipe(
this.discoverySubscription = this.discoverySubscriber.observable().pipe(
tap(() => {
this.discoveryService.discoverZone(this.selectedProbe.probe.probeKey, dz);
}),
@ -51,6 +57,7 @@ export class DiscoveryComponent {
const stopDate = discoveryNotify.params as Date;
this.discoverySubscription.unsubscribe();
this.discoverySubscription = null;
break;
}
case 'DiscoveryService.discoveredZone': {

View File

@ -21,7 +21,7 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
error$: Observable<any>;
noauthProbes: NoAuthProbe[];
// connectingSubscription$: Subscription;
noauthProbeSubscription: Subscription;
constructor(
private confirmationService: ConfirmationService,
@ -55,24 +55,7 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
}),
).take(1).subscribe();
// this.connectingSubscription$ = this.store.pipe(
// select(NoAuthProbeConnectingSelector.selectEntities),
// tap((entities: { [id: number]: NoAuthProbe }) => {
// const noauthProbes = [];
// this.noauthProbes.forEach(noauthProbe => {
// const t = entities[noauthProbe.id];
// if (undefined !== t) {
// noauthProbes.push(t);
// } else {
// noauthProbes.push(noauthProbe);
// }
// });
// this.setNoauthProbes(noauthProbes);
// }
// ),
// ).subscribe();
this.noAuthProbeSubscriber.observable().pipe(
this.noauthProbeSubscription = this.noAuthProbeSubscriber.observable().pipe(
tap((noAuthProbeNotify: NoAuthProbeNotify) => {
const noauthProbes = [];
this.noauthProbes.forEach(noauthProbe => {
@ -88,39 +71,12 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
}
),
).subscribe();
// this.noauthProbes$ = this.store.pipe(
// select(AuthSelector.selectDomainMember),
// exhaustMap((domainMember: DomainMember) =>
// this.noAuthProbeService.readAllByDomainID(domainMember.domain.id)
// .pipe(
// map((noauthProbes: NoAuthProbe[]) => {
// this.pending$ = of(false);
// if (null === noauthProbes) {
// return null;
// }
// noauthProbes.forEach(noauthProbe => {
// noauthProbe.descriptions = JSON.parse(noauthProbe.description);
// });
// return noauthProbes;
// }),
// catchError(error => {
// this.pending$ = of(false);
// this.error$ = of(error);
// return of(null);
// })
// )
// )
// );
}
ngOnDestroy(): void {
// this.connectingSubscription$.unsubscribe();
this.noauthProbeSubscription.unsubscribe();
}
onAcceptOrDeny(isAccept: boolean, selected: NoAuthProbe) {
const title = isAccept ?
'Are you sure to accept this Probe?' : 'Are you sure to deny this Probe';