From a3c866bb7502f90a3690e64a58e1a5a183be46b4 Mon Sep 17 00:00:00 2001 From: geek Date: Mon, 11 Jun 2018 16:33:34 +0900 Subject: [PATCH] ing --- .../target/component/list/list.component.ts | 12 ++++------ src/app/pages/pages-routing.module.ts | 1 + .../targets/target-detail-page.component.html | 2 +- .../targets/target-list-page.component.html | 2 +- .../targets/target-list-page.component.ts | 22 ++++++++++--------- .../targets/target-page-routing.module.ts | 4 ++-- .../pages/targets/target-page.component.html | 1 + 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/@overflow/target/component/list/list.component.ts b/@overflow/target/component/list/list.component.ts index 63f8149..b533efb 100644 --- a/@overflow/target/component/list/list.component.ts +++ b/@overflow/target/component/list/list.component.ts @@ -36,6 +36,7 @@ export class ListComponent implements OnInit, OnChanges { @Input() probeID; @Input() pageIdx; @Output() pageChange = new EventEmitter(); + @Output() targetSelect = new EventEmitter(); @ViewChild('paginator') paginator: Paginator; @@ -54,19 +55,15 @@ export class ListComponent implements OnInit, OnChanges { } ngOnChanges(changes: SimpleChanges): void { - console.log(changes); + // console.log(changes); if (changes['pageIdx'] && this.paginator) { - console.log(this.pageIdx); + // console.log(this.pageIdx); this.getTargetList(); this.paginator.changePage(this.pageIdx); } } private getTargetList() { - // console.log('----------------------------------------------------------------'); - // console.log(this.pageIdx); - // console.log('----------------------------------------------------------------'); - if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) { this.pageIdx = 0; } @@ -97,8 +94,7 @@ export class ListComponent implements OnInit, OnChanges { } onRowSelect(event) { - // this.router.navigate(['target'], { queryParams: { target: event.data.id } }); - // this.router.navigate(['target', event.data.id, 'info']); + this.targetSelect.emit(event.data); } onAddSensor(target: Target) { diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index a27c22d..48a8605 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -13,6 +13,7 @@ const routes: Routes = [ { path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' }, { path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' }, { path: 'sensor', loadChildren: './sensors/sensor-tab-page.module#SensorTabPageModule' }, + { path: 'target/:id/info', loadChildren: './targets/target-page.module#TargetPageModule' }, // { path: 'target', loadChildren: './target/target-page.module#TargetPageModule' }, // { path: 'overview', loadChildren: './overview/overview-page.module#OverviewPageModule' }, // { path: 'dashboard', loadChildren: './dashboard/dashboard-page.module#DashboardPageModule' }, diff --git a/src/app/pages/targets/target-detail-page.component.html b/src/app/pages/targets/target-detail-page.component.html index f52dc3c..a580c97 100644 --- a/src/app/pages/targets/target-detail-page.component.html +++ b/src/app/pages/targets/target-detail-page.component.html @@ -3,7 +3,7 @@
- sdfsdf + sdfsdfasdasdasd
diff --git a/src/app/pages/targets/target-list-page.component.html b/src/app/pages/targets/target-list-page.component.html index 63095e3..413995b 100644 --- a/src/app/pages/targets/target-list-page.component.html +++ b/src/app/pages/targets/target-list-page.component.html @@ -2,7 +2,7 @@
- +
diff --git a/src/app/pages/targets/target-list-page.component.ts b/src/app/pages/targets/target-list-page.component.ts index f9c57de..24a5b8a 100644 --- a/src/app/pages/targets/target-list-page.component.ts +++ b/src/app/pages/targets/target-list-page.component.ts @@ -1,5 +1,6 @@ -import {Component, Input, OnInit} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; +import { Component, Input, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Target } from '@overflow/commons-typescript'; @Component({ selector: 'of-pages-target-list', @@ -19,20 +20,21 @@ export class TargetListPageComponent implements OnInit { this.activatedRoute.queryParams.subscribe(queryParams => { this.pageIdx = Number(queryParams['page']); - if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null) { + if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) { this.pageIdx = 0; } - // console.log('*****************************************************'); - // console.log(this.pageIdx); - // console.log('*****************************************************'); }); - // this.pageIdx = this.activatedRoute.snapshot.queryParams['page'] || 1; } onPageChange(pageNo: number) { - // console.log('**********************pageNo*******************************'); - // console.log(pageNo); - // console.log('**********************pageNo*******************************'); this.router.navigate(['/probe', this.probeID, 'target'], { queryParams: { page: pageNo } }); } + + onTargetSelect(target: Target) { + // console.log(target); + // this.router.navigate(['target'], { queryParams: { target: event.data.id } }); + // this.router.navigate(['target', event.data.id, 'info']); + + this.router.navigate(['/target', target.id, 'info']); + } } diff --git a/src/app/pages/targets/target-page-routing.module.ts b/src/app/pages/targets/target-page-routing.module.ts index b897084..b9c66fb 100644 --- a/src/app/pages/targets/target-page-routing.module.ts +++ b/src/app/pages/targets/target-page-routing.module.ts @@ -10,8 +10,8 @@ const routes: Routes = [ path: '', component: TargetPageComponent, children: [ - { path: 'list', component: TargetListPageComponent }, - { path: 'detail', component: TargetDetailPageComponent } + // { path: ':id/target', component: TargetListPageComponent }, + { path: ':id/info', component: TargetDetailPageComponent } ] } ]; diff --git a/src/app/pages/targets/target-page.component.html b/src/app/pages/targets/target-page.component.html index 767e27a..0178f5d 100644 --- a/src/app/pages/targets/target-page.component.html +++ b/src/app/pages/targets/target-page.component.html @@ -5,6 +5,7 @@ +