From 21c70d6d621cc6b1c17a26113f798065b7b3cd8a Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 28 Jul 2023 12:15:54 +0300 Subject: [PATCH 01/17] updated claims api: submit job and get status --- claims/claim-utils/service/claims.service.ts | 10 +++ .../insertClaim/insertClaim.component.ts | 67 ++++++++++++++++--- 2 files changed, 69 insertions(+), 8 deletions(-) diff --git a/claims/claim-utils/service/claims.service.ts b/claims/claim-utils/service/claims.service.ts index b9f32054..26a3d4d3 100644 --- a/claims/claim-utils/service/claims.service.ts +++ b/claims/claim-utils/service/claims.service.ts @@ -106,6 +106,16 @@ export class ClaimsService { .pipe(catchError(this.handleError)); } + getStatus(jobId, apiUrl:string):any{ + + let url = apiUrl +"jobStatus/" + jobId; + + return this.http.get(url,CustomOptions.getAuthOptions()) + //.map(res => res.json()) + //.do(request => console.info("Insert Response:"+request) ) + .pipe(catchError(this.handleError)); + + } private handleError (error: Response) { // in a real world app, we may send the error to some remote logging infrastructure // instead of just logging it to the console diff --git a/claims/linking/insertClaim/insertClaim.component.ts b/claims/linking/insertClaim/insertClaim.component.ts index cb1cef70..2d1a276f 100644 --- a/claims/linking/insertClaim/insertClaim.component.ts +++ b/claims/linking/insertClaim/insertClaim.component.ts @@ -14,7 +14,8 @@ import { Message } from "../../claim-utils/claimHelper.class"; import {UserManagementService} from "../../../services/user-management.service"; -import {Subscriber} from "rxjs"; +import {Subscriber, timer} from "rxjs"; +import {map} from "rxjs/operators"; @Component({ selector: 'claim-insert', @@ -30,7 +31,18 @@ import {Subscriber} from "rxjs";
CONFIRM LINKING
- + + +
+
+ Initiating process....
+
+{{claimsJob.insertedIds.length}} out of {{claims2Insert}} links created.
+
{{feedRecordsJob.length}} records added in the index...
+
+ Please don't close the window, process is ongoing...
+
+

All the links you provided will be published in the OpenAIRE platform.
@@ -84,7 +96,9 @@ export class ClaimInsertComponent { private errorInClaims: ClaimRecord2Insert[] = []; private insertedRecords = []; private errorInRecords = []; - + public claimsJob; + public feedRecordsJob; + public claims2Insert; public insert() { this.confirmOpen(); } @@ -180,9 +194,9 @@ export class ClaimInsertComponent { if (directclaims.length > 0 && this.properties.environment != "development"){ this.subscriptions.push(this.claimService.insertDirectRecords(directclaims, this.properties.claimsAPIURL).subscribe( data => { - this.insertedRecords = data.insertedIds; - - this.errorInRecords = data.errorInClaims; + // this.insertedRecords = data.insertedIds; + // + // this.errorInRecords = data.errorInClaims; this.isertBulkClaims(claims); }, err => { @@ -214,7 +228,7 @@ export class ClaimInsertComponent { this.errors.splice(0, this.errors.length); this.subscriptions.push(this.claimService.insertBulkClaims(claims, this.properties.claimsAPIURL).subscribe( data => { - this.insertedClaims = data.insertedIds; + /*this.insertedClaims = data.insertedIds; this.errorInClaims = data.errorInClaims; //TODO remove - testing having errors in claims // this.insertedClaims.pop(); @@ -233,6 +247,17 @@ export class ClaimInsertComponent { this.errors.push(error); } this.afterclaimsInsertion(); + + */ + console.log(data) + this.claims2Insert = claims.length; + this.claimsJob = data.data; + let timerSubscription = timer(0, 10000).pipe( + map(() => { + this.getStatus(); // load data contains the http request + }) + ).subscribe(); + this.subscriptions.push(timerSubscription); }, err => { err = err && err.error?err.error:err; @@ -517,8 +542,34 @@ export class ClaimInsertComponent { } if(this.defaultColors){ buttonClass+=" linksbaskettitles uk-padding-small "; - } + } return buttonClass + "uk-text-center "; } + + getStatus(){ + + console.log("TODO status fetch") + this.subscriptions.push(this.claimService.getStatus(this.claimsJob.id, this.properties.claimsAPIURL).subscribe(data => { + console.log(data); + this.claimsJob = data.data; + if(this.claimsJob.status == "COMPLETE" || data.data.status == "ERROR"){ + this.insertedClaims = this.claimsJob.insertedIds; + this.errorInClaims = this.claimsJob.errorInClaims; + + if (this.claims2Insert != this.insertedClaims.length) { + let error: ClaimsErrorMessage = new ClaimsErrorMessage(); + error.type = "claimServiceFail2Insert"; + error.inserted = this.insertedClaims.length; + error.failed = this.errorInClaims.length; + this.createErrorMessagesPerEntity((this.insertedClaims.length == 0)); + this.errors.push(error); + } + this.afterclaimsInsertion(); + + + } + + })); + } } From 5c345d8ff79fb821fdc7236896cde43900b0a4d4 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 3 Aug 2023 12:45:39 +0300 Subject: [PATCH 02/17] show status also for direct index records job on reload keep job ids and continue show progres until they finish change get auth options method --- claims/claim-utils/service/claims.service.ts | 53 +----- claims/claimsByToken/claimsByToken.service.ts | 18 +-- .../insertClaim/insertClaim.component.ts | 153 ++++++++++++------ claims/linking/linkingGeneric.component.ts | 5 + .../selected/metadataPreview.component.html | 8 + services/servicesUtils/customOptions.class.ts | 9 +- 6 files changed, 122 insertions(+), 124 deletions(-) diff --git a/claims/claim-utils/service/claims.service.ts b/claims/claim-utils/service/claims.service.ts index 26a3d4d3..d7d46218 100644 --- a/claims/claim-utils/service/claims.service.ts +++ b/claims/claim-utils/service/claims.service.ts @@ -10,7 +10,7 @@ export class ClaimsService { } private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any { - return this.http.get(url, CustomOptions.getAuthOptions()); + return this.http.get(url, CustomOptions.getAuthOptionsWithBody()); } getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string):any { let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types); @@ -44,10 +44,7 @@ export class ClaimsService { deleteClaimById(claimId:string , apiUrl:string):any{ //console.warn('Trying to delete claim with id : '+claimId); let url = apiUrl +"claims/"+claimId; - // let headers = new Headers({ 'Content-Type': 'application/json' }); - // let options = new RequestOptions({ headers: headers }); return this.http.delete( url, CustomOptions.getAuthOptionsWithBody())//.map(request => request.json()) - // .do(request => console.info("After delete" )) .pipe(catchError(this.handleError)); } @@ -61,10 +58,7 @@ export class ClaimsService { } url= apiUrl +"claims/bulk?"+url; - // let headers = new Headers({ 'Content-Type': 'application/json' }); - // let options = new RequestOptions({ headers: headers }); - return this.http.delete( url, CustomOptions.getAuthOptions())//.map(request => request.json()) - // .do(request => console.info("After delete" )) + return this.http.delete( url, CustomOptions.getAuthOptionsWithBody())//.map(request => request.json()) .pipe(catchError(this.handleError)); } @@ -72,37 +66,16 @@ export class ClaimsService { // console.warn('Trying toinsert claims : '+claims); let url = apiUrl +"claims/bulk"; let body = JSON.stringify( claims ); - //console.warn('Json body: : '+body); - // let headers = new Headers({ 'Content-Type': 'application/json' }); - // let options = new RequestOptions({ headers: headers }); return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody()) - //.map(res => res.json()) - //.do(request => console.info("Insert Response:"+request.status) ) .pipe(catchError(this.handleError)); } - insertClaim(claim, apiUrl:string):any{ - //console.warn('Trying toinsert claim : '+claim); - let url = apiUrl +"claims"; - let body = JSON.stringify( claim ); - // let headers = new Headers({ 'Content-Type': 'application/json' }); - // let options = new RequestOptions({ headers: headers }); - return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody()) - //.map(res => res.json()) - //.do(request => console.info("Insert Response:"+request.status) ) - .pipe(catchError(this.handleError)); - } insertDirectRecords(records, apiUrl:string):any{ //console.warn('Trying to feedrecords : '+records); let url = apiUrl +"feed/bulk"; let body = JSON.stringify( records ); - //console.warn('Json body: : '+body); - // let headers = new Headers({ 'Content-Type': 'application/json' }); - // let options = new RequestOptions({ headers: headers }); return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody()) - //.map(res => res.json()) - //.do(request => console.info("Insert Response:"+request) ) .pipe(catchError(this.handleError)); } @@ -110,9 +83,7 @@ export class ClaimsService { let url = apiUrl +"jobStatus/" + jobId; - return this.http.get(url,CustomOptions.getAuthOptions()) - //.map(res => res.json()) - //.do(request => console.info("Insert Response:"+request) ) + return this.http.get(url,CustomOptions.getAuthOptionsWithBody()) .pipe(catchError(this.handleError)); } @@ -123,22 +94,4 @@ export class ClaimsService { return observableThrowError(error || 'Server error'); } - // getClaim(id:string, apiUrl:string):any { - // let url = apiUrl+"claims/"+id; - // return new Promise((resolve, reject) => { - // this.http.get(url) - // //.map(res => res.json()) - // .subscribe( - // data => { - // resolve(data['data']); - // }, - // err => { - // reject(err); - // } - // ) - // ; - // }); - // } - - } diff --git a/claims/claimsByToken/claimsByToken.service.ts b/claims/claimsByToken/claimsByToken.service.ts index 4414065e..21b882da 100644 --- a/claims/claimsByToken/claimsByToken.service.ts +++ b/claims/claimsByToken/claimsByToken.service.ts @@ -18,26 +18,12 @@ export class ClaimsByTokenService { let key = url; - return this.http.get(url, CustomOptions.getAuthOptions()); - //.map(res => res.text()) - //.map(request => request.json()); + return this.http.get(url, CustomOptions.getAuthOptionsWithBody()); + } -/* - getClaims(email: string, token: string, user_token: string):any { - let url = OpenaireProperties.getClaimsAPIURL(); // What else? - let body = JSON.stringify( {"email": email, "token": token} ); - console.warn('Json body: : '+body); - let headers = new Headers({ 'Content-Type': 'application/json' }); - let options = new RequestOptions({ headers: headers }); - return this.http.post(url, body, options) - .map(res => res.json()) - .do(request => console.info("Insert Response:"+request.status) ) - .catch(this.handleError); - } -*/ updateClaimsCuration( selectedRight: Set, selectedWrong: Set, apiURL:string) { let url = apiURL + "curate/bulk"; diff --git a/claims/linking/insertClaim/insertClaim.component.ts b/claims/linking/insertClaim/insertClaim.component.ts index 2d1a276f..068f033c 100644 --- a/claims/linking/insertClaim/insertClaim.component.ts +++ b/claims/linking/insertClaim/insertClaim.component.ts @@ -37,8 +37,9 @@ import {map} from "rxjs/operators";

Initiating process....
-{{claimsJob.insertedIds.length}} out of {{claims2Insert}} links created.
-
{{feedRecordsJob.length}} records added in the index...
+ {{claimsJob.insertedIds.length}} out of {{claims2Insert}} links created. +
+ {{feedRecordsJob.insertedIds.length}} out of {{records2Insert}} records added in the index...
Please don't close the window, process is ongoing...
@@ -72,6 +73,32 @@ export class ClaimInsertComponent { this.subscriptions.push(this.route.queryParams.subscribe(params => { this.params = params; })); + if(localStorage.getItem(this.localStoragePrefix + "claimsJob")){ + this.claimsJob = JSON.parse(localStorage.getItem(this.localStoragePrefix + "claimsJob")); + this.feedRecordsJob = JSON.parse(localStorage.getItem(this.localStoragePrefix + "feedRecordsJob")); + if(this.claimsJob.status != "COMPLETE"){ + this.claiming = true; + let loadingTimerSubscription = timer(0, 1000).pipe( + map(() => { + if(this.loading) { + this.loading.open(); + loadingTimerSubscription.unsubscribe(); + } + }) + ).subscribe(); + this.subscriptions.push(loadingTimerSubscription); + + let timerSubscription = timer(0, 10000).pipe( + map(() => { + this.getStatus(); // load data contains the http request + }) + ).subscribe(); + this.subscriptions.push(timerSubscription); + }else{ + this.claimsJob = null; + } + } + } params = {}; @@ -99,14 +126,12 @@ export class ClaimInsertComponent { public claimsJob; public feedRecordsJob; public claims2Insert; + public records2Insert public insert() { this.confirmOpen(); } saveAndNavigate(){ - localStorage.setItem(this.localStoragePrefix + "results", JSON.stringify(this.results)); - if (this.sources != null) { - localStorage.setItem(this.localStoragePrefix + "sources", JSON.stringify(this.sources)); - } + this.saveLocalStorage(); this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, @@ -191,9 +216,12 @@ export class ClaimInsertComponent { //first call direct index service - when call is done (success or error) call isertBulkClaims method to insert claims in DB // console.log("directclaims"); // console.log(directclaims); - if (directclaims.length > 0 && this.properties.environment != "development"){ + if (directclaims.length > 0/* && this.properties.environment != "development"*/){ this.subscriptions.push(this.claimService.insertDirectRecords(directclaims, this.properties.claimsAPIURL).subscribe( data => { + this.feedRecordsJob = data.data; + this.records2Insert = directclaims.length; + console.log(data); // this.insertedRecords = data.insertedIds; // // this.errorInRecords = data.errorInClaims; @@ -204,12 +232,12 @@ export class ClaimInsertComponent { if (err.code && err.code == 403) { this.saveAndNavigate(); } - if (err.insertedIds && err.insertedIds.length > 0) { + /* if (err.insertedIds && err.insertedIds.length > 0) { this.insertedRecords = err.insertedIds; } if (err.errorInClaims && err.errorInClaims.length > 0) { this.errorInRecords = err.errorInClaims; - } + }*/ this.isertBulkClaims(claims); ClaimInsertComponent.handleError("Error inserting direct records: " + JSON.stringify(directclaims), err); @@ -223,35 +251,12 @@ export class ClaimInsertComponent { } private isertBulkClaims(claims: ClaimRecord2Insert[]) { - console.log("claims"); - console.log(claims); this.errors.splice(0, this.errors.length); this.subscriptions.push(this.claimService.insertBulkClaims(claims, this.properties.claimsAPIURL).subscribe( data => { - /*this.insertedClaims = data.insertedIds; - this.errorInClaims = data.errorInClaims; - //TODO remove - testing having errors in claims - // this.insertedClaims.pop(); - // this.insertedClaims.pop(); - // this.errorInClaims.push(claims[1]); - // this.insertedClaims.splice(0,this.insertedClaims.length); - // this.errorInClaims = claims; - //remove till here - - if (claims.length != this.insertedClaims.length) { - let error: ClaimsErrorMessage = new ClaimsErrorMessage(); - error.type = "claimServiceFail2Insert"; - error.inserted = this.insertedClaims.length; - error.failed = this.errorInClaims.length; - this.createErrorMessagesPerEntity((this.insertedClaims.length == 0)); - this.errors.push(error); - } - this.afterclaimsInsertion(); - - */ - console.log(data) this.claims2Insert = claims.length; this.claimsJob = data.data; + this.saveLocalStorage(); let timerSubscription = timer(0, 10000).pipe( map(() => { this.getStatus(); // load data contains the http request @@ -360,13 +365,16 @@ export class ClaimInsertComponent { } private afterclaimsInsertion() { - - this.loading.close(); this.claiming = false; + this.loading.close(); + if (this.errorInClaims.length == 0 && this.insertedClaims.length > 0) { localStorage.removeItem(this.localStoragePrefix + "sources"); localStorage.removeItem(this.localStoragePrefix + "results"); + localStorage.removeItem(this.localStoragePrefix + "claimsJob"); + localStorage.removeItem(this.localStoragePrefix + "feedRecordsJob"); + this._router.navigate(['/myclaims'], {queryParams: this.params}); } } @@ -547,29 +555,72 @@ export class ClaimInsertComponent { } getStatus(){ - - console.log("TODO status fetch") - this.subscriptions.push(this.claimService.getStatus(this.claimsJob.id, this.properties.claimsAPIURL).subscribe(data => { - console.log(data); - this.claimsJob = data.data; - if(this.claimsJob.status == "COMPLETE" || data.data.status == "ERROR"){ - this.insertedClaims = this.claimsJob.insertedIds; - this.errorInClaims = this.claimsJob.errorInClaims; - - if (this.claims2Insert != this.insertedClaims.length) { + if(this.feedRecordsJob && ! (this.feedRecordsJob.status == "COMPLETE" || this.feedRecordsJob.status == "ERROR") ) { + this.subscriptions.push(this.claimService.getStatus(this.feedRecordsJob.id, this.properties.claimsAPIURL).subscribe(data => { + console.log("feed", data); + this.feedRecordsJob = data.data; + if (this.feedRecordsJob.status == "COMPLETE" || data.data.status == "ERROR") { + this.insertedRecords = this.feedRecordsJob.insertedIds; + this.errorInRecords = this.feedRecordsJob.errorInClaims; + } + }, err => { let error: ClaimsErrorMessage = new ClaimsErrorMessage(); - error.type = "claimServiceFail2Insert"; - error.inserted = this.insertedClaims.length; - error.failed = this.errorInClaims.length; + error.type = "jobError"; this.createErrorMessagesPerEntity((this.insertedClaims.length == 0)); this.errors.push(error); + this.afterclaimsInsertion(); + this.feedRecordsJob = null; + localStorage.removeItem(this.localStoragePrefix + "feedRecordsJob"); } - this.afterclaimsInsertion(); + + )); + } + if(this.claimsJob) { + this.subscriptions.push(this.claimService.getStatus(this.claimsJob.id, this.properties.claimsAPIURL).subscribe(data => { + console.log("claim", data); + this.claimsJob = data.data; + if (this.claimsJob.status == "COMPLETE" || data.data.status == "ERROR" && (!(this.feedRecordsJob.status == "COMPLETE" || data.data.status == "ERROR")) || !this.feedRecordsJob) { + this.insertedClaims = this.claimsJob.insertedIds; + this.errorInClaims = this.claimsJob.errorInClaims; + + if (this.claims2Insert != this.insertedClaims.length) { + let error: ClaimsErrorMessage = new ClaimsErrorMessage(); + error.type = "claimServiceFail2Insert"; + error.inserted = this.insertedClaims.length; + error.failed = this.errorInClaims.length; + this.createErrorMessagesPerEntity((this.insertedClaims.length == 0)); + this.errors.push(error); + } + this.afterclaimsInsertion(); - } + } + }, err => { + let error: ClaimsErrorMessage = new ClaimsErrorMessage(); + error.type = "jobError"; + this.createErrorMessagesPerEntity((this.insertedClaims.length == 0)); + this.errors.push(error); + this.afterclaimsInsertion(); + this.claimsJob = null; + localStorage.removeItem(this.localStoragePrefix + "claimsJob"); - })); + } + )); + } + } + saveLocalStorage(){ + if (this.results != null) { + localStorage.setItem(this.localStoragePrefix + "results", JSON.stringify(this.results)); + } + if (this.sources != null) { + localStorage.setItem(this.localStoragePrefix + "sources", JSON.stringify(this.sources)); + } + if (this.claimsJob != null) { + localStorage.setItem(this.localStoragePrefix + "claimsJob", JSON.stringify(this.claimsJob)); + } + if (this.feedRecordsJob != null) { + localStorage.setItem(this.localStoragePrefix + "feedRecordsJob", JSON.stringify(this.feedRecordsJob)); + } } } diff --git a/claims/linking/linkingGeneric.component.ts b/claims/linking/linkingGeneric.component.ts index 524f3566..31efc1b5 100644 --- a/claims/linking/linkingGeneric.component.ts +++ b/claims/linking/linkingGeneric.component.ts @@ -94,6 +94,11 @@ export class LinkingGenericComponent { if(localStorage.getItem(this.localStoragePrefix + "sources")){ this.sources = JSON.parse(localStorage.getItem(this.localStoragePrefix + "sources")); } + if(localStorage.getItem(this.localStoragePrefix + "claimsJob")){ + let job = JSON.parse(localStorage.getItem(this.localStoragePrefix + "claimsJob")); + if(job.status != "COMPLETE"){ + this.showOptions.show = 'claim'; } + } } } diff --git a/claims/linking/selected/metadataPreview.component.html b/claims/linking/selected/metadataPreview.component.html index 2a8f38c3..a0723118 100644 --- a/claims/linking/selected/metadataPreview.component.html +++ b/claims/linking/selected/metadataPreview.component.html @@ -250,6 +250,14 @@ None of the links saved. +
+ +
+ The saving status of your links can't be fetched. Please check your links or start over. +
+ Manage your links here +
+
Date: Thu, 3 Aug 2023 13:02:59 +0300 Subject: [PATCH 03/17] replace session.isLoggedIn() method --- .../claimContextSearchForm.component.ts | 38 +------------------ claims/linking/linkingGeneric.component.ts | 27 ++++++++++++- 2 files changed, 27 insertions(+), 38 deletions(-) diff --git a/claims/claim-utils/claimContextSearchForm.component.ts b/claims/claim-utils/claimContextSearchForm.component.ts index 95289d97..463c9d93 100644 --- a/claims/claim-utils/claimContextSearchForm.component.ts +++ b/claims/claim-utils/claimContextSearchForm.component.ts @@ -2,12 +2,9 @@ import {Component, Input, ViewChild} from '@angular/core'; import {Router} from '@angular/router'; import {ContextsService} from './service/contexts.service'; import {ClaimEntity, ShowOptions} from './claimHelper.class'; -import {Session} from '../../login/utils/helper.class'; -import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {EnvProperties} from '../../utils/properties/env-properties'; import {Subscriber} from "rxjs"; import {OpenaireEntities} from "../../utils/properties/searchFields"; -import {CommunityService} from "../../connect/community/community.service"; import {CommunitiesService} from "../../connect/communities/communities.service"; declare var UIkit: any; @@ -167,10 +164,6 @@ export class ClaimContextSearchFormComponent { } getCommunities() { - if (!Session.isLoggedIn()) { - this.saveStateAndRedirectLogin(); - - } else { this.loading = true; this.subscriptions.push(this._contextService.getPublicCommunitiesByState().subscribe( data => { @@ -203,18 +196,14 @@ export class ClaimContextSearchFormComponent { this.error = true; } )); - } + } getCategories() { this.loading = true; // this.categories=[]; if (this.selectedCommunityId != '0') { - if (!Session.isLoggedIn()) { - this.saveStateAndRedirectLogin(); - - } else { if (this.categories[this.selectedCommunityId]) { this.loading = false; if(this.categories[this.selectedCommunityId].length > 0){ @@ -242,7 +231,7 @@ export class ClaimContextSearchFormComponent { } )); } - } + } displaySubcategory(id) { @@ -255,9 +244,6 @@ export class ClaimContextSearchFormComponent { } browseConcepts(categoryId) { - if (!Session.isLoggedIn()) { - this.saveStateAndRedirectLogin(); - } else { if (this.conceptsClass[categoryId] != null) { this.conceptsClassDisplay[categoryId] = !this.conceptsClassDisplay[categoryId]; return; @@ -285,8 +271,6 @@ export class ClaimContextSearchFormComponent { this.conceptsCategoryLoading[categoryId] = false; } )); - } - } browseSubConcepts(categoryId, conceptId) { @@ -308,24 +292,6 @@ export class ClaimContextSearchFormComponent { } - - saveStateAndRedirectLogin() { - - if (this.results != null) { - localStorage.setItem(this.localStoragePrefix + "results", JSON.stringify(this.results)); - } - if (this.sources != null) { - localStorage.setItem(this.localStoragePrefix + "sources", JSON.stringify(this.sources)); - } - - this.router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url - } - }); - } - private static handleError(message: string, error) { console.error("Claim context search form (component): " + message, error); } diff --git a/claims/linking/linkingGeneric.component.ts b/claims/linking/linkingGeneric.component.ts index 31efc1b5..e2149bb0 100644 --- a/claims/linking/linkingGeneric.component.ts +++ b/claims/linking/linkingGeneric.component.ts @@ -16,6 +16,8 @@ import {OpenaireEntities} from "../../utils/properties/searchFields"; import {StringUtils} from "../../utils/string-utils.class"; import {RouterHelper} from "../../utils/routerHelper.class"; import { Location } from '@angular/common'; +import {LoginErrorCodes} from "../../login/utils/guardHelper.class"; +import {UserManagementService} from "../../services/user-management.service"; @Component({ selector: 'linking-generic', @@ -51,12 +53,17 @@ export class LinkingGenericComponent { constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, private _meta: Meta, private _title: Title, private _piwikService:PiwikService, private seoService: SEOService, private helper: HelperService, private cdr: ChangeDetectorRef, - private location: Location) { + private location: Location, private userManagementService: UserManagementService) { } subscriptions = []; ngOnInit() { - if(this.breadcrumbs.length === 0) { + this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { + if (!user) { + this.saveStateAndRedirectLogin(); + } + })); + if(this.breadcrumbs.length === 0) { this.breadcrumbs.push({name: 'home', route: '/'}); this.breadcrumbs.push({name: "Link", route: null}); } @@ -211,4 +218,20 @@ export class LinkingGenericComponent { this.location.back(); } } + saveStateAndRedirectLogin() { + + if (this.results != null) { + localStorage.setItem(this.localStoragePrefix + "results", JSON.stringify(this.results)); + } + if (this.sources != null) { + localStorage.setItem(this.localStoragePrefix + "sources", JSON.stringify(this.sources)); + } + + this._router.navigate(['/user-info'], { + queryParams: { + "errorCode": LoginErrorCodes.NOT_VALID, + "redirectUrl": this._router.url + } + }); + } } From fa2b14e9b4237932544b613d004c3985502f89fe Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 13 Sep 2023 10:00:13 +0300 Subject: [PATCH 04/17] fix status checks to avoid show list of errors when the job is still processing --- claims/linking/insertClaim/insertClaim.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/claims/linking/insertClaim/insertClaim.component.ts b/claims/linking/insertClaim/insertClaim.component.ts index 068f033c..1a2ec67f 100644 --- a/claims/linking/insertClaim/insertClaim.component.ts +++ b/claims/linking/insertClaim/insertClaim.component.ts @@ -579,7 +579,7 @@ export class ClaimInsertComponent { this.subscriptions.push(this.claimService.getStatus(this.claimsJob.id, this.properties.claimsAPIURL).subscribe(data => { console.log("claim", data); this.claimsJob = data.data; - if (this.claimsJob.status == "COMPLETE" || data.data.status == "ERROR" && (!(this.feedRecordsJob.status == "COMPLETE" || data.data.status == "ERROR")) || !this.feedRecordsJob) { + if ((this.claimsJob.status == "COMPLETE" || data.data.status == "ERROR") && ( !this.feedRecordsJob || !(this.feedRecordsJob.status == "COMPLETE" || data.data.status == "ERROR")) ) { this.insertedClaims = this.claimsJob.insertedIds; this.errorInClaims = this.claimsJob.errorInClaims; From c12916583247fc225ee49c4851b8b4183edc2be0 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 10 Oct 2023 12:25:03 +0300 Subject: [PATCH 05/17] CommunityInfo: Add isOpen method. Email Composer: Add role in community dashboard invitation. --- connect/community/communityInfo.ts | 6 ++++++ utils/email/composer.ts | 12 +++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/connect/community/communityInfo.ts b/connect/community/communityInfo.ts index 1185f8d1..67904a2d 100644 --- a/connect/community/communityInfo.ts +++ b/connect/community/communityInfo.ts @@ -1,6 +1,7 @@ import {StringUtils} from "../../utils/string-utils.class"; import {properties} from "../../../../environments/environment"; import {SelectionCriteria} from "../../utils/entities/contentProvider"; +import tryThese = CKEDITOR.tools.tryThese; export class CommunityInfo { title: string; @@ -36,6 +37,11 @@ export class CommunityInfo { } return response; } + + public isOpen() { + return !(this.membership && this.membership === 'byInvitation'); + } + public isPublic(){ return this.status == "all" || this.status == "PUBLIC"; } diff --git a/utils/email/composer.ts b/utils/email/composer.ts index 6fead2f0..d2df6d38 100644 --- a/utils/email/composer.ts +++ b/utils/email/composer.ts @@ -302,21 +302,23 @@ export class Composer { return message; } - public static composeEmailForCommunityDashboard(name: string, recipient: string) { + public static composeEmailForCommunityDashboard(name: string, role: "manager" | "member", recipient: string) { let email: Email = new Email(); email.subject = 'OpenAIRE Connect | ' + name; - email.body = this.composeMessageForCommunityDashboard(name); + email.body = this.composeMessageForCommunityDashboard(name, role); email.recipient = recipient; return email; } - public static composeMessageForCommunityDashboard(name: string, user: string = null, invitation: any = null) { + public static composeMessageForCommunityDashboard(name: string, role: "manager" | "member", user: string = null, invitation: any = null) { let message = '

Dear ((__user__)),

' + - '

You have been invited to be a manager of the OpenAIRE Research Community Dashboard for the ' + name + '.

' + + '

You have been invited to be a ' + role + ' of the OpenAIRE Research Community Dashboard for the ' + name + '.

' + '

Click this URL and use the verification code below to accept the invitation.

' + '

The verification code is ((__code__)).

' + + (role === 'manager'? '

As a manager of the OpenAIRE Research Community Dashboard, you will have access to the administration part of the dashboard, ' + - 'where you will be able to customize and manage the content of the ' + name + '.

' + + 'where you will be able to customize and manage the content of the ' + name + '.

': + '

As a member of the OpenAIRE Research Community Dashboard, you will have access to the community dashboard and link research results with projects, communities and other research projects.

') + '

Please contact us at ' + properties.helpdeskEmail + ' if you have any questions or concerns.

' + '

Kind Regards
The OpenAIRE Team

' + From dce6e17ea18db1f0ff55982fac1eb0a12d85fbd6 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 10 Oct 2023 17:12:37 +0300 Subject: [PATCH 06/17] Remove animtation from slider and fix active for nav items on resize. --- .../slider-utils/slider-column.component.ts | 20 +++++++++---------- .../slider-container.component.ts | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sharedComponents/slider-utils/slider-column.component.ts b/sharedComponents/slider-utils/slider-column.component.ts index d3bb22a4..8929bb25 100644 --- a/sharedComponents/slider-utils/slider-column.component.ts +++ b/sharedComponents/slider-utils/slider-column.component.ts @@ -17,7 +17,7 @@ export class SliderColumnComponent implements AfterContentInit, OnDestroy { @Input() type: 'slider' | 'nav' = null; @Input() - animation = 'uk-animation-fade'; + animation = null; @ContentChildren(SliderItemComponent) items: QueryList; @ContentChildren(SliderNavItemComponent) navItems: QueryList; public isMobile: boolean; @@ -35,12 +35,14 @@ export class SliderColumnComponent implements AfterContentInit, OnDestroy { } ngAfterContentInit() { - this.slides.forEach(slide => { - slide.init(this.animation); - }); - this.navItems.forEach(slide => { - slide.init(this.animation); - }); + if (this.animation) { + this.slides.forEach(slide => { + slide.init(this.animation); + }); + this.navItems.forEach(slide => { + slide.init(this.animation); + }); + } this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { this.isMobile = isMobile; })); @@ -56,9 +58,7 @@ export class SliderColumnComponent implements AfterContentInit, OnDestroy { if (this.type === 'nav') { let slides = this.navItems; for (let i = 0; i < slides.length; i++) { - if (this.isMobile) { - slides.get(i).setActive(slides.get(i).start <= time && (!slides.get(i + 1) || slides.get(i + 1).start > time)); - } + slides.get(i).setActive(!this.isMobile || (slides.get(i).start <= time && (!slides.get(i + 1) || slides.get(i + 1).start > time))); slides.get(i).active = slides.get(i).start <= time && (!slides.get(i + 1) || slides.get(i + 1).start > time); } } diff --git a/sharedComponents/slider-utils/slider-container.component.ts b/sharedComponents/slider-utils/slider-container.component.ts index 4731405c..1fd18467 100644 --- a/sharedComponents/slider-utils/slider-container.component.ts +++ b/sharedComponents/slider-utils/slider-container.component.ts @@ -18,7 +18,7 @@ export class Stage { @Component({ selector: 'slider-container', template: ` -
+
From a30ec46a89d772c2d4fae2a63e5c852285cb6512 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 10 Oct 2023 17:20:03 +0300 Subject: [PATCH 07/17] Delete wrong imports --- connect/community/communityInfo.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/connect/community/communityInfo.ts b/connect/community/communityInfo.ts index 67904a2d..8a8469ce 100644 --- a/connect/community/communityInfo.ts +++ b/connect/community/communityInfo.ts @@ -1,7 +1,5 @@ import {StringUtils} from "../../utils/string-utils.class"; -import {properties} from "../../../../environments/environment"; import {SelectionCriteria} from "../../utils/entities/contentProvider"; -import tryThese = CKEDITOR.tools.tryThese; export class CommunityInfo { title: string; From c29488545e6450bd422baf158623df07b4e8cb8a Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 10 Oct 2023 17:42:40 +0300 Subject: [PATCH 08/17] [Library & Explore | develop]: Added in openaireLibrary environment files for common properties (environment.all.ts: Common properties among all portals, regardless environment, environment.-/test/beta/prod.ts: Common properties per environment among all portals) | environments/: Build and export properties by merging local properties and common properties. --- .../environments/environment.all.ts | 25 +++++++++++++++++++ .../environments/environment.beta.ts | 6 +++++ .../environments/environment.prod.ts | 6 +++++ .../environments/environment.test.ts | 6 +++++ utils/properties/environments/environment.ts | 6 +++++ 5 files changed, 49 insertions(+) create mode 100644 utils/properties/environments/environment.all.ts create mode 100644 utils/properties/environments/environment.beta.ts create mode 100644 utils/properties/environments/environment.prod.ts create mode 100644 utils/properties/environments/environment.test.ts create mode 100644 utils/properties/environments/environment.ts diff --git a/utils/properties/environments/environment.all.ts b/utils/properties/environments/environment.all.ts new file mode 100644 index 00000000..020b7e89 --- /dev/null +++ b/utils/properties/environments/environment.all.ts @@ -0,0 +1,25 @@ +import {EnvProperties} from "../env-properties"; + +export let common: EnvProperties = { + swhURL: "https://archive.softwareheritage.org/", + // searchCrossrefAPIURL: "https://api.crossref.org/works", + // searchDataciteAPIURL: "https://api.datacite.org/works", + // searchOrcidURL: "https://pub.orcid.org/v2.1/", + // orcidURL: "https://orcid.org/", + // doiURL: "https://doi.org/", + // pmcURL: "http://europepmc.org/articles/", + // pmidURL: "https://www.ncbi.nlm.nih.gov/pubmed/", + // handleURL: "http://hdl.handle.net/", + // cordisURL: "http://cordis.europa.eu/projects/", + // openDoarURL: "http://v2.sherpa.ac.uk/id/repository/", + // r3DataURL: "http://service.re3data.org/repository/", + // fairSharingURL: "https://fairsharing.org/", + // sherpaURL: "http://sherpa.ac.uk/romeo/issn/", + // sherpaURLSuffix: "/", + // zenodo: "https://zenodo.org/", + // openAccess: "https://www.openaire.eu/support/faq#article-id-234", + // openAccessRepo: "https://www.openaire.eu/support/faq#article-id-310", + // fp7Guidlines: "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme", + // h2020Guidlines: "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020", + // ercGuidlines: "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf", +} \ No newline at end of file diff --git a/utils/properties/environments/environment.beta.ts b/utils/properties/environments/environment.beta.ts new file mode 100644 index 00000000..520b88e2 --- /dev/null +++ b/utils/properties/environments/environment.beta.ts @@ -0,0 +1,6 @@ +import {EnvProperties} from "../env-properties"; + +export let commonBeta: EnvProperties = { + // searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/", + // searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources", +} \ No newline at end of file diff --git a/utils/properties/environments/environment.prod.ts b/utils/properties/environments/environment.prod.ts new file mode 100644 index 00000000..a2aa22f8 --- /dev/null +++ b/utils/properties/environments/environment.prod.ts @@ -0,0 +1,6 @@ +import {EnvProperties} from "../env-properties"; + +export let commonProd: EnvProperties = { + // searchAPIURLLAst: "https://services.openaire.eu/search/v2/api/", + // searchResourcesAPIURL: "https://services.openaire.eu/search/v2/api/resources", +} \ No newline at end of file diff --git a/utils/properties/environments/environment.test.ts b/utils/properties/environments/environment.test.ts new file mode 100644 index 00000000..81abb978 --- /dev/null +++ b/utils/properties/environments/environment.test.ts @@ -0,0 +1,6 @@ +import {EnvProperties} from "../env-properties"; + +export let commonTest: EnvProperties = { + // searchAPIURLLAst: "https://services.openaire.eu/shadowSearch/v2/api/", + // searchResourcesAPIURL: "https://services.openaire.eu/shadowSearch/v2/api/resources", +} \ No newline at end of file diff --git a/utils/properties/environments/environment.ts b/utils/properties/environments/environment.ts new file mode 100644 index 00000000..69e7ceb1 --- /dev/null +++ b/utils/properties/environments/environment.ts @@ -0,0 +1,6 @@ +import {EnvProperties} from "../env-properties"; + +export let commonDev: EnvProperties = { + // searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/", + // searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources", +} \ No newline at end of file From ff4411d69587e012a274dbd0451ca770d1afb969 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 10 Oct 2023 22:40:01 +0300 Subject: [PATCH 09/17] Fix role verification for community members. Modify isPrivate in communityHelper to include membership. --- connect/connectHelper.ts | 10 ++++++++-- .../role-verification.component.ts | 20 +++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/connect/connectHelper.ts b/connect/connectHelper.ts index 0e65047a..d53a63a3 100644 --- a/connect/connectHelper.ts +++ b/connect/connectHelper.ts @@ -1,6 +1,7 @@ import {HttpParams} from '@angular/common/http'; import {properties} from "../../../environments/environment"; import {Session} from "../login/utils/helper.class"; +import {CommunityInfo} from "./community/communityInfo"; export class ConnectHelper { @@ -53,7 +54,12 @@ export class ConnectHelper { } - public static isPrivate(community, user) { - return community && (community.isPrivate() || (community.isRestricted() && !(Session.isPortalAdministrator(user) || Session.isCommunityCurator(user) || Session.isManager("community", community.communityId, user)))) + public static isPrivate(community: CommunityInfo, user) { + return community && (community.isPrivate() || (community.isRestricted() && !( + Session.isPortalAdministrator(user) || + Session.isCommunityCurator(user) || + Session.isManager("community", community.communityId, user) || + (!community.isOpen() && Session.isMember('community', community.communityId, user)) + ))) } } diff --git a/role-verification/role-verification.component.ts b/role-verification/role-verification.component.ts index 9030d636..c4a9a71a 100644 --- a/role-verification/role-verification.component.ts +++ b/role-verification/role-verification.component.ts @@ -34,7 +34,7 @@ import {ClearCacheService} from "../services/clear-cache.service";
-
@@ -119,12 +119,8 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn ngAfterViewInit() { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.user = user; - if (this.paramsSubscription instanceof Subscription) { - this.paramsSubscription.unsubscribe(); - } this.paramsSubscription = this.route.queryParams.subscribe(params => { if (params) { - this.isMember = !!params['isMember']; this.cdr.detectChanges(); if(params['verify'] && !this.isMember) { if (this.user) { @@ -133,7 +129,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this.type === this.verification.type) { if (this.verification.verificationType === 'manager') { this.openManagerModal(); - } else if (this.verification.verificationType === 'member' && this.service === "monitor") { + } else if (this.verification.verificationType === 'member') { this.openMemberModal(); } else { this.openErrorModal(); @@ -217,6 +213,9 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn this.managerModal.cancel(); this.error = null; this.userManagementService.updateUserInfo(() => { + if (this.paramsSubscription instanceof Subscription) { + this.paramsSubscription.unsubscribe(); + } if (this.service === "monitor") { this.loading = false; this.router.navigate(['/admin/' + this.verification.entity]); @@ -254,8 +253,12 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn this.clearCacheService.clearCache('Members updated'); this.loading = false; this.error = null; + this.isMember = true; this.userManagementService.updateUserInfo(() => { - this.router.navigate([], {queryParams: {'verify': null, 'isMember': true}}); + if (this.paramsSubscription instanceof Subscription) { + this.paramsSubscription.unsubscribe(); + } + this.cancel(); }); }, error => { this.loading = false; @@ -271,6 +274,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn } cancel() { - this.router.navigate([], {queryParams: {'verify': null, 'isMember': null}}); + this.isMember = false; + this.router.navigate([]); } } From 9226a5975df57cdb43b795a202db565ac456f0b9 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 11 Oct 2023 12:46:10 +0300 Subject: [PATCH 10/17] [Library | develop]: Added Full-Text in research products actions when available. 1. availableOn.component.ts: Added Full-Text before Data sources, as a separate action and as information for each instance. 2. parsingFunctions.class.ts: Added parsing for fulltext and updated method "compareHostedByCollectedFrom()" to sort by both access and existence of fulltext. 3. resultLanding.component.html: Removed classes for in mobile actions. 4. entity-actions.component.ts: Updated uk-text-bolder class for all actions. 5. result-preview.ts: Added "fulltext?: string;" in HostedByCollectedFrom. --- .../landing-utils/availableOn.component.ts | 95 ++++++++++++------- .../landing-utils/parsingFunctions.class.ts | 52 ++++++---- .../result/resultLanding.component.html | 2 +- .../entity-actions.component.ts | 14 +-- utils/result-preview/result-preview.ts | 1 + 5 files changed, 104 insertions(+), 60 deletions(-) diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index 9a1d217c..23c8ef1e 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -11,44 +11,59 @@ import {RouterHelper} from "../../utils/routerHelper.class"; selector: 'availableOn', template: ` -
- - - - - - - {{sliceString(availableOn[0].downloadNames.join("; "), 20)}} - - - - - -
- -
-
- - - - {{sliceString(availableOn[0].downloadNames.join("; "), 20)}} - - +
+ +

+ @@ -79,6 +94,14 @@ import {RouterHelper} from "../../utils/routerHelper.class"; {{instance.license}}
+
+ Full-Text: + + {{instance.fulltext}} + + {{instance.fulltext}} +
Data sources:
-
+
@@ -41,7 +41,7 @@ import {EnvProperties} from "../properties/env-properties"; + class="uk-flex uk-flex-middle uk-button-link" [ngClass]="isMobile ? 'uk-margin-left uk-margin-xsmall-bottom' : 'uk-text-bolder uk-flex-center'"> Deposit @@ -50,7 +50,7 @@ import {EnvProperties} from "../properties/env-properties"; + class="uk-flex uk-flex-middle uk-button-link" [ngClass]="isMobile ? 'uk-margin-left uk-margin-xsmall-bottom' : 'uk-text-bolder uk-flex-center'"> Embed diff --git a/utils/result-preview/result-preview.ts b/utils/result-preview/result-preview.ts index b7a2450b..11ee68c5 100644 --- a/utils/result-preview/result-preview.ts +++ b/utils/result-preview/result-preview.ts @@ -11,6 +11,7 @@ export interface HostedByCollectedFrom { years: string[]; accessRightIcon: string; license?: string; + fulltext?: string; } export interface Journal { From 0c21afdd7f957bd640c5d40707af826a8d07fd7d Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 11 Oct 2023 16:40:24 +0300 Subject: [PATCH 11/17] Import Session in claimContextSearchForm deleted in Develop branch. --- claims/claim-utils/claimContextSearchForm.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/claims/claim-utils/claimContextSearchForm.component.ts b/claims/claim-utils/claimContextSearchForm.component.ts index 614d1d09..bed48c8f 100644 --- a/claims/claim-utils/claimContextSearchForm.component.ts +++ b/claims/claim-utils/claimContextSearchForm.component.ts @@ -7,6 +7,7 @@ import {Subscriber} from "rxjs"; import {OpenaireEntities} from "../../utils/properties/searchFields"; import {CommunitiesService} from "../../connect/communities/communities.service"; import {UserManagementService} from "../../services/user-management.service"; +import {Session} from "../../login/utils/helper.class"; declare var UIkit: any; From 1bfff3b05c149c9ba38c0a413e9c66ed3eab0b9c Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 12 Oct 2023 12:17:09 +0300 Subject: [PATCH 12/17] update footer links to webinars and blogs --- sharedComponents/bottom.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sharedComponents/bottom.component.html b/sharedComponents/bottom.component.html index 516077e9..c978bf51 100644 --- a/sharedComponents/bottom.component.html +++ b/sharedComponents/bottom.component.html @@ -112,7 +112,7 @@
  • NOADs
  • Guides
  • FAQs
  • -
  • Webinars
  • +
  • Webinars
  • Ask a question
  • @@ -123,7 +123,7 @@ From dbbd7ec541d96a5062a769dea2255ad9ccb36b13 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 12 Oct 2023 13:10:02 +0300 Subject: [PATCH 13/17] Input: Make error text-small --- sharedComponents/input/input.component.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sharedComponents/input/input.component.ts b/sharedComponents/input/input.component.ts index ad0bd9a4..cfcae9d5 100644 --- a/sharedComponents/input/input.component.ts +++ b/sharedComponents/input/input.component.ts @@ -231,10 +231,10 @@ declare var UIkit;
    - - {{errors?.error}} - Please provide a valid URL (e.g. https://example.com) - + + {{errors?.error}} + Please provide a valid URL (e.g. https://example.com) + From f0a48cd2e10ca9bc3c5edafa02c5af20b4106877 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 16 Oct 2023 11:44:18 +0300 Subject: [PATCH 14/17] [Library | develop]: search-input.component.ts: [Bug fix] Added cdr.detectChanges() call on ngAfterViewInit, to solve expressionChangedAfterItHasBeenChecked error. --- sharedComponents/search-input/search-input.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/sharedComponents/search-input/search-input.component.ts b/sharedComponents/search-input/search-input.component.ts index ea7e87df..63fc7d03 100644 --- a/sharedComponents/search-input/search-input.component.ts +++ b/sharedComponents/search-input/search-input.component.ts @@ -90,6 +90,7 @@ export class SearchInputComponent implements OnInit, AfterViewInit { ngAfterViewInit() { if(typeof document !== 'undefined') { this.ratio = Number.parseFloat(getComputedStyle(this.searchInput.nativeElement).getPropertyValue('--search-input-icon-ratio')); + this.cdr.detectChanges(); } } From aa0ec0b06fa169469d68858e5b1590cb5c395907 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 16 Oct 2023 12:11:47 +0300 Subject: [PATCH 15/17] search tab: show all results / don't slice the array Fetch research results: keep all results in allResults field (for community results case) --- utils/fetchEntitiesClasses/fetchResearchResults.class.ts | 4 +++- utils/tabs/contents/search-tab.component.ts | 9 ++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/utils/fetchEntitiesClasses/fetchResearchResults.class.ts b/utils/fetchEntitiesClasses/fetchResearchResults.class.ts index 1090aeae..ce05a800 100644 --- a/utils/fetchEntitiesClasses/fetchResearchResults.class.ts +++ b/utils/fetchEntitiesClasses/fetchResearchResults.class.ts @@ -12,6 +12,7 @@ export class FetchResearchResults { private errorMessages: ErrorMessagesComponent; public results =[]; + public allResults =[]; // in case of paging public requestComplete: Subject; @@ -88,7 +89,8 @@ export class FetchResearchResults { this.subscriptions.push(this._searchResearchResultsService.advancedSearchResults(resultType, "", page, size, "resultdateofacceptance,descending", properties, "&type=results&fq=communityid=" + communityId +(contextId?'&fq=categoryid=' + encodeURIComponent(contextId):'')).subscribe( data => { this.searchUtils.totalResults = data[0]; - this.results = data[1]; + this.allResults = data[1]; + this.results = data[1].slice(0, 5) ; this.searchUtils.status = this.errorCodes.DONE; if(this.searchUtils.totalResults == 0 ){ diff --git a/utils/tabs/contents/search-tab.component.ts b/utils/tabs/contents/search-tab.component.ts index 7383f76e..e8656ed1 100644 --- a/utils/tabs/contents/search-tab.component.ts +++ b/utils/tabs/contents/search-tab.component.ts @@ -1,4 +1,4 @@ -import {Component, Input} from '@angular/core'; +import {Component, Input, SimpleChanges} from '@angular/core'; import {EnvProperties} from "../../properties/env-properties"; import {ErrorCodes} from "../../properties/errorCodes"; import {OpenaireEntities} from "../../properties/searchFields"; @@ -41,7 +41,7 @@ import {StringUtils} from "../../string-utils.class"; @@ -67,7 +67,6 @@ export class SearchTabComponent { @Input() properties: EnvProperties; @Input() customTitle; @Input() showEnermaps: boolean; - @Input() currentPage: number = null; public errorCodes: ErrorCodes = new ErrorCodes(); @@ -75,10 +74,6 @@ export class SearchTabComponent { return StringUtils.getEntityName(entityType, true); } - get results() { - return this.currentPage ? this.fetch.results.slice((this.currentPage - 1) * this.searchNumber, this.currentPage * this.searchNumber) : this.fetch.results; - } - get paramsForExternalUrl() { let parameters: string = ""; Object.keys(this.params).forEach(paramKey => { From fce848008aa7edf91be10a3a241d940abec0076a Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 16 Oct 2023 12:53:40 +0300 Subject: [PATCH 16/17] [Library | develop]: resultLanding.component.html: [Bug fix] Fix check isNumber for bip measures & remove check if value (show citation score also when it is 0). --- landingPages/result/resultLanding.component.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 4aa62494..f12efbb7 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -388,7 +388,7 @@
    -
    +
    @@ -404,7 +404,7 @@
    -
    + @@ -422,14 +422,14 @@
    - -
    +
    {{formatNumber(measure.value)}}
    - -
    + +
    {{measure.value}}
    From 8d6522270c26451c7474630fc71e7fa3e31c5c0e Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 16 Oct 2023 14:34:48 +0300 Subject: [PATCH 17/17] Slider container: Fix error about observer --- .../slider-container.component.ts | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/sharedComponents/slider-utils/slider-container.component.ts b/sharedComponents/slider-utils/slider-container.component.ts index 1fd18467..4eea093d 100644 --- a/sharedComponents/slider-utils/slider-container.component.ts +++ b/sharedComponents/slider-utils/slider-container.component.ts @@ -60,7 +60,7 @@ export class SliderContainerComponent implements OnInit, OnDestroy, AfterContent } ngOnDestroy() { - if(this.observer) { + if(this.observer && typeof IntersectionObserver !== 'undefined') { this.observer.disconnect(); } } @@ -78,24 +78,26 @@ export class SliderContainerComponent implements OnInit, OnDestroy, AfterContent } setObserver() { - let options = { - root: null, - rootMargin: '0px', - threshold: 0.1 - }; - this.observer = new IntersectionObserver(entries => { - entries.forEach(entry => { - if (entry.isIntersecting && !this.initialized) { - this.stopped = false; - this.start(0); - this.initialized = true; - } else { - this.initialized = false; - this.stopped = true; - } - }); - }, options); - this.observer.observe(this.element.nativeElement); + if(typeof IntersectionObserver !== 'undefined') { + let options = { + root: null, + rootMargin: '0px', + threshold: 0.1 + }; + this.observer = new IntersectionObserver(entries => { + entries.forEach(entry => { + if (entry.isIntersecting && !this.initialized) { + this.stopped = false; + this.start(0); + this.initialized = true; + } else { + this.initialized = false; + this.stopped = true; + } + }); + }, options); + this.observer.observe(this.element.nativeElement); + } } start(time: number) {