enable impact factors for inspired-ris, show all featured datasets in enermaps featured tab

This commit is contained in:
argirok 2021-09-07 13:13:06 +03:00
parent 973ebda18e
commit d34fcacf1c
2 changed files with 64 additions and 62 deletions

View File

@ -368,7 +368,8 @@
resultType: 'publication', fetch: fetchPublications,
searchLinkToAdvancedPage: properties.searchLinkToAdvancedResults,
params: getParamsForSearchLink('publications'),
type: 'publication', typeName: 'publication', showImpactFactors:(community.communityId == 'elixir-gr')}">
type: 'publication', typeName: 'publication',
showImpactFactors:(community.communityId == 'elixir-gr' || community.communityId == 'inspired-ris' )}">
</ng-container>
</ng-template>
<ng-template #datasets_tab>
@ -376,7 +377,8 @@
resultType: 'dataset', fetch: fetchDatasets,
searchLinkToAdvancedPage: properties.searchLinkToAdvancedResults,
params: getParamsForSearchLink('datasets'),
type: 'dataset', typeName: 'research data', showImpactFactors:(community.communityId == 'elixir-gr')}">
type: 'dataset', typeName: 'research data',
showImpactFactors:(community.communityId == 'elixir-gr' || community.communityId == 'inspired-ris')}">
</ng-container>
</ng-template>
<ng-template #software_tab>
@ -384,7 +386,8 @@
resultType: 'software', fetch: fetchSoftware,
searchLinkToAdvancedPage: properties.searchLinkToAdvancedResults,
params: getParamsForSearchLink('software'),
type: 'software', typeName: 'software', showImpactFactors:(community.communityId == 'elixir-gr')}">
type: 'software', typeName: 'software',
showImpactFactors:(community.communityId == 'elixir-gr' || community.communityId == 'inspired-ris')}">
</ng-container>
</ng-template>
<ng-template #other_tab>
@ -392,7 +395,8 @@
resultType: 'other', fetch: fetchOrps,
searchLinkToAdvancedPage: properties.searchLinkToAdvancedResults,
params: getParamsForSearchLink('other'),
type: 'orp', typeName: 'other products', showImpactFactors:(community.communityId == 'elixir-gr')}">
type: 'orp', typeName: 'other products',
showImpactFactors:(community.communityId == 'elixir-gr' || community.communityId == 'inspired-ris')}">
</ng-container>
</ng-template>
<ng-template #analytics_tab>

View File

@ -14,14 +14,12 @@ import {StatisticsForDashboardComponent} from '../statistics/statistics.componen
import {StringUtils} from '../openaireLibrary/utils/string-utils.class';
import {PiwikHelper} from '../utils/piwikHelper';
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
import {SearchCommunityDataprovidersService} from "../openaireLibrary/connect/contentProviders/searchDataproviders.service";
import {SearchCommunityProjectsService} from "../openaireLibrary/connect/projects/searchProjects.service";
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class";
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
import {SubscribeComponent} from "../utils/subscribe/subscribe.component";
import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {FetchResearchResults} from "../openaireLibrary/utils/fetchEntitiesClasses/fetchResearchResults.class";
import {ErrorCodes} from "../openaireLibrary/utils/properties/errorCodes";
@ -37,16 +35,16 @@ import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperCla
export class CommunityComponent {
public url: string = null;
public projectTotal = null;
public contentProviderTotal = null;
public projectsCalculated: boolean = false;
public contentProvidersCalculated: boolean = false;
params: any = {};
properties: EnvProperties = properties;
public errorCodes: ErrorCodes = new ErrorCodes();
// Request results of each tab only the one time (first time tab is clicked)
private reloadPublications: boolean = true;
@ -54,7 +52,7 @@ export class CommunityComponent {
private reloadSoftware: boolean = true;
private reloadOrps: boolean = true;
private reloadFeaturedDatasets: boolean = true;
// Variables for publications, research data, projects, content providers, related content providers tabs
public fetchPublications: FetchResearchResults;
public fetchDatasets: FetchResearchResults;
@ -62,31 +60,31 @@ export class CommunityComponent {
public fetchOrps: FetchResearchResults;
public fetchFeaturedDatasets: FetchResearchResults;
public searchNumber: number = 5;
@Input() communityId = null;
public community = null;
public communityInfo = null;
public showLoading: boolean = true;
masterZenodoCommunity = null;
zenodoCommunityIdS = [];
showAllDescription = false;
public thresholdDescription: number = 500;
public descriptionDiff: number = 100;
subscribers: number = 0;
subs: Subscription[] = [];
@ViewChild(StatisticsForDashboardComponent) statistics: StatisticsForDashboardComponent = null;
public activeTab = "summary";
public show: string = 'overview';
public analyticsActiveTab: string = "";
public analyticsChecked: boolean = false;
searchLinkToResults: string = null;
searchLinkToProjects: string = null;
searchLinkToDataProviders: string = null;
searchLinkToAdvancedResults: string = null;
@ -123,14 +121,14 @@ export class CommunityComponent {
private _zenodoCommunitieService: ZenodoCommunitiesService,
private seoService: SEOService,
private userManagementService: UserManagementService) {
var description = "OpenAIRE - Connect, Community Dashboard, research community";
var title = "OpenAIRE - Connect";
this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'");
this._meta.updateTag({content: title}, "property='og:title'");
this._title.setTitle(title);
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
@ -138,7 +136,7 @@ export class CommunityComponent {
this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService);
}
public ngOnInit() {
this.searchLinkToResults = this.properties.searchLinkToResults;
this.searchLinkToProjects = this.properties.searchLinkToProjects;
@ -159,7 +157,7 @@ export class CommunityComponent {
if (community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
this.thresholdDescription = community.description.length;
}
if (this.properties.environment == "development") {
this.params = {communityId: community.communityId};
}
@ -190,7 +188,7 @@ export class CommunityComponent {
));
}
}));
this.countResearchResults("publication");
this.countResearchResults("dataset");
this.countResearchResults("software");
@ -198,7 +196,7 @@ export class CommunityComponent {
if(this.communityId == "enermaps"){
this.countResearchResults("dataset", "enermaps::selection" );
}
this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe(
projectTotal => {
this.projectTotal = projectTotal;
@ -210,7 +208,7 @@ export class CommunityComponent {
this.projectsCalculated = true;
}
));
this.subs.push(this._searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.communityId).subscribe(
contentProviderTotal => {
this.contentProviderTotal = contentProviderTotal;
@ -233,10 +231,10 @@ export class CommunityComponent {
}
));
}
private searchPublications(page: number, size: number) {
this.setActiveTab("publication");
if (this.reloadPublications &&
(this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
(this.fetchPublications.searchUtils.status == this.errorCodes.DONE && this.fetchPublications.searchUtils.totalResults > 0)
@ -246,10 +244,10 @@ export class CommunityComponent {
}
this.reloadPublications = false;
}
private searchDatasets(page: number, size: number) {
this.setActiveTab("dataset");
if (this.reloadDatasets &&
(this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
(this.fetchDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchDatasets.searchUtils.totalResults > 0)
@ -259,10 +257,10 @@ export class CommunityComponent {
}
this.reloadDatasets = false;
}
private searchSoftware(page: number, size: number) {
this.setActiveTab("software");
if (this.reloadSoftware &&
(this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
(this.fetchSoftware.searchUtils.status == this.errorCodes.DONE && this.fetchSoftware.searchUtils.totalResults > 0)
@ -272,10 +270,10 @@ export class CommunityComponent {
}
this.reloadSoftware = false;
}
private searchOrps(page: number, size: number) {
this.setActiveTab("other");
if (this.reloadOrps &&
(this.fetchOrps.searchUtils.status == this.errorCodes.LOADING ||
(this.fetchOrps.searchUtils.status == this.errorCodes.DONE && this.fetchOrps.searchUtils.totalResults > 0)
@ -296,10 +294,10 @@ export class CommunityComponent {
}
this.reloadFeaturedDatasets = false;
}
private countResearchResults(resultType: string, contextId = null) {
let fetch: FetchResearchResults;
if (resultType == "publication") {
fetch = this.fetchPublications;
} else if (resultType == "dataset" && !contextId) {
@ -315,7 +313,7 @@ export class CommunityComponent {
}
fetch.getNumForCommunity(resultType, this.communityId, this.properties, contextId);
}
public ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
@ -326,19 +324,19 @@ export class CommunityComponent {
this.fetchSoftware.clearSubscriptions();
this.fetchFeaturedDatasets.clearSubscriptions();
}
isEntityEnabled(entity: string) {
return this.communityInfo.entities.some(x => x['pid'] == entity && x['isEnabled'] === true);
}
isRouteEnabled(route: string) {
return this.communityInfo.pages.some(x => x['route'] == route && x['isEnabled'] === true);
}
showInvite() {
return this.isManager();
}
isManager() {
if (!this.user) {
return false;
@ -350,11 +348,11 @@ export class CommunityComponent {
}
return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || index != -1;
}
private handleError(message: string, error) {
console.error("Community (component): " + message, error);
}
getSearchPlaceHolder() {
var entities = [];
if (this.isEntityEnabled("publication")) {
@ -371,7 +369,7 @@ export class CommunityComponent {
}
return "Search" + ((entities.length > 0) ? (" for " + entities.join(', ') + "...") : "");
}
countOtherGraphs() {
var count = 0;
if (this.statistics && this.statistics.allowedEntities) {
@ -383,11 +381,11 @@ export class CommunityComponent {
}
return count;
}
createParams(param) {
return StringUtils.quote(StringUtils.URIEncode(param));
}
private setActiveTab(entityType: string) {
if (entityType == "other") {
this.activeTab = "orp";
@ -395,7 +393,7 @@ export class CommunityComponent {
this.activeTab = entityType;
}
}
public getParamsForSearchLink(type: string = "") {
if (type) {
return this.routerHelper.createQueryParams(['type', 'qf', 'sortBy'], [type, 'false', 'resultdateofacceptance,descending']);
@ -403,7 +401,7 @@ export class CommunityComponent {
return {};
}
}
private getEntityName(entityType: string, plural: boolean, full: boolean): string {
if (entityType == "publication") {
return "publication" + (plural ? "s" : "");
@ -415,10 +413,10 @@ export class CommunityComponent {
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
}
}
public buildProjectsAndContentProvidesTooltip(): string {
let tooltipContent: string = "<div class='uk-margin'>";
if (this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)) {
tooltipContent += "<span class='uk-text-bold'>Projects</span>";
}
@ -429,22 +427,22 @@ export class CommunityComponent {
if (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders)) {
tooltipContent += "<span class='uk-text-bold'>Content Providers</span>";
}
tooltipContent += " have been selected as relevant for your community by the gateway curators.";
tooltipContent += "</div>";
return tooltipContent;
}
public buildZenodoCommunitiesTooltip(): string {
let tooltipContent: string = "<div class='uk-margin'>";
tooltipContent += "<span class='uk-text-bold'>Zenodo</span> is a catch-all repository for OpenAIRE.";
tooltipContent += "<div class='uk-margin-small-top'>A <span class='uk-text-bold'>Zenodo Community</span> is created and curated by Zenodo users.</div>";
tooltipContent += "</div>";
return tooltipContent;
}
entityChanged($event) {
this.selectedEntity = $event.entity;
this.selectedEntitySimpleUrl = $event.simpleUrl;
@ -459,7 +457,7 @@ export class CommunityComponent {
this.placeholderText = "Search community content";
}
}
goTo(simple: boolean) {
let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl;
let parameterNames = [];
@ -478,11 +476,11 @@ export class CommunityComponent {
}
this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
}
public countSubscribersEvent($event) {
this.subscribers = $event.value;
}
public checkStatistics(type: string) {
return !!(this.isEntityEnabled(type)
&& this.statistics && this.statistics.statisticsDisplay && this.statistics.statisticsDisplay.isActive
@ -498,7 +496,7 @@ export class CommunityComponent {
&& this.statistics.allowedChartsMode['showInMonitor'][type]
&& this.statistics.allowedChartsMode['showInMonitor'][type].length > 0)));
}
public initializeAnalyticsActiveTab() {
if (!this.analyticsChecked) {
if (this.checkStatistics("publication")) {
@ -512,12 +510,12 @@ export class CommunityComponent {
}
}
}
public showAnalyticsTab() {
this.initializeAnalyticsActiveTab();
return this.analyticsActiveTab;
}
public onSelectActiveTab(activeTabId) {
if (this.activeTab != "activaTabId") { // tab really changed
if (activeTabId == 'summary') {
@ -543,7 +541,7 @@ export class CommunityComponent {
this.activeTab = 'mapping';
} else if (activeTabId == 'enermaps') {
this.show = 'enermaps';
this.searchFeaturedDatasets(1, this.fetchFeaturedDatasets.searchUtils.totalResults < 20?this.fetchFeaturedDatasets.searchUtils.totalResults:20);
this.searchFeaturedDatasets(1, this.fetchFeaturedDatasets.searchUtils.totalResults);
}
}
}