tab result component and its module were missing from previous commit

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46414 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2017-03-22 10:26:25 +00:00
parent 19df55c77c
commit e2cac04ec0
2 changed files with 191 additions and 0 deletions

View File

@ -0,0 +1,164 @@
import {Component, Input} from '@angular/core';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/openaireProperties';
import {RouterHelper} from '../../utils/routerHelper.class';
@Component({
selector: 'tab-result',
template: `
<ul class="uk-list uk-list-line uk-margin">
<div *ngIf="status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No Results found</div>
<div *ngIf="status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="status == errorCodes.LOADING && showLoading" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">Loading...</div>
<li *ngFor="let result of results" class="uk-animation-fade">
<div class = "uk-text-large {{result.title.accessMode}} {{result.title.sc39}}" [title] = result.title.accessMode >
<!--a href="{{result['title'].url}}"-->
<!--a [queryParams]="{articleId: 'od_______908::3a5b2885656a91307156325644e73b92'}" routerLinkActive="router-link-active" routerLink="search/publication"-->
<a *ngIf="lazy=='true'" [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
[innerHTML]="result['title'].name">
</p>
<!--p *ngIf="result['title'].name == undefined || result['title'].name == ''">
{{result['title'].url}}
</p-->
<p *ngIf="result['title'].name == undefined || result['title'].name == ''">
[no title available]
</p>
</a>
<a *ngIf="lazy=='false'" href="/search/{{type}}?{{urlParam}}={{result.id}}">
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
[innerHTML]="result['title'].name">
</p>
<p *ngIf="result['title'].name == undefined || result['title'].name == ''">
[no title available]
</p>
</a>
</div>
<div>
<span *ngIf="result['authors'] != undefined">
<span *ngFor="let author of result['authors'].slice(0,15)">
<a *ngIf="from!='person'" [queryParams]="{personId: author.id}" routerLinkActive="router-link-active" routerLink="/search/person">
{{author['name']}};
</a>
<a *ngIf="from=='person'" href="/search/person?personId={{author.id}}">
{{author['name']}};
</a>
</span>
<span *ngIf="result['authors'].length > 15">...</span>
</span>
<span *ngIf="result.year != undefined && result.year != ''">
({{result.year}})
</span>
</div>
<div *ngIf="result.publisher != undefined && result.publisher != ''">Publisher: {{result.publisher}}</div>
<div *ngIf="result.country != undefined && result.country != ''">Country: {{result.country}}</div>
<div *ngIf="result['projects'] != undefined">
<span> Projects: </span>
<span *ngFor="let project of result['projects'].slice(0,15) let i=index">
<!--a *ngIf="project.url != undefined" href="{{project.url}}"-->
<span>
<a *ngIf="project.id != undefined" [queryParams]="{projectId: project.id}" routerLinkActive="router-link-active" routerLink="/search/project">
{{project['funderShortname']?project['funderShortname']:project['funderName']}}
| {{ project['acronym']?project['acronym']:project['title']}} ({{project.code}})</a><p
*ngIf="project.id == undefined">
{{project['funderShortname']?project['funderShortname']:project['funderName']}}
| {{ project['acronym']?project['acronym']:project['title']}} ({{project.code}})</p></span><span
*ngIf="i < result['projects'].length-1">,</span>
</span>
<span *ngIf="result['projects'].length > 15">...</span>
</div>
<!--blockquote *ngIf="result.description != undefined && result.description != ''">
<div class="text-justify">
{{result.description}}
</div>
</blockquote-->
<mark *ngIf="result.embargoEndDate != undefined && result.embargoEndDate != ''">Embargo End Date: {{result.embargoEndDate}}</mark>
<div *ngIf="result['funders'] != undefined">
<span> Funders: </span>
<span *ngFor="let funder of result['funders'] let i=index">
<span *ngIf="funder.funderShortname">
{{funder.funderShortname}}</span><span
*ngIf="i < result['funders'].length-1">,</span>
</span>
</div>
<span *ngIf="result.startYear && result.endYear"> ({{result.startYear}} - {{result.endYear}})</span>
<div *ngIf="result['organizations'] != undefined && result['organizations'].length > 0">
<span> Organizations: </span>
<span *ngFor="let organization of result['organizations'] let i=index">
<!--a *ngIf="organization.url != undefined" href="{{organization.url}}"-->
<a *ngIf="organization.id != undefined" [queryParams]="{organizationId: organization.id}" routerLinkActive="router-link-active" routerLink="/search/organization">
{{organization.name}}</a><span
*ngIf="organization.id == undefined">
{{organization.name}}</span><span
*ngIf="i < result['organizations'].length-1">,</span>
</span>
</div>
<div *ngIf="result['type'] != undefined && result['type'] != ''">Type: {{result['type']}}</div>
<div *ngIf="result['websiteURL'] != undefined && result['websiteURL'] != ''">
<span>Website URL: </span>
<span>
<a href="{{result['websiteURL']}}" target="_blank" class="uk-icon-external-link custom-icon">
{{result['websiteURL']}}
</a>
</span>
</div>
<div *ngIf="result['OAIPMHURL'] != undefined && result['OAIPMHURL'] != ''">
<span>OAI-PMH URL: </span>
<span>
<a href="{{result['OAIPMHURL']}}" target="_blank" class="uk-icon-external-link custom-icon">
{{result['OAIPMHURL']}}
</a>
</span>
</div>
<div *ngIf="result['compatibility'] != undefined && result['compatibility'] != ''">
Compatibility: {{result.compatibility}}
</div>
<div *ngIf="result['countries'] != undefined && result['countries'].length > 0">
Countries: {{result.countries}}
</div>
</li>
</ul>
`
})
export class TabResultComponent {
@Input() results: SearchResult[];
@Input() status: number;
@Input() type: string;
@Input() urlParam: string;
@Input() showLoading: boolean = false;
@Input() lazy: string = "true";
@Input() from: string = "";
public errorCodes:ErrorCodes = new ErrorCodes();
public routerHelper:RouterHelper = new RouterHelper();
public errorMessage: string = "No results found";
constructor () {
}
ngOnInit() {}
}

View File

@ -0,0 +1,27 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {SearchResult} from '../../utils/entities/searchResult';
import {TabResultComponent} from './tabResult.component';
import {RouterModule} from '@angular/router';
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule
],
declarations: [
TabResultComponent,
],
providers:[
],
exports: [
TabResultComponent
]
})
export class TabResultModule { }