[master | DONE | FIXED]: Fixed when showLoading is set to false - either when search requests are finished or when there are no results.

This commit is contained in:
Konstantina Galouni 2024-01-09 17:41:20 +02:00
parent 77afc19580
commit d0ee07e1ad
1 changed files with 27 additions and 23 deletions

View File

@ -62,29 +62,33 @@ export class BrowseRepositoriesComponent extends BrowseStakeholderBaseComponent
afterStakeholdersInitialized() {
let currentFilteredStakeholders = this.filteredStakeholders.slice((this.currentPage-1)*this.pageSize, this.currentPage*this.pageSize);
let obs: Observable<any>[] = [];
currentFilteredStakeholders.forEach(item => {
if(!item.details) {
this.showLoading = true;
let ob = this.searchDataprovidersService.searchDataproviderById(item.index_id).pipe(
catchError(error => {
let details: SearchResult = new SearchResult();
details['title'] = {'name': item.name, 'accessMode': ''};
details['entityType'] = "dataprovider";
return of([details]);
}));
obs.push(ob);
}
});
this.subscriptions.push(forkJoin(obs).subscribe(
data => {
data.forEach((item, index) => {
currentFilteredStakeholders[index].details = item[0];
currentFilteredStakeholders[index].details['title']['name'] = currentFilteredStakeholders[index].name;
});
}
));
this.showLoading = false;
if(currentFilteredStakeholders && currentFilteredStakeholders.length > 0) {
let obs: Observable<any>[] = [];
currentFilteredStakeholders.forEach(item => {
if (!item.details) {
this.showLoading = true;
let ob = this.searchDataprovidersService.searchDataproviderById(item.index_id).pipe(
catchError(error => {
let details: SearchResult = new SearchResult();
details['title'] = {'name': item.name, 'accessMode': ''};
details['entityType'] = "dataprovider";
return of([details]);
}));
obs.push(ob);
}
});
this.subscriptions.push(forkJoin(obs).subscribe(
data => {
data.forEach((item, index) => {
currentFilteredStakeholders[index].details = item[0];
currentFilteredStakeholders[index].details['title']['name'] = currentFilteredStakeholders[index].name;
});
this.showLoading = false;
}
));
} else {
this.showLoading = false;
}
}
public getResultPreview(result: SearchResult): ResultPreview {