Merge branch 'plugins-functionality' of code-repo.d4science.org:MaDgIK/openaire-library into plugins-functionality

This commit is contained in:
argirok 2024-06-10 09:05:29 +03:00
commit a559329643
9 changed files with 30 additions and 34 deletions

View File

@ -34,7 +34,7 @@
</div>
<form *ngIf="!showLoading" [formGroup]="myForm">
<div class="uk-grid uk-child-width-1-2">
<div *ngIf="placementsOptions.length > 0" input [formInput]="myForm.get('placement')"
<div *ngIf="placementsOptions.length > 1 && myForm.get('placement').value" input [formInput]="myForm.get('placement')"
placeholder="Select placement" [options]="placementsOptions" type="select"></div>
<div input [formInput]="myForm.get('order')" placeholder="Select order" [options]="orderOptions" type="select"></div>
</div>

View File

@ -110,7 +110,7 @@
{{contentProviderTotal|number}}
</a>
<span class="uk-flex uk-flex-middle uk-text-small">
Content Providers
{{openaireEntities.DATASOURCES}}
<a *ngIf="contentProvidersCalculated && (contentProviderTotal && contentProviderTotal > 0 && isEntityEnabled('datasource') && isRouteEnabled(searchLinkToDataProviders))"
[title]="buildContentProvidersTooltip()"
[attr.uk-tooltip]="'pos: bottom-right; delay: 10;'"

View File

@ -211,7 +211,7 @@ export class PluginGatewayInformationComponent extends PluginBaseComponent<Plugi
let tooltipContent: string = "<div>";
if (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders)) {
tooltipContent += "<span class='uk-text-bold'>Content Providers</span>";
tooltipContent += "<span class='uk-text-bold'>Data sources</span>";
}
tooltipContent += " have been selected as relevant for your community by the gateway curators.";

View File

@ -11,6 +11,8 @@
View all
</a>-->
</div>
<div [innerHTML]="pluginObject.description"></div>
<div *ngIf="!contentProviders || contentProviders.length == 0 " class="uk-text-muted uk-text-center">
No datasources available
</div>

View File

@ -5,8 +5,8 @@ import {ConfigurationService} from "../../../../utils/configuration/configuratio
import {CommunityService} from "../../../../connect/community/community.service";
export class PluginSuggestedRepositories extends PluginBaseInfo{
title:string ="Suggested repositories & journals";
description:string = "";
compare(oldObject): any {
console.log()
return super.compare(oldObject);
}
}

View File

@ -8,9 +8,10 @@ import {PluginSuggestedRepositories} from "./plugin-suggested-repositories.compo
<div *ngIf="pluginObject" class="uk-padding-xsmall">
<plugin-field-edit [value]="pluginObject.title"
type="text" field="title" (changed)="valueChanged($event)"></plugin-field-edit>
<plugin-field-edit [value]="pluginObject.description"
type="textarea" field="description" (changed)="valueChanged($event)" [switchToHTMLEditor]="true"></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>
<a routerLink="../../../info/content-providers" target="_blank">Community info</a> by adding them in deposit.</div>
</div>
`,

View File

@ -86,7 +86,7 @@
</div>
</aside>
<div page-content [fullWidth]="true" >
<div page-content [fullWidth]="true" class="uk-width-1-1">
<div inner>
<div> <!--class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">-->

View File

@ -82,7 +82,9 @@
<div class="uk-card-body uk-flex">
<div class="uk-width-expand uk-text-small">
<ng-container *ngIf="pluginGroup.template && !templateView">
<h6>{{pluginGroup.template.name}}</h6>
<h6 *ngIf="!(pluginGroup.plugin.custom && pluginGroup.template.custom)">{{pluginGroup.template.name}}</h6>
<h6 *ngIf="pluginGroup.plugin.custom && pluginGroup.template.custom">{{pluginGroup.plugin.object && pluginGroup.plugin.object.title?pluginGroup.plugin.object.title:pluginGroup.template.name}}</h6>
<div class="uk-margin-small-bottom">
{{pluginGroup.template.description}}
</div>
@ -134,7 +136,7 @@
</button>
</div>
</div>-->
<div *ngIf="pluginGroup.plugin.custom">
<div *ngIf="pluginGroup.plugin.custom && pluginGroup.template.custom">
<div class="uk-padding-small uk-padding-remove-horizontal">
<button
class="uk-button uk-button-link uk-flex uk-flex-middle uk-text-danger"

View File

@ -143,33 +143,30 @@ export class PluginsComponent implements OnInit {
}
let self = this;
this.pluginTemplates.forEach(_ => {
console.log("pl template", _.code, _.custom)
let plugin: Plugin = null;
for (let pl of plugins) {
if (pl.templateId == _._id) {
plugin = pl;
}
}
if (!plugin && !_.custom) {
plugin = new Plugin(this.selectedPageId, this.selectedCommunityPid, _);
this.plugins.push(plugin);
}
if(!_.custom) {
if (plugin) {
console.log("plugin found", plugin.custom)
if (plugin.custom) {
console.log(plugin, _)
for (let pl of plugins) {
if (pl.templateId == _._id) {
plugin = pl;
}
}
if (!plugin) {
plugin = new Plugin(this.selectedPageId, this.selectedCommunityPid, _);
this.plugins.push(plugin);
}
if (plugin) {
plugin.object = PluginUtils.initializeObjectAndCompare(_.code, plugin.object)
this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _, openPreview: false});
}
plugin.object = PluginUtils.initializeObjectAndCompare(_.code, plugin.object)
this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _, openPreview: false});
}
});
/* console.log("________", )
//add custom plugins in the list
this.plugins.forEach(_ => {
if(_.custom){
console.log("custom plugin", _.templateCode)
let customTemplate = null;
this.pluginTemplates.forEach(template => {
if (_.templateId == template._id) {
@ -177,13 +174,10 @@ export class PluginsComponent implements OnInit {
}
});
if(customTemplate){
console.log("template found!")
this.pluginsByPlacement.get(customTemplate.placement).push({plugin: _, template: customTemplate, openPreview: false});
}
}
});*/
});
let availablePlacements = [];
for (let placement of this.pluginUtils.placementsOptions) {
if (this.pluginsByPlacement.get(placement.value).length > 0) {
@ -193,13 +187,10 @@ export class PluginsComponent implements OnInit {
return a.plugin.order - b.plugin.order;
})
}
console.log(availablePlacements)
if (availablePlacements.length == 1) {
this.selectedPlacementView = availablePlacements[0];
this.sinlgePlacementAvailable = true
}
console.log(availablePlacements)
this.showLoading = false;
},
error => this.handleError('System error retrieving plugins', error)));