plugins-functionality #43

Merged
argiro.kokogiannaki merged 86 commits from plugins-functionality into develop 2024-06-13 09:14:22 +02:00
14 changed files with 461 additions and 180 deletions
Showing only changes of commit 17e3cda685 - Show all commits

View File

@ -6,6 +6,8 @@ import {Affiliation} from "../../utils/entities/CuratorInfo";
import {ConnectHelper} from "../connectHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../../../environments/environment";
import {ConfigurationService} from "../../utils/configuration/configuration.service";
import {CommunityService} from "../community/community.service";
@Component({
selector: 'affiliations',
@ -29,8 +31,18 @@ export class AffiliationsComponent {
constructor(private route: ActivatedRoute, private affiliationService: AffiliationService) {
}
public ngOnInit() {
public ngOnInit(/*private config: ConfigurationService */) {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain);
/* this.subscriptions.push(this.config.portalAsObservable.subscribe(
res => {
// this.portal = res;
this.communityId = res.pid
},
error => {
console.log(error);
}
));*/
if (this.getAffiliationsFromAPI) {
this.showLoading = true;
this.affiliationService.initAffiliations(this.communityId);

View File

@ -1,14 +1,74 @@
<div *ngIf="!community " class="uk-text-muted uk-text-center">
No community info available available
</div>
<div class="uk-grid uk-child-width-1-2@m uk-child-width-1-1@s">
<div *ngIf="portal && community" class=""> <!-- this div will have the
customized color or image -->
<div class="uk-container uk-container-large uk-flex uk-flex-center">
<div class="uk-margin-large-top uk-margin-large-bottom">
<h1 *ngIf="pluginObject.showShortTitle" class="uk-text-center uk-h2 uk-margin-remove">
{{community.shortTitle}}
</h1>
<div *ngIf="pluginObject.showTitle"
class="uk-text-center uk-margin-top">
{{community.title}}
</div>
<div *ngIf="pluginObject.description" [innerHTML]="community.description"></div>
<div *ngIf="pluginObject.searchbar && isRouteEnabled(searchLinkToResults)" [class.uk-invisible]="disableSelect" class="uk-margin-medium-top">
<advanced-search-input #advanced (searchEmitter)="goTo(true)">
<entities-selection class="uk-width-1-3" [simpleView]="true" currentEntity="result"
[selectedEntity]="selectedEntity"
(selectionChange)="entityChanged($event);advanced.focusNext(input, $event)"
(disableSelectEmitter)="disableSelectChange($event)"
[onChangeNavigate]="false"></entities-selection>
<div input #input class="uk-width-expand" placeholder="Scholary works" [searchable]="true"
[hint]="'Search in OpenAIRE'" [(value)]="keyword"></div>
</advanced-search-input>
<div *ngIf="selectedEntity === 'result' && input.focused"
(click)="$event.stopPropagation();advanced.focusNext(input, $event)"
class="uk-dropdown uk-display-block uk-margin-small-top uk-width-auto" uk-dropdown="mode: click">
<div class="uk-padding-small">
<quick-selections [resultTypes]="resultTypes" [quickFilter]="resultsQuickFilter"></quick-selections>
</div>
</div>
</div>
<div *ngIf="(pluginObject.fos && isRouteEnabled('/fields-of-science')) || (pluginObject.sdgs && isRouteEnabled('/sdgs'))" class="uk-padding-small uk-margin-small-top">
<div class="uk-text-meta">
Try browsing by:
</div>
<div class="link-actions uk-flex uk-flex-column uk-flex-top uk-margin-small-top">
<a *ngIf="pluginObject.sdgs && isRouteEnabled('/sdgs')" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-margin-small-bottom"
routerLinkActive="router-link-active" routerLink="/sdgs">
<span class="uk-flex uk-flex-middle">
<img src="assets/common-assets/sdg/sdg-dot-img.svg" alt="SDGs logo" loading="lazy" width="17px" height="17px">
<span class="uk-margin-small-left">Sustainable Development Goals (SDG<span
class="uk-text-lowercase">s</span>)</span>
</span>
</a>
<a *ngIf="pluginObject.fos&& isRouteEnabled('/fields-of-science') " class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
routerLinkActive="router-link-active" routerLink="/fields-of-science">
<span class="uk-flex uk-flex-middle">
<img src="assets/common-assets/fos/fos-icon.svg" alt="FOS logo" loading="lazy" width="17px" height="8px">
<span class="uk-margin-small-left">Fields of Science (FoS)</span>
</span>
</a>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="plugin-gateway-information uk-border-rounded uk-padding uk-margin-medium-bottom">
<img class="plugin-background" src="assets/common-assets/connect_image_faded.png">
<div class="plugin-content">
<div class="uk-text-lead uk-text-large uk-text-bold uk-margin-bottom">
{{ pluginObject.title}}
</div>
<div *ngIf="!community " class="uk-text-muted uk-text-center">
No community info available available
</div>
<ng-container *ngIf="community">
<div *ngIf="isRouteEnabled('/curators') && isVisible('curators')" class="uk-text-small uk-margin-xsmall-bottom">
<div *ngIf="isRouteEnabled('/curators') && isVisible('curators')"
class="uk-text-small uk-margin-xsmall-bottom">
<curators [longView]="false"></curators>
</div>
<div *ngIf="community.date && isVisible('date')" class="uk-text-small">
@ -30,7 +90,8 @@
[title]="buildProjectsTooltip()"
[attr.uk-tooltip]="'pos: bottom-right; delay: 10;'"
class="uk-link-reset uk-margin-xsmall-left">
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true" [customClass]="'uk-text-muted'"></icon>
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true"
[customClass]="'uk-text-muted'"></icon>
</a>
</span>
</div>
@ -48,7 +109,8 @@
[title]="buildContentProvidersTooltip()"
[attr.uk-tooltip]="'pos: bottom-right; delay: 10;'"
class="uk-link-reset uk-margin-xsmall-left">
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true" [customClass]="'uk-text-muted'"></icon>
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true"
[customClass]="'uk-text-muted'"></icon>
</a>
</span>
</div>
@ -66,11 +128,13 @@
<a [title]="buildZenodoCommunitiesTooltip()"
[attr.uk-tooltip]="'pos: bottom-right; delay: 10;'"
class="uk-link-reset uk-margin-xsmall-left">
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true" [customClass]="'uk-text-muted'"></icon>
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true"
[customClass]="'uk-text-muted'"></icon>
</a>
</span>
</div>
<div *ngIf="isRouteEnabled('/subjects') && displayedAllSubjects && displayedAllSubjects.length > 0 && isVisible('subjects')"
<div
*ngIf="isRouteEnabled('/subjects') && displayedAllSubjects && displayedAllSubjects.length > 0 && isVisible('subjects')"
class="uk-flex uk-flex-column uk-margin-bottom info-number">
<a class="uk-h5 uk-margin-remove"
routerLinkActive="router-link-active" [routerLink]="'/subjects'">
@ -90,24 +154,30 @@
<div class="uk-flex uk-flex-middle" *ngIf="resultCounts && resultCounts.publications > 0 && isEntityEnabled('publication')
&& isRouteEnabled(searchLinkToResults) &&
isVisible('publications')">
<icon [name]="'description'" [type]="'outlined'" [ratio]="2" [flex]="true" [customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('publications')" [routerLink]="properties.searchLinkToAdvancedResults" class="uk-link-reset uk-flex uk-flex-column">
<icon [name]="'description'" [type]="'outlined'" [ratio]="2" [flex]="true"
[customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('publications')" [routerLink]="properties.searchLinkToAdvancedResults"
class="uk-link-reset uk-flex uk-flex-column">
<span class="uk-text-xsmall">
{{openaireEntities.PUBLICATIONS}}
</span>
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove" [innerHTML]="resultCounts.publications | numberRound: 1:1">
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove"
[innerHTML]="resultCounts.publications | numberRound: 1:1">
</span>
</a>
</div>
<div class="uk-flex uk-flex-middle" *ngIf="resultCounts && resultCounts.datasets > 0 && isEntityEnabled('dataset')
&& isRouteEnabled(searchLinkToResults) &&
isVisible('datasets')">
<icon [name]="'database'" [type]="'outlined'" [ratio]="2" [flex]="true" [customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('datasets')" [routerLink]="properties.searchLinkToAdvancedResults" class="uk-link-reset uk-flex uk-flex-column">
<icon [name]="'database'" [type]="'outlined'" [ratio]="2" [flex]="true"
[customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('datasets')" [routerLink]="properties.searchLinkToAdvancedResults"
class="uk-link-reset uk-flex uk-flex-column">
<span class="uk-text-xsmall">
{{openaireEntities.DATASETS}}
</span>
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove" [innerHTML]="resultCounts.datasets | numberRound: 1:1">
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove"
[innerHTML]="resultCounts.datasets | numberRound: 1:1">
</span>
</a>
</div>
@ -126,20 +196,25 @@
<div class="uk-flex uk-flex-middle" *ngIf="resultCounts && resultCounts.software > 0 && isEntityEnabled('software')
&& isRouteEnabled(searchLinkToResults) &&
isVisible('software')">
<icon [name]="'integration_instructions'" [type]="'outlined'" [ratio]="2" [flex]="true" [customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('software')" [routerLink]="properties.searchLinkToAdvancedResults" class="uk-link-reset uk-flex uk-flex-column">
<icon [name]="'integration_instructions'" [type]="'outlined'" [ratio]="2" [flex]="true"
[customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('software')" [routerLink]="properties.searchLinkToAdvancedResults"
class="uk-link-reset uk-flex uk-flex-column">
<span class="uk-text-xsmall">
{{openaireEntities.SOFTWARE}}
</span>
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove" [innerHTML]="resultCounts.software | numberRound: 1:1">
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove"
[innerHTML]="resultCounts.software | numberRound: 1:1">
</span>
</a>
</div>
<div class="uk-flex uk-flex-middle" *ngIf="resultCounts && resultCounts.other > 0 && isEntityEnabled('orp')
&& isRouteEnabled(searchLinkToResults) &&
isVisible('other')">
<icon [name]="'integration_instructions'" [type]="'outlined'" [ratio]="2" [flex]="true" [customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('other')" [routerLink]="properties.searchLinkToAdvancedResults" class="uk-link-reset uk-flex uk-flex-column">
<icon [name]="'integration_instructions'" [type]="'outlined'" [ratio]="2" [flex]="true"
[customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('other')" [routerLink]="properties.searchLinkToAdvancedResults"
class="uk-link-reset uk-flex uk-flex-column">
<span class="uk-text-xsmall">
{{openaireEntities.OTHER}}
</span>
@ -148,3 +223,5 @@
</a>
</div>
</div>
</div>
</div>

View File

@ -1,17 +1,24 @@
import {Component} from '@angular/core';
import {ChangeDetectorRef, Component} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
import {ConfigurationService} from '../../../../../openaireLibrary/utils/configuration/configuration.service';
import {CommunityService} from '../../../../../openaireLibrary/connect/community/community.service';
import {SearchCommunityProjectsService} from '../../../../../openaireLibrary/connect/projects/searchProjects.service';
import {SearchCommunityDataprovidersService} from '../../../../../openaireLibrary/connect/contentProviders/searchDataproviders.service';
import {ZenodoCommunitiesService} from '../../../../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
import {ConnectHelper} from '../../../../../openaireLibrary/connect/connectHelper';
import {User} from '../../../../../openaireLibrary/login/utils/helper.class';
import {RouterHelper} from "../../../../utils/routerHelper.class";
import {OpenaireEntities} from "../../../../utils/properties/searchFields";
import {HttpClient} from "@angular/common/http";
import {Filter} from "../../../../searchPages/searchUtils/searchHelperClasses.class";
import {Router} from "@angular/router";
export class PluginGatewayInformation extends PluginBaseInfo{
showTitle:boolean = true;
showShortTitle:boolean = false;
description:boolean = false;
sdgs:boolean = false;
fos:boolean = false;
searchbar:boolean = false;
title:string ="Gateway Information";
curators:boolean = true;
date:boolean = true;
@ -56,14 +63,39 @@ export class PluginGatewayInformationComponent extends PluginBaseComponent<Plugi
searchLinkToResults: string = null;
public routerHelper: RouterHelper = new RouterHelper();
openaireEntities= OpenaireEntities;
selectedEntity = 'result';
selectedEntitySimpleUrl;
selectedEntityAdvancedUrl;
resultTypes: Filter = {
values: [],
filterId: "type",
countSelectedValues: 0,
filterType: 'checkbox',
originalFilterId: "",
valueIsExact: true,
title: "Type",
filterOperator: "or"
};
keyword: string = "";
// customFilter;
placeholderText = "Search by title, author, abstract, DOI, orcid... ";
resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
filter: null,
selected: true,
filterId: "resultbestaccessright",
value: "Open Access"
};
disableSelect: boolean = true;
constructor(private http:HttpClient,
private config: ConfigurationService,
private communityService: CommunityService,
private searchCommunityProjectsService: SearchCommunityProjectsService,
private searchCommunityDataprovidersService: SearchCommunityDataprovidersService,
private zenodoCommunitiesService: ZenodoCommunitiesService) {
private zenodoCommunitiesService: ZenodoCommunitiesService, private _router: Router,
private cdr: ChangeDetectorRef) {
super();
// console.log(this.default, this.pluginObject, this.pluginDefaultObject)
this.searchLinkToResults = this.properties.searchLinkToResults;
this.searchLinkToProjects = this.properties.searchLinkToProjects;
this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders;
@ -192,4 +224,45 @@ export class PluginGatewayInformationComponent extends PluginBaseComponent<Plugi
return {};
}
}
entityChanged($event) {
this.selectedEntity = $event.entity;
this.selectedEntitySimpleUrl = $event.simpleUrl;
this.selectedEntityAdvancedUrl = $event.advancedUrl;
if (this.selectedEntity == 'result') {
this.placeholderText = "Search by title, author, abstract, DOI, orcid... ";
} else if (this.selectedEntity == 'project') {
this.placeholderText = "Search by project title, grant id, funder...";
} else if (this.selectedEntity == 'dataprovider') {
this.placeholderText = "Search by name...";
} else {
this.placeholderText = "Search community content";
}
}
goTo(simple: boolean) {
let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl;
let parameterNames = [];
let parameterValues = [];
if (this.selectedEntity == "result" && this.resultsQuickFilter && this.resultsQuickFilter.selected) {
parameterNames.push(this.resultsQuickFilter.filterId);
parameterValues.push('"'+ encodeURIComponent(this.resultsQuickFilter.value)+'"');
}
if (this.keyword.length > 0) {
parameterNames.push("fv0");
parameterValues.push(this.keyword);
parameterNames.push("f0");
parameterValues.push("q");
}
this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
}
disableSelectChange(event: boolean) {
this.disableSelect = event;
this.cdr.detectChanges();
}
}

View File

@ -16,6 +16,30 @@ import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component";
Community info
</div>
<div class="uk-grid uk-child-width-1-1 uk-text-small uk-hr ">
<div class="uk-margin-xsmall-bottom uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.showTitle"
type="checkbox" field="showTitle" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit> Title
</div>
<div class="uk-margin-xsmall-bottom uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.showShortTitle"
type="checkbox" field="showShortTitle" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit> Short title
</div>
<div class="uk-margin-xsmall-bottom uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.description"
type="checkbox" field="description" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit> Description
</div>
<div class="uk-margin-xsmall-bottom uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.curators"
type="checkbox" field="curators" (editClicked)="pluginEditEvent = $event"
@ -68,7 +92,27 @@ import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component";
Pages & menus
</div>
<div class="uk-margin-xsmall-bottom uk-hr uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.searchbar"
type="checkbox" field="searchbar" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
Search bar
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.fos"
type="checkbox" field="fos" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
Browse by FOS
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.sdgs"
type="checkbox" field="sdgs" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
Browse by SDGs
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.publications"
type="checkbox" field="publications" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
@ -109,8 +153,6 @@ import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component";
})
export class PluginGatewayInformationFormComponent extends PluginBaseFormComponent<PluginGatewayInformation> {
default = new PluginGatewayInformation();
selectedIndex = null;
openaireEntities= OpenaireEntities;
constructor() {
super()

View File

@ -13,11 +13,15 @@ import {CuratorsModule} from '../../../../connect/components/curators/curators.m
import {SearchCommunityProjectsService} from '../../../../../openaireLibrary/connect/projects/searchProjects.service';
import {SearchCommunityDataprovidersService} from '../../../../../openaireLibrary/connect/contentProviders/searchDataproviders.service';
import {ZenodoCommunitiesService} from '../../../../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
import {AdvancedSearchInputModule} from "../../../../sharedComponents/advanced-search-input/advanced-search-input.module";
import {EntitiesSelectionModule} from "../../../../searchPages/searchUtils/entitiesSelection.module";
import {QuickSelectionsModule} from "../../../../searchPages/searchUtils/quick-selections.module";
import {InputModule} from "../../../../sharedComponents/input/input.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule,
CuratorsModule
CuratorsModule, AdvancedSearchInputModule, EntitiesSelectionModule, QuickSelectionsModule, InputModule
],
providers: [
PluginsService, SearchCommunityProjectsService, SearchCommunityDataprovidersService, ZenodoCommunitiesService

View File

@ -1,10 +1,10 @@
import {Component} from '@angular/core';
import {Component, SimpleChanges} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
import {HttpClient} from "@angular/common/http";
export class PluginOpenAIREProducts extends PluginBaseInfo{
title:string ="OpenAIRE services for your community";
serviceIdsArray = ["zenodo","graph","explore"];
serviceIdsArray = ["argos","zenodo","amnesia"];
compare(oldObject): any {
return super.compare(oldObject);
}
@ -14,10 +14,12 @@ export class PluginOpenAIREProducts extends PluginBaseInfo{
template: `
<div *ngIf="pluginObject">
<h3>{{pluginObject.title}} </h3>
<div class="uk-child-width-1-3 uk-grid">
<ng-container *ngFor="let service of services">
<div *ngIf="pluginObject && pluginObject.serviceIdsArray.indexOf(service.id)!=-1" class="uk-padding-xsmall">
<div *ngIf="services" 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">
<div *ngFor="let service of servicesToShow.slice((i)*slideItems,(i+1)*slideItems)" uk-scrollspy-class>
<div class="uk-card uk-card-default ">
<div class="uk-card-media-top">
<img [src]="service.logo" width="100%" height="" alt="" class="uk-height-max-small">
@ -30,7 +32,11 @@ export class PluginOpenAIREProducts extends PluginBaseInfo{
</div>
</div>
</div>
</ng-container>
</div>
</li>
</ul>
<ul class="uk-slider-nav uk-dotnav uk-flex-center uk-margin-medium-top"></ul>
</div>
</div>
@ -39,18 +45,42 @@ export class PluginOpenAIREProducts extends PluginBaseInfo{
})
export class PluginOpenaireProductsComponent extends PluginBaseComponent<PluginOpenAIREProducts>{
services = [];
services = null;
excludedServiceIds = ["openaire_login","research_community_dashboard"]
default = new PluginOpenAIREProducts();
constructor(http:HttpClient) {
servicesToShow = [];
slides = 1;
slideItems = 3;
constructor(private http:HttpClient) {
super()
this.subscriptions.push(http.get("https://explore.openaire.eu/cache/get?url="+ encodeURIComponent("https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name")).subscribe(res =>{
}
ngOnInit(): void {
super.ngOnInit();
if(!this.services) {
this.subscriptions.push(this.http.get("https://explore.openaire.eu/cache/get?url="+ encodeURIComponent("https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name")).subscribe(res =>{
this.services = res["results"].map( x=> {
x.id = x.id.split("openaire.")[1]
return x;
});
this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1);
this.calculatePages();
}))
}else{
this.calculatePages();
}
}
ngOnChanges(changes: SimpleChanges) {
if(this.services) {
this.calculatePages();
}
}
calculatePages(){
this.servicesToShow = this.services.filter(x => this.pluginObject.serviceIdsArray.indexOf(x.id) != -1);
if (this.servicesToShow.length > this.slideItems) {
this.slides = parseInt('' + (this.servicesToShow.length / this.slideItems));
if(this.slides< (this.servicesToShow.length / this.slideItems)){
this.slides++;
}
}
}
}

View File

@ -1,31 +1,27 @@
<div>plugin-suggested-repositories</div>
<div class="plugin-suggested-repositories uk-container uk-container-large uk-section">
<div class="uk-flex uk-flex-middle uk-flex-between uk-margin-large-bottom">
<h3 class="uk-margin-remove">
<icon [name]="'database'" [type]="'outlined'" [ratio]="3" class="uk-margin-small-right"></icon>
Suggested repositories & journals
{{pluginObject.title}}
</h3>
<a href="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
<a [href]="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
View all
</a>
</div>
<div uk-slider class="uk-slider">
<ul class="uk-slider-items" uk-height-match="target: .uk-card; row: false">
<li *ngFor="let slide of [].constructor(3); let i=index" class="uk-width-1-1 uk-padding">
<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-2@m uk-child-width-1-1" uk-grid uk-scrollspy="target: [uk-scrollspy-class]; cls: uk-animation-fade; repeat: true">
<ng-container *ngIf="i === 0">
<div *ngFor="let item of [].constructor(2)" uk-scrollspy-class>
<div *ngFor="let item of contentProviders.slice((i)*2,(i+1)*2)" uk-scrollspy-class>
<div class="uk-card uk-card-default uk-card-body uk-card-hover">
Card content from result-preview
{{item.name}}
<hr>
<div>
Lorem ipsum lorem ipsum
</div>
<div>
Lorem ipsum
<div class="uk-text-small">
{{item.message}}
</div>
<div class="uk-flex uk-flex-right uk-margin-small-top">
<a href="" class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
<a [href]="properties.connectPortalUrl + properties.searchLinkToDataProvider + item.openaireId " class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text" target="_blank">
<span class="uk-flex uk-flex-middle">
<icon [name]="'file_upload'" [type]="'outlined'" class="uk-margin-small-right"></icon>
<span>Go to repository</span>
@ -34,29 +30,7 @@
</div>
</div>
</div>
</ng-container>
<ng-container *ngIf="i !== 0">
<div *ngFor="let item of [].constructor(2)">
<div class="uk-card uk-card-default uk-card-body uk-card-hover">
Card content from result-preview
<hr>
<div>
Lorem ipsum lorem ipsum
</div>
<div>
Lorem ipsum
</div>
<div class="uk-flex uk-flex-right uk-margin-small-top">
<a href="" class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
<span class="uk-flex uk-flex-middle">
<icon [name]="'file_upload'" [type]="'outlined'" class="uk-margin-small-right"></icon>
<span>Go to repository</span>
</span>
</a>
</div>
</div>
</div>
</ng-container>
</div>
</li>
</ul>

View File

@ -1,15 +1,56 @@
import {Component} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
import {SearchCommunityDataprovidersService} from "../../../../connect/contentProviders/searchDataproviders.service";
import {ConfigurationService} from "../../../../utils/configuration/configuration.service";
import {CommunityService} from "../../../../connect/community/community.service";
export class PluginSuggestedRepositories extends PluginBaseInfo{
title:string ="Lorem ipsum";
description: string = "Lorem ipsum";
title:string ="Suggested repositories & journals";
}
@Component({
selector: 'plugin-suggested-repositories',
templateUrl: 'plugin-suggested-repositories.component.html'
})
export class PluginSuggestedRepositoriesComponent extends PluginBaseComponent<PluginSuggestedRepositories>{
constructor() {
portal;
community;
contentProviders;
slides = 0;
constructor(private searchCommunityDataprovidersService: SearchCommunityDataprovidersService,
private config: ConfigurationService,
private communityService: CommunityService) {
super()
this.subscriptions.push(this.config.portalAsObservable.subscribe(
res => {
this.portal = res;
},
error => {
console.log(error);
}
));
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
if (community) {
this.subscriptions.push(this.searchCommunityDataprovidersService.searchDataproviders(this.properties, this.community.communityId, true).subscribe(
res => {
this.slides =1;
this.contentProviders = res;
if(this.contentProviders.length > 2){
this.slides = parseInt('' + (this.contentProviders.length/2));
}
if(this.slides< (this.contentProviders.length / 2)){
this.slides++;
}
},
error => {
console.log(error);
}
));
}
}
));
}
}

View File

@ -0,0 +1,25 @@
import {Component} from '@angular/core';
import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component";
import {PluginSuggestedRepositories} from "./plugin-suggested-repositories.component";
@Component({
selector: 'plugin-suggested-repositories-form',
template: `
<div *ngIf="pluginObject" class="uk-padding-xsmall">
<plugin-field-edit [value]="pluginObject.title"
type="text" field="title" (changed)="valueChanged($event)"></plugin-field-edit>
<div class="uk-alert uk-alert-warning uk-text-small"> Manage the content providers list in
<a routerLink="../../info/content-providers" target="_blank">Community info</a> by adding them in deposit.</div>
</div>
`,
})
export class PluginSuggestedRepositoriesFormComponent extends PluginBaseFormComponent<PluginSuggestedRepositories> {
constructor() {
super()
}
}

View File

@ -13,8 +13,10 @@ export class PluginBaseInfo {
if(!oldObject) {
oldObject = Object.assign(this)
}else{
if (!oldObject['title'] ) {
oldObject['title'] = this.title;
for (let attrKey of Object.keys(this)) {
if (!oldObject[attrKey] && oldObject[attrKey] != false) {
oldObject[attrKey] = Object.assign(this[attrKey])
}
}
}
return oldObject;

View File

@ -1,14 +1,13 @@
import {Option} from "../../../sharedComponents/input/input.component";
import {PluginOpenAIREProducts} from "../components/openaireProducts/plugin-openaire-products.component";
import {PluginDiscoverBySubcommunity} from "../components/discover-by-subcommunity/plugin-discover-by-subcommunity.component";
import {PluginBaseInfo, PluginInfoCards, PluginURL} from "./base-plugin.component";
import {PluginBaseInfo} from "./base-plugin.component";
import {PluginGatewayInformation} from "../components/gateway-information/plugin-gateway-information.component";
import {PluginLearnAndConnect} from "../components/learn-and-connect/plugin-learn-and-connect.component";
import {PluginFeaturedDatasets} from "../components/featured-datasets/plugin-featured-datasets.component";
import {PluginHowToUse} from "../components/how-to-use/plugin-how-to-use.component";
import {PluginSearchDepositLink} from "../components/search-deposit-link/plugin-search-deposit-link.component";
import {PluginOrganizations} from "../components/organizations/plugin-organizations.component";
import {FormArray, FormGroup, Validators} from "@angular/forms";
export class PluginUtils{
public attrTypeOptions: Option[] = [
@ -19,7 +18,7 @@ export class PluginUtils{
];
public availablePluginCodes: Option[] = [
{label:"OpenAIRE products", value:"penaire-products"},
{label:"OpenAIRE products", value:"openaire-products"},
{label:"Discover by subcommunity", value:"discover-by-subcommunity"},
{label:"Gateway information", value:"gateway-information"},
{label:"Search/ deposit/ link", value:"search-deposit-link"},

View File

@ -26,7 +26,7 @@ import {PluginEditEvent} from "../utils/base-plugin.form.component";
<plugin-how-to-use-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate" [editSubmenuOpen]="editSubmenuOpen"></plugin-how-to-use-form>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'suggested-repositories'">
<plugin-suggested-repositories [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-suggested-repositories>
<plugin-suggested-repositories-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-suggested-repositories-form>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'featured-datasets'">
<plugin-featured-datasets-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-featured-datasets-form>

View File

@ -13,13 +13,14 @@ import {PluginSearchDepositLinkFormComponent} from "../components/search-deposit
import {PluginOrganizationsFormComponent} from "../components/organizations/plugin-organizations.form.component";
import {IconsModule} from "../../../utils/icons/icons.module";
import {PluginHowToUseFormComponent} from "../components/how-to-use/plugin-how-to-use.form.component";
import {PluginSuggestedRepositoriesFormComponent} from "../components/suggested-repositories/plugin-suggested-repositories.form.component";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, PluginFieldEditModule, IconsModule
],
declarations: [PluginEditWrapperComponent, PluginOpenaireProductsFormComponent, PluginLearnAndConnectFormComponent,
PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginFeaturedDatasetsFormComponent, PluginGatewayInformationFormComponent, PluginSearchDepositLinkFormComponent, PluginOrganizationsFormComponent, PluginHowToUseFormComponent],
PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginFeaturedDatasetsFormComponent, PluginGatewayInformationFormComponent, PluginSearchDepositLinkFormComponent, PluginOrganizationsFormComponent, PluginHowToUseFormComponent, PluginSuggestedRepositoriesFormComponent],
exports: [PluginEditWrapperComponent]
})

View File

@ -1,3 +1,4 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import{EnvProperties} from './properties/env-properties';
import {properties} from "../../../environments/environment";