[Library|Trunk]
Enermaps datasets: apply changes in search results components to be able to add custom title and add an image if available. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60612 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
90121cba60
commit
cca8a3c7f3
|
@ -3,7 +3,7 @@
|
|||
<li *ngFor="let result of previewResults" class="uk-animation-fade">
|
||||
<div class="uk-card uk-card-default uk-card-hover">
|
||||
<result-preview [properties]="properties" [showOrganizations]="showOrganizations"
|
||||
[showSubjects]="showSubjects" [result]="result">
|
||||
[showSubjects]="showSubjects" [result]="result" [showImage]="showImage">
|
||||
</result-preview>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
@ -22,6 +22,7 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
|||
@Input() custom_class: string = "search-results";
|
||||
@Input() properties: EnvProperties;
|
||||
@Input() showImpactFactors: boolean = false;
|
||||
@Input() showImage: boolean;
|
||||
|
||||
constructor( private http: HttpClient/*ATHENA CODE*/
|
||||
, private orcidService: OrcidService) {
|
||||
|
|
|
@ -45,10 +45,10 @@ export class FetchResearchResults {
|
|||
});
|
||||
}
|
||||
|
||||
public getResultsForCommunity(resultType:string, communityId: string, page: number, size: number, properties:EnvProperties) {
|
||||
public getResultsForCommunity(resultType:string, communityId: string, page: number, size: number, properties:EnvProperties, contextId = null) {
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
|
||||
this.subscriptions.push(this._searchResearchResultsService.search(resultType, "", "&fq=communityid=" + communityId, page, size, "resultdateofacceptance,descending", [], properties).subscribe(
|
||||
this.subscriptions.push(this._searchResearchResultsService.search(resultType, "", "&fq=communityid=" + communityId + (contextId?'&fq=categoryid=' + encodeURIComponent(contextId):''), page, size, "resultdateofacceptance,descending", [], properties).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
this.results = data[1];
|
||||
|
@ -65,10 +65,10 @@ export class FetchResearchResults {
|
|||
));
|
||||
}
|
||||
|
||||
public getNumForCommunity(resultType:string, communityId: string, properties:EnvProperties) {
|
||||
public getNumForCommunity(resultType:string, communityId: string, properties:EnvProperties, contextId = null) {
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
|
||||
this.subscriptions.push(this._searchResearchResultsService.countTotalResults(resultType, properties, "&fq=communityid=" + communityId).subscribe(
|
||||
this.subscriptions.push(this._searchResearchResultsService.countTotalResults(resultType, properties, "&fq=communityid=" + communityId +(contextId?'&fq=categoryid=' + encodeURIComponent(contextId):'')).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<!-- Before title -->
|
||||
<div *ngIf="result">
|
||||
<div class="uk-grid uk-flex uk-flex-middle">
|
||||
<div class="uk-width-expand">
|
||||
<div>
|
||||
<!-- deposit searchPage URL -->
|
||||
<span class="uk-width-expand uk-flex-right">
|
||||
|
@ -260,6 +262,12 @@
|
|||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-width-auto">
|
||||
<img *ngIf="showImage && getPID()" class="uk-width-medium"
|
||||
[src]="'http://enermaps.idiap.ch/'+getPID().id+'.png'" alt="tool preview">
|
||||
</div>
|
||||
</div>
|
||||
<!--&& loggedIn -->
|
||||
<div
|
||||
|
|
|
@ -26,6 +26,7 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
public beforeTitle: string[] = [];
|
||||
public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0];
|
||||
@Input() showOrcid: boolean = true;
|
||||
@Input() showImage: boolean = false;
|
||||
|
||||
ngOnInit(): void {
|
||||
if(this.hasLink) {
|
||||
|
@ -78,14 +79,16 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
|
||||
checkPID() {
|
||||
// if result has a pid use it as parameter instead of openaireId
|
||||
let pid:Identifier = Identifier.getResultPIDFromIdentifiers(this.result.identifiers);
|
||||
let pid:Identifier =this.getPID();
|
||||
if(pid){
|
||||
this.urlParam = "pid";
|
||||
this.result.id = encodeURIComponent(pid.id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
getPID() {
|
||||
return Identifier.getResultPIDFromIdentifiers(this.result.identifiers);
|
||||
}
|
||||
get isLoggedIn(): boolean {
|
||||
return Session.isLoggedIn();
|
||||
}
|
||||
|
|
|
@ -10,10 +10,12 @@ import {ErrorCodes} from "../../properties/errorCodes";
|
|||
|
||||
<div *ngIf="fetch.searchUtils.status == errorCodes.DONE">
|
||||
<div class="tab-header">
|
||||
<span *ngIf="resultType != 'organization' && resultType != 'dataprovider' && resultType != 'project'">Recent</span>
|
||||
<span *ngIf="!customTitle"><span *ngIf="resultType != 'organization' && resultType != 'dataprovider' && resultType != 'project'">Recent</span>
|
||||
{{getEntityName(resultType, true, true)}}
|
||||
</span>
|
||||
<span *ngIf="customTitle">{{customTitle}}</span>
|
||||
</div>
|
||||
<div class="uk-text-right">
|
||||
<div *ngIf="searchLinkToAdvancedPage" class="uk-text-right">
|
||||
<!-- {{getEntityName(resultType, true, true)}}-->
|
||||
<a class="el-content uk-button uk-button-text" [queryParams]="params" [routerLink]="searchLinkToAdvancedPage">
|
||||
View all
|
||||
|
@ -24,10 +26,10 @@ import {ErrorCodes} from "../../properties/errorCodes";
|
|||
<search-result [properties]="properties"
|
||||
[results]="fetch.results"
|
||||
[status]="fetch.searchUtils.status"
|
||||
[type]="resultType" [showImpactFactors]="showImpactFactors" >
|
||||
[type]="resultType" [showImpactFactors]="showImpactFactors" [showImage]="showImage">
|
||||
</search-result>
|
||||
|
||||
<div class="uk-text-right">
|
||||
<div *ngIf="searchLinkToAdvancedPage" class="uk-text-right">
|
||||
<!-- {{getEntityName(resultType, true, true)}}-->
|
||||
<a class="el-content uk-button uk-button-text" [queryParams]="params" [routerLink]="searchLinkToAdvancedPage">
|
||||
View all
|
||||
|
@ -46,6 +48,9 @@ export class SearchTabComponent {
|
|||
@Input() public searchLinkToAdvancedPage: string;
|
||||
@Input() properties: EnvProperties;
|
||||
@Input() showImpactFactors;
|
||||
@Input() customTitle;
|
||||
@Input() showImage: boolean;
|
||||
|
||||
public errorCodes: ErrorCodes = new ErrorCodes();
|
||||
|
||||
public getEntityName(entityType: string, plural: boolean, full: boolean): string {
|
||||
|
|
Loading…
Reference in New Issue