[Trunk | Library]:

1. error-interceptor.service.ts: Add "properties.orcidAPIURL" in UNAUTHORIZED_WHITELIST.
2. resultLanding.component.html: If result has identifiers and user is logged in, call <orcid-work>.
3. resultLanding.module.ts: Import OrcidModule.
4. searchResult.component.ts: If user is logged in, call "orcidService.getPutCodes()" and set orcidPutCodes of previewResults.
5. searchResults.module.ts: Add "OrcidService" in providers.
6. searchResearchResults.service.ts: In method "parseResults()", call "this.parsingFunctions.parseIdentifiers(resData['pid'])" to set identifiers.
7. customOptions.class.ts: Change method return type: "public static registryOptions(): any" --> public static registryOptions(): {}". (caused problem in return type of services (e.g. HttpEvent<string> instead of string).
8. searchResult.ts: Add field "identifiers: Map<string, string[]>".
9. env-properties.ts: Add field "orcidAPIURL".
10. result-preview.component.html: 
	a. If result has identifiers and user is logged in, call <orcid-work>.
	b. In bottom line with impact factors and orcid, add class "result-preview-bottom" (set color to #747474 (like muted text) when not on hover).
11. result-preview.component.ts: Add field "loggedIn" and check on init if user is logged in (via Session).
12. result-preview.module.ts: Import OrcidModule.
13. result-preview.ts: Add field "orcidPutCodes" | In method "searchResultConvert()", set resultPreview.identifiers with all identifiers (not only dois).


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60231 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2021-01-13 18:30:25 +00:00
parent 948831e201
commit eb4a1f13f6
12 changed files with 72 additions and 13 deletions

View File

@ -11,7 +11,7 @@ import {isArray} from "util";
@Injectable()
export class ErrorInterceptorService implements HttpInterceptor {
private static UNAUTHORIZED_WHITELIST = [properties.userInfoUrl];
private static UNAUTHORIZED_WHITELIST = [properties.userInfoUrl, properties.orcidAPIURL];
constructor(private router: Router) {
}

View File

@ -100,6 +100,12 @@
<span class="uk-margin-small-left">Cite this {{getTypeName()}}</span>
</a>
</li>
<!-- ORCID -->
<li *ngIf="properties.environment == 'development' &&
loggedIn && resultLandingInfo && resultLandingInfo.identifiers && resultLandingInfo.identifiers.size > 0">
<orcid-work [resultId]="id" [resultLandingInfo]="resultLandingInfo" [pids]="pidsArrayString" [pageType]="'landing'">
</orcid-work>
</li>
<li *ngIf="properties.b2noteAPIURL">
<a *ngIf="isLoggedIn && pid" class="uk-link-text uk-text-bold uk-text-uppercase" (click)="annotation.toggleAnnotation($event)">
<span class="uk-icon-button uk-button-primary uk-icon">

View File

@ -28,13 +28,16 @@ import {ResultPreviewModule} from "../../utils/result-preview/result-preview.mod
import {FeedbackModule} from "../feedback/feedback.module";
import {TabsModule} from "../../utils/tabs/tabs.module";
import {LoadingModule} from "../../utils/loading/loading.module";
import {OrcidModule} from "../../orcid/orcid.module";
@NgModule({
imports: [
CommonModule, FormsModule, LandingModule, SharedModule, RouterModule,
CiteThisModule, PagingModule, IFrameModule,
MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule,
DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule, AnnotationModule, LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule, TabsModule, LoadingModule
DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule,
AnnotationModule, LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule, TabsModule, LoadingModule,
OrcidModule
],
declarations: [
ResultLandingComponent

View File

@ -3,6 +3,8 @@ import {SearchResult} from '../../utils/entities/searchResult';
import {EnvProperties} from '../../utils/properties/env-properties';
import {ResultPreview} from "../../utils/result-preview/result-preview";
import {HttpClient} from "@angular/common/http";
import {OrcidService} from "../../orcid/orcid.service";
import {Session} from "../../login/utils/helper.class";
@Component({
selector: 'search-result',
@ -20,7 +22,8 @@ export class SearchResultComponent implements OnInit, OnChanges {
@Input() properties: EnvProperties;
@Input() showImpactFactors: boolean = false;
constructor( private http: HttpClient/*ATHENA CODE*/) {
constructor( private http: HttpClient/*ATHENA CODE*/
, private orcidService: OrcidService) {
}
ngOnInit() {}
@ -35,6 +38,31 @@ export class SearchResultComponent implements OnInit, OnChanges {
for(let result of this.results){
this.previewResults.push(this.getResultPreview(result));
}
if(this.properties.environment == 'development' && Session.isLoggedIn() && this.results && this.results.length > 0) {
this.orcidService.getPutCodes(this.previewResults.map(
previewResult => {
if(previewResult.identifiers) {
let pidsArray: string[] = [];
for(let key of Array.from(previewResult.identifiers.keys())) {
pidsArray = pidsArray.concat(previewResult.identifiers.get(key));
}
return pidsArray;//.join();
}
})).subscribe(
putCodes => {
for (let i = 0; i < this.previewResults.length; i++) {
if(this.previewResults[i].identifiers) {
this.previewResults[i].orcidPutCodes = putCodes[i];
console.debug(i, this.previewResults[i].orcidPutCodes);
}
}
}, error => {
}
);
}
/////////////////////// ATHENA CODE ///////////////////////
// console.log(data[1]);
let dois = encodeURIComponent(this.results.map((result) => result.DOIs).join(","));

View File

@ -9,6 +9,7 @@ import {ApprovedByCommunityModule} from '../../connect/approvedByCommunity/appro
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
import {HighlightModule} from "./highlight/highlight.module";
import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module";
import {OrcidService} from "../../orcid/orcid.service";
@NgModule({
imports: [
@ -21,6 +22,7 @@ import {ResultPreviewModule} from "../../utils/result-preview/result-preview.mod
SearchResultComponent
],
providers:[
OrcidService
],
exports: [
SearchResultComponent

View File

@ -4,7 +4,7 @@ import {HttpHeaders} from "@angular/common/http";
export class CustomOptions {
public static registryOptions(): any {
public static registryOptions(): {} {
return {
headers: new HttpHeaders({
'Content-Type': 'application/json',

View File

@ -4,6 +4,7 @@ export class SearchResult {
title: ResultTitle;
id: string;
DOIs: string[]=[];
identifiers: Map<string, string[]>;
//publications & datasets & orp & software & projects & dataproviders:
description: string;
@ -30,6 +31,7 @@ export class SearchResult {
//projects:
acronym: string;
code: string;
// callIdentifier?: string; // currently not parsed
funderShortname: string;
budget?: string;
contribution?: string;

View File

@ -30,6 +30,7 @@ export interface EnvProperties {
searchDataciteAPIURL?: string;
searchOrcidURL?: string;
orcidURL?: string;
orcidAPIURL?: string;
doiURL?: string;
pmcURL?: string;
pmidURL?: string;

View File

@ -262,9 +262,11 @@
</span>
</div>
</div>
<div>
<div *ngIf="(result.pop_inf && result.DOI) || (loggedIn && result.identifiers && result.identifiers.size > 0)"
class="result-preview-bottom">
<!-- Impact Factors-->
<span *ngIf="result.pop_inf && result.DOI" class="uk-flex uk-flex-middle">
<span class="uk-flex uk-flex-middle">
<ng-container *ngIf="result.pop_inf && result.DOI">
<!--Popularity -->
<a title="Popularity" class="popularity-{{result.pop_inf[0]}} uk-margin-right uk-flex uk-flex-middle">
<svg xmlns="http://www.w3.org/2000/svg" width="10.749" height="14.33" viewBox="0 0 10.749 14.33"><defs><!--<style>.a{fill:#d51717;}</style>--></defs><path
@ -299,7 +301,7 @@
</div>
</div>
<!--Influence -->
<a title="Influence" class="influence-{{result.pop_inf[1]}} uk-flex uk-flex-middle">
<a title="Influence" class="influence-{{result.pop_inf[1]}} uk-margin-right uk-flex uk-flex-middle">
<svg xmlns="http://www.w3.org/2000/svg" width="12.667" height="14" viewBox="0 0 12.667 14">
<defs><!--<style>.a{fill:#e1920a;}</style>--></defs>
<path class="a"
@ -334,5 +336,12 @@
"https://bip.imis.athena-innovation.gr/site/details?id={{result.DOI}}">View more details</a>
</div>
</div>
</ng-container>
<span *ngIf="properties.environment == 'development' && loggedIn && result.identifiers && result.identifiers.size > 0"
class="uk-margin-right uk-flex uk-flex-middle uk-flex-right uk-width-expand">
<orcid-work [resultId]="result.id" [type]="result.resultType" [pageType]="'search'"
[putCodes]="result.orcidPutCodes" [givenPutCode]="true">
</orcid-work>
</span>
</span>
</div>

View File

@ -4,6 +4,7 @@ import {EnvProperties} from "../properties/env-properties";
import {RouterHelper} from "../routerHelper.class";
import {AlertModal} from "../modal/alert";
import {properties} from "../../../../environments/environment";
import {Session} from "../../login/utils/helper.class";
@Component({
selector: 'result-preview',
@ -22,8 +23,12 @@ export class ResultPreviewComponent implements OnInit{
public type: string;
public beforeTitle: string[] = [];
public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0];
public loggedIn: boolean = false;
ngOnInit(): void {
if (Session.isLoggedIn()) {
this.loggedIn = true;
}
if (this.result.resultType === "publication") {
this.urlParam = "articleId";
this.url = properties.searchLinkToPublication.split('?')[0];

View File

@ -4,9 +4,10 @@ import {ResultPreviewComponent} from "./result-preview.component";
import {RouterModule} from "@angular/router";
import {ShowAuthorsModule} from "../authors/showAuthors.module";
import {ResultLandingUtilsModule} from "../../landingPages/landing-utils/resultLandingUtils.module";
import {OrcidModule} from "../../orcid/orcid.module";
@NgModule({
imports: [CommonModule, RouterModule, ShowAuthorsModule, ResultLandingUtilsModule],
imports: [CommonModule, RouterModule, ShowAuthorsModule, ResultLandingUtilsModule, OrcidModule],
declarations: [ResultPreviewComponent],
exports: [ResultPreviewComponent]
})

View File

@ -90,6 +90,7 @@ export class ResultPreview {
languages: string[];
identifiers: Map<string, string[]>; //key is the classname
hostedBy_collectedFrom: HostedByCollectedFrom[];
orcidPutCodes: string[];
//datasets & orp & software:
publisher: string;
@ -178,10 +179,11 @@ export class ResultPreview {
resultPreview.subjects = result.subjects;
resultPreview.resultType = type;
//impact factor;
if(result.DOIs && result.DOIs.length > 0) {
resultPreview.identifiers = new Map();
resultPreview.identifiers.set("doi", result.DOIs);
}
// if(result.DOIs && result.DOIs.length > 0) {
// resultPreview.identifiers = new Map();
// resultPreview.identifiers.set("doi", result.DOIs);
// }
resultPreview.identifiers = result.identifiers;
return resultPreview;
}