probe's target
This commit is contained in:
		
							parent
							
								
									bd97afccc5
								
							
						
					
					
						commit
						aa74b9b819
					
				| @ -19,7 +19,6 @@ import { Target } from '../../model'; | |||||||
| }) | }) | ||||||
| export class ListComponent implements OnInit, AfterContentInit { | export class ListComponent implements OnInit, AfterContentInit { | ||||||
| 
 | 
 | ||||||
|     probe$ = this.probeDetailStore.pipe(select(ProbeDetailSelector.select('probe'))); |  | ||||||
|     infras$ = this.infraListStore.pipe(select(ListSelector.select('page'))); |     infras$ = this.infraListStore.pipe(select(ListSelector.select('page'))); | ||||||
|     infras: Infra[]; |     infras: Infra[]; | ||||||
|     probe: Probe; |     probe: Probe; | ||||||
| @ -30,85 +29,33 @@ export class ListComponent implements OnInit, AfterContentInit { | |||||||
|         private route: ActivatedRoute, |         private route: ActivatedRoute, | ||||||
|         private router: Router, |         private router: Router, | ||||||
|         private infraListStore: Store<InfraListStore.State>, |         private infraListStore: Store<InfraListStore.State>, | ||||||
|         private probeDetailStore: Store<ProbeDetailStore.State>, |  | ||||||
|     ) { |     ) { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     ngOnInit() { |     ngOnInit() { | ||||||
|         // this.probe$.subscribe(
 |  | ||||||
|         //     (probe: Probe) => {
 |  | ||||||
|         //         if (probe) {
 |  | ||||||
|         //             console.log(probe);
 |  | ||||||
|         //             this.probe = probe;
 |  | ||||||
|         //             this.getInfras(probe);
 |  | ||||||
|         //         }
 |  | ||||||
|         //     },
 |  | ||||||
|         //     (error: RPCClientError) => {
 |  | ||||||
|         //         console.log(error.response.message);
 |  | ||||||
|         //     }
 |  | ||||||
|         // );
 |  | ||||||
| 
 | 
 | ||||||
|         // this.infras$.subscribe(
 |         this.infras$.subscribe( | ||||||
|         //     (page: Page) => {
 |             (page: Page) => { | ||||||
|         //         if (!page) {
 |                 if (!page) { | ||||||
|         //             return;
 |                     return; | ||||||
|         //         }
 |                 } | ||||||
|         //         this.infras = page.content;
 |                 this.infras = page.content; | ||||||
|         //     },
 |             }, | ||||||
|         //     (error: RPCClientError) => {
 |             (error: RPCClientError) => { | ||||||
|         //         console.log(error);
 |                 console.log(error); | ||||||
|         //     }
 |             } | ||||||
|         // );
 |         ); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     ngAfterContentInit() { |     ngAfterContentInit() { | ||||||
|         const probeId = this.route.snapshot.paramMap.get('id'); |         this.route.params.subscribe((params: any) => { | ||||||
|         this.getProbe(probeId); |             const probe = { | ||||||
| 
 |                 id: params['id'], | ||||||
|         // Temporary
 |             }; | ||||||
|         const infra1 = { |             this.getInfras(probe); | ||||||
|             id: 1, |         }); | ||||||
|             infraType: { |  | ||||||
|                 id: 1 |  | ||||||
|             }, |  | ||||||
|             target: { |  | ||||||
|                 id: 1, |  | ||||||
|                 displayName: 'FakeTarget1', |  | ||||||
|             }, |  | ||||||
|         }; |  | ||||||
|         const infra2 = { |  | ||||||
|             id: 2, |  | ||||||
|             infraType: { |  | ||||||
|                 id: 3 |  | ||||||
|             }, |  | ||||||
|             target: { |  | ||||||
|                 id: 2, |  | ||||||
|                 displayName: 'FakeTarget2', |  | ||||||
|             }, |  | ||||||
|         }; |  | ||||||
|         const infra3 = { |  | ||||||
|             id: 3, |  | ||||||
|             infraType: { |  | ||||||
|                 id: 2 |  | ||||||
|             }, |  | ||||||
|             target: { |  | ||||||
|                 id: 3, |  | ||||||
|                 displayName: 'FakeTarget3', |  | ||||||
|             }, |  | ||||||
|         }; |  | ||||||
|         this.infras = []; |  | ||||||
|         this.infras.push(infra1); |  | ||||||
|         this.infras.push(infra2); |  | ||||||
|         this.infras.push(infra3); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     getProbe(probeId: string) { |  | ||||||
|         this.probeDetailStore.dispatch( |  | ||||||
|             new ProbeDetailStore.Read( |  | ||||||
|                 { id: probeId } |  | ||||||
|             ) |  | ||||||
|         ); |  | ||||||
|     } |  | ||||||
|     getInfras(probe) { |     getInfras(probe) { | ||||||
|         const pageParams: PageParams = { |         const pageParams: PageParams = { | ||||||
|             pageNo: '0', |             pageNo: '0', | ||||||
| @ -124,7 +71,7 @@ export class ListComponent implements OnInit, AfterContentInit { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     onRowSelect(event) { |     onRowSelect(event) { | ||||||
|         this.router.navigate(['sensors'], { queryParams: {target: event.data.id}}); |         this.router.navigate(['sensors'], { queryParams: { target: event.data.id } }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     onAddSensor(target: Target) { |     onAddSensor(target: Target) { | ||||||
|  | |||||||
| @ -6,13 +6,15 @@ import { SERVICES } from './service'; | |||||||
| import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module'; | import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module'; | ||||||
| import { SensorModule } from '../sensor/sensor.module'; | import { SensorModule } from '../sensor/sensor.module'; | ||||||
| import { KeyValueModule } from 'app/commons/component/key-value/key-value.module'; | import { KeyValueModule } from 'app/commons/component/key-value/key-value.module'; | ||||||
|  | import { InfraModule } from '../infra/infra.module'; | ||||||
| 
 | 
 | ||||||
| @NgModule({ | @NgModule({ | ||||||
|   imports: [ |   imports: [ | ||||||
|     CommonModule, |     CommonModule, | ||||||
|     PrimeNGModules, |     PrimeNGModules, | ||||||
|     SensorModule, |     SensorModule, | ||||||
|     KeyValueModule |     KeyValueModule, | ||||||
|  |     InfraModule | ||||||
|   ], |   ], | ||||||
|   declarations: [ |   declarations: [ | ||||||
|     COMPONENTS, |     COMPONENTS, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user