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

View File

@ -21,7 +21,7 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
error$: Observable<any>; error$: Observable<any>;
noauthProbes: NoAuthProbe[]; noauthProbes: NoAuthProbe[];
// connectingSubscription$: Subscription; noauthProbeSubscription: Subscription;
constructor( constructor(
private confirmationService: ConfirmationService, private confirmationService: ConfirmationService,
@ -55,24 +55,7 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
}), }),
).take(1).subscribe(); ).take(1).subscribe();
// this.connectingSubscription$ = this.store.pipe( this.noauthProbeSubscription = this.noAuthProbeSubscriber.observable().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(
tap((noAuthProbeNotify: NoAuthProbeNotify) => { tap((noAuthProbeNotify: NoAuthProbeNotify) => {
const noauthProbes = []; const noauthProbes = [];
this.noauthProbes.forEach(noauthProbe => { this.noauthProbes.forEach(noauthProbe => {
@ -88,39 +71,12 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
} }
), ),
).subscribe(); ).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 { ngOnDestroy(): void {
// this.connectingSubscription$.unsubscribe(); this.noauthProbeSubscription.unsubscribe();
} }
onAcceptOrDeny(isAccept: boolean, selected: NoAuthProbe) { onAcceptOrDeny(isAccept: boolean, selected: NoAuthProbe) {
const title = isAccept ? const title = isAccept ?
'Are you sure to accept this Probe?' : 'Are you sure to deny this Probe'; 'Are you sure to accept this Probe?' : 'Are you sure to deny this Probe';