[plugins-functionality | WIP] add more plugins, update forms...

This commit is contained in:
argirok 2024-02-22 11:09:20 +02:00
parent 552edbd0e2
commit f92c4cbf52
43 changed files with 1121 additions and 641 deletions

View File

@ -24,7 +24,8 @@ export class CommunityInfo {
fos: string[] = [];
sdg: string[] = []
selectionCriteria: SelectionCriteria;
plan: "starter" | "extended";
public static checkIsUpload(response: CommunityInfo | CommunityInfo[]): any | any[] {
if (Array.isArray(response)) {
response.forEach(value => {

View File

@ -6,7 +6,7 @@ import { RouterModule } from '@angular/router';
import {CuratorsComponent} from './curators.component';
import {CuratorService} from "../../curators/curator.service";
import {CuratorsRoutingModule} from "./curators-routing.module";
import {AffiliationsModule} from "../../../../affiliations/affiliations.module";
import {AffiliationsModule} from "../../../../pages/affiliations/affiliations.module";
import {HelperModule} from "../../../utils/helper/helper.module";
import {Schema2jsonldModule} from "../../../sharedComponents/schema2jsonld/schema2jsonld.module";
import {SEOServiceModule} from "../../../sharedComponents/SEO/SEOService.module";

View File

@ -1,13 +1,18 @@
<div>plugin-discover-by-subcommunity</div>
<div class="plugin-discover-by-subcommunity uk-container uk-container-large uk-section">
<h3 class="uk-text-center uk-margin-large-bottom">
Discover content by sub-community
{{pluginObject.title}}
</h3>
<ul class="uk-subnav uk-subnav-pill">
<li *ngFor="let item of [].constructor(16);" class="uk-margin-small-bottom">
<a>
Lorem ipsum
<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">
<a [href]="properties.searchLinkToAdvancedResults">
<!--{{item.category}}:--> {{item.label}}
</a>
</li>
</ul>
</div>
<div *ngIf="subcommunities && subcommunities.length == 0" class="uk-text-muted uk-text-center">
No subcommunities available
</div>
<div *ngIf="!community && !subcommunities" class="uk-text-muted uk-text-center">
No community info available
</div>
</div>

View File

@ -1,12 +1,32 @@
import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
import {HttpClient} from "@angular/common/http";
import {CommunityService} from "../../../../connect/community/community.service";
export class PluginDiscoverBySubcommunity extends PluginBaseInfo{
title:string ="Discover content by sub-community";
}
@Component({
selector: 'plugin-discover-by-subcommunity',
templateUrl: 'plugin-discover-by-subcommunity.component.html'
})
export class PluginDiscoverBySubcommunityComponent extends PluginBaseComponent{
constructor() {
export class PluginDiscoverBySubcommunityComponent extends PluginBaseComponent<PluginDiscoverBySubcommunity>{
default = new PluginDiscoverBySubcommunity();
subcommunities = null;
community;
constructor(http:HttpClient, private communityService: CommunityService) {
super()
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
if(community) {
this.subscriptions.push(http.get(this.properties.communityAPI + community.communityId
+ "/subcommunities?all=false").subscribe(res => {
console.log(res)
this.subcommunities = res ? res : [] /* = res.splice(0,15)*/;
}));
}
}));
}
}

View File

@ -0,0 +1,25 @@
import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
import {HttpClient} from "@angular/common/http";
import {PluginDiscoverBySubcommunity} from "./plugin-discover-by-subcommunity.component";
@Component({
selector: 'plugin-discover-by-subcommunity-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>
`,
})
export class PluginDiscoverBySubcommunityFormComponent extends PluginBaseComponent<PluginDiscoverBySubcommunity> {
default = new PluginDiscoverBySubcommunity();
selectedIndex = null;
constructor(http:HttpClient) {
super()
}
}

View File

@ -1,15 +1,26 @@
<div>plugin-featured-datasets</div>
<div class="plugin-featured-datasets uk-container uk-container-large uk-section">
<div class="uk-flex uk-flex-middle uk-flex-between uk-margin-large-bottom">
<div class="uk-flex uk-flex-middle uk-flex-between ">
<h3 class="uk-margin-remove">
Featured Datasets
{{pluginObject.title}}
</h3>
<a href="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
View all
</a>
</div>
<div>
<!-- Will we use search-result component? Featured dataset card will need some alterations. Also there is no "View all" page I think -->
content
<div class="uk-margin-top uk-margin-medium-bottom uk-text-meta">
<div>{{pluginObject.textLine1}}</div>
<div>
{{pluginObject.textLine2}}
</div>
</div>
<no-load-paging *ngIf="fetchFeaturedDatasets && fetchFeaturedDatasets.searchUtils.totalResults > size" [type]="'Featured Datasets'"
(pageChange)="updatePage($event)"
[page]="fetchFeaturedDatasets.searchUtils.page" [pageSize]="size"
[totalResults]="fetchFeaturedDatasets.searchUtils.totalResults" >
</no-load-paging>
<search-result [properties]="properties"
[results]="fetchFeaturedDatasets.results"
[status]="fetchFeaturedDatasets.searchUtils.status"
[type]="'dataset'" [showEnermaps]="true" >
</search-result>
</div>
</div>
</div>

View File

@ -1,12 +1,36 @@
import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
import {FetchResearchResults} from "../../../../utils/fetchEntitiesClasses/fetchResearchResults.class";
import {SearchResearchResultsService} from "../../../../services/searchResearchResults.service";
export class PluginFeaturedDatasets {
title: string = "Featured datasets";
textLine1: string = "Here are listed some of the most important energy datasets as selected by energy experts.";
textLine2: string = "Check them if you want to easily explore and visualize the European energy landscape, using only well-known datasets which you can trust.";
}
@Component({
selector: 'plugin-featured-datasets',
templateUrl: 'plugin-featured-datasets.component.html'
})
export class PluginFeaturedDatasetsComponent extends PluginBaseComponent{
constructor() {
export class PluginFeaturedDatasetsComponent extends PluginBaseComponent<PluginFeaturedDatasets> {
default = new PluginFeaturedDatasets();
public fetchFeaturedDatasets: FetchResearchResults;
page = 1;
size = 3;
constructor(private _searchResearchResultsService: SearchResearchResultsService) {
super()
this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService);
this.fetchFeaturedDatasets.searchUtils.size = this.size;
this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", "enermaps", 1, 100, this.properties, "enermaps::selection");
}
public updatePage(event) {
this.page = event.value;
this.fetchFeaturedDatasets.searchUtils.page = event.value;
this.fetchFeaturedDatasets.results = this.fetchFeaturedDatasets.allResults.slice((this.page - 1) * this.size, this.page * this.size);
}
}

View File

@ -0,0 +1,31 @@
import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
import {HttpClient} from "@angular/common/http";
import {OpenaireEntities} from "../../../../utils/properties/searchFields";
import {PluginFeaturedDatasets} from "./plugin-featured-datasets.component";
@Component({
selector: 'plugin-featured-datasets-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>
<plugin-field-edit [value]="pluginObject.textLine1"
type="text" field="textLine1" (changed)="valueChanged($event)"></plugin-field-edit>
<plugin-field-edit [value]="pluginObject.textLine2"
type="text" field="textLine2" (changed)="valueChanged($event)"></plugin-field-edit>
</div>
`,
})
export class PluginFeaturedDatasetsFormComponent extends PluginBaseComponent<PluginFeaturedDatasets> {
default = new PluginFeaturedDatasets();
selectedIndex = null;
openaireEntities= OpenaireEntities;
constructor(http: HttpClient) {
super()
}
}

View File

@ -9,10 +9,12 @@ import {IconsService} from "../../../../utils/icons/icons.service";
import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
import {PluginFeaturedDatasetsComponent} from './plugin-featured-datasets.component';
import {NoLoadPaging} from "../../../../searchPages/searchUtils/no-load-paging.module";
import {SearchResultsModule} from "../../../../searchPages/searchUtils/searchResults.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule, NoLoadPaging, SearchResultsModule
],
providers:[PluginsService],
declarations: [PluginFeaturedDatasetsComponent],

View File

@ -1,19 +1,22 @@
<div>plugin-gateway-information</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">
Gateway Information
{{ pluginObject.title}}
</div>
<div *ngIf="isRouteEnabled('/curators')" class="uk-text-small uk-margin-xsmall-bottom">
<div *ngIf="!community " class="uk-text-muted uk-text-center">
No community info available available
</div>
<div *ngIf="isRouteEnabled('/curators') && isVisible('curators')" class="uk-text-small uk-margin-xsmall-bottom">
<curators [longView]="false"></curators>
</div>
<div *ngIf="community.date" class="uk-text-small">
<div *ngIf="community.date && isVisible('date')" class="uk-text-small">
<span>Created: </span> {{community.date | date:'dd-MMM-yyyy'}}
</div>
<div class="uk-grid uk-grid-large uk-grid-stack uk-margin-top" uk-grid uk-height-match=".info-number">
<div>
<div *ngIf="projectTotal && projectTotal > 0 && isEntityEnabled('project') && isRouteEnabled(searchLinkToProjects)"
<div *ngIf="projectTotal && projectTotal > 0 && isEntityEnabled('project')
&& isRouteEnabled(searchLinkToProjects) && isVisible('projects')"
class="uk-flex uk-flex-column uk-margin-bottom info-number">
<a class="uk-h5 uk-margin-remove" [queryParams]=params
routerLinkActive="router-link-active"
@ -30,7 +33,8 @@
</a>
</span>
</div>
<div *ngIf="contentProviderTotal && contentProviderTotal > 0 && isEntityEnabled('datasource') && isRouteEnabled(searchLinkToDataProviders)"
<div *ngIf="contentProviderTotal && contentProviderTotal > 0 && isEntityEnabled('datasource') &&
isRouteEnabled(searchLinkToDataProviders) && isVisible('datasources')"
class="uk-flex uk-flex-column info-number">
<a class="uk-h5 uk-margin-remove" [queryParams]=params
routerLinkActive="router-link-active"
@ -49,7 +53,8 @@
</div>
</div>
<div>
<div *ngIf="(zenodoCommunityIdS.length + ((masterZenodoCommunity) ? 1 : 0) > 0) && isRouteEnabled(shareInZenodoPage)"
<div *ngIf="(zenodoCommunityIdS.length + ((masterZenodoCommunity) ? 1 : 0) > 0) && isRouteEnabled(shareInZenodoPage)
&& isVisible('communities')"
class="uk-flex uk-flex-column uk-margin-bottom info-number">
<a class="uk-h5 uk-margin-remove" [queryParams]=params
routerLinkActive="router-link-active" [routerLink]="shareInZenodoPage">
@ -64,7 +69,7 @@
</a>
</span>
</div>
<div *ngIf="isRouteEnabled('/subjects') && displayedAllSubjects && displayedAllSubjects.length > 0"
<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'">
@ -77,4 +82,67 @@
</div>
</div>
</div>
</div>
</div>
<div class="plugin2 uk-flex uk-flex-middle uk-flex-wrap" style="grid-gap: 30px;">
<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">
<span class="uk-text-xsmall">
{{openaireEntities.PUBLICATIONS}}
</span>
<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">
<span class="uk-text-xsmall">
{{openaireEntities.DATASETS}}
</span>
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove" [innerHTML]="resultCounts.datasets | 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">
<span class="uk-text-xsmall">
{{openaireEntities.DATASETS}}
</span>
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove" [innerHTML]="resultCounts.datasets | numberRound: 1:1">
</span>
</a>
</div>-->
<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">
<span class="uk-text-xsmall">
{{openaireEntities.SOFTWARE}}
</span>
<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">
<span class="uk-text-xsmall">
{{openaireEntities.OTHER}}
</span>
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove" [innerHTML]="resultCounts.other | numberRound: 1:1">
</span>
</a>
</div>
</div>

View File

@ -7,13 +7,31 @@ import {SearchCommunityDataprovidersService} from '../../../../../openaireLibrar
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";
export class PluginGatewayInformation{
title:string ="Gateway Information";
curators:boolean = true;
date:boolean = true;
communities:boolean = true;
projects:boolean = true;
organizations:boolean = true;
datasources:boolean = true;
subjects:boolean = true;
publications:boolean = true;
datasets:boolean = true;
software:boolean = true;
other:boolean = true;
}
@Component({
selector: 'plugin-gateway-information',
templateUrl: 'plugin-gateway-information.component.html',
styleUrls: ['plugin-gateway-information.component.less']
})
export class PluginGatewayInformationComponent extends PluginBaseComponent{
export class PluginGatewayInformationComponent extends PluginBaseComponent<PluginGatewayInformation>{
default = new PluginGatewayInformation();
community = null;
portal = null;
params: any = {};
@ -33,25 +51,26 @@ export class PluginGatewayInformationComponent extends PluginBaseComponent{
displayedSubjects = [];
displayedSdg = [];
displayedFos = [];
resultCounts = null;
private user: User;
constructor(private config: ConfigurationService,
searchLinkToResults: string = null;
public routerHelper: RouterHelper = new RouterHelper();
openaireEntities= OpenaireEntities;
constructor(private http:HttpClient,
private config: ConfigurationService,
private communityService: CommunityService,
private searchCommunityProjectsService: SearchCommunityProjectsService,
private searchCommunityDataprovidersService: SearchCommunityDataprovidersService,
private zenodoCommunitiesService: ZenodoCommunitiesService) {
super()
}
ngOnInit() {
super();
// console.log(this.default, this.pluginObject, this.pluginDefaultObject)
this.searchLinkToResults = this.properties.searchLinkToResults;
this.searchLinkToProjects = this.properties.searchLinkToProjects;
this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders;
this.shareInZenodoPage = this.properties.shareInZenodoPage;
this.subscriptions.push(this.config.portalAsObservable.subscribe(
res => {
console.log(res);
this.portal = res;
},
error => {
@ -60,7 +79,6 @@ export class PluginGatewayInformationComponent extends PluginBaseComponent{
));
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(
community => {
console.log(community);
this.community = community;
if(community && !ConnectHelper.isPrivate(community, this.user)) {
this.displayedSubjects = community.subjects;
@ -79,7 +97,7 @@ export class PluginGatewayInformationComponent extends PluginBaseComponent{
this.params = {communityId: community.communityId};
}
if (this.community.zenodoCommunity) {
this.subscriptions.push(this.zenodoCommunitiesService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity).subscribe(
this.subscriptions.push(this.zenodoCommunitiesService.getZenodoCommunityById(this.properties, this.community.zenodoCommunity).subscribe(
res => {
this.masterZenodoCommunity = res;
},
@ -116,8 +134,12 @@ export class PluginGatewayInformationComponent extends PluginBaseComponent{
this.contentProvidersCalculated = true;
}
));
this.subscriptions.push(this.http.get(this.properties.utilsService + "/portals/countResults?field=communityid&value=" + this.community.communityId).subscribe(res => {
this.resultCounts = res;
}));
}
isEntityEnabled(entity: string) {
return this.portal.entities.some(x => x['pid'] == entity && x['isEnabled'] === true);
}
@ -161,4 +183,11 @@ export class PluginGatewayInformationComponent extends PluginBaseComponent{
return tooltipContent;
}
public getParamsForSearchLink(type: string = "") {
if (type) {
return this.routerHelper.createQueryParams(['type', 'qf', 'sortBy'], [type, 'false', 'resultdateofacceptance,descending']);
} else {
return {};
}
}
}

View File

@ -0,0 +1,103 @@
import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
import {PluginGatewayInformation} from "./plugin-gateway-information.component";
import {OpenaireEntities} from "../../../../utils/properties/searchFields";
@Component({
selector: 'plugin-gateway-information-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-margin-top uk-text-meta uk-text-small">
Show or hide the following information:
</div>
<div class="uk-grid uk-child-width-1-1">
<div>
Curated by:
<plugin-field-edit [value]=" pluginObject.curators"
type="boolean" field="curators" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
</div>
<div>
Created:
<plugin-field-edit [value]=" pluginObject.date"
type="boolean" field="date" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
</div>
<div>
{{openaireEntities.PROJECTS}}:
<plugin-field-edit [value]=" pluginObject.projects"
type="boolean" field="projects" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
</div>
<div>
Linked Zenodo communities:
<plugin-field-edit [value]=" pluginObject.communities"
type="boolean" field="communities" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
</div>
<div>
{{openaireEntities.DATASOURCES}}
<plugin-field-edit [value]=" pluginObject.datasources"
type="boolean" field="datasources" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
</div>
<div>
Subjects:
<plugin-field-edit [value]=" pluginObject.subjects"
type="boolean" field="subjects" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
</div>
<div>
{{openaireEntities.PUBLICATIONS}}:
<plugin-field-edit [value]=" pluginObject.publications"
type="boolean" field="publications" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
</div>
<div>
{{openaireEntities.DATASETS}}:
<plugin-field-edit [value]=" pluginObject.datasets"
type="boolean" field="datasets" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
</div>
<div>
{{openaireEntities.SOFTWARE}}:
<plugin-field-edit [value]=" pluginObject.software"
type="boolean" field="software" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
</div>
<div>
{{openaireEntities.OTHER}}:
<plugin-field-edit [value]=" pluginObject.other"
type="boolean" field="other" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
</div>
</div>
</div>
`,
})
export class PluginGatewayInformationFormComponent extends PluginBaseComponent<PluginGatewayInformation> {
default = new PluginGatewayInformation();
selectedIndex = null;
openaireEntities= OpenaireEntities;
constructor() {
super()
}
}

View File

@ -1,58 +1,30 @@
<div>plugin-how-to-use</div>
<div class="plugin-how-to-use uk-container uk-container-large uk-section">
<h3 class="uk-h2 uk-margin-large-bottom">
How to use the gateway?
{{pluginObject.title}}
</h3>
<div class="uk-padding" uk-height-match=".title">
<div class="uk-padding uk-grid uk-child-width-1-3@m uk-child-width-1-1 uk-grid-large" uk-grid uk-height-match=".description">
<!-- icon1, title1, description1, link1 -->
<div class="uk-flex uk-flex-column uk-flex-middle">
<div class="uk-card uk-card-default uk-card-body">
<icon [name]="'description'" [type]="'outlined'" [ratio]="3" [flex]="true"></icon>
</div>
<h5 class="title">
Tutorials
</h5>
<div class="uk-text-center uk-margin-bottom description">
The mini-video tutorials can help you find quick answers on specific gateway functionalities.
</div>
<a href="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
View all
</a>
</div>
<!-- icon2, title2, description2, link2 -->
<div class="uk-flex uk-flex-column uk-flex-middle">
<div class="uk-card uk-card-default uk-card-body">
<icon [name]="'description'" [type]="'outlined'" [ratio]="3" [flex]="true"></icon>
</div>
<h5 class="title">
Guides
</h5>
<div class="uk-text-center uk-margin-bottom description">
Textual guides to all gateway functionalities.
</div>
<a href="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
Guide for the users
</a>
<a href="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
Guide for the managers
</a>
</div>
<!-- icon3, title3, description3, link3 -->
<div class="uk-flex uk-flex-column uk-flex-middle">
<div class="uk-card uk-card-default uk-card-body">
<icon [name]="'description'" [type]="'outlined'" [ratio]="3" [flex]="true"></icon>
</div>
<h5 class="title">
Webinars
</h5>
<div class="uk-text-center uk-margin-bottom description">
Recordings and slides of webinars on OpenAIRE CONNECT and your gateway.
</div>
<a href="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
View all
</a>
</div>
<div class="uk-padding uk-grid uk-child-width-1-3@m uk-child-width-1-1 uk-grid-large" uk-grid
uk-height-match=".description">
<ng-container *ngFor="let card of pluginObject.cardInfoArray">
<ng-container *ngIf="card.show">
<div class="uk-flex uk-flex-column uk-flex-middle">
<div class="uk-card uk-card-default uk-card-body">
<icon [name]="'description'" [type]="'outlined'" [ratio]="3" [flex]="true"></icon>
</div>
<h5 class="title">
{{card.title}}
</h5>
<div class="uk-text-center uk-margin-bottom description">
{{card.description}}
</div>
<a *ngFor="let url of card.urls" [href]="card.url"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default"
[target]="url.target">
{{url.linkText}}
</a>
</div>
</ng-container>
</ng-container>
</div>
</div>
</div>
</div>

View File

@ -1,11 +1,18 @@
import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
import {PluginBaseComponent, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component";
export class PluginHowToUse{
title:string ="How to use the gateway?";
cardInfoArray: PluginInfoCards[] = [
{title: "Tutorials", description: "The mini-video tutorials can help you find quick answers on specific gateway functionalities.", urls:[ new PluginURL("","View all")], show:true},
{title: "Guides", description: "Textual guides to all gateway functionalities.", urls:[ new PluginURL("","Guide for the users"), new PluginURL("","Guide for the managers")], show:true},
{title: "Webinars", description: "Recordings and slides of webinars on different aspects of Open Science.", urls:[ new PluginURL("","View all")], show:true}
];
}
@Component({
selector: 'plugin-how-to-use',
templateUrl: 'plugin-how-to-use.component.html'
})
export class PluginHowToUseComponent extends PluginBaseComponent{
export class PluginHowToUseComponent extends PluginBaseComponent<PluginHowToUse>{
constructor() {
super()
}

View File

@ -1,57 +1,32 @@
<div>plugin-learn-and-connect</div>
<div class="plugin-learn-and-connect uk-container uk-container-large uk-section">
<h3 class="uk-h2 uk-margin-large-bottom">
Learn & Connect with Open Science
{{pluginObject.title}}
</h3>
<div class="uk-padding" uk-height-match=".title">
<div class="uk-padding uk-grid uk-child-width-1-3@m uk-child-width-1-1 uk-grid-large" uk-grid uk-height-match=".description">
<!-- icon1, title1, description1, link1 -->
<div class="uk-flex uk-flex-column uk-flex-middle">
<div
class="uk-padding uk-grid uk-child-width-1-3@m uk-child-width-1-1 uk-grid-large" uk-grid uk-height-match=".description">
<ng-container *ngFor="let card of pluginObject.cardInfoArray">
<ng-container *ngIf="card.show">
<div
class="uk-flex uk-flex-column uk-flex-middle">
<div class="uk-card uk-card-default uk-card-body">
<icon [name]="'description'" [type]="'outlined'" [ratio]="3" [flex]="true"></icon>
</div>
<h5 class="title">
OS Practices
{{card.title}}
</h5>
<div class="uk-text-center uk-margin-bottom description">
Open Science best practices for your community, policies and mandates.
{{card.description}}
</div>
<a href="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
Learn more
</a>
</div>
<!-- icon2, title2, description2, link2 -->
<div class="uk-flex uk-flex-column uk-flex-middle">
<div class="uk-card uk-card-default uk-card-body">
<icon [name]="'description'" [type]="'outlined'" [ratio]="3" [flex]="true"></icon>
</div>
<h5 class="title">
OS Guides for beginners
</h5>
<div class="uk-text-center uk-margin-bottom description">
New to Open Science? Learn the basics!
</div>
<div>
<a href="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
Learn more
</a>
</div>
</div>
<!-- icon3, title3, description3, link3 -->
<div class="uk-flex uk-flex-column uk-flex-middle">
<div class="uk-card uk-card-default uk-card-body">
<icon [name]="'description'" [type]="'outlined'" [ratio]="3" [flex]="true"></icon>
</div>
<h5 class="title">
Webinars
</h5>
<div class="uk-text-center uk-margin-bottom description">
Recordings and slides of webinars on different aspects of Open Science.
</div>
<a href="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
Learn more
<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">
{{url.linkText}}
</a>
</div>
</ng-container>
</ng-container>
</div>
<!-- icon1, title1, description1, link1 -->
</div>
</div>
</div>

View File

@ -1,11 +1,19 @@
import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
import {PluginBaseComponent, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component";
export class PluginLearnAndConnect{
title:string ="Learn & Connect with Open Science";
cardInfoArray:PluginInfoCards[] = [
{title: "OS Practices", description: "Open Science best practices for your community, policies and mandates.",
urls:[ new PluginURL("","Learn more")], show:true},
{title: "OS Guides for beginners", description: "New to Open Science? Learn the basics!",urls:[ new PluginURL("","Learn more")], show:true},
{title: "Webinars", description: "Recordings and slides of webinars on different aspects of Open Science.",urls:[ new PluginURL("","Learn more")], show:true}
];
}
@Component({
selector: 'plugin-learn-and-connect',
templateUrl: 'plugin-learn-and-connect.component.html'
})
export class PluginLearnAndConnectComponent extends PluginBaseComponent{
export class PluginLearnAndConnectComponent extends PluginBaseComponent<PluginLearnAndConnect>{
constructor() {
super()
}

View File

@ -0,0 +1,115 @@
import {Component, EventEmitter, OnChanges, Output, SimpleChanges} from '@angular/core';
import {PluginBaseComponent, PluginEditEvent} from "../../utils/base-plugin.component";
import {HttpClient} from "@angular/common/http";
import {PluginLearnAndConnect} from "./plugin-learn-and-connect.component";
import {PluginOpenAIREProducts} from "../openaireProducts/plugin-openaire-products.component";
@Component({
selector: 'plugin-learn-and-connect-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-margin-top uk-text-muted">
Cards:
</div>
<ng-container *ngFor="let card of pluginObject.cardInfoArray; let i = index">
<div class="uk-grid uk-grid-small uk-margin-xsmall-top">
<div *ngIf="selectedIndex != i" class="uk-text-small uk-width-3-4">{{card.title}}</div>
<div *ngIf="selectedIndex == i"class="uk-margin-top">
<plugin-field-edit [value]="pluginObject.cardInfoArray[i].title"
type="text" field="title" (changed)="cardValueChanged(i, $event)" ></plugin-field-edit>
</div>
<div class=" uk-width-auto">
<plugin-field-edit [value]=" pluginObject.cardInfoArray[i].show"
type="boolean" field="cardInfoArray" (editClicked)="pluginEditEvent = $event" (changed)="cardShowChanged(i,$event)" >
</plugin-field-edit>
</div>
<div class=" uk-width-auto">
<a *ngIf="selectedIndex != i" (click)="edit(i)">edit</a>
<a *ngIf="selectedIndex == i" (click)="selectedIndex = null">hide</a>
</div>
<div *ngIf="selectedIndex == i" class="width-1-1">
<div class="uk-margin-top">
<plugin-field-edit [value]=" pluginObject.cardInfoArray[i].description"
type="text" field="description" (changed)="cardValueChanged(i, $event)" ></plugin-field-edit>
</div>
<div class="uk-margin-top">
<plugin-field-edit [value]=" pluginObject.cardInfoArray[i].url"
type="text" field="url" (changed)="cardValueChanged(i, $event)" ></plugin-field-edit>
</div>
<div class="uk-margin-top">
<plugin-field-edit [value]=" pluginObject.cardInfoArray[i].linkText"
type="text" field="linkText" (changed)="cardValueChanged(i, $event)" ></plugin-field-edit>
</div>
<!--<div class="uk-margin-top">
<plugin-field-edit [value]="pluginObject && pluginObject.cardInfoArray[i].show?pluginObject.cardInfoArray[i].show:pluginDefaultObject.cardInfoArray[i].show"
type="boolean" field="show" (changed)="cardValueChanged(i, $event)" ></plugin-field-edit>
</div>-->
</div>
</div>
</ng-container>
</div>
`,
})
export class PluginLearnAndConnectFormComponent extends PluginBaseComponent<PluginLearnAndConnect> /*implements OnChanges*/{
selectedIndex = null;
default = new PluginLearnAndConnect();
constructor(http:HttpClient) {
super()
// this.default = new PluginLearnAndConnect();
}
/*ngOnInit(): void {
if(this.pluginTemplate && (!this.pluginDefaultObject || !this.pluginDefaultObject.title)){
this.pluginTemplate.object = new PluginLearnAndConnect();
}
}*/
/*ngOnChanges(changes: SimpleChanges) {
console.log("changes")
if(changes.plugin){
console.log("changes plugin", changes.plugin)
}else if (changes.pluginTemplate){
console.log("changes pluginTemplate", changes.pluginTemplate)
}
}
*/
cardShowChanged(i,$event:PluginEditEvent){
if(this.editTemplate){
this.pluginTemplate.object.cardInfoArray[i].show=$event.value;
$event.value =this.pluginTemplate.object.cardInfoArray;
}else{
this.plugin.object.cardInfoArray[i].show=$event.value;
$event.value =this.plugin.object.cardInfoArray;
}
this.valuesChanged.emit({field:$event.field, value: $event.value, type: 'parent'})
}
cardValueChanged(i,$event:PluginEditEvent){
if(this.editTemplate){
this.pluginTemplate.object.cardInfoArray[i][$event.field]=$event.value;
$event.value =this.pluginTemplate.object.cardInfoArray;
}else{
this.plugin.object.cardInfoArray[i][$event.field]=$event.value;
$event.value =this.plugin.object.cardInfoArray;
}
this.valuesChanged.emit({field:"cardInfoArray", value: $event.value, type: 'parent'})
}
edit(i){
this.selectedIndex = i;
}
}

View File

@ -1,33 +1,21 @@
import {Component} from '@angular/core';
import {PluginBaseComponent, PluginEditEvent} from "../../utils/base-plugin.component";
import {PluginBaseComponent, PluginBaseInfo, PluginEditEvent} from "../../utils/base-plugin.component";
import {HttpClient} from "@angular/common/http";
export class PluginOpenAIREProducts{
export class PluginOpenAIREProducts extends PluginBaseInfo{
title:string ="OpenAIRE services for your community";
serviceIds = {"zenodo":true,"graph":true,"explore":true};
constructor() {
}
serviceIdsArray = ["zenodo","graph","explore"];
}
@Component({
selector: 'plugin-openaire-products',
template: `
<div *ngIf="pluginDefaultObject">
<div [class.fieldEditMode]="editMode">
<ng-container *ngIf="editMode">
<plugin-field-edit [value]="pluginObject && pluginObject.title?pluginObject.title:pluginDefaultObject.title"
type="text" field="title" (editClicked)="pluginEditEvent = $event" (changed)="valueChanged($event)" ></plugin-field-edit>
</ng-container>
<div *ngIf="pluginObject">
<h3 [class.uk-invisible]=" (pluginEditEvent && pluginEditEvent.field == 'title')">
{{pluginObject && pluginObject.title?pluginObject.title:pluginDefaultObject.title}} </h3>
</div>
<div [class.fieldEditMode]="editMode && !editTemplate">
{{pluginObject.title}} </h3>
<div class="uk-child-width-1-3 uk-grid">
<ng-container *ngFor="let service of services">
<ng-container
*ngIf="editMode?services:(pluginObject?pluginObject.serviceIds[service.id]:pluginDefaultObject.serviceIds[service.id])">
<div class="uk-padding-xsmall">
<div *ngIf="pluginObject && pluginObject.serviceIdsArray.indexOf(service.id)!=-1" class="uk-padding-xsmall">
<div class="uk-card uk-card-default ">
<div class="uk-card-media-top">
@ -38,40 +26,24 @@ export class PluginOpenAIREProducts{
<div class="uk-h5 uk-margin-remove-vertical">{{service.tagline}}</div>
<div [innerHTML]="service.description" class="uk-text-truncate uk-text-small uk-text-meta"></div>
<a class="uk-link-text" [href]="service.webpage" target="_blank">Read more</a>
<ng-container *ngIf="editMode && !editTemplate">
<div class="uk-float-right">
<plugin-field-edit [value]=" pluginObject?pluginObject.serviceIds[service.id]:pluginDefaultObject.serviceIds[service.id]"
type="boolean" field="serviceIds" (editClicked)="pluginEditEvent = $event" (changed)="serviceChanged(service.id,$event)" >
</plugin-field-edit>
</div>
</ng-container>
</div>
</div>
</div>
</ng-container>
</ng-container>
</div>
</div>
</div>
`,
})
export class PluginOpenaireProductsComponent extends PluginBaseComponent{
export class PluginOpenaireProductsComponent extends PluginBaseComponent<PluginOpenAIREProducts>{
services = [];
excludedServiceIds = ["openaire_login","research_community_dashboard"]
get pluginObject():PluginOpenAIREProducts{
return this.plugin?this.plugin.object:null;
}
get pluginDefaultObject():PluginOpenAIREProducts{
return this.pluginTemplate?this.pluginTemplate.object:null;
}
default = new PluginOpenAIREProducts();
constructor(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 =>{
console.log(res)
this.services = res["results"].map( x=> {
x.id = x.id.split("openaire.")[1]
return x;
@ -80,26 +52,4 @@ export class PluginOpenaireProductsComponent extends PluginBaseComponent{
}))
}
ngOnInit(): void {
if(this.pluginTemplate && (!this.pluginDefaultObject || !this.pluginDefaultObject.title)){
this.pluginTemplate.object = new PluginOpenAIREProducts();
}
}
serviceChanged(id,$event:PluginEditEvent){
if(this.editTemplate){
this.pluginTemplate.object.serviceIds[id]=$event.value;
$event.value =this.pluginTemplate.object.serviceIds;
}else{
if(!this.plugin.object){
this.plugin.object =this.pluginDefaultObject? Object.assign(this.pluginDefaultObject): new PluginOpenAIREProducts();
}
console.log(this.plugin.object,this.plugin.object.serviceIds)
this.plugin.object.serviceIds[id]=$event.value;
$event.value =this.plugin.object.serviceIds;
}
this.valuesChanged.emit($event)
}
}

View File

@ -0,0 +1,62 @@
import {Component, EventEmitter, Output} from '@angular/core';
import {PluginBaseComponent, PluginEditEvent} from "../../utils/base-plugin.component";
import {HttpClient} from "@angular/common/http";
import {PluginOpenAIREProducts} from "./plugin-openaire-products.component";
@Component({
selector: 'plugin-openaire-products-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-margin-medium-top uk-text-muted">
Select services:
</div>
<ng-container *ngFor="let service of services">
<div class="uk-grid uk-grid-small uk-margin-xsmall-top">
<div class="uk-text-small uk-width-3-4">{{service.name}}</div>
<div class=" uk-width-1-4">
<plugin-field-edit [value]=" pluginObject.serviceIdsArray.indexOf(service.id)!=-1"
type="boolean" field="serviceIdsArray" (changed)="serviceChanged(service.id,$event)" >
</plugin-field-edit>
</div>
</div>
</ng-container>
</div>
`,
})
export class PluginOpenaireProductsFormComponent extends PluginBaseComponent<PluginOpenAIREProducts>{
default = new PluginOpenAIREProducts();
services = [];
excludedServiceIds = ["openaire_login","research_community_dashboard"]
constructor(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 =>{
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);
}))
}
serviceChanged(id,$event:PluginEditEvent){
let index = this.pluginObject.serviceIdsArray.indexOf(id);
if(index !=-1){
this.pluginObject.serviceIdsArray.splice(index,1);
}else{
this.pluginObject.serviceIdsArray.push(id);
}
$event.value =this.pluginObject.serviceIdsArray;
this.valuesChanged.emit({field:$event.field, value: $event.value, type: 'parent'})
}
}

View File

@ -1,94 +0,0 @@
import {Component, Input, OnInit} from '@angular/core';
import {Plugin} from "../../../../utils/entities/adminTool/plugin";
import {PluginTemplate} from "../../../../utils/entities/adminTool/pluginTemplate";
import {SearchResearchResultsService} from "../../../../services/searchResearchResults.service";
import {FetchResearchResults} from "../../../../utils/fetchEntitiesClasses/fetchResearchResults.class";
import {EnvProperties} from "../../../../utils/properties/env-properties";
import { properties } from 'src/environments/environment';
import {RouterHelper} from "../../../../utils/routerHelper.class";
import {OpenaireEntities} from "../../../../utils/properties/searchFields";
import {PluginBaseComponent} from "../../utils/base-plugin.component";
export class PluginResultsNumbers{
publicationsOnOff:boolean;
datasetsOnOff:boolean;
softwareOnOff:boolean;
otherOnOff:boolean;
}
@Component({
selector: 'plugin-results-numbers',
template: `
<div class="plugin2 uk-flex uk-flex-middle uk-flex-wrap" style="grid-gap: 30px;">
<div class="uk-flex uk-flex-middle">
<!-- <a *ngIf="editMode" (click)="editClicked.emit({field: 'publicationsOnOff', type: 'boolean'}) ">Edit</a>-->
<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="fetchPublications.searchUtils.totalResults" class="uk-h6 uk-margin-remove" [innerHTML]="fetchPublications.searchUtils.totalResults | numberRound: 1:1">
</span>
</a>
</div>
<!--<div class="uk-flex uk-flex-middle">
<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="fetchDatasets.searchUtils.totalResults" class="uk-h6 uk-margin-remove" [innerhtml]="fetchDatasets.searchUtils.totalResults | numberRound: 1:1">
</span>
</a>
</div>
<div class="uk-flex uk-flex-middle">
<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="fetchSoftware.searchUtils.totalResults" class="uk-h6 uk-margin-remove" [innerhtml]="fetchSoftware.searchUtils.totalResults | numberRound: 1:1">
</span>
</a>
</div>-->
</div>
`
})
export class PluginResultsNumbersComponent extends PluginBaseComponent{
get pluginObject():PluginResultsNumbers{
return this.plugin.object;
}
get pluginDefaultObject():PluginResultsNumbers{
return this.pluginTemplate.object;
}
// Variables for publications, research data, projects, content providers, related content providers tabs
public fetchPublications: FetchResearchResults;
public fetchDatasets: FetchResearchResults;
public fetchSoftware: FetchResearchResults;
public fetchOrps: FetchResearchResults;
public fetchFeaturedDatasets: FetchResearchResults;
searchLinkToResults: string = null;
properties: EnvProperties = properties;
public routerHelper: RouterHelper = new RouterHelper();
openaireEntities= OpenaireEntities;
constructor(private _searchResearchResultsService: SearchResearchResultsService,) {
super();
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService);
}
ngOnInit(): void {
this.searchLinkToResults = this.properties.searchLinkToResults;
}
public getParamsForSearchLink(type: string = "") {
if (type) {
return this.routerHelper.createQueryParams(['type', 'qf', 'sortBy'], [type, 'false', 'resultdateofacceptance,descending']);
} else {
return {};
}
}
}

View File

@ -1,24 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginsService} from "../../../../services/plugins.service";
import {PluginResultsNumbersComponent} from "./plugin-results-numbers.component";
import {IconsModule} from "../../../../utils/icons/icons.module";
import {NumberRoundModule} from "../../../../utils/pipes/number-round.module";
import {IconsService} from "../../../../utils/icons/icons.service";
import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule
],
providers:[PluginsService],
declarations: [PluginResultsNumbersComponent],
exports: [PluginResultsNumbersComponent]
})
export class PluginResultsNumbersModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([])
}
}

View File

@ -1,2 +1,61 @@
<div>plugin-search-deposit-link</div>
<!-- add slider component -->
<!-- add slider component -->
<div #parent class="uk-section uk-section-secondary connect-dark-logo-background">
<div class="uk-container uk-container-large uk-margin-large-bottom">
<div class="uk-width-1-1 uk-margin-medium-bottom">
<!-- <span class="uk-h6 uk-text-primary">Benefits.</span>-->
<h2 class="uk-margin-remove-top uk-width-1-2@m">
Find the best for your community<span class="uk-text-primary">.</span>
</h2>
</div>
<slider-container [total]="4" [navigation]="'progress'" [period]="6000" [infinite]="true" [parent]="parent">
<slider-column type="slider">
<slider-item type="static">
<img class="uk-position-center uk-position-z-index" src="assets/connect-assets/home/tablet.png"
alt="ipad" loading="lazy">
</slider-item>
<slider-item type="slide" [start]="0">
<img src="assets/connect-assets/home/1.png" alt="ipad" loading="lazy">
</slider-item>
<slider-item type="slide" [start]="1">
<img src="assets/connect-assets/home/2.png" alt="ipad" loading="lazy">
</slider-item>
<slider-item type="slide" [start]="2">
<img src="assets/connect-assets/home/3.png" alt="ipad" loading="lazy">
</slider-item>
<slider-item type="slide" [start]="3">
<img src="assets/connect-assets/home/4.png" alt="ipad" loading="lazy">
</slider-item>
</slider-column>
<slider-column type="nav" class="slider-nav">
<slider-nav-item [start]="0">
<h5 class="uk-margin-remove">
<i class="uk-text-primary">Find a repository </i>
<span>to deposit your {{entities.RESULT | lowercase}}</span>
<span class="uk-text-primary">.</span>
</h5>
</slider-nav-item>
<slider-nav-item [start]="1">
<h5 class="uk-margin-remove">
<i class="uk-text-primary">Link your {{entities.RESULT | lowercase}} </i>
<span>with your community, funding, and other {{entities.RESULTS | lowercase}}</span>
<span class="uk-text-primary">.</span>
</h5>
</slider-nav-item>
<slider-nav-item [start]="2">
<h5 class="uk-margin-remove">
<span>View community's </span>
<i class="uk-text-primary">overview at a glance.</i>
</h5>
</slider-nav-item>
<slider-nav-item [start]="3">
<h5 class="uk-margin-remove">
<i class="uk-text-primary">Search & browse </i>
<span>your community's {{entities.RESULTS | lowercase}}</span>
<span class="uk-text-primary">.</span>
</h5>
</slider-nav-item>
</slider-column>
</slider-container>
</div>
</div>

View File

@ -1,11 +1,17 @@
import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
import {OpenaireEntities} from "../../../../utils/properties/searchFields";
export class PluginSearchDepositLink{
title:string ="Search, link and deposit your research in one place.";
description: string = "Lorem ipsum";
}
@Component({
selector: 'plugin-search-deposit-link',
templateUrl: 'plugin-search-deposit-link.component.html'
})
export class PluginSearchDepositLinkComponent extends PluginBaseComponent{
export class PluginSearchDepositLinkComponent extends PluginBaseComponent<PluginSearchDepositLink>{
entities= OpenaireEntities;
constructor() {
super()
}

View File

@ -9,10 +9,11 @@ import {IconsService} from "../../../../utils/icons/icons.service";
import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
import {PluginSearchDepositLinkComponent} from './plugin-search-deposit-link.component';
import {SliderUtilsModule} from "../../../../sharedComponents/slider-utils/slider-utils.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule, SliderUtilsModule
],
providers:[PluginsService],
declarations: [PluginSearchDepositLinkComponent],

View File

@ -1,11 +1,14 @@
import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
export class PluginSuggestedRepositories{
title:string ="Lorem ipsum";
description: string = "Lorem ipsum";
}
@Component({
selector: 'plugin-suggested-repositories',
templateUrl: 'plugin-suggested-repositories.component.html'
})
export class PluginSuggestedRepositoriesComponent extends PluginBaseComponent{
export class PluginSuggestedRepositoriesComponent extends PluginBaseComponent<PluginSuggestedRepositories>{
constructor() {
super()
}

View File

@ -1,71 +0,0 @@
import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
export class PluginTest{
title:string ="Test Plugin";
description: string = "Lorem ipsum";
numberOn:boolean = true;
constructor() {
console.log(this)
}
}
@Component({
selector: 'plugin-test',
template: `
<div *ngIf="pluginDefaultObject">
<div [class.fieldEditMode]="editMode">
<ng-container *ngIf="editMode">
<plugin-field-edit [value]="pluginObject && pluginObject.title?pluginObject.title:pluginDefaultObject.title"
type="text" field="title" (editClicked)="pluginEditEvent = $event" (changed)="valueChanged($event)" ></plugin-field-edit>
</ng-container>
<h1 [class.uk-invisible]=" (pluginEditEvent && pluginEditEvent.field == 'title')">
{{pluginObject && pluginObject.title?pluginObject.title:pluginDefaultObject.title}} </h1>
</div>
<div [class.fieldEditMode]="editMode">
<ng-container *ngIf="editMode">
<plugin-field-edit [value]="pluginObject && pluginObject.description?pluginObject.description:pluginDefaultObject.description"
type="text" field="description" (editClicked)="pluginEditEvent = $event" (changed)="valueChanged($event)" ></plugin-field-edit>
</ng-container>
<p [class.uk-invisible]=" (pluginEditEvent && pluginEditEvent.field == 'description')">
{{pluginObject && pluginObject.description?pluginObject.description:pluginDefaultObject.description}} </p>
</div>
<div [class.fieldEditMode]="editMode && !editTemplate">
<ng-container *ngIf="editMode && !editTemplate">
<plugin-field-edit [value]=" pluginObject.numberOn"
type="boolean" field="numberOn" (editClicked)="pluginEditEvent = $event" (changed)="valueChanged($event)" >
</plugin-field-edit>
</ng-container>
<p *ngIf="showOnOffBlock('numberOn')"
[class.uk-invisible]=" (pluginEditEvent && pluginEditEvent.field == 'numberOn')">58K </p>
</div>
</div>
`,
})
export class PluginTestComponent extends PluginBaseComponent{
get pluginObject():PluginTest{
return this.plugin?this.plugin.object:null;
}
get pluginDefaultObject():PluginTest{
return this.pluginTemplate?this.pluginTemplate.object:null;
}
constructor() {
super()
}
ngOnInit(): void {
if(this.pluginTemplate && (!this.pluginDefaultObject || !this.pluginDefaultObject.title)){
this.pluginTemplate.object = new PluginTest();
}
}
}

View File

@ -1,25 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginsService} from "../../../../services/plugins.service";
import {IconsModule} from "../../../../utils/icons/icons.module";
import {NumberRoundModule} from "../../../../utils/pipes/number-round.module";
import {IconsService} from "../../../../utils/icons/icons.service";
import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module";
import {PluginTestComponent} from "./plugin-test.component";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule
],
providers:[PluginsService],
declarations: [PluginTestComponent],
exports: [PluginTestComponent]
})
export class PluginTestModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([])
}
}

View File

@ -1,30 +1,73 @@
<div page-content>
<div class="uk-flex">
<aside id="sidebar_main" class="uk-sticky" uk-sticky="start: 0; end: .sidebar_main_swipe">
<div sidebar-content>
<div *ngIf="editView" class="back">
<a (click)="editView = false; selectedTemplate = null; selectedPlugin = null;" class="uk-flex uk-flex-middle uk-flex-center">
<div class="uk-width-auto">
<icon name="west" ratio="1.3"
[flex]="true"> </icon>
</div>
<span class="uk-text-small">Plugins list</span>
</a>
<div *ngIf="templateForm" class="uk-width-auto uk-margin-top">
<button class="uk-button uk-button-default uk-margin-right"
(click)="reset()" [class.uk-disabled]="!templateForm.dirty"
[disabled]="!templateForm.dirty || showLoading">Reset
</button>
<button class="uk-button uk-button-primary" [class.uk-disabled]="templateForm.invalid || !templateForm.dirty || templateForm.disabled"
(click)="saveConfirmed(index)" [disabled]="templateForm.invalid ||!templateForm.dirty || templateForm.disabled || showLoading">Save
</button>
</div>
</div>
<div class="menu_section uk-margin-large-top">
<div *ngIf="!editView">Select a plugin to edit </div>
<ng-container *ngIf="editView">
<form *ngIf="!selectTemplateView" [formGroup]="templateForm" class="uk-grid" uk-grid>
<div>Status <mat-slide-toggle [checked]="templateForm.get('active').value"
(change)="templateForm.get('active').setValue($event.checked); templateForm.markAsDirty()"></mat-slide-toggle></div>
<plugin-wrapper-form [pluginTemplate]="selectedTemplate" [plugin]="this.templateForm.getRawValue()"
(changed)="pluginFieldChanged($event)" [pluginObject]="this.templateForm.getRawValue().object"></plugin-wrapper-form>
<ng-container *ngIf="selectedTemplate || selectedPlugin">
<div *ngIf="attrFormArray.controls.length > 0" class="uk-heading-divider uk-text-small uk-width-1-1 uk-margin-bottom uk-text-meta">
<div class="uk-grid">
<div>Plugin settings</div>
</div>
</div>
<div *ngFor="let attrForm of attrFormArray.controls; let i=index" class="uk-width-1-1 uk-grid uk-child-width-1-2 uk-margin-top" uk-grid>
<div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'text'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.settings[attrForm.get('key').value].name" type="text" ></div>
<div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'URL'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.settings[attrForm.get('key').value].name" type="URL" [validators]="urlValidator"></div>
<div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'boolean'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.settings[attrForm.get('key').value].name" type="select"
[options]="[{label: 'yes', value:true}, {label: 'no', value:false}]"></div>
<div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'HTML'" class="uk-width-1-1">
<label>
{{selectedTemplate.settings[attrForm.get('key').value].name}}:
</label>
<ckeditor [readonly]="false"
debounce="500"
[formControl]="attrForm.get('value')"
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]',
removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +
'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +
'CreateDiv,Flash,PageBreak,' +
'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language',
extraPlugins: 'divarea'}">
</ckeditor>
</div>
</div>
</ng-container>
</form>
</ng-container> </div>
</div>
</aside>
<div page-content class="uk-width-1-1">
<div header>
<div class="uk-section-xsmall uk-margin-top">
<div class="uk-flex-middle uk-grid" uk-grid>
<ng-container *ngIf="editView ">
<div class="uk-width-expand">
<a (click)="editView = false; selectedTemplate = null; selectedPlugin = null;" class="uk-flex uk-flex-middle uk-h5 uk-link-reset">
<span class="uk-margin-right">
<icon name="west" ratio="1.7" [flex]="true"></icon>
</span>
<h1 *ngIf="page" class="uk-h5 uk-margin-remove">{{page.name}} - {{selectedPlugin ? 'Update ' : 'Add new '}} plugin
<span *ngIf=" templateForm && templateForm.dirty" class="uk-text-large"> (unsaved changes)</span>
</h1>
</a>
</div>
<div *ngIf="templateForm" class="uk-width-auto">
<button class="uk-button uk-button-default uk-margin-right"
(click)="reset()" [class.uk-disabled]="!templateForm.dirty"
[disabled]="!templateForm.dirty || showLoading">Reset
</button>
<button class="uk-button uk-button-primary" [class.uk-disabled]="templateForm.invalid || !templateForm.dirty || templateForm.disabled"
(click)="saveConfirmed()" [disabled]="templateForm.invalid ||!templateForm.dirty || templateForm.disabled || showLoading">Save
</button>
</div>
</ng-container>
<ng-container *ngIf="!editView">
<div *ngIf="!templateView" class="uk-width-expand">
<ng-container>
<div *ngIf="!templateView && !editView" class="uk-width-expand">
<a routerLink="../pages" class="uk-flex uk-flex-middle uk-h5 uk-link-reset">
<span class="uk-margin-right">
<icon name="west" ratio="1.7" [flex]="true"></icon>
@ -49,21 +92,13 @@
<h1 *ngIf="template" class="uk-h5 uk-margin-remove">{{template.name}}</h1>
</a>
</div>
<!--<div search-input [disabled]="showLoading" [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer" placeholder="Search plugins" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1">
</div>-->
<!-- <div>
<button (click)="newPluginSelectTemplate()" [disabled]="showLoading" [class.uk-disabled]="showLoading || this.pluginTemplates.length ==0"
class="uk-flex uk-flex-middle uk-button uk-button-default" >
<icon [flex]="true" name="add"></icon>
<span class="uk-margin-small-left">Add new plugin</span>
</button>
</div>-->
</ng-container>
</div>
</div>
</div>
<div inner>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div> <!--class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">-->
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>
@ -78,8 +113,10 @@
<ng-container *ngIf="selectedPlacementView == placement.value || selectedPlacementView == 'all'">
<div *ngIf="pluginsByPlacement.get(placement.value).length >0 && page"
class="uk-heading-divider uk-h6 uk-margin-left uk-padding-remove-left uk-text-capitalize ">{{placement.value}}</div>
<div *ngFor="let pluginGroup of pluginsByPlacement.get(placement.value) ; let i=index">
<div class="uk-card uk-card-default">
<ng-container *ngFor="let pluginGroup of pluginsByPlacement.get(placement.value) ; let i=index">
<ng-container *ngIf="(pluginGroup.template.portalSpecific.length == 0 || pluginGroup.template.portalSpecific.indexOf(communityInfo.communityId) != -1 ) &&
(pluginGroup.template.plan == 'starter'|| pluginGroup.template.plan == communityInfo.plan )">
<div class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-card-body uk-flex">
<div class="uk-width-expand uk-text-small">
<ng-container *ngIf="pluginGroup.template && !templateView">
@ -87,33 +124,22 @@
<div class="uk-margin-small-bottom">
{{pluginGroup.template.description}}
</div>
<plugin-wrapper [editMode]="false" [wrapperEditMode]="true" [pluginTemplate]="pluginGroup.template" [plugin]="pluginGroup.plugin"></plugin-wrapper>
</ng-container>
<!--<ng-container *ngIf="templateView">
<h6>Community: {{check.plugin.pid}}</h6>
</ng-container>-->
<!-- <ng-container *ngIf="!check.template">-->
<!-- <h6>{{check.plugin.code}}</h6>-->
<!-- <div class="uk-margin-small-bottom uk-text-warning">-->
<!-- Plugin is not supported anymore!-->
<!-- </div>-->
<!-- </ng-container>-->
<div class="uk-margin-small-bottom">
<span class="uk-text-meta">Placement: </span>{{pluginGroup.plugin.placement}}
</div>
<div class="uk-margin-small-bottom">
<span class="uk-text-meta">Order: </span>{{pluginGroup.plugin.order}}
</div>
<!--<div *ngFor="let key of getKeys(check.template.attributes)">
<div *ngIf="check.template.attributes[key]['type'] =='HTML' ">
{{check.template.attributes[key]['name']}}:
<div [innerHTML]="check.plugin.values[key]"></div>
<ul uk-accordion>
<li>
<a class="uk-accordion-title" >Preview</a>
<div class="uk-accordion-content">
<plugin-wrapper [pluginTemplate]="pluginGroup.template" [plugin]="pluginGroup.plugin" [pluginObject]="pluginGroup.plugin.object"></plugin-wrapper>
</div>
<div *ngIf="check.template.attributes[key]['type'] =='text' ">
{{check.template.attributes[key]['name']}}:
<div >{{check.plugin.values[key]}}</div>
</div>
</div>-->
</li>
</ul>
</div>
@ -125,7 +151,7 @@
<div>
<div class="uk-padding-small uk-padding-remove-horizontal">
<button
class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="edit(pluginGroup.plugin, pluginGroup.template, placement, index)"
class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="edit(pluginGroup.plugin, pluginGroup.template, placement, i)"
[class.uk-disabled]="!pluginGroup.template">
<icon name="edit" [flex]="true"></icon>
<span class="uk-margin-xsmall-left"> Edit</span>
@ -173,7 +199,8 @@
</div>
</div>
</div>
</ng-container>
</ng-container>
</ng-container>
</ng-container>
@ -217,45 +244,48 @@
</div>
</div>-->
<form *ngIf="!selectTemplateView" [formGroup]="templateForm" class="uk-grid" uk-grid>
<!-- <form *ngIf="!selectTemplateView" [formGroup]="templateForm" class="uk-grid" uk-grid>-->
<ng-container *ngIf="selectedTemplate || selectedPlugin">
<div class="uk-text-large ">{{selectedTemplate.name}}</div>
<div class="uk-text-meta uk-width-1-1">{{selectedTemplate.description}}</div>
<!-- <div input [formInput]="templateForm.get('placement')" placeholder="Placements" [options]="placementsOptions" type="select" class="uk-width-1-2"></div>-->
<plugin-wrapper [editMode]="true" [wrapperEditMode]="false" [pluginTemplate]="selectedTemplate" [plugin]="this.templateForm.getRawValue()"
class="uk-width-1-1" (changed)="pluginFieldChanged($event)"></plugin-wrapper>
<div *ngIf="attrFormArray.controls.length > 0" class="uk-heading-divider uk-text-small uk-width-1-1 uk-margin-bottom uk-text-meta">
<div class="uk-grid">
<div>Plugin settings</div>
</div>
</div>
<div *ngFor="let attrForm of attrFormArray.controls; let i=index" class="uk-width-1-1 uk-grid uk-child-width-1-2 uk-margin-top" uk-grid>
<div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'text'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.settings[attrForm.get('key').value].name" type="text" ></div>
<div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'URL'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.settings[attrForm.get('key').value].name" type="URL" [validators]="urlValidator"></div>
<div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'boolean'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.settings[attrForm.get('key').value].name" type="select"
[options]="[{label: 'yes', value:true}, {label: 'no', value:false}]"></div>
<div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'HTML'" class="uk-width-1-1">
<label>
{{selectedTemplate.settings[attrForm.get('key').value].name}}:
</label>
<ckeditor [readonly]="false"
debounce="500"
[formControl]="attrForm.get('value')"
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]',
removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +
'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +
'CreateDiv,Flash,PageBreak,' +
'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language',
extraPlugins: 'divarea'}">
</ckeditor>
</div>
</div>
<!-- <ng-container *ngIf="selectedTemplate || selectedPlugin">-->
<!-- <div class="uk-text-large ">{{selectedTemplate.name}}</div>-->
<!-- <div class="uk-text-meta uk-width-1-1">{{selectedTemplate.description}}</div>-->
<!--&lt;!&ndash; <div input [formInput]="templateForm.get('placement')" placeholder="Placements" [options]="placementsOptions" type="select" class="uk-width-1-2"></div>&ndash;&gt;-->
<!-- <plugin-wrapper [editMode]="true" [wrapperEditMode]="false" [pluginTemplate]="selectedTemplate" [plugin]="this.templateForm.getRawValue()"-->
<!-- class="uk-width-1-1" (changed)="pluginFieldChanged($event)"></plugin-wrapper>-->
<!-- <div *ngIf="attrFormArray.controls.length > 0" class="uk-heading-divider uk-text-small uk-width-1-1 uk-margin-bottom uk-text-meta">-->
<!-- <div class="uk-grid">-->
<!-- <div>Plugin settings</div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div *ngFor="let attrForm of attrFormArray.controls; let i=index" class="uk-width-1-1 uk-grid uk-child-width-1-2 uk-margin-top" uk-grid>-->
<!-- <div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'text'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.settings[attrForm.get('key').value].name" type="text" ></div>-->
<!-- <div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'URL'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.settings[attrForm.get('key').value].name" type="URL" [validators]="urlValidator"></div>-->
<!-- <div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'boolean'" input [formInput]="attrForm.get('value')" [placeholder]="selectedTemplate.settings[attrForm.get('key').value].name" type="select"-->
<!-- [options]="[{label: 'yes', value:true}, {label: 'no', value:false}]"></div>-->
<!-- <div *ngIf="this.selectedTemplate.settings[attrForm.get('key').value].type == 'HTML'" class="uk-width-1-1">-->
<!-- <label>-->
<!-- {{selectedTemplate.settings[attrForm.get('key').value].name}}:-->
<!-- </label>-->
<!-- <ckeditor [readonly]="false"-->
<!-- debounce="500"-->
<!-- [formControl]="attrForm.get('value')"-->
<!-- [config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]',-->
<!-- removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +-->
<!-- 'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +-->
<!-- 'CreateDiv,Flash,PageBreak,' +-->
<!-- 'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language',-->
<!-- extraPlugins: 'divarea'}">-->
<!-- </ckeditor>-->
<!-- </div>-->
<!-- </div>-->
</ng-container>
</form>
<!-- </ng-container>-->
<!-- </form>-->
<plugin-wrapper *ngIf="this.templateForm" [pluginTemplate]="selectedTemplate" [plugin]="this.templateForm.getRawValue()" [pluginObject]="this.templateForm.getRawValue().object"
class="uk-width-1-1"></plugin-wrapper>
</ng-container>
</div>
</div>
</div>
</div>

View File

@ -2,7 +2,7 @@ import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {HelpContentService} from "../../services/help-content.service";
import {
FormArray,
FormArray, FormGroup,
UntypedFormArray,
UntypedFormBuilder,
UntypedFormGroup,
@ -27,6 +27,8 @@ import {Portal} from "../../utils/entities/adminTool/portal";
import {PluginTemplate} from "../../utils/entities/adminTool/pluginTemplate";
import {PluginEditEvent} from "./utils/base-plugin.component";
import {PluginUtils} from "./utils/pluginUtils";
import {CommunityService} from "../../connect/community/community.service";
import {CommunityInfo} from "../../connect/community/communityInfo";
@Component({
selector: 'plugins',
@ -63,7 +65,9 @@ export class PluginsComponent implements OnInit {
public templateCode:string = null;
public template;
public selectedPlacementView = "all";
communityInfo:CommunityInfo = null;
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router,
private communityService: CommunityService,
private title: Title, private _helpContentService: HelpContentService,
private _pluginsService: PluginsService, private _fb: UntypedFormBuilder,
private _clearCacheService: ClearCacheService) {
@ -71,10 +75,15 @@ export class PluginsComponent implements OnInit {
ngOnInit() {
this.title.setTitle('Administrator Dashboard | Plugins');
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(
community => {
this.communityInfo = community;
}));
this.subscriptions.push(this.route.params.subscribe(params => {
this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param];
this.selectedCommunityPid = params.community;
this.subscriptions.push(this.route.queryParams.subscribe(params => {
HelperFunctions.scroll();
this.selectedPageId = params['pageId'];
@ -147,6 +156,8 @@ export class PluginsComponent implements OnInit {
plugin = new Plugin(this.selectedPageId, this.selectedCommunityPid,_);
this.plugins.push(plugin);
}
let defaultObj = PluginUtils.initializeObject(_.code);
plugin.object = PluginUtils.updateExistingObject(plugin.object, PluginUtils.updateExistingObject(_.object, defaultObj))
this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _ });
});
for(let placement of this.pluginUtils.placementsOptions){
@ -178,8 +189,16 @@ export class PluginsComponent implements OnInit {
order: this._fb.control(plugin.order),
active: this._fb.control(plugin.active),
values: this._fb.array([]),
object: this._fb.group(plugin.object?plugin.object:(this.selectedTemplate.object?this.selectedTemplate.object:{}))
object: this._fb.group({})
});
for (let attrKey of Object.keys(plugin.object)) {
if(attrKey.indexOf("Array")==-1) {
(this.templateForm.get("object") as FormGroup).addControl(attrKey, this._fb.control(plugin.object[attrKey]));
}else{
(this.templateForm.get("object") as FormGroup).addControl(attrKey,this._fb.array(plugin.object[attrKey]));
}
}
if (template.settings) {
for (let attrKey of Object.keys(template.settings)) {
(this.templateForm.get("values") as FormArray).push(this._fb.group({
@ -189,6 +208,7 @@ export class PluginsComponent implements OnInit {
));
}
}
console.log("aaa", this.templateForm.getRawValue())
}
public newPluginSelectTemplate() {
@ -227,7 +247,7 @@ export class PluginsComponent implements OnInit {
}
public saveConfirmed() {
public saveConfirmed(index) {
this.showLoading = true;
let plugin: Plugin = <Plugin>this.templateForm.getRawValue();
plugin.settingsValues = new Map<string, string>();
@ -235,7 +255,7 @@ export class PluginsComponent implements OnInit {
plugin.settingsValues[fields.key] = fields.value;
}
let update = (plugin._id) ? true : false;
this.savePlugin(plugin,update, null)
this.savePlugin(plugin,update, this.index)
}
public savePlugin(plugin, update, index){
this.subscriptions.push(this._pluginsService.savePlugin(plugin, this.properties.adminToolsAPIURL).subscribe(
@ -251,6 +271,7 @@ export class PluginsComponent implements OnInit {
}
public savedSuccessfully(plugin: Plugin, update: boolean, index) {
console.log(plugin.placement, index, update)
if (update) {
this.pluginsByPlacement.get(plugin.placement)[index].plugin = plugin;
} else {
@ -369,7 +390,16 @@ export class PluginsComponent implements OnInit {
pluginFieldChanged($event:PluginEditEvent){
let object = this.templateForm.get("object").getRawValue();
object[$event.field]=$event.value;
this.templateForm.get("object").setValue(object);
if($event.field.indexOf("Array") == -1) {
this.templateForm.get("object").get($event.field).setValue($event.value);
}else{
((this.templateForm.get("object") as FormGroup).get($event.field) as FormArray).clear();
$event.value.forEach(id => {
((this.templateForm.get("object") as FormGroup).get($event.field) as FormArray).push(this._fb.control(id))
});
console.log(((this.templateForm.get("object") as FormGroup).get($event.field) as FormArray).getRawValue());
}
this.templateForm.markAsDirty();
}

View File

@ -24,16 +24,19 @@ import {PluginsService} from "../../services/plugins.service";
import {CKEditorModule} from "ng2-ckeditor";
import {MatSlideToggleModule} from "@angular/material/slide-toggle";
import {PluginWrapperModule} from "./wrapper/plugin-wrapper.module";
import {SideBarModule} from "../sharedComponents/sidebar/sideBar.module";
import {PluginEditWrapperModule} from "./wrapper/plugin-edit-wrapper.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule,
AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule,
MatCheckboxModule, AdminTabsModule, PageContentModule, PluginsRoutingModule, SearchInputModule, IconsModule, LoadingModule, CKEditorModule,
MatSlideToggleModule, PluginWrapperModule
MatSlideToggleModule, PluginWrapperModule, SideBarModule, PluginEditWrapperModule
],
providers:[PluginsService],
declarations: [PluginsComponent],
declarations: [PluginsComponent],
exports: [PluginsComponent]
})
export class PluginsModule {}

View File

@ -43,41 +43,41 @@
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No templates found</div>
</div>-->
<div class="uk-grid uk-child-width-1-1" uk-height-match=".uk-card-body" uk-grid>
<div class="uk-grid uk-child-width-1-1">
<ng-container *ngFor="let placement of pluginUtils.placementsOptions">
<ng-container *ngIf="filterForm.get('position').value == placement.value || filterForm.get('position').value == 'all'">
<div *ngIf="templatesByPlacement.get(placement.value).length >0 && page"
class="uk-heading-divider uk-h6 uk-margin-left uk-padding-remove-left uk-text-capitalize ">{{placement.value}}</div>
<div *ngFor="let template of templatesByPlacement.get(placement.value) ; let i=index">
<!-- <div *ngIf="this.filter(template)">-->
<!-- <div *ngFor="let check of checkboxes; let i=index">-->
<div class="uk-card uk-card-default">
<div class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-card-body uk-flex">
<!--<div *ngIf="!portal" class="uk-margin-right">
<input [id]="check.template._id" class="uk-checkbox" type="checkbox"
name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
</div>-->
<div class="uk-width-expand uk-text-small">
<!-- <h6>{{check.template.name}}</h6>-->
<plugin-wrapper [editMode]="false" [wrapperEditMode]="true" [pluginTemplate]="template"></plugin-wrapper>
<h6>{{template.name}}</h6>
<div class="uk-margin-small-bottom">
<span class="uk-text-meta">Page: </span>{{getPageAsString(template.page)}} -
<span class="uk-text-meta">Placement: </span>{{template.placement}} -
<span class="uk-text-meta">Order: </span>{{template.order}}
</div>
<div class="uk-margin-small-bottom">
<span class="uk-text-meta">Portal type: </span>{{template.portalType}}
</div>
<div class="uk-margin-small-bottom">
<span class="uk-text-meta">Plan: </span>{{template.plan}}
<span class="uk-label uk-padding-xsmall uk-text-capitalize" [class.uk-label-success]="template.plan !='extended'" [class.uk-label-danger]="template.plan =='extended'">Plan: {{template.plan}} </span>
<span *ngIf="template.portalSpecific && template.portalSpecific.length > 0" class="uk-label uk-label-primary uk-padding-xsmall uk-text-capitalize uk-margin-left">Communities: {{template.portalSpecific.join(', ')}} </span>
<span *ngIf="template.defaultIsActive" class="uk-label uk-label-success uk-padding-xsmall uk-text-capitalize uk-margin-left">Default status: Active </span>
</div>
<div class="uk-margin-small-bottom">
{{template.description}}
</div>
<div class="uk-margin-small-bottom">
<span class="uk-text-meta">Page: </span>{{getPageAsString(template.page)}} -
<span class="uk-text-meta">Placement: </span>{{template.placement}} -
<span class="uk-text-meta">Order: </span>{{template.order}}
</div>
<div class="uk-margin-small-bottom">
<span class="uk-text-meta">Portal type: </span>{{template.portalType}}
</div>
<ul uk-accordion>
<li>
<a class="uk-accordion-title" >Preview</a>
<div class="uk-accordion-content">
<plugin-wrapper [pluginTemplate]="template" [pluginObject]="template.object" ></plugin-wrapper>
</div>
</li>
</ul>
</div>
</div>
<div class="uk-card-footer uk-padding-remove-vertical">
@ -137,7 +137,13 @@
</div>
<modal-alert #editModal (alertOutput)="saveConfirmed($event)" [large]="true"
[okDisabled]="templateForm && (templateForm.invalid || !templateForm.dirty)" classTitle="uk-background-primary uk-light">
<form *ngIf="templateForm" [formGroup]="templateForm" class="uk-grid uk-child-width-1-2" uk-grid>
<form *ngIf="templateForm" [formGroup]="templateForm" class="uk-grid " uk-grid>
<div class="uk-width-1-3" *ngIf="templateForm.getRawValue()['_id']">
<div class="uk-text-muted uk-text-bold uk-text-center uk-margin-bottom">Plugin options</div>
<plugin-wrapper-form [pluginTemplate]="templateForm.getRawValue()" [pluginObject]="this.templateForm.getRawValue().object"
(changed)="pluginFieldChanged($event)" [editTemplate]="true"> </plugin-wrapper-form>
</div>
<div class="uk-grid uk-width-expand uk-child-width-1-2" uk-grid>
<div input [formInput]="templateForm.get('name')" placeholder="Template Name"></div>
<div input [formInput]="templateForm.get('code')" placeholder="Template Code" [options]="pluginUtils.availablePluginCodes" type="select"></div>
<div class="uk-width-1-1" input [formInput]="templateForm.get('description')" placeholder="Description" type="textarea"> </div>
@ -147,27 +153,12 @@
<div input [formInput]="templateForm.get('placement')" placeholder="Placement" [options]="pluginUtils.placementsOptions" type="select"></div>
<div *ngIf="!templateForm.get('portalType').value" input [formInput]="templateForm.get('page')" placeholder="Page" [options]="allPages" type="select" ></div>
<div *ngIf="templateForm.get('portalType').value" input [formInput]="templateForm.get('page')" placeholder="Page" [options]="allPagesByPortal.get(templateForm.get('portalType').value)" type="select" ></div>
<div input [formInput]="templateForm.get('portalSpecific')" placeholder="Available to communities" hint="community ids, comma seperated, no spaces"></div>
<div input [formInput]="templateForm.get('order')" placeholder="Order" ></div>
<div>Default Status <mat-slide-toggle [checked]="templateForm.get('defaultIsActive').value"
(change)="templateForm.get('defaultIsActive').setValue($event.checked); templateForm.markAsDirty()"></mat-slide-toggle></div>
<plugin-wrapper *ngIf="selectedTemplate " [editMode]="true" [wrapperEditMode]="false" [pluginTemplate]="this.templateForm.getRawValue()"
class="uk-width-1-1" [editTemplate]="true" (changed)="pluginFieldChanged($event)"></plugin-wrapper>
<!--<div *ngIf="pluginEditEvent">
<div *ngIf="pluginEditEvent.type == 'text'" input [value]="this.templateForm.getRawValue().object[pluginEditEvent.field]" [placeholder]="pluginEditEvent.field" [type]="pluginEditEvent.type"
(valueChange)="pluginFieldChanged($event)"></div>
&lt;!&ndash; <div *ngIf="pluginEditEvent.type == 'URL'" input [formInput]="attrForm.get('value')" placeholder="Default value" [type]="attrForm.get('type').value" [validators]="urlValidator"></div>&ndash;&gt;
<div *ngIf="pluginEditEvent.type == 'boolean'" input [value]="pluginObject[pluginEditEvent.field]" [placeholder]="pluginEditEvent.field" type="select"
[options]="[{label: 'yes', value:true}, {label: 'no', value:false}]"></div>
&lt;!&ndash; <div *ngIf="pluginEditEvent.type == 'HTML'" class="uk-width-1-1">
<ckeditor [readonly]="false"
debounce="500"
[formControl]="attrForm.get('value')"
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]',
removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +
'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +
'CreateDiv,Flash,PageBreak,' +
'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language',
extraPlugins: 'divarea'}">
</ckeditor>
</div>&ndash;&gt;
</div>-->
<div *ngFor="let attrForm of attrFormArray.controls; let i=index" class="uk-width-1-1 uk-grid uk-child-width-1-2" uk-grid>
@ -206,6 +197,13 @@
<div class="uk-width-1-1 uk-text-center ">
<a (click)="addNewAttr()">Add settings</a>
</div>
<div *ngIf="templateForm.getRawValue()['_id']" class="uk-width-1-1">
<hr class="uk-width-1-1">
<div class="uk-text-muted uk-text-bold uk-width-1-1 uk-text-center">Plugin preview</div>
<plugin-wrapper [pluginTemplate]="templateForm.getRawValue()" [pluginObject]="this.templateForm.getRawValue().object"></plugin-wrapper>
</div>
</div>
</form>
</modal-alert>
<modal-alert #deleteModal (alertOutput)="confirmedDelete()" classTitle="uk-background-primary uk-light"></modal-alert>

View File

@ -1,7 +1,7 @@
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {HelpContentService} from "../../../services/help-content.service";
import {FormArray, UntypedFormBuilder, UntypedFormGroup, ValidatorFn, Validators} from "@angular/forms";
import {FormArray, FormGroup, UntypedFormBuilder, UntypedFormGroup, ValidatorFn, Validators} from "@angular/forms";
import {Page} from "../../../utils/entities/adminTool/page";
import {EnvProperties} from '../../../utils/properties/env-properties';
import {HelperFunctions} from "../../../utils/HelperFunctions.class";
@ -26,10 +26,6 @@ import {PluginUtils} from "../utils/pluginUtils";
export class PluginTemplatesComponent implements OnInit {
@ViewChild('editModal') editModal: AlertModal;
@ViewChild('deleteModal') deleteModal: AlertModal;
/*public checkboxes: {
template: PluginTemplate;
checked: boolean;
}[] = [];*/
public templatesByPlacement: Map<string,PluginTemplate[]> = new Map();
public templateForm: UntypedFormGroup;
urlValidator: ValidatorFn = StringUtils.urlValidator;
@ -122,7 +118,8 @@ export class PluginTemplatesComponent implements OnInit {
this.templatesByPlacement.set(pos.value,[]);
}
for(let template of templates){
let defaultObj = PluginUtils.initializeObject(template.code);
template.object = PluginUtils.updateExistingObject(template.object, defaultObj)
this.templatesByPlacement.get(template.placement).push(template);
}
// this.checkboxes = [];
@ -136,20 +133,11 @@ export class PluginTemplatesComponent implements OnInit {
error => this.handleError('System error retrieving classes', error)));
}
/*public toggleCheckBoxes(event) {
this.checkboxes.forEach(_ => _.checked = event.target.checked);
}*/
/*public applyCheck(flag: boolean) {
this.checkboxes.forEach(_ => _.checked = flag);
}*/
private deleteFromArray(template:PluginTemplate): void {
let i = this.templatesByPlacement.get(template.placement).findIndex(_ => _._id == template._id);
this.templatesByPlacement.get(template.placement).splice(i, 1);
// this.applyFilters();
}
public confirmDelete(template:PluginTemplate) {
@ -180,8 +168,6 @@ export class PluginTemplatesComponent implements OnInit {
public edit(pluginTemplate) {
this.selectedTemplate = pluginTemplate;
// this.pluginObject = Object.assign(this.templates[this.index].object);
// this.formPages = <Page[]>pluginTemplate.pages;
this.templateForm = this._fb.group({
_id: this._fb.control(pluginTemplate._id),
name: this._fb.control(pluginTemplate.name),
@ -191,11 +177,20 @@ export class PluginTemplatesComponent implements OnInit {
code: this._fb.control(pluginTemplate.code, Validators.required),
description: this._fb.control(pluginTemplate.description),
plan: this._fb.control(pluginTemplate.plan, Validators.required),
placement: this._fb.control(pluginTemplate.placement),
placement: this._fb.control(pluginTemplate.placement, Validators.required),
order: this._fb.control(pluginTemplate.order),
portalSpecific: this._fb.control(pluginTemplate.portalSpecific?pluginTemplate.portalSpecific.join(','):''),
defaultIsActive: this._fb.control(pluginTemplate.defaultIsActive),
settings: this._fb.array([]),
object: this._fb.group(pluginTemplate.object ? pluginTemplate.object : {})
object: this._fb.group({})
});
for (let attrKey of Object.keys(pluginTemplate.object)) {
if(attrKey.indexOf("Array")==-1) {
(this.templateForm.get("object") as FormGroup).addControl(attrKey, this._fb.control(pluginTemplate.object[attrKey]));
}else{
(this.templateForm.get("object") as FormGroup).addControl(attrKey,this._fb.array(pluginTemplate.object[attrKey]));
}
}
this.templateForm.get('portalType').disable();
if (pluginTemplate.settings) {
for (let attrKey of Object.keys(pluginTemplate.settings)) {
@ -224,8 +219,10 @@ export class PluginTemplatesComponent implements OnInit {
description: this._fb.control(''),
page: this._fb.control(this.page?this.getPageById(this.page):'', Validators.required),
portalType: this._fb.control('community', Validators.required),
placement: this._fb.array([]),
placement: this._fb.control('', Validators.required),
order: this._fb.control(''),
portalSpecific: this._fb.control(''),
defaultIsActive: this._fb.control(false),
settings: this._fb.array([]),
object: this._fb.control({})
});
@ -263,7 +260,7 @@ export class PluginTemplatesComponent implements OnInit {
this.showLoading = true;
let template: PluginTemplate = <PluginTemplate>this.templateForm.getRawValue();
template.page = this.templateForm.getRawValue().page._id
template.placement = this.templateForm.getRawValue().placement[0];
template.portalSpecific = this.templateForm.getRawValue().portalSpecific.length > 0? this.templateForm.getRawValue().portalSpecific.split(','):[];
template.settings = new Map<string, { name: string; type: string; value: string }>();
if(!template._id){
template.order = this.templatesByPlacement.get(template.placement).length > 0 ? this.templatesByPlacement.get(template.placement).length:0;
@ -290,6 +287,8 @@ export class PluginTemplatesComponent implements OnInit {
// TODO sort
// this.templatesByPlacement.get(this.selectedTemplate.placement) = this.templatesByPlacement.get(this.selectedTemplate.placement).sort()
} else {
let defaultObj = PluginUtils.initializeObject(template.code);
template.object = PluginUtils.updateExistingObject(template.object, defaultObj)
this.templatesByPlacement.get(this.selectedTemplate.placement).push(template);
}
@ -396,13 +395,23 @@ export class PluginTemplatesComponent implements OnInit {
return pageId;
}
pluginFieldChanged($event: PluginEditEvent) {
let object = this.templateForm.get("object").getRawValue();
object[$event.field] = $event.value;
this.templateForm.get("object").setValue(object);
pluginFieldChanged($event:PluginEditEvent){
console.log($event)
// let object = this.templateForm.get("object").getRawValue();
// object[$event.field]=$event.value;
if($event.field.indexOf("Array") == -1) {
this.templateForm.get("object").get($event.field).setValue($event.value);
}else{
((this.templateForm.get("object") as FormGroup).get($event.field) as FormArray).clear();
$event.value.forEach(id => {
((this.templateForm.get("object") as FormGroup).get($event.field) as FormArray).push(this._fb.control(id))
});
console.log(((this.templateForm.get("object") as FormGroup).get($event.field) as FormArray).getRawValue());
}
this.templateForm.markAsDirty();
}
public getPagesByPortal(portal) {
return this.allPages.filter(option => option.value.portalType == portal);
}

View File

@ -23,12 +23,14 @@ import {LoadingModule} from "../../../utils/loading/loading.module";
import {PluginsService} from "../../../services/plugins.service";
import {CKEditorModule} from "ng2-ckeditor";
import {PluginWrapperModule} from "../wrapper/plugin-wrapper.module";
import {PluginEditWrapperModule} from "../wrapper/plugin-edit-wrapper.module";
import {MatSlideToggleModule} from "@angular/material/slide-toggle";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule,
AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule,
MatCheckboxModule, AdminTabsModule, PageContentModule, PluginTemplatesRoutingModule, SearchInputModule, IconsModule, LoadingModule, CKEditorModule, PluginWrapperModule
MatCheckboxModule, AdminTabsModule, PageContentModule, PluginTemplatesRoutingModule, SearchInputModule, IconsModule, LoadingModule, CKEditorModule, PluginWrapperModule, PluginEditWrapperModule, MatSlideToggleModule
],
providers:[PluginsService],
declarations: [PluginTemplatesComponent],

View File

@ -7,27 +7,58 @@ import {Subscriber} from "rxjs";
export class PluginEditEvent {
field:string;
type:"text" | "HTML" | "boolean";
type:"text" | "HTML" | "boolean" | 'parent';
value?:any;
}
export class PluginBaseInfo {
title: string = "Lorem ipsum";
constructor() {
}
}
export class PluginURL {
url:string;
linkText:string;
target:string;
constructor(url,linkText, target = "_blank") {
this.url = url;
this.linkText = linkText;
this.target = target;
}
}
export class PluginInfoCards{
title:string;
description:string;
urls:PluginURL[];
image?:string;
show:boolean;
}
@Directive()
export abstract class PluginBaseComponent implements OnDestroy {
export abstract class PluginBaseComponent<T extends PluginBaseInfo> implements OnDestroy {
public properties: EnvProperties = properties;
@Input() editMode =false;
@Input() plugin:Plugin;
@Input() pluginTemplate:PluginTemplate;
@Input() editTemplate:boolean = false;
@Input() pluginObject:T;
@Output() valuesChanged:EventEmitter<PluginEditEvent> = new EventEmitter<any>();
subscriptions = [];
pluginEditEvent:PluginEditEvent;
/*default:T;*/
constructor() {
}
ngOnInit(): void {
// console.log(this.default)
/*if (this.pluginTemplate && (!this.pluginDefaultObject || !this.pluginDefaultObject.title) && this.default) {
this.pluginTemplate.object = Object.assign(this.default);
}*/
}
ngOnDestroy() {
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe()
@ -43,18 +74,22 @@ export class PluginEditEvent {
valueChanged($event:PluginEditEvent){
if(this.editTemplate){
this.pluginTemplate.object[$event.field]=$event.value;
this.pluginObject[$event.field]=$event.value;
}else{
this.plugin.object[$event.field]=$event.value;
}
this.valuesChanged.emit($event)
}
showOnOffBlock(field){
return (this.editTemplate /* edit template*/
|| (this.editMode && !this.editTemplate) /* edit plugin*/
|| (this.plugin && this.plugin.object && this.plugin.object[field] == true) /* is on anyway */
|| (!this.plugin)) /* is not plugin view */
isVisible(field){
return (this.plugin && this.plugin.object && this.plugin.object[field] == true) /* plugin is on anyway */
|| (!this.plugin && this.pluginTemplate && this.pluginTemplate.object && this.pluginTemplate.object[field] == true) /* template is on */
}
/*get pluginObject():T{
return this.plugin?this.plugin.object:null;
}
get pluginDefaultObject():T{
return this.pluginTemplate?this.pluginTemplate.object:null;
}*/
}

View File

@ -6,16 +6,15 @@ import {PluginEditEvent} from "./base-plugin.component";
selector: 'plugin-field-edit',
template: `
<ng-container *ngIf="type=='boolean'">
{{value}}
<mat-slide-toggle [checked]="value" (change)="updateObject($event.checked)"></mat-slide-toggle>
</ng-container>
<ng-container *ngIf="type!='boolean'">
<a *ngIf="!editingModeOn" class="uk-float-right" (click)=" editClicked.emit({field: field, type: type}); editingModeOn = true ">Edit</a>
<!-- <a *ngIf="!editingModeOn" class="uk-float-right" (click)=" editClicked.emit({field: field, type: type}); editingModeOn = true ">Edit</a>-->
<ng-container *ngIf="editingModeOn">
<a *ngIf="editingModeOn" class="uk-float-right" (click)="editClicked.emit(null); editingModeOn = false ">close</a>
<br>
<div *ngIf="type == 'text'" input [value]="value" [placeholder]="field" type="text" (valueChange)="updateObject($event)"></div>
<!-- <a *ngIf="editingModeOn" class="uk-float-right" (click)="editClicked.emit(null); editingModeOn = false ">close</a>-->
<!-- <br>-->
<div *ngIf="type == 'text'" input [value]="value" [placeholder]="field.toUpperCase()" type="text" (valueChange)="updateObject($event)" inputClass=" border-bottom "></div>
<!--<div *ngIf="type == 'URL'" input [value]="value" [placeholder]="name" type="URL" ></div>
<div *ngIf="type == 'HTML'" class="uk-width-1-1">
<ckeditor [readonly]="false"
@ -42,7 +41,7 @@ export class PluginFieldEditComponent {
@Input() field;
@Output() editClicked:EventEmitter<PluginEditEvent> = new EventEmitter<PluginEditEvent>();
@Output() changed:EventEmitter<PluginEditEvent> = new EventEmitter()
editingModeOn: boolean = false;
editingModeOn: boolean = true;
updateObject(value){
console.log(value)

View File

@ -1,4 +1,11 @@
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} 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";
export class PluginUtils{
public attrTypeOptions: Option[] = [
@ -9,9 +16,7 @@ export class PluginUtils{
];
public availablePluginCodes: Option[] = [
{label:"Test", value:"test"},
{label:"openaire-products", value:"openaire-products"},
{label:"results-numbers", value:"results-numbers"},
{label:"discover-by-subcommunity", value:"discover-by-subcommunity"},
{label:"gateway-information", value:"gateway-information"},
{label:"search-deposit-link", value:"search-deposit-link"},
@ -34,4 +39,48 @@ export class PluginUtils{
{value: 'starter', label: 'Starter'},
{value: 'extended', label: 'Extended'}
];
public static initializeObject(code){
switch(code) {
case 'openaire-products': {
return new PluginOpenAIREProducts();
}
case 'discover-by-subcommunity': {
return new PluginDiscoverBySubcommunity();
}
case 'gateway-information': {
return new PluginGatewayInformation();
}
case 'search-deposit-link': {
return new PluginBaseInfo();
}
case 'learn-and-connect': {
return new PluginLearnAndConnect();
}
case 'how-to-use': {
return new PluginHowToUse();
}
case 'suggested-repositories': {
return new PluginBaseInfo();
}
case 'featured-datasets': {
return new PluginFeaturedDatasets();
}
default: {
return new PluginBaseInfo();
}
}
}
public static updateExistingObject(oldObject, object ){
if(!oldObject) {
oldObject = Object.assign(object)
}else{
for (let attrKey of Object.keys(object)) {
if (!oldObject[attrKey] && oldObject[attrKey] != false) {
oldObject[attrKey] = Object.assign(object[attrKey])
}
}
}
return oldObject;
}
}

View File

@ -0,0 +1,51 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Plugin} from "../../../utils/entities/adminTool/plugin";
import {PluginTemplate} from "../../../utils/entities/adminTool/pluginTemplate";
import {PluginEditEvent} from "../utils/base-plugin.component";
@Component({
selector: 'plugin-wrapper-form',
template: `
<div class="uk-width-1-1" *ngIf="pluginObject">
<ng-container *ngIf="pluginTemplate.code == 'openaire-products'">
<plugin-openaire-products-form [pluginTemplate]="pluginTemplate" [plugin]="plugin" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-openaire-products-form>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'discover-by-subcommunity'">
<plugin-discover-by-subcommunity-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-discover-by-subcommunity-form>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'gateway-information'">
<plugin-gateway-information-form [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-gateway-information-form>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'search-deposit-link'">
<plugin-search-deposit-link [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-search-deposit-link>
</ng-container>
<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"></plugin-learn-and-connect-form>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'how-to-use'">
<plugin-how-to-use [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-how-to-use>
</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>
</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>
</ng-container>
</div>
`,
styleUrls: ["edit-plugin.css"]
})
export class PluginEditWrapperComponent implements OnInit {
@Input() plugin:Plugin;
@Input() pluginTemplate:PluginTemplate;
@Input() editTemplate:boolean;
@Input() pluginObject;
@Output() changed:EventEmitter<PluginEditEvent> = new EventEmitter();
ngOnInit(): void {
}
}

View File

@ -0,0 +1,24 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginEditWrapperComponent} from "./plugin-edit-wrapper.component";
import {PluginOpenaireProductsFormComponent} from "../components/openaireProducts/plugin-openaire-products.form.component";
import {PluginLearnAndConnectFormComponent} from "../components/learn-and-connect/plugin-learn-and-connect.form.component";
import {PluginFieldEditModule} from "../utils/plugin-field-edit.module";
import {PluginDiscoverBySubcommunityFormComponent} from "../components/discover-by-subcommunity/plugin-discover-by-subcommunity.form.component";
import {PluginFeaturedDatasetsFormComponent} from "../components/featured-datasets/plugin-featured-datasets.form.component";
import {PluginGatewayInformationFormComponent} from "../components/gateway-information/plugin-gateway-information.form.component";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, PluginFieldEditModule
],
declarations: [PluginEditWrapperComponent, PluginOpenaireProductsFormComponent, PluginLearnAndConnectFormComponent,
PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginDiscoverBySubcommunityFormComponent, PluginFeaturedDatasetsFormComponent, PluginGatewayInformationFormComponent],
exports: [PluginEditWrapperComponent]
})
export class PluginEditWrapperModule {
}

View File

@ -2,57 +2,45 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Plugin} from "../../../utils/entities/adminTool/plugin";
import {PluginTemplate} from "../../../utils/entities/adminTool/pluginTemplate";
import {PluginEditEvent} from "../utils/base-plugin.component";
import {PluginUtils} from "../utils/pluginUtils";
@Component({
selector: 'plugin-wrapper',
template: `
<ng-container *ngIf="pluginTemplate">
<div [class.pluginEditMode]="wrapperEditMode" >
<ng-container *ngIf="pluginTemplate.code == 'results-numbers'">
<plugin-results-numbers [plugin]="plugin" [pluginTemplate]="pluginTemplate" [editMode]="editMode" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-results-numbers>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'test'">
<plugin-test [plugin]="plugin" [pluginTemplate]="pluginTemplate" [editMode]="editMode" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-test>
</ng-container>
<ng-container *ngIf="pluginTemplate && pluginObject">
<div>
<ng-container *ngIf="pluginTemplate.code == 'openaire-products'">
<plugin-openaire-products [plugin]="plugin" [pluginTemplate]="pluginTemplate" [editMode]="editMode" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-openaire-products>
<plugin-openaire-products [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-openaire-products>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'discover-by-subcommunity'">
<plugin-discover-by-subcommunity [plugin]="plugin" [pluginTemplate]="pluginTemplate" [editMode]="editMode" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-discover-by-subcommunity>
<plugin-discover-by-subcommunity [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-discover-by-subcommunity>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'gateway-information'">
<plugin-gateway-information [plugin]="plugin" [pluginTemplate]="pluginTemplate" [editMode]="editMode" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-gateway-information>
<plugin-gateway-information [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-gateway-information>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'search-deposit-link'">
<plugin-search-deposit-link [plugin]="plugin" [pluginTemplate]="pluginTemplate" [editMode]="editMode" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-search-deposit-link>
<plugin-search-deposit-link [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-search-deposit-link>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'learn-and-connect'">
<plugin-learn-and-connect [plugin]="plugin" [pluginTemplate]="pluginTemplate" [editMode]="editMode" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-learn-and-connect>
<plugin-learn-and-connect [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-learn-and-connect>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'how-to-use'">
<plugin-how-to-use [plugin]="plugin" [pluginTemplate]="pluginTemplate" [editMode]="editMode" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-how-to-use>
<plugin-how-to-use [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-how-to-use>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'suggested-repositories'">
<plugin-suggested-repositories [plugin]="plugin" [pluginTemplate]="pluginTemplate" [editMode]="editMode" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-suggested-repositories>
<plugin-suggested-repositories [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-suggested-repositories>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'featured-datasets'">
<plugin-featured-datasets [plugin]="plugin" [pluginTemplate]="pluginTemplate" [editMode]="editMode" (valuesChanged)="changed.emit($event)" [editTemplate]="editTemplate"></plugin-featured-datasets>
<plugin-featured-datasets [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-featured-datasets>
</ng-container>
</div>
</ng-container>
`,
styleUrls: ["edit-plugin.css"]
`
})
export class PluginWrapperComponent implements OnInit {
@Input() editMode =false;
@Input() wrapperEditMode =false;
@Input() plugin:Plugin;
@Input() pluginObject;
@Input() pluginTemplate:PluginTemplate;
@Input() editTemplate:boolean;
// @Output() editWrapperClicked:EventEmitter<any> = new EventEmitter()
@Output() changed:EventEmitter<PluginEditEvent> = new EventEmitter();
ngOnInit(): void {

View File

@ -3,9 +3,7 @@ import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginWrapperComponent} from "./plugin-wrapper.component";
import {PluginTestModule} from "../components/test/plugin-test.module";
import {PluginOpenaireProductsModule} from "../components/openaireProducts/plugin-openaire-products.module";
import {PluginResultsNumbersModule} from "../components/results-numbers/plugin-results-numbers.module";
import {PluginDiscoverBySubcommunityModule} from '../components/discover-by-subcommunity/plugin-discover-by-subcommunity.module';
import {PluginGatewayInformationModule} from '../components/gateway-information/plugin-gateway-information.module';
import {PluginSearchDepositLinkModule} from '../components/search-deposit-link/plugin-search-deposit-link.module';
@ -16,8 +14,8 @@ import {PluginFeaturedDatasetsModule} from '../components/featured-datasets/plug
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, PluginResultsNumbersModule, PluginTestModule, PluginOpenaireProductsModule,
PluginDiscoverBySubcommunityModule, /*PluginGatewayInformationModule,*/ PluginSearchDepositLinkModule, PluginLearnAndConnectModule,
CommonModule, RouterModule, FormsModule, PluginOpenaireProductsModule,
PluginDiscoverBySubcommunityModule, PluginSearchDepositLinkModule, PluginLearnAndConnectModule,
PluginHowToUseModule, PluginSuggestedRepositoriesModule, PluginFeaturedDatasetsModule, PluginGatewayInformationModule
],
declarations: [PluginWrapperComponent],

View File

@ -13,13 +13,12 @@ export class Plugin {
settingsValues:Map<string,string> = new Map<string, string>();
constructor(page, pid, template:PluginTemplate) {
console.log(template)
this.page = page;
this.pid = pid;
this.templateCode = template.code;
this.templateId = template._id;
this.placement = template.placement;
this.active = false;
this.active = template.defaultIsActive;
this.object = template.object && Object.keys(template.object).length > 0 ? Object.assign(template.object) : null;
this.order = template.order;
if (template.settings) {

View File

@ -8,6 +8,8 @@ export class PluginTemplate{
image: string;
page: string;
plan: "starter" | "extended";
portalSpecific:string[];
defaultIsActive:boolean = false;
order:number;
placement: string;
portalType: string;

View File

@ -86,7 +86,7 @@ export class FetchResearchResults {
public getAllResultsForCommunity(resultType:string, communityId: string, page: number, size: number, properties:EnvProperties, contextId = null) {
this.searchUtils.status = this.errorCodes.LOADING;
this.subscriptions.push(this._searchResearchResultsService.advancedSearchResults(resultType, "", page, size, "resultdateofacceptance,descending", properties, "&type=results&fq=communityid=" + communityId +(contextId?'&fq=categoryid=' + encodeURIComponent(contextId):'')).subscribe(
this.subscriptions.push(this._searchResearchResultsService.advancedSearchResults(resultType, null, page, size, null, properties, "&type=results&fq=communityid=" + communityId +(contextId?'&fq=categoryid=' + encodeURIComponent(contextId):'')).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.allResults = data[1];