[plugins-functionality | WIP]

This commit is contained in:
argirok 2024-03-15 20:19:31 +02:00
parent e781dc8a51
commit 7d5b82e0dc
10 changed files with 120 additions and 71 deletions

View File

@ -38,9 +38,9 @@
</div> </div>
<div *ngIf="affiliations.length > 0 && communityFirstPage && !longView" class="uk-grid uk-grid-large" uk-grid> <div *ngIf="affiliations.length > 0 && communityFirstPage && !longView" class="uk-grid uk-grid-large" uk-grid>
<div class="uk-width-1-3@m"> <div class="uk-width-auto@m uk-width-1-1@s">
<h2 class="uk-h1"> <h2 class="uk-h1">
Supporting Organizations Supporting <br> Organizations
</h2> </h2>
<a class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default uk-margin-top" <a class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default uk-margin-top"
routerLinkActive="router-link-active" routerLink="/organizations"> routerLinkActive="router-link-active" routerLink="/organizations">
@ -49,7 +49,7 @@
</span> </span>
</a> </a>
</div> </div>
<div class="uk-width-2-3@m"> <div class="uk-width-expand@m uk-width-1-1@s">
<div class="uk-grid uk-grid-large uk-child-width-1-3@m uk-child-width-1-2@s supportingOrganizations" uk-grid> <div class="uk-grid uk-grid-large uk-child-width-1-3@m uk-child-width-1-2@s supportingOrganizations" uk-grid>
<div *ngFor="let affiliation of affiliations.slice(0,9);"> <div *ngFor="let affiliation of affiliations.slice(0,9);">
<a *ngIf="affiliation.website_url" target="_blank" [href]="affiliation.website_url | urlPrefix" class="uk-link-reset"> <a *ngIf="affiliation.website_url" target="_blank" [href]="affiliation.website_url | urlPrefix" class="uk-link-reset">

View File

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

View File

@ -4,6 +4,11 @@
{{pluginObject.title}} {{pluginObject.title}}
</h3> </h3>
<!-- <a [routerLink]="properties.searchLinkToAdvancedResults"
[queryParams]="{f0:'categoryid', fv0: 'enermaps::selection'}"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
Browse all
</a>-->
</div> </div>
<div> <div>
<div class="uk-margin-top uk-margin-medium-bottom uk-text-meta"> <div class="uk-margin-top uk-margin-medium-bottom uk-text-meta">
@ -12,19 +17,19 @@
{{pluginObject.textLine2}} {{pluginObject.textLine2}}
</div> </div>
</div> </div>
<div *ngIf="fetchFeaturedDatasets" uk-slider class="uk-slider"> <div *ngIf="results" class=" uk-card uk-card-default uk-padding-xsmall">
<ul *ngIf="slides" class="uk-slider-items" uk-height-match="target: .uk-card; row: false"> <div>
<li *ngFor="let slide of [].constructor(slides); let i=index" class="uk-width-1-1 uk-padding"> <paging-no-load [totalResults]="results.length" [currentPage]="page" (pageChange)="page = $event.value"
<div class="uk-grid uk-child-width-1-1" uk-grid uk-scrollspy="target: [uk-scrollspy-class]; cls: uk-animation-fade; repeat: true"> [size]="size"></paging-no-load>
<search-result [properties]="properties" </div>
[results]="fetchFeaturedDatasets.results" <div class="uk-margin-top">
[status]="fetchFeaturedDatasets.searchUtils.status" <ng-container *ngFor="let result of results.slice((page-1)*slideItems,(page)*slideItems)">
[type]="'dataset'" [showEnermaps]="true" > <result-preview [properties]="properties" [showOrganizations]="true"
</search-result> [showSubjects]="true" [result]="result" [showEnermaps]="true"
[isCard]="true" [showEntityActions]="false">
</result-preview>
</ng-container>
</div> </div>
</li>
</ul>
<ul class="uk-slider-nav uk-dotnav uk-flex-center uk-margin-medium-top"></ul>
</div> </div>

View File

@ -1,7 +1,9 @@
import {Component} from '@angular/core'; import {Component, SimpleChanges} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component"; import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
import {FetchResearchResults} from "../../../../utils/fetchEntitiesClasses/fetchResearchResults.class"; import {FetchResearchResults} from "../../../../utils/fetchEntitiesClasses/fetchResearchResults.class";
import {SearchResearchResultsService} from "../../../../services/searchResearchResults.service"; import {SearchResearchResultsService} from "../../../../services/searchResearchResults.service";
import {properties} from "../../../../../../environments/environment";
import {ResultPreview} from "../../../../utils/result-preview/result-preview";
export class PluginFeaturedDatasets extends PluginBaseInfo{ export class PluginFeaturedDatasets extends PluginBaseInfo{
title: string = "Featured datasets"; title: string = "Featured datasets";
@ -17,17 +19,53 @@ export class PluginFeaturedDatasets extends PluginBaseInfo{
export class PluginFeaturedDatasetsComponent extends PluginBaseComponent<PluginFeaturedDatasets> { export class PluginFeaturedDatasetsComponent extends PluginBaseComponent<PluginFeaturedDatasets> {
default = new PluginFeaturedDatasets(); default = new PluginFeaturedDatasets();
public fetchFeaturedDatasets: FetchResearchResults; // public fetchFeaturedDatasets: FetchResearchResults;
page = 1; page = 1;
size = 3; size = 3;
slides = 1; slides = 1;
slideItems = 3; slideItems = 3;
totalNum = null;
results: ResultPreview[] = null;
constructor(private _searchResearchResultsService: SearchResearchResultsService) { constructor(private _searchResearchResultsService: SearchResearchResultsService) {
super() super()
this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService); // this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService);
this.fetchFeaturedDatasets.searchUtils.size = this.size; // this.fetchFeaturedDatasets.searchUtils.size = this.size;
this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", "enermaps", 1, 50, this.properties, "enermaps::selection"); // this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", "enermaps", 1, 50, this.properties, "enermaps::selection");
} this.subscriptions.push(this._searchResearchResultsService.advancedSearchResults("dataset", null, 1, 50, null, properties, "&type=results&fq=communityid=enermaps&fq=categoryid=" + encodeURIComponent("enermaps::selection")).subscribe(
data => {
console.log(data);
this.totalNum = data[0];
this.results = data[1].map( res => {
let resultPreview = ResultPreview.searchResultConvert(res, 'dataset')
resultPreview.hostedBy_collectedFrom = null;
resultPreview.measure = null;
return resultPreview
}) ;
console.log(this.totalNum = data[0], this.results);
if(this.results && this.results.length>0) {
this.calculatePages();
}
},
err => {
}
));
}
/* ngOnChanges(changes: SimpleChanges) {
if(this.results) {
this.calculatePages();
}
}*/
calculatePages(){
this.slides = 1;
if (this.results.length > this.slideItems) {
this.slides = parseInt('' + (this.results.length / this.slideItems));
if(this.slides< (this.results.length / this.slideItems)){
this.slides++;
}
}
}
} }

View File

@ -12,10 +12,11 @@ import {PluginFeaturedDatasetsComponent} from './plugin-featured-datasets.compon
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"; import {ResultPreviewModule} from "../../../../utils/result-preview/result-preview.module";
import {PagingModule} from "../../../../utils/paging.module";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule, NoLoadPaging, SearchResultsModule, ResultPreviewModule CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, ResultPreviewModule, PagingModule
], ],
providers:[PluginsService], providers:[PluginsService],
declarations: [PluginFeaturedDatasetsComponent], declarations: [PluginFeaturedDatasetsComponent],

View File

@ -43,26 +43,22 @@ export class MonitorComponent extends MonitorIndicatorStakeholderBaseComponent {
super.ngOnInit(); super.ngOnInit();
this.requireLogin = false; this.requireLogin = false;
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(communityInfo => { this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(communityInfo => {
// this.subscriptions.push(this.http.get("https://services.openaire.eu/uoa-monitor-service/stakeholder/connect-template").
// subscribe(stakeholder => { if (communityInfo) {
// if (stakeholder) {
this.loading = true; this.loading = true;
this.stakeholder = PluginStats.getMockStakeholder(); this.stakeholder = PluginStats.getMockStakeholder();
this.stakeholder.index_id = communityInfo.communityId this.stakeholder.index_id = communityInfo.communityId
this.stakeholder.index_name = communityInfo.title; this.stakeholder.index_name = communityInfo.title;
this.stakeholder.index_shortName = communityInfo.shortTitle; this.stakeholder.index_shortName = communityInfo.shortTitle;
this.title = this.stakeholder.name; this.title = this.stakeholder.name;
this.description = this.stakeholder.name; this.description = this.stakeholder.name;
this.loading = true; this.loading = true;
this.activeTopic = null; this.activeTopic = null;
this.activeCategory = null; this.activeCategory = null;
this.activeSubCategory = null; this.activeSubCategory = null;
this.numberResults = new Map<string, number>(); this.numberResults = new Map<string, number>();
this.chartsActiveType = new Map<string, IndicatorPath>(); this.chartsActiveType = new Map<string, IndicatorPath>();
// this.subscriptions.push(this._route.queryParams.subscribe(queryParams => {
this.setView({}); this.setView({});
let ids = []; let ids = [];
for (let section of this.activeSubCategory.charts) { for (let section of this.activeSubCategory.charts) {
@ -70,10 +66,8 @@ export class MonitorComponent extends MonitorIndicatorStakeholderBaseComponent {
ids.push(indicator._id) ids.push(indicator._id)
} }
} }
// this.setMetadata();
// }
// })); }
})); }));
} }
@ -86,6 +80,7 @@ export class MonitorComponent extends MonitorIndicatorStakeholderBaseComponent {
return false; return false;
} }
public showIndicator(indicator): boolean { public showIndicator(indicator): boolean {
return this.pluginObject.disabledIndicators.indexOf(indicator._id) == -1; return this.pluginObject.disabledIndicators.indexOf(indicator._id) == -1;
} }

View File

@ -16,12 +16,7 @@ import {LoadingModule} from "../../../../utils/loading/loading.module";
@NgModule({ @NgModule({
imports: [CommonModule, RouterModule.forChild([ imports: [CommonModule, PageContentModule, SliderTabsModule, NumberRoundModule, IconsModule, ClickModule, RangeFilterModule, SearchFilterModule, SliderUtilsModule, LoadingModule],
{path: '', component: MonitorComponent},
{path: ':topic/', component: MonitorComponent},
{path: ':topic/:category', component: MonitorComponent},
{path: ':topic/:category/:subCategory', component: MonitorComponent}
]), PageContentModule, SliderTabsModule, NumberRoundModule, IconsModule, ClickModule, RangeFilterModule, SearchFilterModule, SliderUtilsModule, LoadingModule],
declarations: [MonitorComponent], declarations: [MonitorComponent],
exports: [ exports: [
MonitorComponent MonitorComponent

File diff suppressed because one or more lines are too long

View File

@ -50,6 +50,12 @@ export class PluginsService {
getPluginTemplatesByPage(api: string, pid: string, pageId: string) { getPluginTemplatesByPage(api: string, pid: string, pageId: string) {
return this.http.get<Array<PluginTemplate>>(api + properties.adminToolsPortalType + '/' + pid + '/pluginTemplates/page/' + pageId); return this.http.get<Array<PluginTemplate>>(api + properties.adminToolsPortalType + '/' + pid + '/pluginTemplates/page/' + pageId);
} }
getPluginsByPageRoute(api:string, pid:string, route:string){
return this.http.get<Array<Plugin>>(api + 'community/' +pid+'/plugins/page/route?route=' + route);
}
getPluginTemplatesByPageRoute(api:string, pid:string, route:string){
return this.http.get<Array<PluginTemplate>>(api + 'community/' +pid+'/pluginTemplates/page/route?route=' + route);
}
togglePlugin(id: string, status: boolean, api: string) { togglePlugin(id: string, status: boolean, api: string) {
return this.http.post(api + 'plugin/status/' + id, status, CustomOptions.getAuthOptionsWithBody()); return this.http.post(api + 'plugin/status/' + id, status, CustomOptions.getAuthOptionsWithBody());

View File

@ -32,7 +32,7 @@ export class SearchFieldsBase {
]; ];
public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "eoscifguidelines", "resultpublisher", public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "eoscifguidelines", "resultpublisher",
"resultbestaccessright", "community", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance", "resultbestaccessright", "community","conceptname", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance",
"relfunder", "relfunder",
"relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id",
"resultlanguagename", "relorganizationid", "pid", "relprojectid", "instancetypename", "fos", "sdg"]; "resultlanguagename", "relorganizationid", "pid", "relprojectid", "instancetypename", "fos", "sdg"];
@ -142,6 +142,14 @@ export class SearchFieldsBase {
equalityOperator: " exact ", equalityOperator: " exact ",
filterType: "checkbox" filterType: "checkbox"
}, },
["conceptname"]: {
name: "Subcommunity",
type: "keyword",
param: "conceptname",
operator: "sc",
equalityOperator: " exact ",
filterType: "checkbox"
},
["relproject"]: { ["relproject"]: {
name: "Project", name: "Project",
type: "refine", type: "refine",