Merge remote-tracking branch 'origin/master'

This commit is contained in:
argirok 2023-11-28 12:13:52 +02:00
commit 81b175a5ea
7 changed files with 36 additions and 13 deletions

View File

@ -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',

View File

@ -6,7 +6,7 @@
<div *ngIf="!showLoading" class="uk-container uk-container-large">
<div class="uk-flex uk-flex-middle uk-flex-center">
<div search-input *ngIf="keywordControl" [searchControl]="keywordControl" searchInputClass="border-bottom" iconPosition="left"
placeholder="Search for {{typeAsLabel}} {{entities.stakeholders}}" [disabled]="stakeholders.length === 0" class="uk-width-1-2@m uk-width-1-1">
placeholder="Search for {{typeAsLabel}}s" [disabled]="stakeholders.length === 0" class="uk-width-1-2@m uk-width-1-1">
</div>
</div>
<div class="uk-flex uk-flex-middle uk-flex-between uk-margin-large-top">

View File

@ -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<Observable<any>> = 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 {

View File

@ -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: `
<div class="datasource">
<loading *ngIf="loading" class="uk-position-center"></loading>
<div *ngIf="!loading">
<div class="uk-banner">
@ -44,7 +44,6 @@ import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/sea
<router-outlet></router-outlet>
</div>
</div>
</div>
`
})
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();

View File

@ -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'];

View File

@ -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'];

View File

@ -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;
}
}