Skip to content

Commit

Permalink
fixed ready handling for network list; fix #SNRGY-3007
Browse files Browse the repository at this point in the history
  • Loading branch information
hahahannes committed Dec 1, 2023
1 parent 4c13c20 commit ddff1a0
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/app/modules/devices/networks/networks.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
});
});
}

Expand All @@ -152,16 +159,21 @@ 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);
}
});
});
}

private getNetworks(): Observable<NetworksModel[]> {
this.ready = false;

return this.networksService
.searchNetworks(this.searchText, this.pageSize, this.offset, this.sortBy, this.sortDirection)
.pipe(
Expand All @@ -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() {
Expand Down

0 comments on commit ddff1a0

Please sign in to comment.