Project

General

Profile

1
import {Component, Input} from '@angular/core';
2
import {SearchResult}     from '../../utils/entities/searchResult';
3
import {ErrorCodes} from '../../utils/properties/openaireProperties';
4
import {RouterHelper} from '../../utils/routerHelper.class';
5

    
6
@Component({
7
    selector: 'tab-result',
8
    template: `
9
     <ul class="uk-list uk-list-divider  uk-margin">
10
      <div *ngIf="status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No Results found</div>
11
      <div *ngIf="status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
12
      <div *ngIf="status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
13
      <div *ngIf="status == errorCodes.LOADING && showLoading" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">Loading...</div>
14

    
15
        <li *ngFor="let result of results" class="uk-animation-fade">
16
            <div class = "uk-text-large {{result.title.accessMode}} {{result.title.sc39}}" [title] = result.title.accessMode >
17
                <!--a href="{{result['title'].url}}"-->
18
                <!--a [queryParams]="{articleId: 'od_______908::3a5b2885656a91307156325644e73b92'}" routerLinkActive="router-link-active" routerLink="search/publication"-->
19

    
20
                <a [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
21
                    <p *ngIf="result['title'].name != undefined && result['title'].name != ''"
22
                        [innerHTML]="result['title'].name">
23
                    </p>
24
                    <!--p *ngIf="result['title'].name == undefined || result['title'].name == ''">
25
                        {{result['title'].url}}
26
                    </p-->
27
                    <p *ngIf="result['title'].name == undefined || result['title'].name == ''">
28
                        [no title available]
29
                    </p>
30
                </a>
31
            </div>
32

    
33
            <div>
34
                <span *ngIf="result['authors'] != undefined">
35
                    <span *ngFor="let author of result['authors'].slice(0,15)">
36
                        <a [queryParams]="{personId: author.id}" routerLinkActive="router-link-active" routerLink="/search/person">
37
                            {{author['name']}};
38
                        </a>
39
                    </span>
40
                    <span *ngIf="result['authors'].length > 15">...</span>
41
                </span>
42
                <span *ngIf="result.year != undefined && result.year != ''">
43
                    ({{result.year}})
44
                </span>
45
            </div>
46

    
47
            <div *ngIf="result.publisher != undefined && result.publisher != ''">Publisher: {{result.publisher}}</div>
48

    
49
            <div *ngIf="result.country != undefined && result.country != ''">Country: {{result.country}}</div>
50

    
51
            <div *ngIf="result['projects'] != undefined">
52
                <span> Projects: </span>
53
                <span *ngFor="let project of result['projects'].slice(0,15) let i=index">
54
                    <!--a *ngIf="project.url != undefined" href="{{project.url}}"-->
55
                        <a *ngIf="project.id" [queryParams]="{projectId: project.id}" routerLinkActive="router-link-active" routerLink="/search/project">
56
                            {{project['funderShortname']?project['funderShortname']:project['funderName']}}
57
                            | {{ project['acronym']?project['acronym']:project['title']}} ({{project.code}})</a><span
58

    
59
                            *ngIf="!project.id">{{project['funderShortname']?project['funderShortname']:project['funderName']}}<span
60
                                *ngIf="project['acronym'] || project['title']"> | {{ project['acronym']?project['acronym']:project['title']}}</span><span
61
                                *ngIf="project.code">({{project.code}})</span></span><span
62

    
63
                    *ngIf="i < result['projects'].length-1">,</span>
64
                </span>
65
                <span *ngIf="result['projects'].length > 15">...</span>
66
            </div>
67

    
68
            <!--blockquote *ngIf="result.description != undefined && result.description != ''">
69
                <div class="text-justify">
70
                    {{result.description}}
71
                </div>
72
            </blockquote-->
73

    
74
            <mark *ngIf="result.embargoEndDate != undefined && result.embargoEndDate != ''">Embargo End Date: {{result.embargoEndDate}}</mark>
75

    
76

    
77
            <div *ngIf="result['funders'] != undefined">
78
              <span> Funders: </span>
79
              <span *ngFor="let funder of result['funders'] let i=index">
80

    
81
                  <span *ngIf="funder.funderShortname">
82
                    {{funder.funderShortname}}</span><span
83

    
84
                    *ngIf="i < result['funders'].length-1">,</span>
85
              </span>
86
            </div>
87
            <span *ngIf="result.startYear && result.endYear"> ({{result.startYear}} - {{result.endYear}})</span>
88
            <div *ngIf="result['organizations'] != undefined && result['organizations'].length > 0">
89
                <span> Organizations: </span>
90
                <span *ngFor="let organization of result['organizations'] let i=index">
91
                    <!--a *ngIf="organization.url != undefined" href="{{organization.url}}"-->
92
                    <a *ngIf="organization.id" [queryParams]="{organizationId: organization.id}" routerLinkActive="router-link-active" routerLink="/search/organization">
93
                            {{organization.name}}</a><span
94

    
95
                        *ngIf="!organization.id">
96
                            {{organization.name}}</span><span
97

    
98
                        *ngIf="i < result['organizations'].length-1">,</span>
99
                </span>
100
            </div>
101

    
102
            <div *ngIf="result['type'] != undefined && result['type'] != ''">Type: {{result['type']}}</div>
103
            <div *ngIf="result['websiteURL'] != undefined && result['websiteURL'] != ''">
104
                <span>Website URL: </span>
105
                <span>
106
                    <a href="{{result['websiteURL']}}" target="_blank" class="custom-external custom-icon">
107
                        {{result['websiteURL']}}
108
                    </a>
109
                </span>
110
            </div>
111
            <div *ngIf="result['OAIPMHURL'] != undefined && result['OAIPMHURL'] != ''">
112
                <span>OAI-PMH URL: </span>
113
                <span>
114
                    <a href="{{result['OAIPMHURL']}}" target="_blank" class="custom-external custom-icon">
115
                        {{result['OAIPMHURL']}}
116
                    </a>
117
                </span>
118
            </div>
119

    
120
            <div *ngIf="result['compatibility'] != undefined && result['compatibility'] != ''">
121
                Compatibility: {{result.compatibility}}
122
            </div>
123

    
124
            <div *ngIf="result['countries'] && result['countries'].length > 0">
125
                Countries: {{result.countries}}
126
            </div>
127

    
128
        </li>
129
    </ul>
130
    `
131
})
132

    
133
export class TabResultComponent {
134
    @Input() results: SearchResult[];
135
    @Input() status: number;
136
    @Input() type: string;
137
    @Input() urlParam: string;
138
    @Input() showLoading: boolean = false;
139

    
140
    public errorCodes:ErrorCodes = new ErrorCodes();
141
    public routerHelper:RouterHelper = new RouterHelper();
142
    public errorMessage: string = "No results found";
143

    
144
    constructor () {
145

    
146
    }
147

    
148
    ngOnInit() {}
149
}
(27-27/28)