1
|
import {Component, Input, Output, EventEmitter} from '@angular/core';
|
2
|
import { ActivatedRoute } from '@angular/router';
|
3
|
import {SearchCrossrefService} from '../claim-utils/service/searchCrossref.service';
|
4
|
import {SearchOrcidService} from '../claim-utils/service/searchOrcid.service';
|
5
|
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
6
|
import { SearchDataciteService } from '../claim-utils/service/searchDatacite.service';
|
7
|
import {SearchDatasetsService} from '../../services/searchDatasets.service';
|
8
|
import {SearchSoftwareService} from '../../services/searchSoftware.service';
|
9
|
|
10
|
import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
11
|
import {ClaimResult} from '../claim-utils/claimEntities.class';
|
12
|
import{DOI} from '../../utils/string-utils.class';
|
13
|
declare var UIkit:any;
|
14
|
|
15
|
@Component({
|
16
|
selector: 'claim-result-search-form',
|
17
|
templateUrl: 'claimResultSearchForm.component.html',
|
18
|
|
19
|
})
|
20
|
export class ClaimResultSearchFormComponent {
|
21
|
constructor (private _searchDataciteService: SearchDataciteService, private _searchDatasetsService:SearchDatasetsService, private _searchSoftwareService:SearchSoftwareService,
|
22
|
private _searchCrossrefService: SearchCrossrefService,private _searchOrcidService: SearchOrcidService, private _searchPublicationsService: SearchPublicationsService,
|
23
|
private route: ActivatedRoute) {
|
24
|
var myDate = new Date();
|
25
|
this.todayDate = myDate.getFullYear()+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
26
|
this.nextDate = (myDate.getFullYear()+100)+ "-" +(myDate.getMonth() + 1) + "-" + myDate.getDate() ;
|
27
|
|
28
|
}
|
29
|
ngOnInit() {
|
30
|
if(this.keyword !=null && this.keyword.length > 0){
|
31
|
this.search(false);
|
32
|
}
|
33
|
}
|
34
|
|
35
|
|
36
|
page : number = 1;
|
37
|
size:number = 5;
|
38
|
navigateTo: string = "Search";
|
39
|
source: string = "datacite";
|
40
|
type : string = "dataset";
|
41
|
showSearchResults:boolean=false;
|
42
|
// searchType ="publication";
|
43
|
@Input() public select:boolean = true ;
|
44
|
@Input() public keyword:string = '';
|
45
|
@Input() public selectedResults:ClaimResult[];
|
46
|
// @Output() datasetsChange = new EventEmitter();
|
47
|
// @Output() publicationsChange = new EventEmitter();
|
48
|
|
49
|
// @Output() resultsChange = new EventEmitter();
|
50
|
|
51
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
52
|
|
53
|
dataciteResults=[];
|
54
|
dataciteResultsNum:number = null;
|
55
|
// dataciteResultsNum : Observable<number> = null;
|
56
|
dataciteStatus = this.errorCodes.NONE;
|
57
|
datacitePage : number = 1;
|
58
|
|
59
|
openaireData=[];
|
60
|
openaireDataNum:number = 0 ;
|
61
|
openaireDataStatus = this.errorCodes.NONE;
|
62
|
openaireDataPage : number = 1;
|
63
|
openaireSoftware=[];
|
64
|
openaireSoftwareNum:number = 0 ;
|
65
|
openaireSoftwareStatus = this.errorCodes.NONE;
|
66
|
openaireSoftwarePage : number = 1;
|
67
|
|
68
|
public warningMessage = "";
|
69
|
public infoMessage = "";
|
70
|
|
71
|
public todayDate = '';
|
72
|
public nextDate = '';
|
73
|
public DOIs:string[] = [];
|
74
|
sub: any;
|
75
|
public searchSource:string = "openaire"
|
76
|
public activeTab:string = "openairePub"
|
77
|
|
78
|
|
79
|
crossrefResults=[];
|
80
|
crossrefResultsNum : number = null;
|
81
|
crossrefPage : number = 1;
|
82
|
crossrefStatus:number = this.errorCodes.NONE;
|
83
|
|
84
|
openairePubs = [];
|
85
|
openairePubsNum: number ;
|
86
|
openairePubsPage : number = 1;
|
87
|
openairePubsStatus:number = this.errorCodes.NONE;
|
88
|
|
89
|
orcidResults: string[];
|
90
|
orcidResultsNum: number ;
|
91
|
totalPages: number;
|
92
|
orcidResultsToShow: string[];
|
93
|
orcidPage : number = 1;
|
94
|
orcidStatus:number = this.errorCodes.NONE;
|
95
|
authorId: string;
|
96
|
selectAuthorId: string = "0";
|
97
|
authorGivenName: string;
|
98
|
authorFamilyName: string;
|
99
|
|
100
|
authorIds: string[];
|
101
|
authorGivenNames: string[];
|
102
|
authorFamilyNames: string[];
|
103
|
|
104
|
authorsNum : number ;
|
105
|
|
106
|
reloadOpenaire:boolean = true;
|
107
|
reloadCrossref:boolean = false;
|
108
|
reloadDatacite:boolean = false;
|
109
|
reloadOrcid:boolean = false;
|
110
|
|
111
|
|
112
|
|
113
|
|
114
|
search(sourceChanged){
|
115
|
this.warningMessage = "";
|
116
|
this.infoMessage = "";
|
117
|
if(!sourceChanged){
|
118
|
this.DOIs = DOI.getDOIsFromString(this.keyword);
|
119
|
this.reloadOpenaire = true;
|
120
|
this.reloadCrossref = true;
|
121
|
this.reloadDatacite = true;
|
122
|
this.reloadOrcid = true;
|
123
|
}
|
124
|
if((this.searchSource == "all" || this.searchSource == "openaire") && this.reloadOpenaire){
|
125
|
this.searchOpenairePubs(this.keyword, this.size, 1);
|
126
|
this.searchOpenaireData(this.keyword,this.size,1);
|
127
|
this.searchOpenaireSoftware(this.keyword,this.size,1);
|
128
|
this.reloadOpenaire = false;
|
129
|
}
|
130
|
if((this.searchSource == "all" || this.searchSource == "crossref")&&this.reloadCrossref){
|
131
|
this.getCrossrefResults(this.keyword, this.size,1);
|
132
|
this.reloadCrossref = false;
|
133
|
}
|
134
|
if((this.searchSource == "all" || this.searchSource == "datacite")&& this.reloadDatacite){
|
135
|
this.searchDatacite(this.keyword,this.size,1);
|
136
|
this.reloadDatacite = false;
|
137
|
}
|
138
|
if((this.searchSource == "all" || this.searchSource == "orcid")&& this.reloadOrcid){
|
139
|
this.searchOrcid(this.keyword);
|
140
|
this.reloadOrcid = false;
|
141
|
}
|
142
|
this.showSearchResults = true;
|
143
|
|
144
|
}
|
145
|
|
146
|
private getCrossrefResults (term: string, size : number, page : number) {
|
147
|
this.crossrefStatus = this.errorCodes.LOADING;
|
148
|
if( this.DOIs.length > 0 ){
|
149
|
this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs).subscribe(
|
150
|
data => {
|
151
|
if(data != null) {
|
152
|
this.crossrefResults = data.items;
|
153
|
this.crossrefPage=page;
|
154
|
this.crossrefResultsNum = data['total-results'];
|
155
|
if(data.items == 0){
|
156
|
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
|
157
|
data => {
|
158
|
if(data != null) {
|
159
|
this.crossrefResults = data.items;
|
160
|
this.crossrefPage=page;
|
161
|
this.crossrefResultsNum = data['total-results'];
|
162
|
this.crossrefStatus = this.errorCodes.DONE;
|
163
|
|
164
|
}else{
|
165
|
this.crossrefStatus = this.errorCodes.ERROR;
|
166
|
}
|
167
|
},
|
168
|
err =>{
|
169
|
console.log(err.status);
|
170
|
this.crossrefStatus = this.errorCodes.ERROR;
|
171
|
}
|
172
|
|
173
|
);
|
174
|
}else{
|
175
|
this.crossrefStatus = this.errorCodes.DONE;
|
176
|
}
|
177
|
}
|
178
|
},
|
179
|
err => {
|
180
|
//console.log(err);
|
181
|
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
|
182
|
data => {
|
183
|
this.crossrefResults = data.items;
|
184
|
this.crossrefPage=page;
|
185
|
this.crossrefResultsNum = data['total-results'];
|
186
|
this.crossrefStatus = this.errorCodes.DONE;
|
187
|
|
188
|
},
|
189
|
err => {
|
190
|
console.log(err.status);
|
191
|
this.crossrefStatus = this.errorCodes.ERROR;
|
192
|
}
|
193
|
|
194
|
);
|
195
|
}
|
196
|
);
|
197
|
|
198
|
}else{
|
199
|
|
200
|
|
201
|
this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe(
|
202
|
data => {
|
203
|
if(data != null) {
|
204
|
this.crossrefResults = data.items;
|
205
|
this.crossrefPage=page;
|
206
|
this.crossrefResultsNum = data['total-results'];
|
207
|
this.crossrefStatus = this.errorCodes.DONE;
|
208
|
|
209
|
}else{
|
210
|
this.crossrefStatus = this.errorCodes.ERROR;
|
211
|
}
|
212
|
|
213
|
},
|
214
|
err => {
|
215
|
console.log(err.status);
|
216
|
this.crossrefStatus = this.errorCodes.ERROR;
|
217
|
}
|
218
|
);
|
219
|
}
|
220
|
}
|
221
|
private searchOpenairePubs(term: string, size : number, page : number) {
|
222
|
|
223
|
if(this.DOIs.length > 0 ){
|
224
|
this.openairePubsStatus = this.errorCodes.LOADING;
|
225
|
this._searchPublicationsService.searchPublicationsByDois(this.DOIs, null, page, size, []).subscribe(
|
226
|
data => {
|
227
|
if(data != null) {
|
228
|
this.openairePubsPage=page;
|
229
|
this.openairePubsNum = data[0];
|
230
|
this.openairePubs = data[1];
|
231
|
this.openairePubsStatus = this.errorCodes.DONE;
|
232
|
if(this.openairePubsNum == 0){
|
233
|
this.openairePubsStatus = this.errorCodes.NONE;
|
234
|
}
|
235
|
}else {
|
236
|
this.openairePubsStatus = this.errorCodes.ERROR;
|
237
|
}
|
238
|
},
|
239
|
err => {
|
240
|
this.openairePubsStatus = this.errorCodes.ERROR;
|
241
|
console.log(err.status);
|
242
|
}
|
243
|
);
|
244
|
}else{
|
245
|
this.openairePubsStatus = this.errorCodes.LOADING;
|
246
|
this._searchPublicationsService.searchPublications('q='+term, null, page, size, []).subscribe(
|
247
|
data => {
|
248
|
if(data != null) {
|
249
|
this.openairePubsPage=page;
|
250
|
this.openairePubsNum = data[0];
|
251
|
this.openairePubs = data[1];
|
252
|
this.openairePubsStatus = this.errorCodes.DONE;
|
253
|
if(this.openairePubsNum == 0){
|
254
|
this.openairePubsStatus = this.errorCodes.NONE;
|
255
|
}
|
256
|
}else {
|
257
|
this.openairePubsStatus = this.errorCodes.ERROR;
|
258
|
}
|
259
|
},
|
260
|
err => {
|
261
|
this.openairePubsStatus = this.errorCodes.ERROR;
|
262
|
console.log(err.status);
|
263
|
}
|
264
|
);
|
265
|
}
|
266
|
}
|
267
|
|
268
|
private searchOrcid (term: string) {
|
269
|
if(this.DOIs.length > 0){
|
270
|
this.orcidStatus = this.errorCodes.NONE;
|
271
|
return;
|
272
|
}
|
273
|
this.orcidStatus = this.errorCodes.LOADING;
|
274
|
this.authorIds = new Array<string>();
|
275
|
this.authorGivenNames = new Array<string>();
|
276
|
this.authorFamilyNames = new Array<string>();
|
277
|
|
278
|
this.getOrcidAuthor(term);
|
279
|
|
280
|
console.info('searchOrcid in searchOrcid file');
|
281
|
}
|
282
|
|
283
|
private readData(data: any) {
|
284
|
this.authorIds.push(data[2].path);
|
285
|
|
286
|
if(data[0] != null) {
|
287
|
this.authorGivenNames.push(data[0].value);
|
288
|
} else {
|
289
|
this.authorGivenNames.push("");
|
290
|
}
|
291
|
if(data[1] != null) {
|
292
|
this.authorFamilyNames.push(data[1].value);
|
293
|
} else {
|
294
|
this.authorFamilyNames.push("");
|
295
|
}
|
296
|
}
|
297
|
|
298
|
private getOrcidAuthor (term: string) {
|
299
|
this.orcidResultsNum = null;
|
300
|
|
301
|
//passing structures in order to fill them in service
|
302
|
this._searchOrcidService.searchOrcidAuthor(term, this.authorIds,
|
303
|
this.authorGivenNames, this.authorFamilyNames).subscribe(
|
304
|
data => {
|
305
|
if(data != null && data == true) {
|
306
|
this.getOrcidResultsByIndex(0);
|
307
|
}
|
308
|
|
309
|
this.orcidStatus = this.errorCodes.NONE;
|
310
|
|
311
|
},
|
312
|
err => this.errorHandler(err, term)
|
313
|
|
314
|
);
|
315
|
}
|
316
|
|
317
|
private errorHandler(err: any, term: string) {
|
318
|
if(err.status == 404){
|
319
|
this.getOrcidAuthors(term);
|
320
|
} else {
|
321
|
this.orcidStatus = this.errorCodes.ERROR;
|
322
|
console.log(err.status);
|
323
|
|
324
|
}
|
325
|
}
|
326
|
|
327
|
private getOrcidAuthors (term: string) {
|
328
|
this.orcidResultsNum = null;
|
329
|
this.selectAuthorId = "0";
|
330
|
this.orcidStatus = this.errorCodes.LOADING;
|
331
|
//passing structures in order to fill them in service
|
332
|
this._searchOrcidService.searchOrcidAuthors(term, this.authorIds,
|
333
|
this.authorGivenNames, this.authorFamilyNames).subscribe(
|
334
|
data => {
|
335
|
if(data != null && data == true) {
|
336
|
this.getOrcidResultsByIndex(0);
|
337
|
}else{
|
338
|
this.orcidStatus = this.errorCodes.ERROR;
|
339
|
}
|
340
|
|
341
|
},
|
342
|
err => {
|
343
|
this.orcidStatus = this.errorCodes.ERROR;
|
344
|
console.log(err.status);
|
345
|
}
|
346
|
);
|
347
|
}
|
348
|
|
349
|
|
350
|
private getOrcidResultsByIndex (index:number) {
|
351
|
if(this.authorIds.length > index) {
|
352
|
this.orcidStatus = this.errorCodes.LOADING;
|
353
|
let id = this.authorIds[index];
|
354
|
this.authorGivenName = this.authorGivenNames[index];
|
355
|
this.authorFamilyName = this.authorFamilyNames[index];
|
356
|
this.getOrcidResultsById(id);
|
357
|
}
|
358
|
}
|
359
|
private getOrcidResultsById (id:string) {
|
360
|
if(id=="0"){
|
361
|
return;
|
362
|
}
|
363
|
var index = this.authorIds.indexOf(id);
|
364
|
this.authorGivenName = this.authorGivenNames[index];
|
365
|
this.authorFamilyName = this.authorFamilyNames[index];
|
366
|
this.authorId = id;
|
367
|
console.info("getOrcidResultsById: "+id);
|
368
|
this.orcidStatus = this.errorCodes.LOADING;
|
369
|
this._searchOrcidService.searchOrcidPublications(id).subscribe(
|
370
|
data => {
|
371
|
if(data != null) {
|
372
|
this.orcidResults=data['orcid-work'];
|
373
|
this.orcidResultsNum = data['orcid-work'].length;
|
374
|
this.orcidPage = 1;
|
375
|
if((this.orcidResultsNum % this.size) == 0){
|
376
|
this.totalPages=parseInt(''+(this.orcidResultsNum/this.size));
|
377
|
} else{
|
378
|
this.totalPages=parseInt(''+(this.orcidResultsNum/this.size+1));
|
379
|
}
|
380
|
|
381
|
this.orcidResultsToShow = this.orcidResults.slice(0,10);
|
382
|
|
383
|
this.orcidStatus = this.errorCodes.DONE;
|
384
|
if(this.orcidResultsNum == 0){
|
385
|
this.orcidStatus = this.errorCodes.NONE;
|
386
|
}
|
387
|
} else {
|
388
|
this.orcidResultsNum = 0;
|
389
|
this.totalPages=0;
|
390
|
this.orcidStatus = this.errorCodes.NONE;
|
391
|
}
|
392
|
|
393
|
},
|
394
|
err => {
|
395
|
console.log(err.status);
|
396
|
this.orcidStatus = this.errorCodes.ERROR;
|
397
|
}
|
398
|
);
|
399
|
|
400
|
|
401
|
}
|
402
|
|
403
|
/*
|
404
|
Is it USED???
|
405
|
private remove(item){
|
406
|
this.warningMessage = "";
|
407
|
this.infoMessage = "";
|
408
|
var index:number =this.selectedResults.indexOf(item);
|
409
|
item.selected=false;
|
410
|
if (index > -1) {
|
411
|
this.selectedResults.splice(index, 1);
|
412
|
// this.publicationsChange.emit({
|
413
|
// value: this.selectedResults
|
414
|
// });
|
415
|
}
|
416
|
|
417
|
}*/
|
418
|
private crossrefPageChange($event) {
|
419
|
this.crossrefPage=$event.value;
|
420
|
this.crossrefResults=[];
|
421
|
console.log("Crossref chaenged "+this.crossrefPage);
|
422
|
this.getCrossrefResults(this.keyword,this.size,this.crossrefPage);
|
423
|
}
|
424
|
private orcidPageChange($event) {
|
425
|
this.orcidPage=$event.value;
|
426
|
this.orcidResultsToShow=[];
|
427
|
this.orcidResultsToShow = this.orcidResults.slice(($event.value-1)*this.size, $event.value*this.size);
|
428
|
}
|
429
|
private openairePubsPageChange($event) {
|
430
|
this.openairePubsPage=$event.value;
|
431
|
this.searchOpenairePubs(this.keyword,this.size,this.openairePubsPage);
|
432
|
}
|
433
|
datacitePageChange($event) {
|
434
|
this.datacitePage=$event.value;
|
435
|
this.dataciteResults=[];
|
436
|
this.searchDatacite(this.keyword,10,this.datacitePage);
|
437
|
this.warningMessage = "";
|
438
|
this.infoMessage = "";
|
439
|
|
440
|
}
|
441
|
openaireDataPageChange($event) {
|
442
|
this.openaireDataPage=$event.value;
|
443
|
this.openaireData=[];
|
444
|
this.searchOpenaireData(this.keyword,10,this.openaireDataPage);
|
445
|
this.warningMessage = "";
|
446
|
this.infoMessage = "";
|
447
|
|
448
|
}
|
449
|
openaireSoftwarePageChange($event) {
|
450
|
this.openaireSoftwarePage=$event.value;
|
451
|
this.openaireSoftware=[];
|
452
|
this.searchOpenaireSoftware(this.keyword,10,this.openaireSoftwarePage);
|
453
|
this.warningMessage = "";
|
454
|
this.infoMessage = "";
|
455
|
|
456
|
}
|
457
|
|
458
|
private isSelected(id:string){
|
459
|
|
460
|
var found:boolean = false;
|
461
|
this.warningMessage = "";
|
462
|
for (var _i = 0; _i < this.selectedResults.length; _i++) {
|
463
|
let item = this.selectedResults[_i];
|
464
|
if(item.id == id){
|
465
|
found=true;
|
466
|
this.warningMessage = "Publication already in selected list";
|
467
|
}
|
468
|
}
|
469
|
return found;
|
470
|
|
471
|
|
472
|
}
|
473
|
// isSelected(id:string){
|
474
|
//
|
475
|
// var found:boolean = false;
|
476
|
// this.warningMessage = "";
|
477
|
// for (var _i = 0; _i < this.selectedResults.length; _i++) {
|
478
|
// let item = this.selectedResults[_i];
|
479
|
// if(item.id == id){
|
480
|
// found=true;
|
481
|
// break;
|
482
|
// }
|
483
|
// }
|
484
|
// return found;
|
485
|
// }
|
486
|
private searchDatacite (term: string, size : number, page : number) {
|
487
|
this.getDataciteResults(term,size,page);
|
488
|
this.warningMessage = "";
|
489
|
this.infoMessage = "";
|
490
|
|
491
|
}
|
492
|
private searchOpenaireData (term: string, size : number, page : number) {
|
493
|
if(this.DOIs.length > 0 ){
|
494
|
this.openaireDataStatus = this.errorCodes.LOADING;
|
495
|
this._searchDatasetsService.searchDatasetsByDois(this.DOIs, null, page, size, []).subscribe(
|
496
|
data => {
|
497
|
if(data != null) {
|
498
|
this.openaireDataPage=page;
|
499
|
this.openaireDataNum = data[0];
|
500
|
this.openaireData = data[1];
|
501
|
this.openaireDataStatus = this.errorCodes.DONE;
|
502
|
if(this.openaireDataNum == 0){
|
503
|
this.openaireDataStatus = this.errorCodes.NONE;
|
504
|
}
|
505
|
}
|
506
|
},
|
507
|
err => {
|
508
|
this.openaireDataStatus = this.errorCodes.ERROR;
|
509
|
console.log(err.status);
|
510
|
}
|
511
|
);
|
512
|
}else{
|
513
|
this._searchDatasetsService.searchDatasets('q='+term+'', null, page, size, []).subscribe(
|
514
|
data => {
|
515
|
if(data != null) {
|
516
|
this.openaireDataPage=page;
|
517
|
this.openaireDataNum = data[0];
|
518
|
this.openaireData = data[1];
|
519
|
this.openaireDataStatus = this.errorCodes.DONE;
|
520
|
if(this.openaireDataNum == 0){
|
521
|
this.openaireDataStatus = this.errorCodes.NONE;
|
522
|
}
|
523
|
}
|
524
|
},
|
525
|
err => {
|
526
|
this.openaireDataStatus = this.errorCodes.ERROR;
|
527
|
console.log(err.status);
|
528
|
}
|
529
|
);
|
530
|
}
|
531
|
this.warningMessage = "";
|
532
|
this.infoMessage = "";
|
533
|
|
534
|
}
|
535
|
private searchOpenaireSoftware (term: string, size : number, page : number) {
|
536
|
if(this.DOIs.length > 0 ){
|
537
|
this.openaireSoftwareStatus = this.errorCodes.LOADING;
|
538
|
this._searchSoftwareService.searchSoftwareByDois(this.DOIs, null, page, size, []).subscribe(
|
539
|
data => {
|
540
|
if(data != null) {
|
541
|
this.openaireSoftwarePage=page;
|
542
|
this.openaireSoftwareNum = data[0];
|
543
|
this.openaireSoftware = data[1];
|
544
|
this.openaireSoftwareStatus = this.errorCodes.DONE;
|
545
|
if(this.openaireSoftwareNum == 0){
|
546
|
this.openaireSoftwareStatus = this.errorCodes.NONE;
|
547
|
}
|
548
|
}
|
549
|
},
|
550
|
err => {
|
551
|
this.openaireSoftwareStatus = this.errorCodes.ERROR;
|
552
|
console.log(err.status);
|
553
|
}
|
554
|
);
|
555
|
}else{
|
556
|
this._searchSoftwareService.searchSoftware('q='+term+'', null, page, size, []).subscribe(
|
557
|
data => {
|
558
|
if(data != null) {
|
559
|
this.openaireSoftwarePage=page;
|
560
|
this.openaireSoftwareNum = data[0];
|
561
|
this.openaireSoftware = data[1];
|
562
|
this.openaireSoftwareStatus = this.errorCodes.DONE;
|
563
|
if(this.openaireSoftwareNum == 0){
|
564
|
this.openaireSoftwareStatus = this.errorCodes.NONE;
|
565
|
}
|
566
|
}
|
567
|
},
|
568
|
err => {
|
569
|
this.openaireSoftwareStatus = this.errorCodes.ERROR;
|
570
|
console.log(err.status);
|
571
|
}
|
572
|
);
|
573
|
}
|
574
|
this.warningMessage = "";
|
575
|
this.infoMessage = "";
|
576
|
|
577
|
}
|
578
|
private getDataciteResults (term: string, size : number, page : number) {
|
579
|
this._searchDataciteService.searchDataciteResults(term, size, page).subscribe(
|
580
|
data => {
|
581
|
this.dataciteResults = data.data;
|
582
|
this.datacitePage=page;
|
583
|
this.dataciteResultsNum = data.meta.total;
|
584
|
this.dataciteStatus = this.errorCodes.DONE;
|
585
|
|
586
|
|
587
|
},
|
588
|
err => {
|
589
|
this.dataciteStatus = this.errorCodes.ERROR;
|
590
|
console.log(err);
|
591
|
}
|
592
|
|
593
|
);
|
594
|
}
|
595
|
|
596
|
add(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
|
597
|
|
598
|
console.log(' adding ' + itemType + " From " + itemSource+" "+ itemTitle);
|
599
|
var result: ClaimResult = ClaimResult.generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode);
|
600
|
|
601
|
|
602
|
if (itemSource == 'orcid'){
|
603
|
if(result.authors.length ==0 ){
|
604
|
result.authors.push(this.authorGivenName + ', '+ this.authorFamilyName);
|
605
|
}
|
606
|
}
|
607
|
var found:boolean = this.isSelected( result.id);
|
608
|
|
609
|
this.warningMessage = "";
|
610
|
if (!found) {
|
611
|
this.selectedResults.push(result);
|
612
|
|
613
|
UIkit.notification({
|
614
|
message : 'A new research result is selected.',
|
615
|
status : 'primary',
|
616
|
timeout : 1000,
|
617
|
pos : 'top-center'
|
618
|
});
|
619
|
|
620
|
|
621
|
}else{
|
622
|
this.warningMessage = "Research Data already in selected list";
|
623
|
UIkit.notification({
|
624
|
message : 'The research result is already on your list.',
|
625
|
status : 'warning',
|
626
|
timeout : 1000,
|
627
|
pos : 'top-center'
|
628
|
});
|
629
|
}
|
630
|
|
631
|
}
|
632
|
|
633
|
public searchSourceChanged(source){
|
634
|
this.searchSource = source;
|
635
|
this.activeTab = (source == "openaire" || source == "all")?"openairePub":source;
|
636
|
if(this.keyword && this.keyword.length > 0){
|
637
|
this.search(true);
|
638
|
}
|
639
|
}
|
640
|
public clickTab(tab){
|
641
|
this.activeTab = tab;
|
642
|
}
|
643
|
}
|