[plugins-functionality | WIP] affiliations update the way to get community id, updates on plugins

This commit is contained in:
argirok 2024-03-06 15:26:14 +02:00
parent 17e3cda685
commit f5ec98eb88
17 changed files with 94 additions and 95 deletions

View File

@ -28,13 +28,11 @@ export class AffiliationsComponent {
public properties: EnvProperties = properties; public properties: EnvProperties = properties;
private subscriptions = []; private subscriptions = [];
constructor(private route: ActivatedRoute, private affiliationService: AffiliationService) { constructor(private route: ActivatedRoute, private affiliationService: AffiliationService, private config: ConfigurationService) {
} }
public ngOnInit(/*private config: ConfigurationService */) { public ngOnInit() {
this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); this.subscriptions.push(this.config.portalAsObservable.subscribe(
/* this.subscriptions.push(this.config.portalAsObservable.subscribe(
res => { res => {
// this.portal = res; // this.portal = res;
this.communityId = res.pid this.communityId = res.pid
@ -42,7 +40,7 @@ export class AffiliationsComponent {
error => { error => {
console.log(error); console.log(error);
} }
));*/ ));
if (this.getAffiliationsFromAPI) { if (this.getAffiliationsFromAPI) {
this.showLoading = true; this.showLoading = true;
this.affiliationService.initAffiliations(this.communityId); this.affiliationService.initAffiliations(this.communityId);

View File

@ -12,15 +12,21 @@
{{pluginObject.textLine2}} {{pluginObject.textLine2}}
</div> </div>
</div> </div>
<!-- <no-load-paging *ngIf="fetchFeaturedDatasets && fetchFeaturedDatasets.searchUtils.totalResults > size" [type]="'Featured Datasets'" <div *ngIf="fetchFeaturedDatasets" uk-slider class="uk-slider">
(pageChange)="updatePage($event)" <ul *ngIf="slides" class="uk-slider-items" uk-height-match="target: .uk-card; row: false">
[page]="fetchFeaturedDatasets.searchUtils.page" [pageSize]="size" <li *ngFor="let slide of [].constructor(slides); let i=index" class="uk-width-1-1 uk-padding">
[totalResults]="fetchFeaturedDatasets.searchUtils.totalResults" > <div class="uk-grid uk-child-width-1-1" uk-grid uk-scrollspy="target: [uk-scrollspy-class]; cls: uk-animation-fade; repeat: true">
</no-load-paging>--> <search-result [properties]="properties"
<search-result [properties]="properties" [results]="fetchFeaturedDatasets.results"
[results]="fetchFeaturedDatasets.results" [status]="fetchFeaturedDatasets.searchUtils.status"
[status]="fetchFeaturedDatasets.searchUtils.status" [type]="'dataset'" [showEnermaps]="true" >
[type]="'dataset'" [showEnermaps]="true" > </search-result>
</search-result> </div>
</li>
</ul>
<ul class="uk-slider-nav uk-dotnav uk-flex-center uk-margin-medium-top"></ul>
</div>
</div> </div>
</div> </div>

View File

@ -20,7 +20,8 @@ export class PluginFeaturedDatasetsComponent extends PluginBaseComponent<PluginF
public fetchFeaturedDatasets: FetchResearchResults; public fetchFeaturedDatasets: FetchResearchResults;
page = 1; page = 1;
size = 3; size = 3;
slides = 1;
slideItems = 3;
constructor(private _searchResearchResultsService: SearchResearchResultsService) { constructor(private _searchResearchResultsService: SearchResearchResultsService) {
super() super()
this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService); this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService);
@ -28,9 +29,5 @@ export class PluginFeaturedDatasetsComponent extends PluginBaseComponent<PluginF
this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", "enermaps", 1, 50, this.properties, "enermaps::selection"); this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", "enermaps", 1, 50, 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

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

View File

@ -1,5 +1,5 @@
<div *ngIf="!community " class="uk-text-muted uk-text-center"> <div *ngIf="!community " class="uk-text-muted uk-text-center">
No community info available available No community info available
</div> </div>
<div class="uk-grid uk-child-width-1-2@m uk-child-width-1-1@s"> <div class="uk-grid uk-child-width-1-2@m uk-child-width-1-1@s">
<div *ngIf="portal && community" class=""> <!-- this div will have the <div *ngIf="portal && community" class=""> <!-- this div will have the

View File

@ -31,6 +31,12 @@ export class PluginGatewayInformation extends PluginBaseInfo{
datasets:boolean = true; datasets:boolean = true;
software:boolean = true; software:boolean = true;
other:boolean = true; other:boolean = true;
compare(oldObject): any {
let newObj= super.compare(oldObject);
console.log("PluginGatewayInformation", oldObject, newObj)
return newObj;
}
} }
@Component({ @Component({
selector: 'plugin-gateway-information', selector: 'plugin-gateway-information',

View File

@ -63,7 +63,7 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.
(changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit> (changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit>
</div> </div>
<ng-container *ngFor="let cardUrl of pluginObject.cardInfoArray[selectedIndex].urlsArray; let j = index "> <ng-container *ngFor="let cardUrl of pluginObject.cardInfoArray[selectedIndex].urlsArray; let j = index ">
<div class=" uk-margin-top uk-text-meta uk-text-xsmall"> Link #{{j+1}}</div> <div class=" uk-margin-top uk-text-meta uk-text-xsmall"> Link #{{j + 1}}</div>
<div class="uk-margin-small-top"> <div class="uk-margin-small-top">
<plugin-field-edit [value]=" cardUrl.url" <plugin-field-edit [value]=" cardUrl.url"
type="text" field="url" type="text" field="url"
@ -85,9 +85,11 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.
export class PluginHowToUseFormComponent extends PluginBaseFormComponent<PluginHowToUse> { export class PluginHowToUseFormComponent extends PluginBaseFormComponent<PluginHowToUse> {
selectedIndex = -1; selectedIndex = -1;
@Input() editSubmenuOpen; @Input() editSubmenuOpen;
constructor() { constructor() {
super() super()
} }
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (this.editSubmenuOpen == false && this.selectedIndex > -1) { if (this.editSubmenuOpen == false && this.selectedIndex > -1) {
this.close(); this.close();
@ -95,29 +97,18 @@ export class PluginHowToUseFormComponent extends PluginBaseFormComponent<PluginH
} }
cardShowChanged(i, $event: PluginEditEvent) { cardShowChanged(i, $event: PluginEditEvent) {
if (this.editTemplate) { this.pluginObject.cardInfoArray[i].show = $event.value;
this.pluginTemplate.object.cardInfoArray[i].show = $event.value; $event.value = this.pluginObject.cardInfoArray;
$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'}) this.valuesChanged.emit({field: $event.field, value: $event.value, type: 'parent'})
} }
cardValueChanged(i, $event: PluginEditEvent) { cardValueChanged(i, $event: PluginEditEvent) {
if (this.editTemplate) { this.pluginObject.cardInfoArray[i][$event.field] = $event.value;
this.pluginObject.cardInfoArray[i][$event.field] = $event.value; $event.value = this.pluginObject.cardInfoArray
$event.value = this.pluginObject.cardInfoArray
} else {
this.pluginObject.cardInfoArray[i][$event.field] = $event.value;
$event.value = this.pluginObject.cardInfoArray;
}
this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'}) this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
} }
cardUrlValueChanged(i, j, $event: PluginEditEvent) {
cardUrlValueChanged(i, j, $event: PluginEditEvent) {
if (this.editTemplate) { if (this.editTemplate) {
this.pluginObject.cardInfoArray[i].urlsArray[j][$event.field] = $event.value; this.pluginObject.cardInfoArray[i].urlsArray[j][$event.field] = $event.value;
$event.value = this.pluginObject.cardInfoArray; $event.value = this.pluginObject.cardInfoArray;
@ -128,6 +119,7 @@ export class PluginHowToUseFormComponent extends PluginBaseFormComponent<PluginH
this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'}) this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
} }
edit(i) { edit(i) {
this.selectedIndex = i; this.selectedIndex = i;
this.toggleSubMenu(true); this.toggleSubMenu(true);

View File

@ -88,7 +88,6 @@ export class PluginLearnAndConnectFormComponent extends PluginBaseFormComponent<
} }
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (this.editSubmenuOpen == false && this.selectedIndex > -1) { if (this.editSubmenuOpen == false && this.selectedIndex > -1) {
this.close(); this.close();
@ -96,26 +95,14 @@ export class PluginLearnAndConnectFormComponent extends PluginBaseFormComponent<
} }
cardShowChanged(i, $event: PluginEditEvent) { cardShowChanged(i, $event: PluginEditEvent) {
if (this.editTemplate) { this.pluginObject.cardInfoArray[i].show = $event.value;
this.pluginTemplate.object.cardInfoArray[i].show = $event.value; $event.value = this.pluginObject.cardInfoArray;
$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'}) this.valuesChanged.emit({field: $event.field, value: $event.value, type: 'parent'})
} }
cardValueChanged(i, $event: PluginEditEvent) { cardValueChanged(i, $event: PluginEditEvent) {
if (this.editTemplate) { this.pluginObject.cardInfoArray[i][$event.field] = $event.value;
this.pluginTemplate.object.cardInfoArray[i][$event.field] = $event.value; $event.value = this.pluginObject.cardInfoArray;
$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'}) this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
} }

View File

@ -75,6 +75,7 @@ export class PluginOpenaireProductsComponent extends PluginBaseComponent<PluginO
} }
} }
calculatePages(){ calculatePages(){
this.slides = 1;
this.servicesToShow = this.services.filter(x => this.pluginObject.serviceIdsArray.indexOf(x.id) != -1); this.servicesToShow = this.services.filter(x => this.pluginObject.serviceIdsArray.indexOf(x.id) != -1);
if (this.servicesToShow.length > this.slideItems) { if (this.servicesToShow.length > this.slideItems) {
this.slides = parseInt('' + (this.servicesToShow.length / this.slideItems)); this.slides = parseInt('' + (this.servicesToShow.length / this.slideItems));

View File

@ -3,5 +3,5 @@
</div> </div>
<div *ngIf="!portal " class="uk-text-muted uk-text-center"> <div *ngIf="!portal " class="uk-text-muted uk-text-center">
No community info available available No community info available
</div> </div>

View File

@ -6,6 +6,20 @@
</h2> </h2>
</div> </div>
<slider-container [total]="activeCards.length" [navigation]="'progress'" [period]="6000" [infinite]="true" [parent]="parent"> <slider-container [total]="activeCards.length" [navigation]="'progress'" [period]="6000" [infinite]="true" [parent]="parent">
<slider-column type="nav" class="slider-nav">
<ng-container *ngFor="let card of activeCards; let i = index">
<ng-container *ngIf="card.show">
<slider-nav-item [start]="i">
<div class="uk-text-primary">{{card.tag}}</div>
<h5 class="uk-margin-remove">
{{card.title}}
</h5>
<div>{{card.description}}</div>
</slider-nav-item>
</ng-container>
</ng-container>
</slider-column>
<slider-column type="slider"> <slider-column type="slider">
<slider-item type="static"> <slider-item type="static">
<img class="uk-position-center uk-position-z-index" [src]="'https://' + (properties.environment == 'production'?'':'beta.') <img class="uk-position-center uk-position-z-index" [src]="'https://' + (properties.environment == 'production'?'':'beta.')
@ -20,19 +34,6 @@
</ng-container> </ng-container>
</ng-container> </ng-container>
</slider-column> </slider-column>
<slider-column type="nav" class="slider-nav">
<ng-container *ngFor="let card of activeCards; let i = index">
<ng-container *ngIf="card.show">
<slider-nav-item [start]="i">
<div class="uk-text-primary">{{card.tag}}</div>
<h5 class="uk-margin-remove">
{{card.title}}
</h5>
<div>{{card.description}}</div>
</slider-nav-item>
</ng-container>
</ng-container>
</slider-column>
</slider-container> </slider-container>
</div> </div>
</div> </div>

View File

@ -19,6 +19,12 @@ export class PluginSearchDepositLink extends PluginBaseInfo{
image:'https://' + (properties.environment == 'production'?'':'beta.') image:'https://' + (properties.environment == 'production'?'':'beta.')
+ 'connect.openaire.eu/assets/connect-assets/home/2.png',show:true}, + 'connect.openaire.eu/assets/connect-assets/home/2.png',show:true},
]; ];
compare(oldObject): any {
let newObj= super.compare(oldObject);
console.log("PluginSearchDepositLink", oldObject, newObj)
return newObj;
}
} }
@Component({ @Component({
selector: 'plugin-search-deposit-link', selector: 'plugin-search-deposit-link',

View File

@ -95,29 +95,18 @@ export class PluginSearchDepositLinkFormComponent extends PluginBaseFormComponen
} }
cardShowChanged(i, $event: PluginEditEvent) { cardShowChanged(i, $event: PluginEditEvent) {
if (this.editTemplate) {
this.pluginTemplate.object.cardInfoArray[i].show = $event.value; this.pluginObject.cardInfoArray[i].show = $event.value;
$event.value = this.pluginTemplate.object.cardInfoArray; $event.value = this.pluginObject.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'}) this.valuesChanged.emit({field: $event.field, value: $event.value, type: 'parent'})
} }
cardValueChanged(i, $event: PluginEditEvent) { cardValueChanged(i, $event: PluginEditEvent) {
if (this.editTemplate) { this.pluginObject.cardInfoArray[i][$event.field] = $event.value;
this.pluginTemplate.object.cardInfoArray[i][$event.field] = $event.value; $event.value = this.pluginObject.cardInfoArray;
$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'}) this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
} }
edit(i) { edit(i) {
this.selectedIndex = i; this.selectedIndex = i;
this.toggleSubMenu(true); this.toggleSubMenu(true);

View File

@ -1,13 +1,20 @@
<div class="plugin-suggested-repositories uk-container uk-container-large uk-section"> <div *ngIf="!community " class="uk-text-muted uk-text-center">
No community info available
</div>
<div *ngIf="community" class="plugin-suggested-repositories uk-container uk-container-large uk-section">
<div class="uk-flex uk-flex-middle uk-flex-between uk-margin-large-bottom"> <div class="uk-flex uk-flex-middle uk-flex-between uk-margin-large-bottom">
<h3 class="uk-margin-remove"> <h3 class="uk-margin-remove">
<icon [name]="'database'" [type]="'outlined'" [ratio]="3" class="uk-margin-small-right"></icon> <icon [name]="'database'" [type]="'outlined'" [ratio]="3" class="uk-margin-small-right"></icon>
{{pluginObject.title}} {{pluginObject.title}}
</h3> </h3>
<a [href]="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default"> <a *ngIf=" contentProviders && contentProviders.length > 2" [href]="" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
View all View all
</a> </a>
</div> </div>
<div *ngIf="!contentProviders || contentProviders.length == 0 " class="uk-text-muted uk-text-center">
No datasources available
</div>
<div uk-slider class="uk-slider"> <div uk-slider class="uk-slider">
<ul *ngIf="slides" class="uk-slider-items" uk-height-match="target: .uk-card; row: false"> <ul *ngIf="slides" class="uk-slider-items" uk-height-match="target: .uk-card; row: false">
<li *ngFor="let slide of [].constructor(slides); let i=index" class="uk-width-1-1 uk-padding"> <li *ngFor="let slide of [].constructor(slides); let i=index" class="uk-width-1-1 uk-padding">

View File

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

View File

@ -1,4 +1,4 @@
import {Directive, EventEmitter, Input, OnDestroy, Output} from '@angular/core'; import {Directive, Input, OnDestroy} from '@angular/core';
import {Plugin} from "../../../utils/entities/adminTool/plugin"; import {Plugin} from "../../../utils/entities/adminTool/plugin";
import {PluginTemplate} from "../../../utils/entities/adminTool/pluginTemplate"; import {PluginTemplate} from "../../../utils/entities/adminTool/pluginTemplate";
import {EnvProperties} from "../../../utils/properties/env-properties"; import {EnvProperties} from "../../../utils/properties/env-properties";
@ -15,7 +15,11 @@ export class PluginBaseInfo {
}else{ }else{
for (let attrKey of Object.keys(this)) { for (let attrKey of Object.keys(this)) {
if (!oldObject[attrKey] && oldObject[attrKey] != false) { if (!oldObject[attrKey] && oldObject[attrKey] != false) {
oldObject[attrKey] = Object.assign(this[attrKey]) if(typeof this[attrKey] === "string" || typeof this[attrKey] === "boolean" ){
oldObject[attrKey] = this[attrKey];
}else {
oldObject[attrKey] = Object.assign(this[attrKey])
}
} }
} }
} }

View File

@ -8,6 +8,7 @@ import {PluginFeaturedDatasets} from "../components/featured-datasets/plugin-fea
import {PluginHowToUse} from "../components/how-to-use/plugin-how-to-use.component"; import {PluginHowToUse} from "../components/how-to-use/plugin-how-to-use.component";
import {PluginSearchDepositLink} from "../components/search-deposit-link/plugin-search-deposit-link.component"; import {PluginSearchDepositLink} from "../components/search-deposit-link/plugin-search-deposit-link.component";
import {PluginOrganizations} from "../components/organizations/plugin-organizations.component"; import {PluginOrganizations} from "../components/organizations/plugin-organizations.component";
import {PluginSuggestedRepositories} from "../components/suggested-repositories/plugin-suggested-repositories.component";
export class PluginUtils{ export class PluginUtils{
public attrTypeOptions: Option[] = [ public attrTypeOptions: Option[] = [
@ -69,7 +70,7 @@ export class PluginUtils{
return (new PluginHowToUse()).compare(oldObject); return (new PluginHowToUse()).compare(oldObject);
} }
case 'suggested-repositories': { case 'suggested-repositories': {
return (new PluginBaseInfo()).compare(oldObject); return (new PluginSuggestedRepositories()).compare(oldObject);
} }
case 'featured-datasets': { case 'featured-datasets': {
return (new PluginFeaturedDatasets()).compare(oldObject); return (new PluginFeaturedDatasets()).compare(oldObject);