Skip to content

Commit

Permalink
In case of a lot of traces the UI hands for a bit #1980 - Improve per…
Browse files Browse the repository at this point in the history
…formace of dialog when loading.
  • Loading branch information
HarelM committed Apr 4, 2024
1 parent 149f4ce commit 38d8607
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</div>
</div>
<mat-spinner *ngIf="loadingShareUrls"></mat-spinner>
<p *ngIf="filteredShareUrls.length === 0 && !loadingShareUrls">{{resources.noShares}}</p>
<p *ngIf="hasNoShares()">{{resources.noShares}}</p>
</div>
<div mat-dialog-actions>
<div class="flex flex-row w-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,17 @@ export class SharesDialogComponent extends BaseMapComponent implements OnInit, O
}));
this.searchTerm.setValue(this.sessionSearchTerm);
this.subscriptions.push(this.shareUrls$.subscribe(() => {
this.updateFilteredLists(this.searchTerm.value);
if (!this.loadingShareUrls) {
this.updateFilteredLists(this.searchTerm.value);
}
}));
}

public async ngOnInit() {
this.loadingShareUrls = this.store.selectSnapshot((s: ApplicationState) => s.shareUrlsState).shareUrls.length === 0;
this.loadingShareUrls = true;
this.shareUrlsService.syncShareUrls();
this.loadingShareUrls = false;
this.updateFilteredLists(this.searchTerm.value);
}

public ngOnDestroy() {
Expand Down Expand Up @@ -208,6 +211,10 @@ export class SharesDialogComponent extends BaseMapComponent implements OnInit, O
return this.shareUrlsService.getShareSocialLinks(this.getSelectedShareUrl());
}

public hasNoShares(): boolean {
return !this.loadingShareUrls && this.filteredShareUrls.length === 0;
}

public trackById(_: number, shareUrl: ShareUrl) {
return shareUrl.id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,17 @@ export class TracesDialogComponent extends BaseMapComponent implements OnInit, O
});
this.searchTerm.setValue(this.sessionSearchTerm);
this.tracesChangedSubscription = this.traces$.subscribe(() => {
this.updateFilteredLists(this.searchTerm.value);
if (!this.loadingTraces) {
this.updateFilteredLists(this.searchTerm.value);
}
});
}

public async ngOnInit() {
this.loadingTraces = this.store.selectSnapshot((s: ApplicationState) => s.tracesState).traces.length === 0;
this.loadingTraces = true;
await this.tracesService.syncTraces();
this.loadingTraces = false;
this.updateFilteredLists(this.searchTerm.value);
}

public ngOnDestroy() {
Expand Down

0 comments on commit 38d8607

Please sign in to comment.