diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index f75301b..cbf0e20 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -18,12 +18,12 @@ const routes: Routes = [ { path: 'rpo', loadChildren: () => import('./rpo/rpo.module').then(m => m.RpoModule), - data: {type: 'organization'} + data: {type: 'organization', title: Irish.METADATA_PREFIX} }, { path: 'rfo', loadChildren: () => import('./rfo/rfo.module').then(m => m.RfoModule), - data: {type: 'funder'} + data: {type: 'funder', title: Irish.METADATA_PREFIX} }, { path: 'researcher', diff --git a/src/app/repository/browse-repositories/browse-repositories.component.html b/src/app/repository/browse-repositories/browse-repositories.component.html index eb266e4..b673d0b 100644 --- a/src/app/repository/browse-repositories/browse-repositories.component.html +++ b/src/app/repository/browse-repositories/browse-repositories.component.html @@ -6,7 +6,7 @@
+ placeholder="Search for {{typeAsLabel}}s" [disabled]="stakeholders.length === 0" class="uk-width-1-2@m uk-width-1-1">
diff --git a/src/app/repository/browse-repositories/browse-repositories.component.ts b/src/app/repository/browse-repositories/browse-repositories.component.ts index 26b820b..be0656e 100644 --- a/src/app/repository/browse-repositories/browse-repositories.component.ts +++ b/src/app/repository/browse-repositories/browse-repositories.component.ts @@ -9,6 +9,8 @@ import {Stakeholder} from "../../openaireLibrary/monitor/entities/stakeholder"; import {SearchDataprovidersService} from "../../openaireLibrary/services/searchDataproviders.service"; import {SearchResult} from "../../openaireLibrary/utils/entities/searchResult"; import {ResultPreview} from "../../openaireLibrary/utils/result-preview/result-preview"; +import {Observable, forkJoin, of} from "rxjs"; +import {catchError} from "rxjs/operators"; @Component({ selector: 'browse-repository', @@ -58,16 +60,30 @@ export class BrowseRepositoriesComponent extends BrowseStakeholderBaseComponent } afterStakeholdersInitialized() { - this.filteredStakeholders.slice((this.currentPage-1)*this.pageSize, this.currentPage*this.pageSize).forEach(item => { + let currentFilteredStakeholders = this.filteredStakeholders.slice((this.currentPage-1)*this.pageSize, this.currentPage*this.pageSize); + let obs: Array> = new Array(); + currentFilteredStakeholders.forEach(item => { if(!item.details) { - item.details = new ResultPreview(); - item.details['title'] = {'name': item.name}; - this.subscriptions.push(this.searchDataprovidersService.searchDataproviderById(item.index_id).subscribe(data => { - item.details = data[0]; - item.details['title']['name'] = item.name; - })); + 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; + } + )); } public getResultPreview(result: SearchResult): ResultPreview { diff --git a/src/app/repository/repository.component.ts b/src/app/repository/repository.component.ts index e2260ea..6c9afb4 100644 --- a/src/app/repository/repository.component.ts +++ b/src/app/repository/repository.component.ts @@ -9,11 +9,11 @@ import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholde import {CustomFilterService} from "../shared/customFilter.service"; import {LinksResolver} from "../search/links-resolver"; import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; @Component({ selector: 'repository', template: ` -
@@ -44,7 +44,6 @@ import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/sea
-
` }) export class RepositoryComponent extends StakeholderBaseComponent implements OnInit { @@ -54,6 +53,7 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI loading: boolean = false; constructor(private stakeholderService: StakeholderService, + private layoutService: LayoutService, private _customFilterService: CustomFilterService, protected _router: Router, protected _route: ActivatedRoute, @@ -68,6 +68,7 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI } ngOnInit() { + this.layoutService.setRootClass('datasource'); this.title = 'Repository Monitors'; this.description = 'Repository Monitors'; this.setMetadata(); diff --git a/src/app/rfo/rfo.component.ts b/src/app/rfo/rfo.component.ts index bac2eab..86a6a14 100644 --- a/src/app/rfo/rfo.component.ts +++ b/src/app/rfo/rfo.component.ts @@ -68,6 +68,9 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit { ngOnInit() { this.layoutService.setRootClass('funder'); + this.title = 'RFOs'; + this.description = 'RFOs'; + this.setMetadata(); this.params.subscribe(params => { this._customFilterService.setCustomFilter(null); this.alias = params['stakeholder']; diff --git a/src/app/rpo/rpo.component.ts b/src/app/rpo/rpo.component.ts index 026ad40..66a174a 100644 --- a/src/app/rpo/rpo.component.ts +++ b/src/app/rpo/rpo.component.ts @@ -68,6 +68,9 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit { ngOnInit() { this.layoutService.setRootClass('organization'); + this.title = 'RPOs'; + this.description = 'RPOs'; + this.setMetadata(); this.params.subscribe(params => { this._customFilterService.setCustomFilter(null); this.alias = params['stakeholder']; diff --git a/src/app/shared/browse-stakeholder-base.component.ts b/src/app/shared/browse-stakeholder-base.component.ts index 6366cb8..32a15fb 100644 --- a/src/app/shared/browse-stakeholder-base.component.ts +++ b/src/app/shared/browse-stakeholder-base.component.ts @@ -54,7 +54,6 @@ export class BrowseStakeholderBaseComponent extends StakeholderBaseComponent imp this.filteredStakeholders = stakeholders; this.filteredStakeholders.sort((a, b) => a['name'].localeCompare(b['name'])); this.filtering(this.keywordControl.value); - this.showLoading = false; })); this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(200), distinctUntilChanged()).subscribe(value => { this.filtering(value); @@ -112,5 +111,6 @@ export class BrowseStakeholderBaseComponent extends StakeholderBaseComponent imp afterStakeholdersInitialized() { // this is a method that will be overriden from the components extending this base component, if needed + this.showLoading = false; } }