[pluginsFunctionality | DONE | FIXED] Plugin Openaire services: fix no services appear

This commit is contained in:
argirok 2024-04-09 10:48:23 +03:00
parent d2cc0b0f33
commit f5850aa781
1 changed files with 6 additions and 4 deletions

View File

@ -12,10 +12,10 @@ export class PluginOpenAIREProducts extends PluginBaseInfo{
@Component({
selector: 'plugin-openaire-products',
template: `
<div *ngIf="pluginObject" class="uk-container uk-section">
<div *ngIf="pluginObject " class="uk-container uk-section">
<h3>{{pluginObject.title}} </h3>
<div *ngIf="services" uk-slider class="uk-slider">
<div *ngIf="services && servicesToShow" uk-slider class="uk-slider">
<ul *ngIf="slides" class="uk-slider-items" uk-height-match="target: .uk-card; row: false">
<li *ngFor="let slide of [].constructor(slides); let i=index" class="uk-width-1-1 uk-padding">
<div class="uk-grid uk-child-width-1-3@m uk-child-width-1-1" uk-grid uk-scrollspy="target: [uk-scrollspy-class]; cls: uk-animation-fade; repeat: true">
@ -51,7 +51,7 @@ export class PluginOpenAIREProducts extends PluginBaseInfo{
export class PluginOpenaireProductsComponent extends PluginBaseComponent<PluginOpenAIREProducts>{
services = null;
excludedServiceIds = ["openaire_login","research_community_dashboard"]
servicesToShow = [];
servicesToShow = null;
slides = 1;
slideItems = 3;
api= "https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name";
@ -64,7 +64,9 @@ export class PluginOpenaireProductsComponent extends PluginBaseComponent<PluginO
if(!this.services) {
this.subscriptions.push(this.http.get( this.properties.cacheUrl + encodeURIComponent(this.api)).subscribe(res =>{
this.services = res["results"].map( x=> {
if(x.id.indexOf("openaire.")!=-1){
x.id = x.id.split("openaire.")[1]
}
return x;
});
this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1);