This commit is contained in:
crusader 2018-06-04 13:15:09 +09:00
parent ad6907f7ba
commit 378c65c514

View File

@ -18,10 +18,10 @@ import { PageParams } from '@overflow/commons-typescript/model/commons/PageParam
templateUrl: './sensor-list.component.html', templateUrl: './sensor-list.component.html',
}) })
export class SensorListComponent implements OnInit, OnChanges { export class SensorListComponent implements OnInit, OnChanges {
@Input() pageNo: number;
@Output() select = new EventEmitter<Sensor>(); @Output() select = new EventEmitter<Sensor>();
@Output() addSensor = new EventEmitter(); @Output() addSensor = new EventEmitter();
pageNo = 1;
page: Page<Sensor>; page: Page<Sensor>;
pending$: Observable<boolean>; pending$: Observable<boolean>;
error$: Observable<any>; error$: Observable<any>;
@ -37,10 +37,6 @@ export class SensorListComponent implements OnInit, OnChanges {
} }
ngOnInit() { ngOnInit() {
if (undefined === this.pageNo || 1 > this.pageNo) {
this.pageNo = 0;
}
this.store.pipe( this.store.pipe(
tap(() => { tap(() => {
this.pending$ = of(true); this.pending$ = of(true);
@ -48,7 +44,7 @@ export class SensorListComponent implements OnInit, OnChanges {
select(AuthSelector.selectDomainMember), select(AuthSelector.selectDomainMember),
exhaustMap((domainMember: DomainMember) => { exhaustMap((domainMember: DomainMember) => {
const pageParams: PageParams = { const pageParams: PageParams = {
pageNo: this.pageNo, pageNo: this.pageNo - 1,
countPerPage: 10, countPerPage: 10,
sortCol: 'id', sortCol: 'id',
sortDirection: 'descending', sortDirection: 'descending',
@ -58,6 +54,7 @@ export class SensorListComponent implements OnInit, OnChanges {
.pipe( .pipe(
map((page: Page<Sensor>) => { map((page: Page<Sensor>) => {
this.page = page; this.page = page;
this.generateSensorMap();
}), }),
catchError(error => { catchError(error => {
this.error$ = of(error); this.error$ = of(error);