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