ing
This commit is contained in:
parent
e854e6751e
commit
ed245412a1
|
@ -1,12 +1,11 @@
|
|||
import { Component, Input, Output, EventEmitter, AfterContentInit } from '@angular/core';
|
||||
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
|
||||
import { ConfirmationService, Message } from 'primeng/primeng';
|
||||
import { MessageService } from 'primeng/components/common/messageservice';
|
||||
|
||||
@Component({
|
||||
selector: 'of-noauth-probe-list',
|
||||
templateUrl: './noauth-probe-list.component.html',
|
||||
providers: [ConfirmationService, MessageService]
|
||||
providers: [ConfirmationService]
|
||||
})
|
||||
export class NoAuthProbeListComponent {
|
||||
@Input() noauthProbes: NoAuthProbe[];
|
||||
|
@ -19,7 +18,6 @@ export class NoAuthProbeListComponent {
|
|||
|
||||
constructor(
|
||||
private confirmationService: ConfirmationService,
|
||||
private messageService: MessageService
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
<p-messages [(value)]="msgs"></p-messages>
|
||||
|
||||
<of-noauth-probe-list
|
||||
[noauthProbes]="noauthProbes$ | async"
|
||||
[pending]="pending$ | async"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Store, select } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/operator/map';
|
||||
|
@ -11,25 +11,31 @@ import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
|
|||
import { ConfirmationService } from 'primeng/primeng';
|
||||
import { MessageService } from 'primeng/components/common/messageservice';
|
||||
import { RPCClientError } from '@loafer/ng-rpc';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'of-noauth-probe-list-container',
|
||||
templateUrl: './noauth-probe-list-container.component.html',
|
||||
providers: [ConfirmationService, MessageService]
|
||||
})
|
||||
export class NoAuthProbeListContainerComponent implements OnInit {
|
||||
export class NoAuthProbeListContainerComponent implements OnInit, OnDestroy {
|
||||
noauthProbes$: Observable<NoAuthProbe[]>;
|
||||
pending$: Observable<boolean>;
|
||||
error$: Observable<any>;
|
||||
errorSubscription: Subscription;
|
||||
|
||||
constructor(
|
||||
private store: Store<any>,
|
||||
private messageService: MessageService,
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.pending$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectPending));
|
||||
this.error$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectError));
|
||||
this.errorSubscription = this.store.pipe(select(NoAuthProbeListContainerSelector.selectError)).subscribe(
|
||||
(e: any) => {
|
||||
this.messageService.add({severity: 'error', summary: 'Service Message', detail: 'Via MessageService'});
|
||||
}
|
||||
);
|
||||
this.noauthProbes$ = this.store.pipe(select(NoAuthProbeListContainerSelector.selectAll)).map((_noauthProbes: NoAuthProbe[]) => {
|
||||
if (null === _noauthProbes) {
|
||||
return null;
|
||||
|
@ -47,8 +53,12 @@ export class NoAuthProbeListContainerComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.errorSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
accept(noAuthProbe: NoAuthProbe) {
|
||||
this.store.dispatch(new NoAuthProbeEntityStore.Accept(noAuthProbe.id));
|
||||
this.store.dispatch(new NoAuthProbeEntityStore.Accept({aa: noAuthProbe.id} as any));
|
||||
}
|
||||
|
||||
deny(noAuthProbe: NoAuthProbe) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user