Merge remote-tracking branch 'origin/develop' into plugins-functionality

# Conflicts:
#	utils/properties/environments/environment.ts
This commit is contained in:
argirok 2024-06-10 09:11:08 +03:00
commit 4fffa9f06c
35 changed files with 483 additions and 392 deletions

View File

@ -129,7 +129,7 @@ export class ClaimContextSearchFormComponent {
} }
select(communityId, communityLabel) { select(communityId, communityLabel) {
console.log("SELECT", communityId) // console.log("SELECT", communityId)
this.selectedCommunityId = communityId; this.selectedCommunityId = communityId;
this.selectedCommunityLabel = communityLabel; this.selectedCommunityLabel = communityLabel;
this.getCategories(); this.getCategories();

View File

@ -202,6 +202,6 @@ export class ShowOptions {
options.push({value: 'context',label: OpenaireEntities.COMMUNITIES}) options.push({value: 'context',label: OpenaireEntities.COMMUNITIES})
} }
this.selectOptions = options; this.selectOptions = options;
console.log(options, claimProperties.SELECT_ENTITIES.projects) // console.log(options, claimProperties.SELECT_ENTITIES.projects)
} }
} }

View File

@ -329,7 +329,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
delete() { delete() {
let claimsToBeDeleted = ((this.index != null) ? [this.claims[this.index].id] : this.selected.map(claim => claim.id)); let claimsToBeDeleted = ((this.index != null) ? [this.claims[this.index].id] : this.selected.map(claim => claim.id));
console.log(claimsToBeDeleted); // console.log(claimsToBeDeleted);
this.subscriptions.push(this._claimService.deleteBulk(claimsToBeDeleted, this.properties.claimsAPIURL).subscribe( this.subscriptions.push(this._claimService.deleteBulk(claimsToBeDeleted, this.properties.claimsAPIURL).subscribe(
res => { res => {
if (this.index != null) { if (this.index != null) {

View File

@ -108,7 +108,6 @@ export class SearchOrcidService {
static parseOrcidAuthor(data: any, authorIds: string[], authors, addId): any { static parseOrcidAuthor(data: any, authorIds: string[], authors, addId): any {
console.log(data)
if (data[2] != null) { if (data[2] != null) {
if (addId) { if (addId) {
authorIds.push(data[2].path); authorIds.push(data[2].path);
@ -128,9 +127,7 @@ export class SearchOrcidService {
if (data[3] != null) { if (data[3] != null) {
author['institution'] = data[3]; author['institution'] = data[3];
} }
console.log(author['institution'])
authors.push(author); authors.push(author);
return true; return true;
} }
return false; return false;

View File

@ -1,3 +1,4 @@
<loading *ngIf="validInput === null" [full]="true" class="uk-position-center"></loading>
<linking-generic *ngIf="validInput" [localStoragePrefix]="localStoragePrefix" [results]="results" [sources]="sources" <linking-generic *ngIf="validInput" [localStoragePrefix]="localStoragePrefix" [results]="results" [sources]="sources"
[communityId]="communityId" [inlineEntity]="inlineEntity" [showOptions]="showOptions" [communityId]="communityId" [inlineEntity]="inlineEntity" [showOptions]="showOptions"
pageTitle="Direct Linking" [claimsProperties]="claimsProperties"> pageTitle="Direct Linking" [claimsProperties]="claimsProperties">

View File

@ -8,12 +8,13 @@ import {SearchResearchResultsServiceModule} from '../../services/searchResearchR
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import {LinkingGenericModule} from '../linking/linkingGeneric.module'; import {LinkingGenericModule} from '../linking/linkingGeneric.module';
import {LoadingModule} from "../../utils/loading/loading.module";
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, SharedModule,
EntitySearchServiceModule, SearchResearchResultsServiceModule, EntitySearchServiceModule, SearchResearchResultsServiceModule,
Schema2jsonldModule, SEOServiceModule, LinkingGenericModule Schema2jsonldModule, SEOServiceModule, LinkingGenericModule, LoadingModule
], ],
providers:[], providers:[],
declarations: [ declarations: [

View File

@ -133,11 +133,11 @@ export class BulkClaimComponent {
} }
}); });
} }
upload() { upload() {
this.enableUpload = false; this.enableUpload = false;
this.showReport = false; this.showReport = false;
this.errorMessage = ""; this.errorMessage = "";
console.log(this.filesToUpload);
if (this.filesToUpload.length == 0) { if (this.filesToUpload.length == 0) {
this.errorMessage = "There is no selected file to upload."; this.errorMessage = "There is no selected file to upload.";
return; return;

View File

@ -232,7 +232,7 @@ export class ClaimInsertComponent {
data => { data => {
this.feedRecordsJob = data.data; this.feedRecordsJob = data.data;
this.records2Insert = directclaims.length; this.records2Insert = directclaims.length;
console.log(data); // console.log(data);
// this.insertedRecords = data.insertedIds; // this.insertedRecords = data.insertedIds;
// //
// this.errorInRecords = data.errorInClaims; // this.errorInRecords = data.errorInClaims;

View File

@ -134,42 +134,6 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy {
this.sticky.footer = UIkit.sticky(this.sticky_footer.nativeElement, {end: true, offset: footer_offset}); this.sticky.footer = UIkit.sticky(this.sticky_footer.nativeElement, {end: true, offset: footer_offset});
} }
/**
* @deprecated
*
* Should be smooth
*
* */
private observeBottom() {
let bottom = document.getElementById('bottom');
if (bottom) {
let bottomObs = new IntersectionObserver(entries => {
entries.forEach(entry => {
this.shouldSticky = !entry.isIntersecting;
})
});
this.subscriptions.push(bottomObs);
bottomObs.observe(bottom);
}
}
/**
* @deprecated
* */
private observeHeader() {
if (this.header) {
let headerObs = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.boundingClientRect.height > 0) {
this.layoutService.setReplaceHeader(!entry.isIntersecting);
}
})
});
this.subscriptions.push(headerObs);
headerObs.observe(this.header.nativeElement);
}
}
private observeStickyFooter() { private observeStickyFooter() {
if (this.sticky_footer) { if (this.sticky_footer) {
let resizeObs = new ResizeObserver(entries => { let resizeObs = new ResizeObserver(entries => {

View File

@ -1,4 +1,4 @@
import {Injectable} from "@angular/core"; import {AfterViewInit, Injectable} from "@angular/core";
import {BehaviorSubject, Observable, Subscriber} from "rxjs"; import {BehaviorSubject, Observable, Subscriber} from "rxjs";
import {ActivationStart, Router} from "@angular/router"; import {ActivationStart, Router} from "@angular/router";
import {Icon} from "../../../sharedComponents/menu"; import {Icon} from "../../../sharedComponents/menu";
@ -92,6 +92,7 @@ export class LayoutService {
* Display help pop-up on non-admin pages. (default true for the rest of the pages) * Display help pop-up on non-admin pages. (default true for the rest of the pages)
* */ * */
private hasHelpPopUpSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true); private hasHelpPopUpSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
private isBottomIntersectingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
private subscriptions: any[] = []; private subscriptions: any[] = [];
ngOnDestroy() { ngOnDestroy() {
@ -119,6 +120,20 @@ export class LayoutService {
this.subscriptions.push(resizeObs); this.subscriptions.push(resizeObs);
resizeObs.observe(document.documentElement); resizeObs.observe(document.documentElement);
} }
if(typeof document !== "undefined") {
setTimeout(() => {
let bottom = document.getElementById('bottom');
if (bottom) {
let bottomObs = new IntersectionObserver(entries => {
entries.forEach(entry => {
this.isBottomIntersectingSubject.next(entry.isIntersecting);
})
});
this.subscriptions.push(bottomObs);
bottomObs.observe(bottom);
}
}, 500)
}
} }
constructor(private router: Router) { constructor(private router: Router) {
@ -355,4 +370,8 @@ export class LayoutService {
setHasHelpPopUp(value: boolean) { setHasHelpPopUp(value: boolean) {
this.hasHelpPopUpSubject.next(value); this.hasHelpPopUpSubject.next(value);
} }
get isBottomIntersecting(): Observable<boolean> {
return this.isBottomIntersectingSubject.asObservable();
}
} }

View File

@ -40,7 +40,7 @@
<a [routerLink]="getItemRoute(item)" [title]="item.title" (click)="item.items.length === 0?closeOffcanvas():null" <a [routerLink]="getItemRoute(item)" [title]="item.title" (click)="item.items.length === 0?closeOffcanvas():null"
[queryParams]="item.route?item.params:null" [queryParamsHandling]="item.route?queryParamsHandling:null" class="uk-flex uk-flex-middle"> [queryParams]="item.route?item.params:null" [queryParamsHandling]="item.route?queryParamsHandling:null" class="uk-flex uk-flex-middle">
<div *ngIf="item.icon && (item.icon.svg || item.icon.name)" class="uk-width-auto"> <div *ngIf="item.icon && (item.icon.svg || item.icon.name)" class="uk-width-auto">
<icon class="menu-icon" [customClass]="item.icon.class" [name]="item.icon.name" ratio="0.9" [svg]="item.icon.svg" [flex]="true"></icon> <icon class="menu-icon" [customClass]="item.icon.class" [name]="item.icon.name" [ratio]="item.icon.ratio?item.icon.ratio:0.9" [svg]="item.icon.svg" [flex]="true"></icon>
</div> </div>
<span [class.hide-on-close]="item.icon" class="uk-width-expand@l uk-text-truncate uk-margin-small-left">{{item.title}}</span> <span [class.hide-on-close]="item.icon" class="uk-width-expand@l uk-text-truncate uk-margin-small-left">{{item.title}}</span>
<span *ngIf="item.items.length > 0" class="uk-nav-parent-icon hide-on-close"></span> <span *ngIf="item.items.length > 0" class="uk-nav-parent-icon hide-on-close"></span>

View File

@ -2,7 +2,9 @@
<schema2jsonld *ngIf="dataProviderInfo" <schema2jsonld *ngIf="dataProviderInfo"
[data]=dataProviderInfo [URL]="canonicalUrl" type="datasource" [data]=dataProviderInfo [URL]="canonicalUrl" type="datasource"
[otherURL]="(dataProviderInfo.provenance)?provenanceUrls:null"></schema2jsonld> [otherURL]="(dataProviderInfo.provenance)?provenanceUrls:null"></schema2jsonld>
<div *ngIf="dataProviderInfo && !dataProviderInfo.belongsTo && !isBottomIntersecting" [innerHTML]="dataProviderInfo.message"
class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;">
</div>
<!-- Desktop view --> <!-- Desktop view -->
<div class="uk-visible@m landing uk-section uk-padding-remove tm-middle"> <div class="uk-visible@m landing uk-section uk-padding-remove tm-middle">
<div *ngIf="!isMobile" class="tm-main"> <div *ngIf="!isMobile" class="tm-main">

View File

@ -148,14 +148,13 @@ export class DataProviderComponent {
@ViewChild("descriptionDiv") descriptionDiv: ElementRef; @ViewChild("descriptionDiv") descriptionDiv: ElementRef;
@ViewChild('descriptionModal') descriptionModal; @ViewChild('descriptionModal') descriptionModal;
// public shouldSticky: boolean = true;
subscriptions = []; subscriptions = [];
private sub: Subscription; private sub: Subscription;
properties: EnvProperties = properties; properties: EnvProperties = properties;
public openaireEntities = OpenaireEntities; public openaireEntities = OpenaireEntities;
public isMobile: boolean = false; public isMobile: boolean = false;
public isBottomIntersecting: boolean = false;
public mobileContent: "info" | "metrics" | "actions" = "info"; public mobileContent: "info" | "metrics" | "actions" = "info";
public tabMobile: string = ""; public tabMobile: string = "";
public viewAllMobile: string = ""; public viewAllMobile: string = "";
@ -198,6 +197,11 @@ export class DataProviderComponent {
ngOnInit() { ngOnInit() {
this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => {
this.isMobile = isMobile; this.isMobile = isMobile;
this.cdr.detectChanges();
}));
this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => {
this.isBottomIntersecting = isBottomIntersecting;
this.cdr.detectChanges();
})); }));
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => { this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
@ -261,16 +265,6 @@ export class DataProviderComponent {
} else { } else {
this.offset = 0; this.offset = 0;
} }
// let bottom = document.getElementById('bottom');
// if(bottom) {
// let observer = new IntersectionObserver(entries => {
// entries.forEach(entry => {
// this.shouldSticky = !entry.isIntersecting;
// })
// });
// this.subscriptions.push(observer);
// observer.observe(bottom);
// }
if(this.graph_and_feedback) { if(this.graph_and_feedback) {
this.observeGraphAndFeedback(); this.observeGraphAndFeedback();
} }
@ -389,6 +383,7 @@ export class DataProviderComponent {
this.dataProviderInfo = data; this.dataProviderInfo = data;
this.getProvenanceUrls(); this.getProvenanceUrls();
this.datasourceId = this.dataProviderInfo.objIdentifier; this.datasourceId = this.dataProviderInfo.objIdentifier;
this.dataProviderInfo.setBelongsTo(this.datasourceId);
let pid:Identifier = Identifier.getPIDFromIdentifiers(this.dataProviderInfo.identifiers); let pid:Identifier = Identifier.getPIDFromIdentifiers(this.dataProviderInfo.identifiers);
this.canonicalUrl = this.properties.domain+ properties.baseLink + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + encodeURIComponent(pid.id)): this.canonicalUrl = this.properties.domain+ properties.baseLink + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + encodeURIComponent(pid.id)):
(this.linkToLandingPage + this.dataProviderInfo.relcanId)); (this.linkToLandingPage + this.dataProviderInfo.relcanId));

View File

@ -3,7 +3,9 @@
[URL]="properties.domain + properties.baseLink+this.properties.searchLinkToOrganization+organizationInfo.relcanId" [URL]="properties.domain + properties.baseLink+this.properties.searchLinkToOrganization+organizationInfo.relcanId"
type="organization"> type="organization">
</schema2jsonld> </schema2jsonld>
<div *ngIf="organizationInfo && !organizationInfo.belongsTo && !isBottomIntersecting" [innerHTML]="organizationInfo.message"
class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;">
</div>
<!-- Desktop view --> <!-- Desktop view -->
<div id="tm-main" class="uk-visible@m landing uk-section uk-padding-remove tm-middle"> <div id="tm-main" class="uk-visible@m landing uk-section uk-padding-remove tm-middle">
<div *ngIf="!isMobile" class="tm-main"> <div *ngIf="!isMobile" class="tm-main">

View File

@ -115,8 +115,6 @@ export class OrganizationComponent {
public graph_height: number = 0; public graph_height: number = 0;
@ViewChild("graph_and_feedback") graph_and_feedback; @ViewChild("graph_and_feedback") graph_and_feedback;
// public shouldSticky: boolean = true;
subscriptions = []; subscriptions = [];
innerReportSubscriptions = []; innerReportSubscriptions = [];
properties: EnvProperties; properties: EnvProperties;
@ -131,6 +129,7 @@ export class OrganizationComponent {
public deleteByInferenceOpened: boolean = false; public deleteByInferenceOpened: boolean = false;
public isMobile: boolean = false; public isMobile: boolean = false;
public isBottomIntersecting: boolean = false;
public mobileContent: "info" | "actions" = "info"; public mobileContent: "info" | "actions" = "info";
public viewAllMobile: string = ""; public viewAllMobile: string = "";
@ -162,6 +161,11 @@ export class OrganizationComponent {
ngOnInit() { ngOnInit() {
this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => {
this.isMobile = isMobile; this.isMobile = isMobile;
this.cdr.detectChanges();
}));
this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => {
this.isBottomIntersecting = isBottomIntersecting;
this.cdr.detectChanges();
})); }));
this.properties = properties; this.properties = properties;
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
@ -218,16 +222,6 @@ export class OrganizationComponent {
} else { } else {
this.offset = 0; this.offset = 0;
} }
// let bottom = document.getElementById('bottom');
// if(bottom) {
// let observer = new IntersectionObserver(entries => {
// entries.forEach(entry => {
// this.shouldSticky = !entry.isIntersecting;
// })
// });
// this.subscriptions.push(observer);
// observer.observe(bottom);
// }
if(this.graph_and_feedback) { if(this.graph_and_feedback) {
this.observeGraphAndFeedback(); this.observeGraphAndFeedback();
} }
@ -401,6 +395,7 @@ export class OrganizationComponent {
} else { } else {
this.organizationInfo = data; this.organizationInfo = data;
this.organizationId = this.organizationInfo.objIdentifier; // reset in case the parameter was a canonical url. The related queries and reports should have the dedup id this.organizationId = this.organizationInfo.objIdentifier; // reset in case the parameter was a canonical url. The related queries and reports should have the dedup id
this.organizationInfo.setBelongsTo(this.organizationId);
this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))'; this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))';
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToOrganization + this.organizationInfo.relcanId); this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToOrganization + this.organizationInfo.relcanId);
this.updateTitle((this.organizationInfo.title.name?this.organizationInfo.title.name:(this.organizationInfo.name?this.organizationInfo.name:'No title available'))); this.updateTitle((this.organizationInfo.title.name?this.organizationInfo.title.name:(this.organizationInfo.name?this.organizationInfo.name:'No title available')));

View File

@ -2,7 +2,9 @@
<schema2jsonld *ngIf="projectInfo" <schema2jsonld *ngIf="projectInfo"
[data]=projectInfo [URL]="properties.domain+properties.baseLink+properties.searchLinkToProject+projectId" [data]=projectInfo [URL]="properties.domain+properties.baseLink+properties.searchLinkToProject+projectId"
type="project"></schema2jsonld> type="project"></schema2jsonld>
<div *ngIf="projectInfo && !projectInfo.belongsTo && !isBottomIntersecting" [innerHTML]="projectInfo.message"
class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;">
</div>
<!-- Desktop view --> <!-- Desktop view -->
<div class=" uk-visible@m landing uk-section uk-padding-remove tm-middle"> <div class=" uk-visible@m landing uk-section uk-padding-remove tm-middle">
<div *ngIf="!isMobile" class="tm-main"> <div *ngIf="!isMobile" class="tm-main">

View File

@ -169,14 +169,13 @@ export class ProjectComponent {
@ViewChild("descriptionDiv") descriptionDiv: ElementRef; @ViewChild("descriptionDiv") descriptionDiv: ElementRef;
@ViewChild('descriptionModal') descriptionModal; @ViewChild('descriptionModal') descriptionModal;
// public shouldSticky: boolean = true;
subscriptions = []; subscriptions = [];
private sub: Subscription; private sub: Subscription;
properties: EnvProperties; properties: EnvProperties;
public openaireEntities = OpenaireEntities; public openaireEntities = OpenaireEntities;
public isMobile: boolean = false; public isMobile: boolean = false;
public isBottomIntersecting: boolean = false;
public mobileContent: "info" | "metrics" | "actions" = "info"; public mobileContent: "info" | "metrics" | "actions" = "info";
public tabMobile: string = ""; public tabMobile: string = "";
public viewAllMobile: string = ""; public viewAllMobile: string = "";
@ -209,6 +208,11 @@ export class ProjectComponent {
ngOnInit() { ngOnInit() {
this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => {
this.isMobile = isMobile; this.isMobile = isMobile;
this.cdr.detectChanges();
}));
this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => {
this.isBottomIntersecting = isBottomIntersecting;
this.cdr.detectChanges();
})); }));
this.properties = properties; this.properties = properties;
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
@ -278,16 +282,6 @@ export class ProjectComponent {
} else { } else {
this.offset = 0; this.offset = 0;
} }
// let bottom = document.getElementById('bottom');
// if(bottom) {
// let observer = new IntersectionObserver(entries => {
// entries.forEach(entry => {
// this.shouldSticky = !entry.isIntersecting;
// })
// });
// this.subscriptions.push(observer);
// observer.observe(bottom);
// }
if(this.graph_and_feedback) { if(this.graph_and_feedback) {
this.observeGraphAndFeedback(); this.observeGraphAndFeedback();
} }
@ -466,6 +460,7 @@ export class ProjectComponent {
this.subscriptions.push(this._projectService.getProjectInfo(id, this.properties).subscribe( this.subscriptions.push(this._projectService.getProjectInfo(id, this.properties).subscribe(
data => { data => {
this.projectInfo = data; this.projectInfo = data;
this.projectInfo.setBelongsTo(id);
this.projectInfo.id = this.projectId; this.projectInfo.id = this.projectId;
this.actionsAfterGettingProjectInfo(); this.actionsAfterGettingProjectInfo();

View File

@ -4,254 +4,267 @@ import {throwError} from 'rxjs';
import {ProjectInfo} from '../../utils/entities/projectInfo'; import {ProjectInfo} from '../../utils/entities/projectInfo';
import {EnvProperties} from '../../utils/properties/env-properties';
import{EnvProperties} from '../../utils/properties/env-properties'; import {ParsingFunctions} from '../landing-utils/parsingFunctions.class';
import { ParsingFunctions } from '../landing-utils/parsingFunctions.class';
import {map} from "rxjs/operators"; import {map} from "rxjs/operators";
import {StringUtils} from "../../utils/string-utils.class"; import {StringUtils} from "../../utils/string-utils.class";
@Injectable() @Injectable()
export class ProjectService { export class ProjectService {
constructor(private http: HttpClient ) { constructor(private http: HttpClient) {
this.parsingFunctions = new ParsingFunctions(); this.parsingFunctions = new ParsingFunctions();
}
public parsingFunctions: ParsingFunctions;
projectInfo: ProjectInfo;
getProjectInfo(id: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'projects/' + id + "?format=json";
let key = url;
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => [res,
res['fundingtree'],
res['rels']['rel']]))
.pipe(map(res => this.parseProjectInfo(res, properties)));
}
getProjectInfoByGrantId(grant: string, funder: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'resources?query=(oaftype exact project)' +
'and (projectcode_nt exact "' + grant + '" ) and (fundershortname exact ' + '"' + funder + '"' + ')' + "&format=json&size=1";
let key = url;
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['results'][0]))
.pipe(map(res => [res['result']['metadata']['oaf:entity']['oaf:project'], res['result']['header']['dri:objIdentifier']]))
.pipe(map(res => [res[0],
res[0]['fundingtree'],
res[0]['rels']['rel'], res[1]]))
.pipe(map(res => this.parseProjectInfo(res, properties)));
}
/*
get project strtDate and endDate
*/
getProjectDates(id: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'projects/' + id + "?format=json";
let key = url + '_projectDates';
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => [res,
res['fundingtree'],
res['rels']['rel']]))
.pipe(map(res => this.parseProjectDates(id, res)))
}
getHTMLInfo(id: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'projects/' + id + "?format=json";
let key = url;
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => this.parseHTMLInfo(res)));
}
private handleError(error: HttpErrorResponse) {
console.log(error);
return throwError(error || 'Server error');
}
parseHTMLInfo(data: any): any {
let htmlInfo: { "title": string, "acronym": string, "callIdentifier": string };
if (data != null) {
htmlInfo = {"title": data.title, "acronym": data.acronym, "callIdentifier": data.callidentifier};
}
return htmlInfo;
}
parseProjectInfo(data: any, properties: EnvProperties): any {
this.projectInfo = new ProjectInfo();
this.projectInfo.funding = {
funderName: "", funderShortName: "", funderJurisdiction: "", code: "", callIdentifier: "",
fundingStream: "", budget: "", contribution: "", currency: ""
};
// ['result']['header']['dri:objIdentifier']
if (data[3] != null) {
this.projectInfo.id = data[3];
} }
public parsingFunctions: ParsingFunctions; // ['result']['metadata']['oaf:entity']['oaf:project']['fundingtree']
projectInfo: ProjectInfo; if (data[1] != null) {
let funding: { "funderName": string, "funderShortname": string, "funderJurisdiction": string, "stream": string };
getProjectInfo (id: string, properties:EnvProperties):any { funding = this.parsingFunctions.parseFundingTrees(data[1]);
if (funding.funderName) {
let url = properties.searchAPIURLLAst + 'projects/'+id+"?format=json"; this.projectInfo.funding.funderName = funding.funderName;
let key = url;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => [res,
res['fundingtree'],
res['rels']['rel']]))
.pipe(map(res => this.parseProjectInfo(res, properties)));
}
getProjectInfoByGrantId (grant: string, funder:string, properties:EnvProperties):any {
let url =properties.searchAPIURLLAst+ 'resources?query=(oaftype exact project)'+
'and (projectcode_nt exact "'+grant+'" ) and (fundershortname exact '+'"'+funder+ '"'+')'+"&format=json&size=1";
let key = url;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['results'][0]))
.pipe(map(res => [res['result']['metadata']['oaf:entity']['oaf:project'],res['result']['header']['dri:objIdentifier']]))
.pipe(map(res => [res[0],
res[0]['fundingtree'],
res[0]['rels']['rel'],res[1]]))
.pipe(map(res => this.parseProjectInfo(res, properties)));
}
/*
get project strtDate and endDate
*/
getProjectDates (id: string, properties:EnvProperties):any {
let url = properties.searchAPIURLLAst+'projects/'+id+"?format=json";
let key = url+'_projectDates';
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => [res,
res['fundingtree'],
res['rels']['rel']]))
.pipe(map(res => this.parseProjectDates(id,res)))
}
getHTMLInfo(id: string, properties:EnvProperties): any {
let url = properties.searchAPIURLLAst + 'projects/'+id+"?format=json";
let key = url;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => this.parseHTMLInfo(res)));
}
private handleError (error: HttpErrorResponse) {
console.log(error);
return throwError(error || 'Server error');
}
parseHTMLInfo (data: any):any {
let htmlInfo: {"title": string, "acronym": string, "callIdentifier": string};
if(data != null) {
htmlInfo = {"title": data.title, "acronym": data.acronym, "callIdentifier": data.callidentifier};
}
return htmlInfo;
}
parseProjectInfo (data: any, properties:EnvProperties):any {
this.projectInfo = new ProjectInfo();
this.projectInfo.funding = {funderName: "", funderShortName: "", code: "", callIdentifier: "",
fundingStream: "", budget: "", contribution: "", currency: ""};
// ['result']['header']['dri:objIdentifier']
if(data[3] != null) {
this.projectInfo.id = data[3];
}
// ['result']['metadata']['oaf:entity']['oaf:project']['fundingtree']
if(data[1] != null) {
let funding: {"funderName": string, "funderShortname": string, "stream": string};
funding = this.parsingFunctions.parseFundingTrees(data[1]);
if(funding.funderName) {
this.projectInfo.funding.funderName = funding.funderName;
}
if(funding.funderShortname) {
this.projectInfo.funding.funderShortName = funding.funderShortname;
}
if(funding.stream) {
this.projectInfo.funding.fundingStream = funding.stream;
}
} }
if (funding.funderShortname) {
// ['result']['metadata']['oaf:entity']['oaf:project'] this.projectInfo.funding.funderShortName = funding.funderShortname;
if(data[0] != null) {
this.projectInfo.acronym = data[0].acronym;
if(data[0]['title']) {
this.projectInfo.title = Array.isArray(data[0]['title']) ? StringUtils.HTMLToString(String(data[0].title[0])) : StringUtils.HTMLToString(String(data[0].title));
} else {
this.projectInfo.title = "";
}
this.projectInfo.funding.code = data[0].code;
if(data[0].startdate) {
let date: number = Date.parse(data[0].startdate);
this.projectInfo.startDate = (date ? date : null);
}
if(data[0].enddate) {
let date: number = Date.parse(data[0].enddate);
this.projectInfo.endDate = (date ? date : null);
}
if(this.projectInfo.endDate || this.projectInfo.startDate) {
let todayDate = Date.parse(new Date().toString());
this.projectInfo.currentDate = todayDate;
if(this.projectInfo.startDate) {
let startDate = +(this.projectInfo.startDate);
if (todayDate < startDate) {
this.projectInfo.status = "Not started";
}
}
if(this.projectInfo.endDate && !this.projectInfo.status) {
let endDate = +(this.projectInfo.endDate);
if (todayDate <= endDate) {
this.projectInfo.status = "On going";
} else {
this.projectInfo.status = "Closed";
}
}
}
if(this.projectInfo.funding) {
if(this.projectInfo.funding.funderShortName == "EC") {
this.projectInfo.openAccessMandatePublications = data[0].oamandatepublications;
// this.projectInfo.specialClause39 = data[0].ecsc39;
if(data[0].hasOwnProperty("projectoamandatedata")) {
this.projectInfo.openAccessMandateDatasets = data[0].projectoamandatedata;
} else if(data[0].hasOwnProperty("ecarticle29_3")) {
this.projectInfo.openAccessMandateDatasets = data[0].ecarticle29_3;
}
this.projectInfo.funding.callIdentifier = data[0].callidentifier;
}
this.projectInfo.funding.budget = data[0].totalcost;//"10000";
this.projectInfo.funding.contribution = data[0].fundedamount;//"200100";
this.projectInfo.funding.currency = data[0].currency;//"EUR";
}
// if(!Array.isArray(data[0]['summary'])) {
// this.projectInfo.description = (data[0]['summary']) ? String(data[0]['summary']) : "";
// } else {
// this.projectInfo.description = (data[0]['summary'][0]) ? String(data[0]['summary'][0]) : "";
// }
this.projectInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].summary?data[0].summary:[]);
} }
if (funding.funderJurisdiction) {
this.projectInfo.funding.funderJurisdiction = funding.funderJurisdiction;
}
if (funding.stream) {
this.projectInfo.funding.fundingStream = funding.stream;
}
}
// ['result']['metadata']['oaf:entity']['oaf:project']['rels']['rel'] // ['result']['metadata']['oaf:entity']['oaf:project']
if(data[2] != null) { if (data[0] != null) {
this.projectInfo.organizations = [];//new Map<string, string>(); this.projectInfo.acronym = data[0].acronym;
if (data[0]['title']) {
this.projectInfo.title = Array.isArray(data[0]['title']) ? StringUtils.HTMLToString(String(data[0].title[0])) : StringUtils.HTMLToString(String(data[0].title));
} else {
this.projectInfo.title = "";
}
this.projectInfo.funding.code = data[0].code;
if (data[0].startdate) {
let date: number = Date.parse(data[0].startdate);
this.projectInfo.startDate = (date ? date : null);
}
if (data[0].enddate) {
let date: number = Date.parse(data[0].enddate);
this.projectInfo.endDate = (date ? date : null);
}
if (this.projectInfo.endDate || this.projectInfo.startDate) {
let todayDate = Date.parse(new Date().toString());
this.projectInfo.currentDate = todayDate;
if (this.projectInfo.startDate) {
let startDate = +(this.projectInfo.startDate);
if (todayDate < startDate) {
this.projectInfo.status = "Not started";
}
}
if (this.projectInfo.endDate && !this.projectInfo.status) {
let endDate = +(this.projectInfo.endDate);
if (todayDate <= endDate) {
this.projectInfo.status = "On going";
} else {
this.projectInfo.status = "Closed";
}
}
}
if (this.projectInfo.funding) {
if (this.projectInfo.funding.funderShortName == "EC") {
this.projectInfo.openAccessMandatePublications = data[0].oamandatepublications;
// this.projectInfo.specialClause39 = data[0].ecsc39;
if (data[0].hasOwnProperty("projectoamandatedata")) {
this.projectInfo.openAccessMandateDatasets = data[0].projectoamandatedata;
} else if (data[0].hasOwnProperty("ecarticle29_3")) {
this.projectInfo.openAccessMandateDatasets = data[0].ecarticle29_3;
}
this.projectInfo.funding.callIdentifier = data[0].callidentifier;
}
this.projectInfo.funding.budget = data[0].totalcost;//"10000";
this.projectInfo.funding.contribution = data[0].fundedamount;//"200100";
this.projectInfo.funding.currency = data[0].currency;//"EUR";
}
// if(!Array.isArray(data[0]['summary'])) {
// this.projectInfo.description = (data[0]['summary']) ? String(data[0]['summary']) : "";
// } else {
// this.projectInfo.description = (data[0]['summary'][0]) ? String(data[0]['summary'][0]) : "";
// }
this.projectInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].summary ? data[0].summary : []);
}
if(!Array.isArray(data[2])) { // ['result']['metadata']['oaf:entity']['oaf:project']['rels']['rel']
if(data[2].hasOwnProperty("to") && data[2]['to'].class && data[2]['to'].class.toLowerCase() == "hasparticipant") { if (data[2] != null) {
let acronym: string = ""; this.projectInfo.organizations = [];
let name: string = "";
let id: string = "";
if (data[2].hasOwnProperty("legalshortname")) {
acronym = data[2].legalshortname;
}
if (data[2].hasOwnProperty("legalname")) {
name = data[2].legalname;
}
if (!acronym && !name) {
// acronym is displayed with link and name only in tooltip
acronym = "[no title available]";
}
if (data[2].hasOwnProperty("to")) { if (!Array.isArray(data[2])) {
id = data[2]['to'].content; if (data[2].hasOwnProperty("to") && data[2]['to'].class && data[2]['to'].class.toLowerCase() == "hasparticipant") {
} let country: string = "";
let acronym: string = "";
let name: string = "";
let id: string = "";
if(data[2].hasOwnProperty("country")) {
country = data[2].country.classname;
}
if (data[2].hasOwnProperty("legalshortname")) {
acronym = data[2].legalshortname;
}
if (data[2].hasOwnProperty("legalname")) {
name = data[2].legalname;
}
if (!acronym && !name) {
// acronym is displayed with link and name only in tooltip
acronym = "[no title available]";
}
this.projectInfo.organizations.push({"acronym": acronym, "name": name, "id": id}); if (data[2].hasOwnProperty("to")) {
} id = data[2]['to'].content;
} else { }
for(let i=0; i<data[2].length; i++) {
let acronym: string = "";
let name: string = "";
let id: string = "";
if(data[2][i].hasOwnProperty("to") && data[2][i]['to'].class && data[2][i]['to'].class.toLowerCase() == "hasparticipant") {
if(data[2][i].hasOwnProperty("legalshortname")) {
acronym = data[2][i].legalshortname;
}
if(data[2][i].hasOwnProperty("legalname")) {
name = data[2][i].legalname;
}
if(!acronym && !name){
acronym = "[no title available]";
}
if(data[2][i].hasOwnProperty("to")) { this.projectInfo.organizations.push({"country": country, "acronym": acronym, "name": name, "id": id});
id = data[2][i]['to'].content; }
} } else {
for (let i = 0; i < data[2].length; i++) {
this.projectInfo.organizations.push({"acronym": acronym, "name": name, "id": id}); let country: string = "";
} let acronym: string = "";
} let name: string = "";
let id: string = "";
if (data[2][i].hasOwnProperty("to") && data[2][i]['to'].class && data[2][i]['to'].class.toLowerCase() == "hasparticipant") {
if(data[2][i].hasOwnProperty("country")) {
country = data[2][i].country.classname;
} }
if (data[2][i].hasOwnProperty("legalshortname")) {
acronym = data[2][i].legalshortname;
}
if (data[2][i].hasOwnProperty("legalname")) {
name = data[2][i].legalname;
}
if (!acronym && !name) {
acronym = "[no title available]";
}
if (data[2][i].hasOwnProperty("to")) {
id = data[2][i]['to'].content;
}
this.projectInfo.organizations.push({"country": country, "acronym": acronym, "name": name, "id": id});
}
} }
}
if(this.projectInfo.funding && this.projectInfo.funding.funderShortName == "EC") {
this.projectInfo.url = properties.cordisURL+this.projectInfo.funding.code;
this.projectInfo.urlInfo = "Detailed project information (CORDIS)";
}
if (data[0]?.measure) {
this.projectInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
}
return this.projectInfo;
} }
parseProjectDates (id: string, data: any):any { if (this.projectInfo.funding && this.projectInfo.funding.funderShortName == "EC") {
let project = { id: id, startDate: "", endDate: ""}; this.projectInfo.url = properties.cordisURL + this.projectInfo.funding.code;
if(data[0] != null) { this.projectInfo.urlInfo = "Detailed project information (CORDIS)";
project.startDate = data[0].startdate;
project.endDate = data[0].enddate;
}
return project;
} }
if (data[0]?.measure) {
this.projectInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
}
return this.projectInfo;
}
parseProjectDates(id: string, data: any): any {
let project = {id: id, startDate: "", endDate: ""};
if (data[0] != null) {
project.startDate = data[0].startdate;
project.endDate = data[0].enddate;
}
return project;
}
} }

View File

@ -2,7 +2,7 @@
<schema2jsonld *ngIf="resultLandingInfo && resultLandingInfo.record" <schema2jsonld *ngIf="resultLandingInfo && resultLandingInfo.record"
[data]=resultLandingInfo.record [URL]="canonicalUrl" [data]=resultLandingInfo.record [URL]="canonicalUrl"
[searchActionRoute]="properties.searchLinkToResults"></schema2jsonld> [searchActionRoute]="properties.searchLinkToResults"></schema2jsonld>
<div *ngIf="resultLandingInfo && !resultLandingInfo.belongsTo" [innerHTML]="resultLandingInfo.message" <div *ngIf="resultLandingInfo && !resultLandingInfo.belongsTo && !isBottomIntersecting" [innerHTML]="resultLandingInfo.message"
class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;"> class="uk-alert uk-alert-warning uk-position-fixed uk-position-bottom-center uk-text-small" style="z-index: 1000;">
</div> </div>
<!-- Desktop view --> <!-- Desktop view -->

View File

@ -155,8 +155,6 @@ export class ResultLandingComponent {
@ViewChild("descriptionDiv") descriptionDiv: ElementRef; @ViewChild("descriptionDiv") descriptionDiv: ElementRef;
@ViewChild('descriptionModal') descriptionModal; @ViewChild('descriptionModal') descriptionModal;
// public shouldSticky: boolean = true;
public mobileContent: "info" | "metrics" | "actions" = "info"; public mobileContent: "info" | "metrics" | "actions" = "info";
public tabMobile: string = ""; public tabMobile: string = "";
public viewAllMobile: string = ""; public viewAllMobile: string = "";
@ -164,6 +162,7 @@ export class ResultLandingComponent {
@ViewChild("sdgFosSuggest") sdgFosSuggest: SdgFosSuggestComponent; @ViewChild("sdgFosSuggest") sdgFosSuggest: SdgFosSuggestComponent;
public isMobile: boolean = false; public isMobile: boolean = false;
public isBottomIntersecting: boolean = false;
// Full screen modals for small screens (mobile) // Full screen modals for small screens (mobile)
@ViewChild('summaryFsModal') summaryFsModal: FullScreenModalComponent; @ViewChild('summaryFsModal') summaryFsModal: FullScreenModalComponent;
@ViewChild('subjectsFsModal') subjectsFsModal: FullScreenModalComponent; @ViewChild('subjectsFsModal') subjectsFsModal: FullScreenModalComponent;
@ -208,6 +207,11 @@ export class ResultLandingComponent {
ngOnInit() { ngOnInit() {
this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => {
this.isMobile = isMobile; this.isMobile = isMobile;
this.cdr.detectChanges();
}));
this.subscriptions.push(this.layoutService.isBottomIntersecting.subscribe(isBottomIntersecting => {
this.isBottomIntersecting = isBottomIntersecting;
this.cdr.detectChanges();
})); }));
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.isLoggedIn = !!user; this.isLoggedIn = !!user;
@ -294,16 +298,6 @@ export class ResultLandingComponent {
} else { } else {
this.offset = 0; this.offset = 0;
} }
// let bottom = document.getElementById('bottom');
// if(bottom) {
// let observer = new IntersectionObserver(entries => {
// entries.forEach(entry => {
// this.shouldSticky = !entry.isIntersecting;
// })
// });
// this.subscriptions.push(observer);
// observer.observe(bottom);
// }
if(this.graph_and_feedback) { if(this.graph_and_feedback) {
this.observeGraphAndFeedback(); this.observeGraphAndFeedback();
} }

View File

@ -516,7 +516,7 @@
</div> </div>
</span> </span>
</li> </li>
<li class="uk-margin-small-top"> <li *ngIf="!indicator.defaultId" class="uk-margin-small-top">
<a (click)="activeChartIndicatorPath(chartIndicatorPaths.length); $event.preventDefault()" <a (click)="activeChartIndicatorPath(chartIndicatorPaths.length); $event.preventDefault()"
class="uk-flex uk-flex-middle"> class="uk-flex uk-flex-middle">
<icon name="add" [flex]="true"></icon> <icon name="add" [flex]="true"></icon>

View File

@ -103,7 +103,7 @@ export class BrowseStakeholderBaseComponent<T> extends StakeholderBaseComponent
} }
get typeAsLabel() { get typeAsLabel() {
return this.stakeholderUtils.types.find(type => type.value === this.stakeholderType).label; return this.stakeholderUtils.types.find(type => type.value === this.stakeholderType)?.label;
} }
afterStakeholdersInitialized() { afterStakeholdersInitialized() {

View File

@ -13,6 +13,7 @@ import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
import {RefineResultsUtils} from "../services/servicesUtils/refineResults.class"; import {RefineResultsUtils} from "../services/servicesUtils/refineResults.class";
import {RefineFieldResultsService} from "../services/refineFieldResults.service"; import {RefineFieldResultsService} from "../services/refineFieldResults.service";
import {zip} from "rxjs";
@Component({ @Component({
@ -207,12 +208,28 @@ export class SearchDataProvidersComponent {
parametersFull = parameters; parametersFull = parameters;
refineQueryFull = refineFieldsFilterQuery+(refineFieldsFilterQuery.length > 0 && datasourceQueryPrefix.length >0 ? "&" : "")+(datasourceQueryPrefix.length>0 ? "fq=" : "")+datasourceQueryPrefix; refineQueryFull = refineFieldsFilterQuery+(refineFieldsFilterQuery.length > 0 && datasourceQueryPrefix.length >0 ? "&" : "")+(datasourceQueryPrefix.length>0 ? "fq=" : "")+datasourceQueryPrefix;
} }
this.searchFiltersSub = this._searchDataProvidersService.advancedSearchDataproviders( parametersFull, page, size, this.properties, (refine /*&& (this.type=="all" || this.type == "deposit")*/) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineQueryFull, isDeposit, true)
//.switchMap( let filterQueries;
.subscribe( let filterIds = [];
let fields = this.searchPage.getFields();
for(let filter of this.searchPage.URLCreatedFilters) {
filterIds.push(filter.filterId);
fields = fields.filter(field => field != filter.filterId);
}
if(filterIds.length > 0) {
filterQueries = zip(this._searchDataProvidersService.advancedSearchDataproviders(parametersFull, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(filterIds) : null, filterIds, refineQueryFull, isDeposit, false),
this._searchDataProvidersService.advancedSearchDataproviders(parametersFull, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineQueryFull, isDeposit, true)
);
} else {
filterQueries = this._searchDataProvidersService.advancedSearchDataproviders(parametersFull, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineQueryFull, isDeposit, true)
}
this.searchFiltersSub = filterQueries.subscribe(
data => { data => {
let totalResults = data[0]; let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
let filters = data[2]; let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
this.filtersReturned(refine, filters, totalResults, page); this.filtersReturned(refine, filters, totalResults, page);
}, },
err => { err => {

View File

@ -10,6 +10,7 @@ import {EnvProperties} from '../utils/properties/env-properties';
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component"; import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
import {RefineFieldResultsService} from "../services/refineFieldResults.service"; import {RefineFieldResultsService} from "../services/refineFieldResults.service";
import {zip} from "rxjs";
@Component({ @Component({
@ -169,12 +170,28 @@ export class SearchOrganizationsComponent {
this.searchUtils.refineStatus = this.errorCodes.LOADING; this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.disableRefineForms = true; this.disableRefineForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.searchFiltersSub = this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, true)
//.switchMap( let filterQueries;
.subscribe( let filterIds = [];
let fields = this.searchPage.getFields();
for(let filter of this.searchPage.URLCreatedFilters) {
filterIds.push(filter.filterId);
fields = fields.filter(field => field != filter.filterId);
}
if(filterIds.length > 0) {
filterQueries = zip(this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(filterIds) : null, filterIds, refineFieldsFilterQuery, false),
this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
);
} else {
filterQueries = this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
}
this.searchFiltersSub = filterQueries.subscribe(
data => { data => {
let totalResults = data[0]; let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
let filters = data[2]; let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
this.filtersReturned(refine, filters, totalResults, page); this.filtersReturned(refine, filters, totalResults, page);
}, },
err => { err => {

View File

@ -11,6 +11,7 @@ import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.co
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class"; import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
import {RefineFieldResultsService} from "../services/refineFieldResults.service"; import {RefineFieldResultsService} from "../services/refineFieldResults.service";
import {zip} from "rxjs";
@Component({ @Component({
selector: 'search-projects', selector: 'search-projects',
@ -174,30 +175,45 @@ export class SearchProjectsComponent {
disableRefineForms: this.disableRefineForms, disableRefineForms: this.disableRefineForms,
searchUtils: this.searchUtils searchUtils: this.searchUtils
}); });
this.searchFiltersSub = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, true)
//.switchMap( let filterQueries;
.subscribe( let filterIds = [];
data => { let fields = this.searchPage.getFields();
let totalResults = data[0]; for(let filter of this.searchPage.URLCreatedFilters) {
let filters = data[2]; filterIds.push(filter.filterId);
this.filtersReturned(refine, filters, totalResults, page); fields = fields.filter(field => field != filter.filterId);
}
},
err => { if(filterIds.length > 0) {
this.filters = this.searchPage.prepareFiltersToShow([], 0); filterQueries = zip(this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(filterIds) : null, filterIds, refineFieldsFilterQuery, false),
this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
this.handleError("Error getting refine filters for projects: ", err);
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
this.disableRefineForms = false;
this.searchPageUpdates.emit({
disableForms: this.disableForms,
disableRefineForms: this.disableRefineForms,
searchUtils: this.searchUtils
})
}
); );
} else {
filterQueries = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
}
this.searchFiltersSub = filterQueries.subscribe(
data => {
let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
this.filtersReturned(refine, filters, totalResults, page);
},
err => {
this.filters = this.searchPage.prepareFiltersToShow([], 0);
this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
this.handleError("Error getting refine filters for projects: ", err);
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
this.disableRefineForms = false;
this.searchPageUpdates.emit({
disableForms: this.disableForms,
disableRefineForms: this.disableRefineForms,
searchUtils: this.searchUtils
})
}
);
} }
} }

View File

@ -14,6 +14,7 @@ import {ContextsService} from "../claims/claim-utils/service/contexts.service";
import {StringUtils} from "../utils/string-utils.class"; import {StringUtils} from "../utils/string-utils.class";
import {RefineResultsUtils} from "../services/servicesUtils/refineResults.class"; import {RefineResultsUtils} from "../services/servicesUtils/refineResults.class";
import {RefineFieldResultsService} from "../services/refineFieldResults.service"; import {RefineFieldResultsService} from "../services/refineFieldResults.service";
import {zip} from "rxjs";
@Component({ @Component({
selector: 'search-research-results', selector: 'search-research-results',
@ -253,13 +254,27 @@ export class SearchResearchResultsComponent {
this.searchUtils.refineStatus = this.errorCodes.LOADING; this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.disableRefineForms = true; this.disableRefineForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.searchFiltersSub = this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, true)
// this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery) let filterQueries;
//.switchMap( let filterIds = [];
.subscribe( let fields = this.searchPage.getFields();
for(let filter of this.searchPage.URLCreatedFilters) {
filterIds.push(filter.filterId);
fields = fields.filter(field => field != filter.filterId);
}
if(filterIds.length > 0) {
filterQueries = zip(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(filterIds) : null, filterIds, refineFieldsFilterQuery, false),
this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
);
} else {
filterQueries = this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true);
}
this.searchFiltersSub = filterQueries.subscribe(
data => { data => {
let totalResults = data[0]; let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
let filters = data[2]; let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
// if (refine) { // if (refine) {
// this.filters = this.searchPage.prepareFiltersToShow(filters, totalResults); // this.filters = this.searchPage.prepareFiltersToShow(filters, totalResults);

View File

@ -551,9 +551,11 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
/* /*
* Get a query string of all fields, that want to get from search (e.g. &fields=funderid&fields=projectstartyear&...)) * Get a query string of all fields, that want to get from search (e.g. &fields=funderid&fields=projectstartyear&...))
*/ */
public getRefineFieldsQuery(): string { public getRefineFieldsQuery(fields: string[] = null): string {
var fields: string[] = this.getFields(); if(!fields) {
fields = this.getFields();
}
var fieldsStr = "" var fieldsStr = ""
for (var i = 0; i < fields.length; i++) { for (var i = 0; i < fields.length; i++) {
fieldsStr += "&fields=" + fields[i]; fieldsStr += "&fields=" + fields[i];
@ -1816,10 +1818,10 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
this.showUnknownFilters = true; this.showUnknownFilters = true;
this.filters = filters; this.filters = filters;
} }
this.buildPageURLParameters(this.URLCreatedFilters, this.URLCreatedRangeFilters, this.URLCreatedStaticFilters, true); this.buildPageURLParameters(this.URLCreatedFilters, this.URLCreatedRangeFilters, this.URLCreatedStaticFilters, true);
//this.checkSelectedRangeFilters(this.rangeFilters); //this.checkSelectedRangeFilters(this.rangeFilters);
this.checkSelectedFilters(this.filters); this.checkSelectedFilters(this.filters);
this.countSelectedFilters(this.filters); this.countSelectedFilters(this.filters);
this.updateMeta(this.pageTitle); this.updateMeta(this.pageTitle);

View File

@ -1,7 +1,8 @@
export interface Icon { export interface Icon {
name?: string, name?: string,
svg?: string, svg?: string,
class?: string class?: string,
ratio?: number
} }
export class MenuItem { export class MenuItem {
@ -90,4 +91,4 @@ export class SideMenuItem extends MenuItem {
ukIcon: string = ''; ukIcon: string = '';
} }
export enum MenuAlignment {LEFT = "LEFT", CENTER = "CENTER", RIGHT = "RIGHT"} export enum MenuAlignment {LEFT = "LEFT", CENTER = "CENTER", RIGHT = "RIGHT"}

View File

@ -202,4 +202,15 @@ export class DataProviderInfo {
//relatedDatasources: Map<string, {"name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string}>; //relatedDatasources: Map<string, {"name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string}>;
relatedDatasources: { "id": string, "name": string, "count": number }[] = []; relatedDatasources: { "id": string, "name": string, "count": number }[] = [];
belongsTo: boolean = true;
message: string;
setBelongsTo(id: string) {
this.belongsTo = !BelongsTo.datasource || BelongsTo.datasource.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
this.message = !this.belongsTo ? BelongsTo.datasource.message : null;
if (this.message) {
this.message = this.message.replace('((id))', id);
}
}
} }

View File

@ -29,4 +29,14 @@ export class OrganizationInfo {
deletedByInferenceIds: string[]; deletedByInferenceIds: string[];
identifiers: Map<string, string[]>; //key is the classname identifiers: Map<string, string[]>; //key is the classname
belongsTo: boolean = true;
message: string;
setBelongsTo(id: string) {
this.belongsTo = !BelongsTo.organization || BelongsTo.organization.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
this.message = !this.belongsTo ? BelongsTo.organization.message : null;
if (this.message) {
this.message = this.message.replace('((id))', id);
}
}
} }

View File

@ -1,12 +1,29 @@
import {BelongsTo, Measure} from "./resultLandingInfo"; import {BelongsTo, Measure} from "./resultLandingInfo";
import {StringUtils} from "../string-utils.class";
export interface Funding {
funderName: string,
funderShortName: string,
funderJurisdiction: string,
code: string,
callIdentifier: string,
fundingStream: string,
budget: string,
contribution: string,
currency: string
}
export interface ProjectOrganization {
acronym: string,
country: string,
name: string,
id: string
}
export class ProjectInfo { export class ProjectInfo {
id:string; id: string;
acronym: string; acronym: string;
title: string; title: string;
funding: {funderName: string, funderShortName: string, code: string, callIdentifier: string, funding: Funding;
fundingStream: string, budget: string, contribution: string, currency: string};
startDate: number; startDate: number;
endDate: number; endDate: number;
currentDate: number; currentDate: number;
@ -14,7 +31,7 @@ export class ProjectInfo {
openAccessMandatePublications: string; openAccessMandatePublications: string;
openAccessMandateDatasets: string; openAccessMandateDatasets: string;
// specialClause39: string; // specialClause39: string;
organizations: { "acronym": string, "name": string, "id": string }[];//Map<string, string>; organizations: ProjectOrganization[];
url: string; url: string;
urlInfo: string; urlInfo: string;
description: string; description: string;
@ -29,8 +46,8 @@ export class ProjectInfo {
setBelongsTo(id: string) { setBelongsTo(id: string) {
this.belongsTo = !BelongsTo.project || BelongsTo.project.fields.findIndex(field => BelongsTo.check(this, field)) != -1; this.belongsTo = !BelongsTo.project || BelongsTo.project.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
this.message = !this.belongsTo?BelongsTo.project.message:null; this.message = !this.belongsTo ? BelongsTo.project.message : null;
if(this.message) { if (this.message) {
this.message = this.message.replace('((id))', id); this.message = this.message.replace('((id))', id);
} }
} }

View File

@ -70,7 +70,7 @@ export class BelongsTo {
if (field) { if (field) {
field = Object.assign({}, field); field = Object.assign({}, field);
let json: any = element; let json: any = element;
if (field.path.length > 0) { if (field.path.length > 0 && json) {
if (Array.isArray(json)) { if (Array.isArray(json)) {
return json.findIndex(value => BelongsTo.check(value, field)) != -1; return json.findIndex(value => BelongsTo.check(value, field)) != -1;
} else { } else {
@ -79,7 +79,6 @@ export class BelongsTo {
return BelongsTo.check(json, field); return BelongsTo.check(json, field);
} }
} }
console.log(json, field.value)
return json == field.value; return json == field.value;
} }
return false; return false;
@ -210,7 +209,7 @@ export class ResultLandingInfo {
this.belongsTo = !BelongsTo.result || BelongsTo.result.fields.findIndex(field => BelongsTo.check(this, field)) != -1; this.belongsTo = !BelongsTo.result || BelongsTo.result.fields.findIndex(field => BelongsTo.check(this, field)) != -1;
this.message = !this.belongsTo ? BelongsTo.result.message : null; this.message = !this.belongsTo ? BelongsTo.result.message : null;
if (this.message) { if (this.message) {
this.message = this.message.replace('((result))', StringUtils.getEntityName(this.resultType)); this.message = this.message.replace('((result))', StringUtils.capitalizeAll(StringUtils.getEntityName(this.resultType)));
this.message = this.message.replace('((type_id))', typeId); this.message = this.message.replace('((type_id))', typeId);
this.message = this.message.replace('((id))', id); this.message = this.message.replace('((id))', id);
} }

View File

@ -115,8 +115,8 @@ export let commonDev: EnvProperties = {
loginServiceURL: "http://mpagasas.di.uoa.gr:19080/login-service/", loginServiceURL: "http://mpagasas.di.uoa.gr:19080/login-service/",
cookieDomain: ".di.uoa.gr", cookieDomain: ".di.uoa.gr",
feedbackmail: "kostis30fylloy@gmail.com", feedbackmail: "kostis30fylloy@gmail.com",
cacheUrl: "http://scoobydoo.di.uoa.gr:3200/get?url=", cacheUrl: "http://dl170.madgik.di.uoa.gr:3000/get?url=",
monitorServiceAPIURL: "http://duffy.di.uoa.gr:19380/uoa-monitor-service", monitorServiceAPIURL: "http://mpagasas.di.uoa.gr:19380/uoa-monitor-service",
adminToolsAPIURL: "http://duffy.di.uoa.gr:19280/uoa-admin-tools/", adminToolsAPIURL: "http://duffy.di.uoa.gr:19280/uoa-admin-tools/",
datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/", datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/",
contextsAPI: "https://dev-openaire.d4science.org/openaire/context", contextsAPI: "https://dev-openaire.d4science.org/openaire/context",

View File

@ -3,9 +3,11 @@
<span *ngIf="result.acronym"> <span *ngIf="result.acronym">
{{result.acronym}} {{result.acronym}}
</span> </span>
<span *ngIf="result.acronym && (result.title)"> (</span> <ng-container *ngIf="result.acronym != result.title">
<span *ngIf="result.title" [innerHTML]="result.title"></span> <span *ngIf="result.acronym && (result.title)"> (</span>
<span *ngIf="result.acronym && result.title">)</span> <span *ngIf="result.title" [innerHTML]="result.title"></span>
<span *ngIf="result.acronym && result.title">)</span>
</ng-container>
</div> </div>
<div *ngIf="!result.title && !result.acronym"> <div *ngIf="!result.title && !result.acronym">
[no title available] [no title available]

View File

@ -443,9 +443,13 @@ export class StringUtils {
}); });
return <string []>words; return <string []>words;
} }
public static capitalizeAll(str: string): string {
return str.split(' ').map(value => StringUtils.capitalize(value)).join(' ');
}
public static capitalize(value: string): string { public static capitalize(str: string): string {
return value.charAt(0).toUpperCase() + value.slice(1); return str.charAt(0).toUpperCase() + str.slice(1);
} }
/** /**