[Trunk|Library]: #4220: Add 'References' section in 'Research Data Landing page'.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@55057 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
8bb75a388d
commit
f28d8a3b44
|
@ -83,6 +83,31 @@
|
||||||
</div></div> -->
|
</div></div> -->
|
||||||
|
|
||||||
<ul class="custom-accordion" uk-accordion>
|
<ul class="custom-accordion" uk-accordion>
|
||||||
|
<li *ngIf="datasetInfo.references" (click)="activeTab='References'">
|
||||||
|
<a class="uk-accordion-title" href="#">
|
||||||
|
References ({{datasetInfo.references.length | number}})
|
||||||
|
</a>
|
||||||
|
<div class="uk-accordion-content">
|
||||||
|
<div>
|
||||||
|
<div *ngIf="datasetInfo.references.length > pageSize" class="uk-margin-bottom">
|
||||||
|
<span class="uk-h6">{{datasetInfo.references.length | number}} references, page {{referencesPage | number}} of {{totalPages(datasetInfo.references.length) | number}}</span>
|
||||||
|
<paging-no-load class="uk-float-right" [currentPage]="referencesPage" [totalResults]="datasetInfo.references.length" [size]="pageSize" (pageChange)="updateReferencesPage($event)"></paging-no-load>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngFor="let item of datasetInfo.references.slice((referencesPage-1)*pageSize, referencesPage*pageSize)">
|
||||||
|
<p *ngIf=" item && item['url']"
|
||||||
|
class="custom-external custom-icon">
|
||||||
|
<a href="{{item['url']}}" target="_blank">
|
||||||
|
{{item['name']}}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p *ngIf="!item['url']" class="pseudo-external custom-icon">
|
||||||
|
{{item['name']}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li *ngIf="datasetInfo.relatedResearchResults" (click)="activeTab='Related Research Results'">
|
<li *ngIf="datasetInfo.relatedResearchResults" (click)="activeTab='Related Research Results'">
|
||||||
<a class="uk-accordion-title" href="#">
|
<a class="uk-accordion-title" href="#">
|
||||||
|
|
|
@ -37,8 +37,12 @@ export class DatasetComponent {
|
||||||
public totalDownloads: number;
|
public totalDownloads: number;
|
||||||
public pageViews: number;
|
public pageViews: number;
|
||||||
|
|
||||||
|
// Custom tab paging variables
|
||||||
|
public referencesPage: number = 1;
|
||||||
|
public pageSize: number = 10;
|
||||||
|
|
||||||
// Active tab variable for responsiveness
|
// Active tab variable for responsiveness
|
||||||
public activeTab: string = "Related Research Results";
|
public activeTab: string = "References";
|
||||||
|
|
||||||
// Map counting variable
|
// Map counting variable
|
||||||
public relatedResearchResultsNum: number = 0;
|
public relatedResearchResultsNum: number = 0;
|
||||||
|
@ -200,4 +204,16 @@ export class DatasetComponent {
|
||||||
private handleError(message: string, error) {
|
private handleError(message: string, error) {
|
||||||
console.error("Research Data Landing Page: "+message, error);
|
console.error("Research Data Landing Page: "+message, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public updateReferencesPage($event) {
|
||||||
|
this.referencesPage = $event.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public totalPages(totalResults: number): number {
|
||||||
|
let totalPages:any = totalResults/this.pageSize;
|
||||||
|
if(!(Number.isInteger(totalPages))) {
|
||||||
|
totalPages = (parseInt(totalPages, this.pageSize) + 1);
|
||||||
|
}
|
||||||
|
return totalPages;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {MetricsModule} from '../landing-utils/metrics.module';
|
||||||
import {AltMetricsModule} from '../../utils/altmetrics.module';
|
import {AltMetricsModule} from '../../utils/altmetrics.module';
|
||||||
import {ConfigurationServiceModule} from '../../utils/configuration/configurationService.module';
|
import {ConfigurationServiceModule} from '../../utils/configuration/configurationService.module';
|
||||||
import {IFrameModule} from '../../utils/iframe.module';
|
import {IFrameModule} from '../../utils/iframe.module';
|
||||||
|
import {PagingModule} from '../../utils/paging.module';
|
||||||
|
|
||||||
import {DatasetService} from './dataset.service';
|
import {DatasetService} from './dataset.service';
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
|
||||||
imports: [
|
imports: [
|
||||||
//MaterialModule.forRoot(),
|
//MaterialModule.forRoot(),
|
||||||
CommonModule, FormsModule, SharedModule, RouterModule, LandingModule,
|
CommonModule, FormsModule, SharedModule, RouterModule, LandingModule,
|
||||||
CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule,
|
CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule,
|
||||||
AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule
|
AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|
|
@ -28,21 +28,22 @@ export class DatasetService {
|
||||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
.map(res => <any> res.json())
|
.map(res => <any> res.json())
|
||||||
.map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity']['oaf:result'],res])
|
.map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity']['oaf:result'],res])
|
||||||
.map(res => [res[1],
|
.map(res => [res[1], //0
|
||||||
res[1]['title'],
|
res[1]['title'], //1
|
||||||
res[1]['rels']['rel'],
|
res[1]['rels']['rel'], //2
|
||||||
res[1]['children'],
|
res[1]['children'], //3
|
||||||
res[1]['pid'],
|
res[1]['pid'], //4
|
||||||
res[1]['subject'],
|
res[1]['subject'], //5
|
||||||
res[1]['bestaccessright'],
|
res[1]['bestaccessright'], //6
|
||||||
res[1]['collectedfrom'],
|
res[1]['collectedfrom'], //7
|
||||||
res[1]['context'],
|
res[1]['context'], //8
|
||||||
//res[1]['resulttype'],
|
//res[1]['resulttype'],
|
||||||
res[0],
|
res[0], //9
|
||||||
res[1]['creator'],
|
res[1]['creator'], //10
|
||||||
res[1]['language'],
|
res[1]['language'], //11
|
||||||
res[1]['country'],
|
res[1]['country'], //12
|
||||||
res[2]
|
res[2], //13
|
||||||
|
(res[1]['extraInfo']!= undefined && res[1]['extraInfo']['citations']!= undefined)? res[1]['extraInfo']['citations']['citation']:null //14
|
||||||
]).map(res => this.parseDatasetInfo(res));
|
]).map(res => this.parseDatasetInfo(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ export class DatasetService {
|
||||||
parseDatasetInfo (data: any):any {
|
parseDatasetInfo (data: any):any {
|
||||||
this.datasetInfo = new DatasetInfo();
|
this.datasetInfo = new DatasetInfo();
|
||||||
this.datasetInfo.record = data[13];
|
this.datasetInfo.record = data[13];
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']
|
||||||
if(data[0] != null) {
|
if(data[0] != null) {
|
||||||
var date:string = (data[0].dateofacceptance)+""; // transform to string in case it is an integer
|
var date:string = (data[0].dateofacceptance)+""; // transform to string in case it is an integer
|
||||||
this.datasetInfo.date = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date;
|
this.datasetInfo.date = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date;
|
||||||
|
@ -82,6 +84,7 @@ export class DatasetService {
|
||||||
if(data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classid")) {
|
if(data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classid")) {
|
||||||
this.datasetInfo.accessMode = data[0]['bestaccessright'].classid;
|
this.datasetInfo.accessMode = data[0]['bestaccessright'].classid;
|
||||||
}
|
}
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']['title']
|
||||||
if(data[1] != null) {
|
if(data[1] != null) {
|
||||||
if(Array.isArray(data[1])) {
|
if(Array.isArray(data[1])) {
|
||||||
this.datasetInfo.title = data[1][0].content;
|
this.datasetInfo.title = data[1][0].content;
|
||||||
|
@ -93,6 +96,7 @@ export class DatasetService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']['rels']['rel']
|
||||||
if(data[2] != null) {
|
if(data[2] != null) {
|
||||||
let relation;
|
let relation;
|
||||||
let length = data[2].length!=undefined ? data[2].length : 1;
|
let length = data[2].length!=undefined ? data[2].length : 1;
|
||||||
|
@ -119,6 +123,7 @@ export class DatasetService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']['children']
|
||||||
if(data[3] != null) {
|
if(data[3] != null) {
|
||||||
if(data[3].hasOwnProperty("instance")) {
|
if(data[3].hasOwnProperty("instance")) {
|
||||||
this.datasetInfo.hostedBy_collectedFrom = new Array<{ "downloadName": string, "downloadUrl": string[],
|
this.datasetInfo.hostedBy_collectedFrom = new Array<{ "downloadName": string, "downloadUrl": string[],
|
||||||
|
@ -155,10 +160,12 @@ export class DatasetService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']['pid']
|
||||||
if(data[4] != null) {
|
if(data[4] != null) {
|
||||||
this.datasetInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
|
this.datasetInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']['subject']
|
||||||
if(data[5] != null) {
|
if(data[5] != null) {
|
||||||
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>] = this.parsingFunctions.parseAllSubjects(data[5]);
|
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>] = this.parsingFunctions.parseAllSubjects(data[5]);
|
||||||
this.datasetInfo.subjects = subjectResults[0];
|
this.datasetInfo.subjects = subjectResults[0];
|
||||||
|
@ -170,6 +177,7 @@ export class DatasetService {
|
||||||
this.datasetInfo.hostedBy_collectedFrom, this.datasetInfo.publisher,
|
this.datasetInfo.hostedBy_collectedFrom, this.datasetInfo.publisher,
|
||||||
null, this.datasetInfo.identifiers/*, this.datasetInfo.title*/);
|
null, this.datasetInfo.identifiers/*, this.datasetInfo.title*/);
|
||||||
|
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']['context']
|
||||||
if(data[8] != null) {
|
if(data[8] != null) {
|
||||||
this.datasetInfo.contexts = this.parsingFunctions.parseContexts(data[8]);
|
this.datasetInfo.contexts = this.parsingFunctions.parseContexts(data[8]);
|
||||||
}
|
}
|
||||||
|
@ -180,12 +188,14 @@ export class DatasetService {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// ['result']['header']['dri:status']
|
||||||
if(data[9] != null && data[9] == "under curation") {
|
if(data[9] != null && data[9] == "under curation") {
|
||||||
this.datasetInfo.underCurationMessage = true;
|
this.datasetInfo.underCurationMessage = true;
|
||||||
} else {
|
} else {
|
||||||
this.datasetInfo.underCurationMessage = false;
|
this.datasetInfo.underCurationMessage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']['creator']
|
||||||
if(data[10] != null) {
|
if(data[10] != null) {
|
||||||
if(this.datasetInfo.authors == undefined) {
|
if(this.datasetInfo.authors == undefined) {
|
||||||
this.datasetInfo.authors = new Array<string>();
|
this.datasetInfo.authors = new Array<string>();
|
||||||
|
@ -204,13 +214,20 @@ export class DatasetService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']['language']
|
||||||
if(data[11] != null) {
|
if(data[11] != null) {
|
||||||
this.datasetInfo.languages = this.parsingFunctions.parseLanguages(data[11]);
|
this.datasetInfo.languages = this.parsingFunctions.parseLanguages(data[11]);
|
||||||
}
|
}
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']['country']
|
||||||
if(data[12] != null) {
|
if(data[12] != null) {
|
||||||
this.datasetInfo.countries = this.parsingFunctions.parseCountries(data[12]);
|
this.datasetInfo.countries = this.parsingFunctions.parseCountries(data[12]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ['result']['metadata']['oaf:entity']['oaf:result']['extraInfo']['citations']['citation']
|
||||||
|
if(data[14] != null) {
|
||||||
|
this.datasetInfo.references = this.parsingFunctions.parseReferences(data[14]);
|
||||||
|
}
|
||||||
|
|
||||||
if(this.datasetInfo.relatedResearchResults) {
|
if(this.datasetInfo.relatedResearchResults) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.datasetInfo.relatedResearchResults.forEach(function (value, key, map) {
|
this.datasetInfo.relatedResearchResults.forEach(function (value, key, map) {
|
||||||
|
|
|
@ -47,4 +47,5 @@ export class DatasetInfo {
|
||||||
similarResearchResults: { "name": string, "id": string, "date": string, "percentage": number, "class": string}[]; // percentage is for similarity
|
similarResearchResults: { "name": string, "id": string, "date": string, "percentage": number, "class": string}[]; // percentage is for similarity
|
||||||
contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[];
|
contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[];
|
||||||
record;
|
record;
|
||||||
|
references: { "name": string, "url": string}[];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue