[Library | Trunk]: Result preview: add hasLink param and check pid if result preview has been changed
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60520 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
74eadebf48
commit
fe7fa1298e
|
@ -24,7 +24,7 @@ import {properties} from "../../../../../environments/environment";
|
|||
</no-load-paging>
|
||||
<ul class="uk-list uk-list-divider uk-margin">
|
||||
<li *ngFor="let result of results.slice((page-1)*pageSize, page*pageSize)">
|
||||
<result-preview [modal]="modal" [properties]="properties" [result]="getResultPreview(result)"></result-preview>
|
||||
<result-preview [modal]="modal" [properties]="properties" [hasLink]="false" [result]="getResultPreview(result)"></result-preview>
|
||||
</li>
|
||||
</ul>
|
||||
<no-load-paging *ngIf="results.length > pageSize" [type]="type"
|
||||
|
|
|
@ -24,7 +24,7 @@ import {properties} from "../../../../../environments/environment";
|
|||
</no-load-paging>
|
||||
<ul class="uk-list uk-list-divider uk-margin">
|
||||
<li *ngFor="let result of results.slice((page-1)*pageSize, page*pageSize)">
|
||||
<result-preview [modal]="modal" [properties]="properties" [result]="getResultPreview(result)" [showOrcid]="false"></result-preview>
|
||||
<result-preview [modal]="modal" [properties]="properties" [hasLink]="false" [result]="getResultPreview(result)" [showOrcid]="false"></result-preview>
|
||||
</li>
|
||||
</ul>
|
||||
<no-load-paging *ngIf="results.length > pageSize" [type]="type"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!-- Before title -->
|
||||
<div uk-grid>
|
||||
<div class="uk-width-1-1">
|
||||
<div *ngIf="result">
|
||||
<div>
|
||||
<!-- deposit searchPage URL -->
|
||||
<span class="uk-width-expand uk-flex-right">
|
||||
<a *ngIf="result.websiteURL && promoteWebsiteURL" href="{{result.websiteURL}}" target="_blank" type="submit"
|
||||
|
@ -187,7 +187,7 @@
|
|||
<span>
|
||||
<a href="{{result.websiteURL}}" target="_blank">
|
||||
<span class="custom-external custom-icon"></span>
|
||||
{{result.websiteURL}}
|
||||
{{result.websiteURL}}
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -197,7 +197,7 @@
|
|||
<span>
|
||||
<a href="{{result.OAIPMHURL}}" target="_blank">
|
||||
<span class="custom-external custom-icon"></span>
|
||||
{{result.OAIPMHURL}}
|
||||
{{result.OAIPMHURL}}
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -212,23 +212,22 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Description -->
|
||||
<div *ngIf="result.description" class="uk-margin-small-bottom multi-line-ellipsis lines-3">
|
||||
<p class="uk-text-muted">
|
||||
{{result.description}}
|
||||
</p>
|
||||
</div>
|
||||
<!-- Download from-->
|
||||
<div *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0"
|
||||
class="uk-margin-small-bottom download-from">
|
||||
<div *ngFor="let from of result.hostedBy_collectedFrom"
|
||||
[title]="from.bestAccessMode ? from.bestAccessMode : 'Not available'"
|
||||
class="uk-flex">
|
||||
<!-- Description -->
|
||||
<div *ngIf="result.description" class="uk-margin-small-bottom multi-line-ellipsis lines-3">
|
||||
<p class="uk-text-muted">
|
||||
{{result.description}}
|
||||
</p>
|
||||
</div>
|
||||
<!-- Download from-->
|
||||
<div *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0"
|
||||
class="uk-margin-small-bottom download-from">
|
||||
<div *ngFor="let from of result.hostedBy_collectedFrom"
|
||||
[title]="from.bestAccessMode ? from.bestAccessMode : 'Not available'"
|
||||
class="uk-flex">
|
||||
<span class="uk-margin-small-right">
|
||||
<img [src]="from.icon">
|
||||
</span>
|
||||
<span class="uk-width-expand">
|
||||
<span class="uk-width-expand">
|
||||
<span class="uk-margin-right uk-display-inline-block">
|
||||
<span class="uk-text-muted">Download from: </span>
|
||||
<span *ngIf="from.downloadUrl.length > 1" class="title">
|
||||
|
@ -260,13 +259,14 @@
|
|||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--&& loggedIn -->
|
||||
<div *ngIf="(result.pop_inf && result.DOI) || (properties.environment != 'production' && properties.adminToolsPortalType == 'explore' && ((showOrcid && result.identifiers && result.identifiers.size > 0) || (result.orcidUpdateDates?.length > 0 || result.orcidCreationDates?.length > 0)))"
|
||||
class="result-preview-bottom">
|
||||
<!-- Impact Factors-->
|
||||
<span class="uk-flex uk-flex-top">
|
||||
<!--&& loggedIn -->
|
||||
<div
|
||||
*ngIf="(result.pop_inf && result.DOI) || (properties.environment != 'production' && properties.adminToolsPortalType == 'explore' && ((showOrcid && result.identifiers && result.identifiers.size > 0) || (result.orcidUpdateDates?.length > 0 || result.orcidCreationDates?.length > 0)))"
|
||||
class="result-preview-bottom">
|
||||
<!-- Impact Factors-->
|
||||
<span class="uk-flex uk-flex-top">
|
||||
<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">
|
||||
|
@ -301,7 +301,7 @@
|
|||
href="https://bip.imis.athena-innovation.gr/site/details?id={{result.DOI}}">View more details</a>
|
||||
</div>
|
||||
</div>
|
||||
<!--Influence -->
|
||||
<!--Influence -->
|
||||
<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>
|
||||
|
@ -338,16 +338,19 @@
|
|||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
<!-- && loggedIn -->
|
||||
<span *ngIf="properties.environment != 'production' && properties.adminToolsPortalType == 'explore' && showOrcid && result.identifiers && result.identifiers.size > 0"
|
||||
class="uk-width-1-3 uk-width-expand@s">
|
||||
<!-- && loggedIn -->
|
||||
<span
|
||||
*ngIf="properties.environment != 'production' && properties.adminToolsPortalType == 'explore' && showOrcid && result.identifiers && result.identifiers.size > 0"
|
||||
class="uk-width-1-3 uk-width-expand@s">
|
||||
<!-- class="uk-flex uk-flex-middle uk-flex-right uk-width-expand">-->
|
||||
<orcid-work *ngIf="showOrcid && result.identifiers && result.identifiers.size > 0" [resultId]="result.relcanId" [type]="result.resultType" [pageType]="'search'"
|
||||
[putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers">
|
||||
<orcid-work *ngIf="showOrcid && result.identifiers && result.identifiers.size > 0" [resultId]="result.relcanId"
|
||||
[type]="result.resultType" [pageType]="'search'"
|
||||
[putCodes]="result.orcidPutCodes" [givenPutCode]="true" [identifiers]="result.identifiers">
|
||||
</orcid-work>
|
||||
</span>
|
||||
<span *ngIf="properties.environment != 'production' && properties.adminToolsPortalType == 'explore' && (result.orcidUpdateDates?.length > 0 || result.orcidCreationDates?.length > 0)"
|
||||
class="uk-width-expand uk-text-right">
|
||||
<span
|
||||
*ngIf="properties.environment != 'production' && properties.adminToolsPortalType == 'explore' && (result.orcidUpdateDates?.length > 0 || result.orcidCreationDates?.length > 0)"
|
||||
class="uk-width-expand uk-text-right">
|
||||
<span *ngIf="result.orcidCreationDates?.length > 0" class="uk-display-inline-block">
|
||||
<span class="uk-text-muted">Added in ORCID:</span>
|
||||
<span *ngFor="let date of result.orcidCreationDates; let i=index">
|
||||
|
@ -367,4 +370,5 @@
|
|||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {Component, Input, OnInit} from "@angular/core";
|
||||
import {Component, Input, OnChanges, OnInit, SimpleChanges} from "@angular/core";
|
||||
import {ResultPreview} from "./result-preview";
|
||||
import {EnvProperties} from "../properties/env-properties";
|
||||
import {RouterHelper} from "../routerHelper.class";
|
||||
|
@ -11,57 +11,50 @@ import {Identifier} from "../string-utils.class";
|
|||
selector: 'result-preview',
|
||||
templateUrl: 'result-preview.component.html'
|
||||
})
|
||||
export class ResultPreviewComponent implements OnInit{
|
||||
export class ResultPreviewComponent implements OnInit, OnChanges {
|
||||
@Input() result: ResultPreview;
|
||||
@Input() properties: EnvProperties;
|
||||
@Input() showSubjects: boolean = true;
|
||||
@Input() showOrganizations: boolean = true;
|
||||
@Input() modal: AlertModal = null;
|
||||
@Input() promoteWebsiteURL: boolean = false;
|
||||
@Input() hasLink: boolean = true;
|
||||
public routerHelper: RouterHelper = new RouterHelper();
|
||||
public urlParam: string;
|
||||
public url: string;
|
||||
public type: string;
|
||||
public beforeTitle: string[] = [];
|
||||
public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0];
|
||||
public loggedIn: boolean = false;
|
||||
@Input() showOrcid: boolean = true;
|
||||
|
||||
ngOnInit(): void {
|
||||
if (Session.isLoggedIn()) {
|
||||
this.loggedIn = true;
|
||||
}
|
||||
if (this.result.resultType === "publication") {
|
||||
this.urlParam = "articleId";
|
||||
this.url = properties.searchLinkToPublication.split('?')[0];
|
||||
} else if (this.result.resultType === "dataset") {
|
||||
this.urlParam = "datasetId";
|
||||
this.url = properties.searchLinkToDataset.split('?')[0];
|
||||
} else if (this.result.resultType === "software") {
|
||||
this.urlParam = "softwareId";
|
||||
this.url = properties.searchLinkToSoftwareLanding.split('?')[0];
|
||||
} else if (this.result.resultType === "other") {
|
||||
this.urlParam = "orpId";
|
||||
this.url = properties.searchLinkToOrp.split('?')[0];
|
||||
} else if (this.result.resultType == "project") {
|
||||
this.urlParam = "projectId";
|
||||
this.url = properties.searchLinkToProject.split('?')[0];
|
||||
} else if (this.result.resultType == "organization") {
|
||||
this.urlParam = "organizationId";
|
||||
this.url = properties.searchLinkToOrganization.split('?')[0];
|
||||
} else if (this.result.resultType == "dataprovider") {
|
||||
this.urlParam = "datasourceId";
|
||||
this.url = properties.searchLinkToDataProvider.split('?')[0];
|
||||
} else {
|
||||
this.urlParam = "id";
|
||||
this.url = properties.searchLinkToResult.split('?')[0];
|
||||
}
|
||||
// if result has a pid use it as parameter instead of openaireId
|
||||
let pid:Identifier = Identifier.getResultPIDFromIdentifiers(this.result.identifiers);
|
||||
if(pid){
|
||||
this.urlParam = "pid";
|
||||
this.result.id = encodeURIComponent(pid.id);
|
||||
|
||||
if(this.hasLink) {
|
||||
if (this.result.resultType === "publication") {
|
||||
this.urlParam = "articleId";
|
||||
this.url = properties.searchLinkToPublication.split('?')[0];
|
||||
} else if (this.result.resultType === "dataset") {
|
||||
this.urlParam = "datasetId";
|
||||
this.url = properties.searchLinkToDataset.split('?')[0];
|
||||
} else if (this.result.resultType === "software") {
|
||||
this.urlParam = "softwareId";
|
||||
this.url = properties.searchLinkToSoftwareLanding.split('?')[0];
|
||||
} else if (this.result.resultType === "other") {
|
||||
this.urlParam = "orpId";
|
||||
this.url = properties.searchLinkToOrp.split('?')[0];
|
||||
} else if (this.result.resultType == "project") {
|
||||
this.urlParam = "projectId";
|
||||
this.url = properties.searchLinkToProject.split('?')[0];
|
||||
} else if (this.result.resultType == "organization") {
|
||||
this.urlParam = "organizationId";
|
||||
this.url = properties.searchLinkToOrganization.split('?')[0];
|
||||
} else if (this.result.resultType == "dataprovider") {
|
||||
this.urlParam = "datasourceId";
|
||||
this.url = properties.searchLinkToDataProvider.split('?')[0];
|
||||
} else {
|
||||
this.urlParam = "id";
|
||||
this.url = properties.searchLinkToResult.split('?')[0];
|
||||
}
|
||||
this.checkPID();
|
||||
}
|
||||
this.initBeforeTitle();
|
||||
if(this.result.languages) {
|
||||
|
@ -72,6 +65,26 @@ export class ResultPreviewComponent implements OnInit{
|
|||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if(changes.result && this.hasLink) {
|
||||
this.checkPID();
|
||||
}
|
||||
}
|
||||
|
||||
checkPID() {
|
||||
// if result has a pid use it as parameter instead of openaireId
|
||||
let pid:Identifier = Identifier.getResultPIDFromIdentifiers(this.result.identifiers);
|
||||
if(pid){
|
||||
this.urlParam = "pid";
|
||||
this.result.id = encodeURIComponent(pid.id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
get isLoggedIn(): boolean {
|
||||
return Session.isLoggedIn();
|
||||
}
|
||||
|
||||
public initBeforeTitle() {
|
||||
if(this.result.resultType && this.result.resultType !== 'dataprovider') {
|
||||
this.type = this.getTypeName(this.result.resultType);
|
||||
|
|
Loading…
Reference in New Issue