ing
This commit is contained in:
parent
c844548d68
commit
a3c866bb75
|
@ -36,6 +36,7 @@ export class ListComponent implements OnInit, OnChanges {
|
||||||
@Input() probeID;
|
@Input() probeID;
|
||||||
@Input() pageIdx;
|
@Input() pageIdx;
|
||||||
@Output() pageChange = new EventEmitter<number>();
|
@Output() pageChange = new EventEmitter<number>();
|
||||||
|
@Output() targetSelect = new EventEmitter<Target>();
|
||||||
|
|
||||||
@ViewChild('paginator') paginator: Paginator;
|
@ViewChild('paginator') paginator: Paginator;
|
||||||
|
|
||||||
|
@ -54,19 +55,15 @@ export class ListComponent implements OnInit, OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
console.log(changes);
|
// console.log(changes);
|
||||||
if (changes['pageIdx'] && this.paginator) {
|
if (changes['pageIdx'] && this.paginator) {
|
||||||
console.log(this.pageIdx);
|
// console.log(this.pageIdx);
|
||||||
this.getTargetList();
|
this.getTargetList();
|
||||||
this.paginator.changePage(this.pageIdx);
|
this.paginator.changePage(this.pageIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTargetList() {
|
private getTargetList() {
|
||||||
// console.log('----------------------------------------------------------------');
|
|
||||||
// console.log(this.pageIdx);
|
|
||||||
// console.log('----------------------------------------------------------------');
|
|
||||||
|
|
||||||
if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) {
|
if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) {
|
||||||
this.pageIdx = 0;
|
this.pageIdx = 0;
|
||||||
}
|
}
|
||||||
|
@ -97,8 +94,7 @@ export class ListComponent implements OnInit, OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
onRowSelect(event) {
|
onRowSelect(event) {
|
||||||
// this.router.navigate(['target'], { queryParams: { target: event.data.id } });
|
this.targetSelect.emit(event.data);
|
||||||
// this.router.navigate(['target', event.data.id, 'info']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAddSensor(target: Target) {
|
onAddSensor(target: Target) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ const routes: Routes = [
|
||||||
{ path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' },
|
{ path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' },
|
||||||
{ path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' },
|
{ path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' },
|
||||||
{ path: 'sensor', loadChildren: './sensors/sensor-tab-page.module#SensorTabPageModule' },
|
{ 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: 'target', loadChildren: './target/target-page.module#TargetPageModule' },
|
||||||
// { path: 'overview', loadChildren: './overview/overview-page.module#OverviewPageModule' },
|
// { path: 'overview', loadChildren: './overview/overview-page.module#OverviewPageModule' },
|
||||||
// { path: 'dashboard', loadChildren: './dashboard/dashboard-page.module#DashboardPageModule' },
|
// { path: 'dashboard', loadChildren: './dashboard/dashboard-page.module#DashboardPageModule' },
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
<div class="card no-margin">
|
<div class="card no-margin">
|
||||||
<!--<of-discovery [probeHostID]="probeHostID"></of-discovery>-->
|
<!--<of-discovery [probeHostID]="probeHostID"></of-discovery>-->
|
||||||
sdfsdf
|
sdfsdfasdasdasd
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="ui-g">
|
<div class="ui-g">
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
<div class="card no-margin">
|
<div class="card no-margin">
|
||||||
<of-target-list [probeID]="probeID" [pageIdx]="pageIdx" (pageChange)="onPageChange($event)"></of-target-list>
|
<of-target-list [probeID]="probeID" [pageIdx]="pageIdx" (pageChange)="onPageChange($event)" (targetSelect)="onTargetSelect($event)" ></of-target-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {Component, Input, OnInit} from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { Target } from '@overflow/commons-typescript';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-pages-target-list',
|
selector: 'of-pages-target-list',
|
||||||
|
@ -19,20 +20,21 @@ export class TargetListPageComponent implements OnInit {
|
||||||
this.activatedRoute.queryParams.subscribe(queryParams => {
|
this.activatedRoute.queryParams.subscribe(queryParams => {
|
||||||
this.pageIdx = Number(queryParams['page']);
|
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;
|
this.pageIdx = 0;
|
||||||
}
|
}
|
||||||
// console.log('*****************************************************');
|
|
||||||
// console.log(this.pageIdx);
|
|
||||||
// console.log('*****************************************************');
|
|
||||||
});
|
});
|
||||||
// this.pageIdx = this.activatedRoute.snapshot.queryParams['page'] || 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageChange(pageNo: number) {
|
onPageChange(pageNo: number) {
|
||||||
// console.log('**********************pageNo*******************************');
|
|
||||||
// console.log(pageNo);
|
|
||||||
// console.log('**********************pageNo*******************************');
|
|
||||||
this.router.navigate(['/probe', this.probeID, 'target'], { queryParams: { page: 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']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@ const routes: Routes = [
|
||||||
path: '',
|
path: '',
|
||||||
component: TargetPageComponent,
|
component: TargetPageComponent,
|
||||||
children: [
|
children: [
|
||||||
{ path: 'list', component: TargetListPageComponent },
|
// { path: ':id/target', component: TargetListPageComponent },
|
||||||
{ path: 'detail', component: TargetDetailPageComponent }
|
{ path: ':id/info', component: TargetDetailPageComponent }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<!--<ng-template #complete>-->
|
<!--<ng-template #complete>-->
|
||||||
<of-pages-target-list [probeID]="probeID" ></of-pages-target-list>
|
<of-pages-target-list [probeID]="probeID" ></of-pages-target-list>
|
||||||
<!--</ng-template>-->
|
<!--</ng-template>-->
|
||||||
|
<!--<router-outlet></router-outlet>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user