From ddff1a0a846ff53a68331ab818fab79090d66d53 Mon Sep 17 00:00:00 2001 From: Hannes Hansen Date: Fri, 1 Dec 2023 16:51:21 +0100 Subject: [PATCH] fixed ready handling for network list; fix #SNRGY-3007 --- .../devices/networks/networks.component.ts | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/app/modules/devices/networks/networks.component.ts b/src/app/modules/devices/networks/networks.component.ts index c419e5b2..53179196 100644 --- a/src/app/modules/devices/networks/networks.component.ts +++ b/src/app/modules/devices/networks/networks.component.ts @@ -126,7 +126,14 @@ export class NetworksComponent implements OnInit, OnDestroy { this.paginator.page.subscribe(()=>{ this.pageSize = this.paginator.pageSize this.offset = this.paginator.pageSize * this.paginator.pageIndex; - this.getNetworks().subscribe(); + this.getNetworks().subscribe({ + next: (_) => { + this.ready = true + }, + error: (_) => { + this.ready = true + } + }); }); } @@ -152,7 +159,14 @@ export class NetworksComponent implements OnInit, OnDestroy { .subscribe((deleteNetwork: boolean) => { if (deleteNetwork) { setTimeout(() => { - this.getNetworks().subscribe(); + this.getNetworks().subscribe({ + next: (_) => { + this.ready = true + }, + error: (_) => { + this.ready = true + } + }); }, 1000); } }); @@ -160,8 +174,6 @@ export class NetworksComponent implements OnInit, OnDestroy { } private getNetworks(): Observable { - this.ready = false; - return this.networksService .searchNetworks(this.searchText, this.pageSize, this.offset, this.sortBy, this.sortDirection) .pipe( @@ -178,9 +190,14 @@ export class NetworksComponent implements OnInit, OnDestroy { this.ready = false; this.selectionClear(); - forkJoin([this.getNetworks(), this.getTotalCount()]).subscribe(_ => { - this.ready = true; - }) + forkJoin([this.getNetworks(), this.getTotalCount()]).subscribe({ + next: (_) => { + this.ready = true + }, + error: (_) => { + this.ready = true + } + }); } isAllSelected() {