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

View File

@ -12,15 +12,21 @@
{{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 *ngIf="fetchFeaturedDatasets" uk-slider class="uk-slider">
<ul *ngIf="slides" class="uk-slider-items" uk-height-match="target: .uk-card; row: false">
<li *ngFor="let slide of [].constructor(slides); let i=index" class="uk-width-1-1 uk-padding">
<div class="uk-grid uk-child-width-1-1" uk-grid uk-scrollspy="target: [uk-scrollspy-class]; cls: uk-animation-fade; repeat: true">
<search-result [properties]="properties"
[results]="fetchFeaturedDatasets.results"
[status]="fetchFeaturedDatasets.searchUtils.status"
[type]="'dataset'" [showEnermaps]="true" >
</search-result>
</div>
</li>
</ul>
<ul class="uk-slider-nav uk-dotnav uk-flex-center uk-margin-medium-top"></ul>
</div>
</div>
</div>

View File

@ -20,7 +20,8 @@ export class PluginFeaturedDatasetsComponent extends PluginBaseComponent<PluginF
public fetchFeaturedDatasets: FetchResearchResults;
page = 1;
size = 3;
slides = 1;
slideItems = 3;
constructor(private _searchResearchResultsService: SearchResearchResultsService) {
super()
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");
}
/* 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 {NoLoadPaging} from "../../../../searchPages/searchUtils/no-load-paging.module";
import {SearchResultsModule} from "../../../../searchPages/searchUtils/searchResults.module";
import {ResultPreviewModule} from "../../../../utils/result-preview/result-preview.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule, NoLoadPaging, SearchResultsModule
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule, NoLoadPaging, SearchResultsModule, ResultPreviewModule
],
providers:[PluginsService],
declarations: [PluginFeaturedDatasetsComponent],

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,6 +6,20 @@
</h2>
</div>
<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-item type="static">
<img class="uk-position-center uk-position-z-index" [src]="'https://' + (properties.environment == 'production'?'':'beta.')
@ -20,19 +34,6 @@
</ng-container>
</ng-container>
</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>
</div>
</div>

View File

@ -19,6 +19,12 @@ export class PluginSearchDepositLink extends PluginBaseInfo{
image:'https://' + (properties.environment == 'production'?'':'beta.')
+ '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({
selector: 'plugin-search-deposit-link',

View File

@ -95,29 +95,18 @@ export class PluginSearchDepositLinkFormComponent extends PluginBaseFormComponen
}
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.pluginObject.cardInfoArray[i].show = $event.value;
$event.value = this.pluginObject.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.pluginObject.cardInfoArray[i][$event.field] = $event.value;
$event.value = this.pluginObject.cardInfoArray;
this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
}
edit(i) {
this.selectedIndex = i;
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">
<h3 class="uk-margin-remove">
<icon [name]="'database'" [type]="'outlined'" [ratio]="3" class="uk-margin-small-right"></icon>
{{pluginObject.title}}
</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
</a>
</div>
<div *ngIf="!contentProviders || contentProviders.length == 0 " class="uk-text-muted uk-text-center">
No datasources available
</div>
<div uk-slider class="uk-slider">
<ul *ngIf="slides" class="uk-slider-items" uk-height-match="target: .uk-card; row: false">
<li *ngFor="let slide of [].constructor(slides); let i=index" class="uk-width-1-1 uk-padding">

View File

@ -5,7 +5,10 @@ import {ConfigurationService} from "../../../../utils/configuration/configuratio
import {CommunityService} from "../../../../connect/community/community.service";
export class PluginSuggestedRepositories extends PluginBaseInfo{
title:string ="Suggested repositories & journals";
compare(oldObject): any {
console.log()
return super.compare(oldObject);
}
}
@Component({
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 {PluginTemplate} from "../../../utils/entities/adminTool/pluginTemplate";
import {EnvProperties} from "../../../utils/properties/env-properties";
@ -15,7 +15,11 @@ export class PluginBaseInfo {
}else{
for (let attrKey of Object.keys(this)) {
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 {PluginSearchDepositLink} from "../components/search-deposit-link/plugin-search-deposit-link.component";
import {PluginOrganizations} from "../components/organizations/plugin-organizations.component";
import {PluginSuggestedRepositories} from "../components/suggested-repositories/plugin-suggested-repositories.component";
export class PluginUtils{
public attrTypeOptions: Option[] = [
@ -69,7 +70,7 @@ export class PluginUtils{
return (new PluginHowToUse()).compare(oldObject);
}
case 'suggested-repositories': {
return (new PluginBaseInfo()).compare(oldObject);
return (new PluginSuggestedRepositories()).compare(oldObject);
}
case 'featured-datasets': {
return (new PluginFeaturedDatasets()).compare(oldObject);