[plugins-functionality | WIP ] updates and fixes after initial beta release

This commit is contained in:
argirok 2024-03-28 12:37:00 +02:00
parent 25051df626
commit a1b49630db
18 changed files with 114 additions and 79 deletions

View File

@ -4,7 +4,7 @@
</h3> </h3>
<ul *ngIf="subcommunities" class="uk-subnav uk-subnav-pill uk-flex uk-flex-center"> <ul *ngIf="subcommunities" class="uk-subnav uk-subnav-pill uk-flex uk-flex-center">
<li *ngFor="let item of subcommunities.slice(0,15)" class="uk-margin-small-bottom"> <li *ngFor="let item of subcommunities.slice(0,15)" class="uk-margin-small-bottom">
<a [routerLink]="properties.searchLinkToAdvancedResults" [queryParams]="{f0:'conceptname', fv0:item.label}"> <a [routerLink]="properties.searchLinkToAdvancedResults" [queryParams]="{f0:'conceptname', fv0:item.label}" [class.uk-disabled] =previewInAdmin>
<!--{{item.category}} : {{item.subCommunityId}} - --> {{item.label}} <!--{{item.category}} : {{item.subCommunityId}} - --> {{item.label}}
</a> </a>
</li> </li>

View File

@ -26,7 +26,7 @@
<ng-container *ngFor="let result of results.slice((page-1)*slideItems,(page)*slideItems)"> <ng-container *ngFor="let result of results.slice((page-1)*slideItems,(page)*slideItems)">
<result-preview [properties]="properties" [showOrganizations]="true" <result-preview [properties]="properties" [showOrganizations]="true"
[showSubjects]="true" [result]="result" [showEnermaps]="true" [showSubjects]="true" [result]="result" [showEnermaps]="true"
[isCard]="true" [showEntityActions]="false"> [isCard]="true" [showEntityActions]="false" [class.uk-disabled] =previewInAdmin>
</result-preview> </result-preview>
</ng-container> </ng-container>
</div> </div>

View File

@ -73,7 +73,7 @@
<ng-container *ngIf="community"> <ng-container *ngIf="community">
<div *ngIf="isRouteEnabled('/curators') && isVisible('curators')" <div *ngIf="isRouteEnabled('/curators') && isVisible('curators')"
class="uk-text-small uk-margin-xsmall-bottom"> class="uk-text-small uk-margin-xsmall-bottom" [class.uk-disabled] =previewInAdmin>
<curators [longView]="false"></curators> <curators [longView]="false"></curators>
</div> </div>
<div *ngIf="community.date && isVisible('date')" class="uk-text-small"> <div *ngIf="community.date && isVisible('date')" class="uk-text-small">
@ -86,7 +86,7 @@
class="uk-flex uk-flex-column uk-margin-bottom info-number"> class="uk-flex uk-flex-column uk-margin-bottom info-number">
<a class="uk-h5 uk-margin-remove" [queryParams]=params <a class="uk-h5 uk-margin-remove" [queryParams]=params
routerLinkActive="router-link-active" routerLinkActive="router-link-active"
[routerLink]="searchLinkToProjects"> [routerLink]="searchLinkToProjects" [class.uk-disabled] =previewInAdmin>
{{projectTotal|number}} {{projectTotal|number}}
</a> </a>
<span class="uk-flex uk-flex-middle uk-text-small"> <span class="uk-flex uk-flex-middle uk-text-small">
@ -94,7 +94,7 @@
<a *ngIf="projectsCalculated && (projectTotal && projectTotal > 0 && isEntityEnabled('project') && isRouteEnabled(searchLinkToProjects))" <a *ngIf="projectsCalculated && (projectTotal && projectTotal > 0 && isEntityEnabled('project') && isRouteEnabled(searchLinkToProjects))"
[title]="buildProjectsTooltip()" [title]="buildProjectsTooltip()"
[attr.uk-tooltip]="'pos: bottom-right; delay: 10;'" [attr.uk-tooltip]="'pos: bottom-right; delay: 10;'"
class="uk-link-reset uk-margin-xsmall-left"> class="uk-link-reset uk-margin-xsmall-left" [class.uk-disabled] =previewInAdmin>
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true" <icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true"
[customClass]="'uk-text-muted'"></icon> [customClass]="'uk-text-muted'"></icon>
</a> </a>
@ -105,7 +105,7 @@
class="uk-flex uk-flex-column info-number"> class="uk-flex uk-flex-column info-number">
<a class="uk-h5 uk-margin-remove" [queryParams]=params <a class="uk-h5 uk-margin-remove" [queryParams]=params
routerLinkActive="router-link-active" routerLinkActive="router-link-active"
[routerLink]="searchLinkToDataProviders"> [routerLink]="searchLinkToDataProviders" [class.uk-disabled] =previewInAdmin>
{{contentProviderTotal|number}} {{contentProviderTotal|number}}
</a> </a>
<span class="uk-flex uk-flex-middle uk-text-small"> <span class="uk-flex uk-flex-middle uk-text-small">
@ -113,7 +113,7 @@
<a *ngIf="contentProvidersCalculated && (contentProviderTotal && contentProviderTotal > 0 && isEntityEnabled('datasource') && isRouteEnabled(searchLinkToDataProviders))" <a *ngIf="contentProvidersCalculated && (contentProviderTotal && contentProviderTotal > 0 && isEntityEnabled('datasource') && isRouteEnabled(searchLinkToDataProviders))"
[title]="buildContentProvidersTooltip()" [title]="buildContentProvidersTooltip()"
[attr.uk-tooltip]="'pos: bottom-right; delay: 10;'" [attr.uk-tooltip]="'pos: bottom-right; delay: 10;'"
class="uk-link-reset uk-margin-xsmall-left"> class="uk-link-reset uk-margin-xsmall-left" [class.uk-disabled] =previewInAdmin>
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true" <icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true"
[customClass]="'uk-text-muted'"></icon> [customClass]="'uk-text-muted'"></icon>
</a> </a>
@ -125,14 +125,14 @@
&& isVisible('communities')" && isVisible('communities')"
class="uk-flex uk-flex-column uk-margin-bottom info-number"> class="uk-flex uk-flex-column uk-margin-bottom info-number">
<a class="uk-h5 uk-margin-remove" [queryParams]=params <a class="uk-h5 uk-margin-remove" [queryParams]=params
routerLinkActive="router-link-active" [routerLink]="shareInZenodoPage"> routerLinkActive="router-link-active" [routerLink]="shareInZenodoPage" [class.uk-disabled] =previewInAdmin>
{{zenodoCommunityIdS.length + ((masterZenodoCommunity) ? 1 : 0)}} {{zenodoCommunityIdS.length + ((masterZenodoCommunity) ? 1 : 0)}}
</a> </a>
<span class="uk-flex uk-flex-middle uk-text-small"> <span class="uk-flex uk-flex-middle uk-text-small">
Linked Zenodo Communities Linked Zenodo Communities
<a [title]="buildZenodoCommunitiesTooltip()" <a [title]="buildZenodoCommunitiesTooltip()"
[attr.uk-tooltip]="'pos: bottom-right; delay: 10;'" [attr.uk-tooltip]="'pos: bottom-right; delay: 10;'"
class="uk-link-reset uk-margin-xsmall-left"> class="uk-link-reset uk-margin-xsmall-left" [class.uk-disabled] =previewInAdmin>
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true" <icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true"
[customClass]="'uk-text-muted'"></icon> [customClass]="'uk-text-muted'"></icon>
</a> </a>
@ -142,7 +142,7 @@
*ngIf="isRouteEnabled('/subjects') && displayedAllSubjects && displayedAllSubjects.length > 0 && isVisible('subjects')" *ngIf="isRouteEnabled('/subjects') && displayedAllSubjects && displayedAllSubjects.length > 0 && isVisible('subjects')"
class="uk-flex uk-flex-column uk-margin-bottom info-number"> class="uk-flex uk-flex-column uk-margin-bottom info-number">
<a class="uk-h5 uk-margin-remove" <a class="uk-h5 uk-margin-remove"
routerLinkActive="router-link-active" [routerLink]="'/subjects'"> routerLinkActive="router-link-active" [routerLink]="'/subjects'" [class.uk-disabled] =previewInAdmin>
{{displayedAllSubjects.length}} {{displayedAllSubjects.length}}
</a> </a>
<span class="uk-text-small"> <span class="uk-text-small">
@ -162,7 +162,7 @@
<icon [name]="'description'" [type]="'outlined'" [ratio]="2" [flex]="true" <icon [name]="'description'" [type]="'outlined'" [ratio]="2" [flex]="true"
[customClass]="'uk-margin-small-right uk-text-secondary'"></icon> [customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('publications')" <a [queryParams]="getParamsForSearchLink('publications')"
[routerLink]="properties.searchLinkToAdvancedResults" [routerLink]="properties.searchLinkToAdvancedResults" [class.uk-disabled] =previewInAdmin
class="uk-link-reset uk-flex uk-flex-column"> class="uk-link-reset uk-flex uk-flex-column">
<span class="uk-text-xsmall"> <span class="uk-text-xsmall">
{{openaireEntities.PUBLICATIONS}} {{openaireEntities.PUBLICATIONS}}
@ -178,7 +178,7 @@
<icon [name]="'database'" [type]="'outlined'" [ratio]="2" [flex]="true" <icon [name]="'database'" [type]="'outlined'" [ratio]="2" [flex]="true"
[customClass]="'uk-margin-small-right uk-text-secondary'"></icon> [customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('datasets')" [routerLink]="properties.searchLinkToAdvancedResults" <a [queryParams]="getParamsForSearchLink('datasets')" [routerLink]="properties.searchLinkToAdvancedResults"
class="uk-link-reset uk-flex uk-flex-column"> class="uk-link-reset uk-flex uk-flex-column" [class.uk-disabled] =previewInAdmin>
<span class="uk-text-xsmall"> <span class="uk-text-xsmall">
{{openaireEntities.DATASETS}} {{openaireEntities.DATASETS}}
</span> </span>
@ -205,7 +205,7 @@
<icon [name]="'integration_instructions'" [type]="'outlined'" [ratio]="2" [flex]="true" <icon [name]="'integration_instructions'" [type]="'outlined'" [ratio]="2" [flex]="true"
[customClass]="'uk-margin-small-right uk-text-secondary'"></icon> [customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('software')" [routerLink]="properties.searchLinkToAdvancedResults" <a [queryParams]="getParamsForSearchLink('software')" [routerLink]="properties.searchLinkToAdvancedResults"
class="uk-link-reset uk-flex uk-flex-column"> class="uk-link-reset uk-flex uk-flex-column" [class.uk-disabled] =previewInAdmin>
<span class="uk-text-xsmall"> <span class="uk-text-xsmall">
{{openaireEntities.SOFTWARE}} {{openaireEntities.SOFTWARE}}
</span> </span>
@ -220,7 +220,7 @@
<icon [name]="'apps'" [type]="'outlined'" [ratio]="2" [flex]="true" <icon [name]="'apps'" [type]="'outlined'" [ratio]="2" [flex]="true"
[customClass]="'uk-margin-small-right uk-text-secondary'"></icon> [customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('other')" [routerLink]="properties.searchLinkToAdvancedResults" <a [queryParams]="getParamsForSearchLink('other')" [routerLink]="properties.searchLinkToAdvancedResults"
class="uk-link-reset uk-flex uk-flex-column"> class="uk-link-reset uk-flex uk-flex-column" [class.uk-disabled] =previewInAdmin>
<span class="uk-text-xsmall"> <span class="uk-text-xsmall">
{{openaireEntities.OTHER}} {{openaireEntities.OTHER}}
</span> </span>

View File

@ -17,7 +17,7 @@
<div class="uk-text-center uk-margin-bottom description"> <div class="uk-text-center uk-margin-bottom description">
{{card.description}} {{card.description}}
</div> </div>
<a *ngFor="let url of card.urlsArray" [href]="card.url" <a *ngFor="let url of card.urlsArray" [href]="card.url" [class.uk-hidden]="!(url.url && url.url.length > 0)"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default"
[target]="url.target"> [target]="url.target">
{{url.linkText}} {{url.linkText}}

View File

@ -18,7 +18,8 @@
<div class="uk-text-center uk-margin-bottom description"> <div class="uk-text-center uk-margin-bottom description">
{{card.description}} {{card.description}}
</div> </div>
<a *ngFor="let url of card.urls" [href]="url.url" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default" [target]="url.target"> <a *ngFor="let url of card.urlsArray" [href]="url.url" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default" [target]="url.target"
[class.uk-hidden]="!(url.url && url.url.length > 0)">
{{url.linkText}} {{url.linkText}}
</a> </a>
</div> </div>

View File

@ -44,14 +44,6 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.
</a> </a>
</div> </div>
<!--<div class="uk-text-small">
Enable
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].show"
type="boolean" field="cardInfoArray" (editClicked)="pluginEditEvent = $event"
(changed)="cardShowChanged(selectedIndex,$event)">
</plugin-field-edit>
</div>-->
<div class="uk-margin-top"> <div class="uk-margin-top">
<plugin-field-edit [value]="pluginObject.cardInfoArray[selectedIndex].title" <plugin-field-edit [value]="pluginObject.cardInfoArray[selectedIndex].title"
type="text" field="title" type="text" field="title"
@ -62,16 +54,19 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.
type="text" field="description" type="text" field="description"
(changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit> (changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit>
</div> </div>
<!--<div class="uk-margin-top"> <ng-container *ngFor="let cardUrl of pluginObject.cardInfoArray[selectedIndex].urlsArray; let j = index ">
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].urlsArray" <div class=" uk-margin-top uk-text-meta uk-text-xsmall"> Link #{{j + 1}}</div>
type="text" field="url" <div class="uk-margin-small-top">
(changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit> <plugin-field-edit [value]=" cardUrl.url"
</div> type="text" field="url"
<div class="uk-margin-top"> (changed)="cardUrlValueChanged(selectedIndex, j, $event)"></plugin-field-edit>
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].urlsArray" </div>
type="text" field="linkText" placeholder="Link text" <div class="uk-margin-top">
(changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit> <plugin-field-edit [value]=" cardUrl.linkText"
</div>--> type="text" field="linkText" placeholder="Link text"
(changed)="cardUrlValueChanged(selectedIndex, j, $event)"></plugin-field-edit>
</div>
</ng-container>
</ng-container> </ng-container>
</div> </div>
@ -105,6 +100,17 @@ export class PluginLearnAndConnectFormComponent extends PluginBaseFormComponent<
$event.value = this.pluginObject.cardInfoArray; $event.value = this.pluginObject.cardInfoArray;
this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'}) this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
} }
cardUrlValueChanged(i, j, $event: PluginEditEvent) {
if (this.editTemplate) {
this.pluginObject.cardInfoArray[i].urlsArray[j][$event.field] = $event.value;
$event.value = this.pluginObject.cardInfoArray;
} else {
this.pluginObject.cardInfoArray[i].urlsArray[j][$event.field] = $event.value;
$event.value = this.pluginObject.cardInfoArray;
}
this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
}
edit(i) { edit(i) {
this.selectedIndex = i; this.selectedIndex = i;

View File

@ -38,6 +38,10 @@ export class PluginOpenAIREProducts extends PluginBaseInfo{
</ul> </ul>
<ul class="uk-slider-nav uk-dotnav uk-flex-center uk-margin-medium-top"></ul> <ul class="uk-slider-nav uk-dotnav uk-flex-center uk-margin-medium-top"></ul>
</div> </div>
<div *ngIf="showErrorMessage" class="uk-text-muted uk-text-center">
No products info available
</div>
</div> </div>
`, `,
@ -50,19 +54,23 @@ export class PluginOpenaireProductsComponent extends PluginBaseComponent<PluginO
servicesToShow = []; servicesToShow = [];
slides = 1; slides = 1;
slideItems = 3; slideItems = 3;
api= "https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name";
showErrorMessage = false;
constructor(private http:HttpClient) { constructor(private http:HttpClient) {
super() super()
} }
ngOnInit(): void { ngOnInit(): void {
super.ngOnInit(); super.ngOnInit();
if(!this.services) { 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.subscriptions.push(this.http.get( this.properties.cacheUrl + encodeURIComponent(this.api)).subscribe(res =>{
this.services = res["results"].map( x=> { this.services = res["results"].map( x=> {
x.id = x.id.split("openaire.")[1] x.id = x.id.split("openaire.")[1]
return x; return x;
}); });
this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1); this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1);
this.calculatePages(); this.calculatePages();
}, error => {
this.showErrorMessage = true;
})) }))
}else{ }else{
this.calculatePages(); this.calculatePages();

View File

@ -23,6 +23,10 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.
{{service.name}} {{service.name}}
</div> </div>
</ng-container> </ng-container>
<div *ngIf="showErrorMessage" class="uk-text-muted uk-text-center">
No products info available
</div>
</div> </div>
@ -35,14 +39,18 @@ export class PluginOpenaireProductsFormComponent extends PluginBaseFormComponent
default = new PluginOpenAIREProducts(); default = new PluginOpenAIREProducts();
services = []; services = [];
excludedServiceIds = ["openaire_login","research_community_dashboard"] excludedServiceIds = ["openaire_login","research_community_dashboard"]
api= "https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name";
showErrorMessage = false;
constructor(http:HttpClient) { constructor(http:HttpClient) {
super() 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 =>{ this.subscriptions.push(http.get( this.properties.cacheUrl + encodeURIComponent(this.api)).subscribe(res =>{
this.services = res["results"].map( x=> { this.services = res["results"].map( x=> {
x.id = x.id.split("openaire.")[1] x.id = x.id.split("openaire.")[1]
return x; return x;
}); });
this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1); this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1);
}, error => {
this.showErrorMessage = true;
})) }))
} }

View File

@ -1,5 +1,5 @@
<div *ngIf=" portal && isRouteEnabled('/organizations')" class="plugin-featured-datasets uk-container uk-container-large uk-section"> <div *ngIf=" portal && isRouteEnabled('/organizations')" class="plugin-featured-datasets uk-container uk-container-large uk-section">
<affiliations [longView]="false" [getAffiliationsFromAPI]="true" [communityFirstPage]="true"></affiliations> <affiliations [longView]="false" [getAffiliationsFromAPI]="true" [communityFirstPage]="true" [class.uk-disabled] =previewInAdmin></affiliations>
</div> </div>
<div *ngIf="!portal " class="uk-text-muted uk-text-center"> <div *ngIf="!portal " class="uk-text-muted uk-text-center">

View File

@ -16,6 +16,10 @@
{{card.title}} {{card.title}}
</div> </div>
<div class="uk-text-small">{{card.description}}</div> <div class="uk-text-small">{{card.description}}</div>
<a *ngFor="let url of card.urlsArray" [route]="url.url" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default" [target]="url.target"
[class.uk-hidden]="!(url.url && url.url.length > 0)">
{{url.linkText}}
</a>
</slider-nav-item> </slider-nav-item>
</ng-container> </ng-container>
</ng-container> </ng-container>

View File

@ -11,11 +11,11 @@ export class PluginSearchDepositLink extends PluginBaseInfo{
image:'https://' + (properties.environment == 'production'?'':'beta.') image:'https://' + (properties.environment == 'production'?'':'beta.')
+ 'connect.openaire.eu/assets/connect-assets/home/4.png',show:true}, + 'connect.openaire.eu/assets/connect-assets/home/4.png',show:true},
{tag: "DEPOSIT YOUR RESEARCH OUTCOME", title: "Publish your research in Open Access.", description:"" {tag: "DEPOSIT YOUR RESEARCH OUTCOME", title: "Publish your research in Open Access.", description:""
, urlsArray:[ new PluginURL("/participate/deposit/learn-how","Start searching", null, true)], , urlsArray:[ new PluginURL("/participate/deposit/learn-how","Deposit your research", null, true)],
image:'https://' + (properties.environment == 'production'?'':'beta.') image:'https://' + (properties.environment == 'production'?'':'beta.')
+ 'connect.openaire.eu/assets/connect-assets/home/1.png',show:true}, + 'connect.openaire.eu/assets/connect-assets/home/1.png',show:true},
{tag: "LINK YOUR RESEARCH", title: "Contribute to your community.", description:"" {tag: "LINK YOUR RESEARCH", title: "Contribute to your community.", description:""
, urlsArray:[ new PluginURL("/participate/claim","Start searching", null, true)], , urlsArray:[ new PluginURL("/participate/claim","Link your Research searching", null, true)],
image:'https://' + (properties.environment == 'production'?'':'beta.') image:'https://' + (properties.environment == 'production'?'':'beta.')
+ 'connect.openaire.eu/assets/connect-assets/home/2.png',show:true}, + 'connect.openaire.eu/assets/connect-assets/home/2.png',show:true},
]; ];

View File

@ -44,14 +44,6 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.
</a> </a>
</div> </div>
<!--<div class="uk-text-small">
Enable
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].show"
type="boolean" field="cardInfoArray" (editClicked)="pluginEditEvent = $event"
(changed)="cardShowChanged(selectedIndex,$event)">
</plugin-field-edit>
</div>-->
<div class="uk-margin-top"> <div class="uk-margin-top">
<plugin-field-edit [value]="pluginObject.cardInfoArray[selectedIndex].title" <plugin-field-edit [value]="pluginObject.cardInfoArray[selectedIndex].title"
type="text" field="title" type="text" field="title"
@ -62,19 +54,23 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.
type="text" field="description" type="text" field="description"
(changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit> (changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit>
</div> </div>
<div class="uk-margin-top"> <ng-container *ngFor="let cardUrl of pluginObject.cardInfoArray[selectedIndex].urlsArray; let j = index ">
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].url" <div class=" uk-margin-top uk-text-meta uk-text-xsmall"> Link #{{j + 1}}</div>
type="text" field="url" <div class="uk-margin-small-top">
(changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit> <plugin-field-edit [value]=" cardUrl.url"
</div> type="text" field="url"
<div class="uk-margin-top"> (changed)="cardUrlValueChanged(selectedIndex, j, $event)"></plugin-field-edit>
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].linkText" </div>
type="text" field="linkText" placeholder="Link text" <div class="uk-margin-top">
(changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit> <plugin-field-edit [value]=" cardUrl.linkText"
</div> type="text" field="linkText" placeholder="Link text"
(changed)="cardUrlValueChanged(selectedIndex, j, $event)"></plugin-field-edit>
</div>
</ng-container>
</ng-container> </ng-container>
</div> </div>
`, `,
@ -95,10 +91,8 @@ export class PluginSearchDepositLinkFormComponent extends PluginBaseFormComponen
} }
cardShowChanged(i, $event: PluginEditEvent) { cardShowChanged(i, $event: PluginEditEvent) {
this.pluginObject.cardInfoArray[i].show = $event.value; this.pluginObject.cardInfoArray[i].show = $event.value;
$event.value = this.pluginObject.cardInfoArray; $event.value = this.pluginObject.cardInfoArray;
this.valuesChanged.emit({field: $event.field, value: $event.value, type: 'parent'}) this.valuesChanged.emit({field: $event.field, value: $event.value, type: 'parent'})
} }
@ -107,6 +101,18 @@ export class PluginSearchDepositLinkFormComponent extends PluginBaseFormComponen
$event.value = this.pluginObject.cardInfoArray; $event.value = this.pluginObject.cardInfoArray;
this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'}) this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
} }
cardUrlValueChanged(i, j, $event: PluginEditEvent) {
if (this.editTemplate) {
this.pluginObject.cardInfoArray[i].urlsArray[j][$event.field] = $event.value;
$event.value = this.pluginObject.cardInfoArray;
} else {
this.pluginObject.cardInfoArray[i].urlsArray[j][$event.field] = $event.value;
$event.value = this.pluginObject.cardInfoArray;
}
this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
}
edit(i) { edit(i) {
this.selectedIndex = i; this.selectedIndex = i;
this.toggleSubMenu(true); this.toggleSubMenu(true);

View File

@ -250,7 +250,7 @@ export class PluginsFormComponent implements OnInit {
this.savePlugin(plugin,update, this.index) this.savePlugin(plugin,update, this.index)
} }
public savePlugin(plugin, update, index){ public savePlugin(plugin, update, index){
this.subscriptions.push(this._pluginsService.savePlugin(plugin, this.properties.adminToolsAPIURL).subscribe( this.subscriptions.push(this._pluginsService.savePlugin(plugin, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
saved => { saved => {
this.savedSuccessfully(saved, update, index); this.savedSuccessfully(saved, update, index);
this.editView = false; this.editView = false;
@ -365,7 +365,7 @@ export class PluginsFormComponent implements OnInit {
this.index = i; this.index = i;
this.selectedTemplate = this.pluginsByPlacement.get(placement)[i].template; this.selectedTemplate = this.pluginsByPlacement.get(placement)[i].template;
if(id) { if(id) {
this.subscriptions.push(this._pluginsService.togglePlugin(id, status, this.properties.adminToolsAPIURL).subscribe( this.subscriptions.push(this._pluginsService.togglePlugin(id, status, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
() => { () => {
this.pluginsByPlacement.get(placement)[i].plugin.active = status; this.pluginsByPlacement.get(placement)[i].plugin.active = status;
@ -406,7 +406,7 @@ export class PluginsFormComponent implements OnInit {
} }
public move(plugin: Plugin, up:boolean, index, placement) { public move(plugin: Plugin, up:boolean, index, placement) {
if(plugin._id) { if(plugin._id) {
this.subscriptions.push(this._pluginsService.updatePluginOrder(plugin, this.properties.adminToolsAPIURL, up ? -1 : 1).subscribe( this.subscriptions.push(this._pluginsService.updatePluginOrder(plugin, this.properties.adminToolsAPIURL, up ? -1 : 1, this.selectedCommunityPid).subscribe(
saved => { saved => {
this.pluginsByPlacement.get(placement)[index].plugin = saved; this.pluginsByPlacement.get(placement)[index].plugin = saved;
}, },

View File

@ -166,7 +166,7 @@
<div class="uk-accordion-content"> <div class="uk-accordion-content">
<ng-container *ngIf="pluginGroup.openPreview"> <ng-container *ngIf="pluginGroup.openPreview">
<plugin-wrapper [pluginTemplate]="pluginGroup.template" [plugin]="pluginGroup.plugin" <plugin-wrapper [pluginTemplate]="pluginGroup.template" [plugin]="pluginGroup.plugin"
[pluginObject]="pluginGroup.plugin.object"></plugin-wrapper> [pluginObject]="pluginGroup.plugin.object" [previewInAdmin]="true"></plugin-wrapper>
</ng-container> </ng-container>
</div> </div>
</li> </li>
@ -243,7 +243,7 @@
<plugin-wrapper *ngIf="this.templateForm" [pluginTemplate]="selectedTemplate" <plugin-wrapper *ngIf="this.templateForm" [pluginTemplate]="selectedTemplate"
[plugin]="this.templateForm.getRawValue()" [plugin]="this.templateForm.getRawValue()"
[pluginObject]="this.selectedPlugin.object" [pluginObject]="this.selectedPlugin.object"
class="uk-width-1-1"></plugin-wrapper> class="uk-width-1-1" [previewInAdmin]="true"></plugin-wrapper>
</ng-container> </ng-container>
</div> </div>
</div> </div>

View File

@ -259,7 +259,7 @@ export class PluginsComponent implements OnInit {
this.savePlugin(plugin,update, this.index) this.savePlugin(plugin,update, this.index)
} }
public savePlugin(plugin, update, index){ public savePlugin(plugin, update, index){
this.subscriptions.push(this._pluginsService.savePlugin(plugin, this.properties.adminToolsAPIURL).subscribe( this.subscriptions.push(this._pluginsService.savePlugin(plugin, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
saved => { saved => {
this.savedSuccessfully(saved, update, index); this.savedSuccessfully(saved, update, index);
this.editView = false; this.editView = false;
@ -374,7 +374,7 @@ export class PluginsComponent implements OnInit {
this.index = i; this.index = i;
this.selectedTemplate = this.pluginsByPlacement.get(placement)[i].template; this.selectedTemplate = this.pluginsByPlacement.get(placement)[i].template;
if(id) { if(id) {
this.subscriptions.push(this._pluginsService.togglePlugin(id, status, this.properties.adminToolsAPIURL).subscribe( this.subscriptions.push(this._pluginsService.togglePlugin(id, status, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
() => { () => {
this.pluginsByPlacement.get(placement)[i].plugin.active = status; this.pluginsByPlacement.get(placement)[i].plugin.active = status;
@ -415,7 +415,7 @@ export class PluginsComponent implements OnInit {
} }
public move(plugin: Plugin, up:boolean, index, placement) { public move(plugin: Plugin, up:boolean, index, placement) {
if(plugin._id) { if(plugin._id) {
this.subscriptions.push(this._pluginsService.updatePluginOrder(plugin, this.properties.adminToolsAPIURL, up ? -1 : 1).subscribe( this.subscriptions.push(this._pluginsService.updatePluginOrder(plugin, this.properties.adminToolsAPIURL, up ? -1 : 1, this.selectedCommunityPid).subscribe(
saved => { saved => {
this.pluginsByPlacement.get(placement)[index].plugin = saved; this.pluginsByPlacement.get(placement)[index].plugin = saved;
}, },

View File

@ -54,6 +54,7 @@ export class PluginInfoCards{
@Input() plugin:Plugin; @Input() plugin:Plugin;
@Input() pluginTemplate:PluginTemplate; @Input() pluginTemplate:PluginTemplate;
@Input() pluginObject:T; @Input() pluginObject:T;
@Input() previewInAdmin:boolean = false;
subscriptions = []; subscriptions = [];
constructor() { constructor() {

View File

@ -20,7 +20,7 @@ import {PluginUtils} from "../utils/pluginUtils";
<plugin-gateway-information-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-gateway-information-form> <plugin-gateway-information-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-gateway-information-form>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'search-deposit-link'"> <ng-container *ngIf="pluginTemplate.code == 'search-deposit-link'">
<plugin-search-deposit-link-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-search-deposit-link-form> <plugin-search-deposit-link-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate" [editSubmenuOpen]="editSubmenuOpen"></plugin-search-deposit-link-form>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'learn-and-connect'"> <ng-container *ngIf="pluginTemplate.code == 'learn-and-connect'">
<plugin-learn-and-connect-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate" [editSubmenuOpen]="editSubmenuOpen"></plugin-learn-and-connect-form> <plugin-learn-and-connect-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate" [editSubmenuOpen]="editSubmenuOpen"></plugin-learn-and-connect-form>

View File

@ -9,37 +9,37 @@ import {PluginUtils} from "../utils/pluginUtils";
<ng-container *ngIf="pluginTemplate && pluginObject"> <ng-container *ngIf="pluginTemplate && pluginObject">
<div *ngIf="pluginTemplate.code && pluginUtils.availablePluginCodes.indexOf(pluginTemplate.code) != -1; else noplugin"> <div *ngIf="pluginTemplate.code && pluginUtils.availablePluginCodes.indexOf(pluginTemplate.code) != -1; else noplugin">
<ng-container *ngIf="pluginTemplate.code == 'openaire-products'"> <ng-container *ngIf="pluginTemplate.code == 'openaire-products'">
<plugin-openaire-products [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-openaire-products> <plugin-openaire-products [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-openaire-products>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'discover-by-subcommunity'"> <ng-container *ngIf="pluginTemplate.code == 'discover-by-subcommunity'">
<plugin-discover-by-subcommunity [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-discover-by-subcommunity> <plugin-discover-by-subcommunity [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-discover-by-subcommunity>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'gateway-information'"> <ng-container *ngIf="pluginTemplate.code == 'gateway-information'">
<plugin-gateway-information [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-gateway-information> <plugin-gateway-information [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-gateway-information>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'search-deposit-link'"> <ng-container *ngIf="pluginTemplate.code == 'search-deposit-link'">
<plugin-search-deposit-link [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-search-deposit-link> <plugin-search-deposit-link [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-search-deposit-link>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'learn-and-connect'"> <ng-container *ngIf="pluginTemplate.code == 'learn-and-connect'">
<plugin-learn-and-connect [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-learn-and-connect> <plugin-learn-and-connect [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-learn-and-connect>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'how-to-use'"> <ng-container *ngIf="pluginTemplate.code == 'how-to-use'">
<plugin-how-to-use [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-how-to-use> <plugin-how-to-use [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-how-to-use>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'suggested-repositories'"> <ng-container *ngIf="pluginTemplate.code == 'suggested-repositories'">
<plugin-suggested-repositories [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-suggested-repositories> <plugin-suggested-repositories [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-suggested-repositories>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'featured-datasets'"> <ng-container *ngIf="pluginTemplate.code == 'featured-datasets'">
<plugin-featured-datasets [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-featured-datasets> <plugin-featured-datasets [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-featured-datasets>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'organizations'"> <ng-container *ngIf="pluginTemplate.code == 'organizations'">
<plugin-organizations [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-organizations> <plugin-organizations [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-organizations>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'graph-info'"> <ng-container *ngIf="pluginTemplate.code == 'graph-info'">
<plugin-graph-info [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-graph-info> <plugin-graph-info [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-graph-info>
</ng-container> </ng-container>
<ng-container *ngIf="pluginTemplate.code == 'stats'"> <ng-container *ngIf="pluginTemplate.code == 'stats'">
<plugin-stats [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-stats> <plugin-stats [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" [previewInAdmin]="previewInAdmin" ></plugin-stats>
</ng-container> </ng-container>
</div> </div>
<ng-template #noplugin> <ng-template #noplugin>
@ -54,6 +54,7 @@ export class PluginWrapperComponent implements OnInit {
@Input() plugin:Plugin; @Input() plugin:Plugin;
@Input() pluginObject; @Input() pluginObject;
@Input() pluginTemplate:PluginTemplate; @Input() pluginTemplate:PluginTemplate;
@Input() previewInAdmin:boolean = false;
pluginUtils = new PluginUtils(); pluginUtils = new PluginUtils();
ngOnInit(): void { ngOnInit(): void {