Pagination fixes.
This commit is contained in:
		
							parent
							
								
									097e2ba0ea
								
							
						
					
					
						commit
						71c44d725a
					
				@ -1,4 +1,4 @@
 | 
				
			|||||||
import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
 | 
					import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
 | 
				
			||||||
import { AssetsService } from '../services/assets.service';
 | 
					import { AssetsService } from '../services/assets.service';
 | 
				
			||||||
import { environment } from 'src/environments/environment';
 | 
					import { environment } from 'src/environments/environment';
 | 
				
			||||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
 | 
					import { FormGroup, FormBuilder, Validators } from '@angular/forms';
 | 
				
			||||||
@ -32,7 +32,6 @@ export class AssetsComponent implements OnInit {
 | 
				
			|||||||
    private formBuilder: FormBuilder,
 | 
					    private formBuilder: FormBuilder,
 | 
				
			||||||
    private route: ActivatedRoute,
 | 
					    private route: ActivatedRoute,
 | 
				
			||||||
    private router: Router,
 | 
					    private router: Router,
 | 
				
			||||||
    private cd: ChangeDetectorRef,
 | 
					 | 
				
			||||||
  ) { }
 | 
					  ) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit() {
 | 
					  ngOnInit() {
 | 
				
			||||||
@ -89,7 +88,6 @@ export class AssetsComponent implements OnInit {
 | 
				
			|||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                  this.page = 1;
 | 
					                  this.page = 1;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                this.cd.markForCheck();
 | 
					 | 
				
			||||||
                if (this.searchForm.get('searchText').value !== (queryParams.search || '')) {
 | 
					                if (this.searchForm.get('searchText').value !== (queryParams.search || '')) {
 | 
				
			||||||
                  this.searchTextChanged(queryParams.search);
 | 
					                  this.searchTextChanged(queryParams.search);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
 | 
					import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
 | 
				
			||||||
import { BisqApiService } from '../bisq-api.service';
 | 
					import { BisqApiService } from '../bisq-api.service';
 | 
				
			||||||
import { switchMap, map } from 'rxjs/operators';
 | 
					import { switchMap, map, take, mergeMap, tap } from 'rxjs/operators';
 | 
				
			||||||
import { Observable } from 'rxjs';
 | 
					import { Observable } from 'rxjs';
 | 
				
			||||||
import { BisqBlock, BisqOutput, BisqTransaction } from '../bisq.interfaces';
 | 
					import { BisqBlock, BisqOutput, BisqTransaction } from '../bisq.interfaces';
 | 
				
			||||||
import { SeoService } from 'src/app/services/seo.service';
 | 
					import { SeoService } from 'src/app/services/seo.service';
 | 
				
			||||||
@ -29,7 +29,6 @@ export class BisqBlocksComponent implements OnInit {
 | 
				
			|||||||
    private seoService: SeoService,
 | 
					    private seoService: SeoService,
 | 
				
			||||||
    private route: ActivatedRoute,
 | 
					    private route: ActivatedRoute,
 | 
				
			||||||
    private router: Router,
 | 
					    private router: Router,
 | 
				
			||||||
    private cd: ChangeDetectorRef,
 | 
					 | 
				
			||||||
  ) { }
 | 
					  ) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit(): void {
 | 
					  ngOnInit(): void {
 | 
				
			||||||
@ -43,12 +42,20 @@ export class BisqBlocksComponent implements OnInit {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    this.blocks$ = this.route.queryParams
 | 
					    this.blocks$ = this.route.queryParams
 | 
				
			||||||
      .pipe(
 | 
					      .pipe(
 | 
				
			||||||
 | 
					        take(1),
 | 
				
			||||||
 | 
					        tap((qp) => {
 | 
				
			||||||
 | 
					          if (qp.page) {
 | 
				
			||||||
 | 
					            this.page = parseInt(qp.page, 10);
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
 | 
					        mergeMap(() => this.route.queryParams),
 | 
				
			||||||
        map((queryParams) => {
 | 
					        map((queryParams) => {
 | 
				
			||||||
          if (queryParams.page) {
 | 
					          if (queryParams.page) {
 | 
				
			||||||
            const newPage = parseInt(queryParams.page, 10);
 | 
					            const newPage = parseInt(queryParams.page, 10);
 | 
				
			||||||
            this.page = newPage;
 | 
					            this.page = newPage;
 | 
				
			||||||
            this.cd.markForCheck();
 | 
					 | 
				
			||||||
            return newPage;
 | 
					            return newPage;
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            this.page = 1;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          return 1;
 | 
					          return 1;
 | 
				
			||||||
        }),
 | 
					        }),
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
 | 
					import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
 | 
				
			||||||
import { BisqTransaction, BisqOutput } from '../bisq.interfaces';
 | 
					import { BisqTransaction, BisqOutput } from '../bisq.interfaces';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { merge, Observable, Subject } from 'rxjs';
 | 
					import { merge, Observable } from 'rxjs';
 | 
				
			||||||
import { switchMap, map, tap, filter } from 'rxjs/operators';
 | 
					import { switchMap, map, tap, filter } from 'rxjs/operators';
 | 
				
			||||||
import { BisqApiService } from '../bisq-api.service';
 | 
					import { BisqApiService } from '../bisq-api.service';
 | 
				
			||||||
import { SeoService } from 'src/app/services/seo.service';
 | 
					import { SeoService } from 'src/app/services/seo.service';
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user