diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.ts b/portal-2/src/app/landingPages/dataset/dataset.component.ts index 455ff826..a5a7fea4 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.component.ts +++ b/portal-2/src/app/landingPages/dataset/dataset.component.ts @@ -188,7 +188,7 @@ export class DatasetComponent { } if(item.code || item.funderName || item.funderShortname || item.funding) { - tooltipContent += "

"; + tooltipContent += "

"; } if(item.provenanceAction == 'Repository') { diff --git a/portal-2/src/app/landingPages/dataset/dataset.service.ts b/portal-2/src/app/landingPages/dataset/dataset.service.ts index 74f8353e..dad6ae53 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.service.ts +++ b/portal-2/src/app/landingPages/dataset/dataset.service.ts @@ -7,12 +7,16 @@ import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/share'; import { CacheService } from '../../shared/cache.service'; +import { ParsingFunctions } from '../landing-utils/parsingFunctions.class'; @Injectable() export class DatasetService { - constructor(private http: Http, public _cache: CacheService) {} + constructor(private http: Http, public _cache: CacheService) { + this.parsingFunctions = new ParsingFunctions(); + } + public parsingFunctions: ParsingFunctions; datasetInfo: DatasetInfo; getDatasetInfo (id: string):any { @@ -141,7 +145,7 @@ export class DatasetService { this.datasetInfo.fundedByProjects[counter]['provenanceAction'] = ""; } - +/* if(mydata.hasOwnProperty("funding")) { let length1 = Array.isArray(mydata['funding']) ? mydata['funding'].length : 1; @@ -176,6 +180,21 @@ export class DatasetService { } } } +*/ + if(mydata.hasOwnProperty("funding")) { + let funding: {"funderName": string, "funderShortname": string, "stream": string}; + funding = this.parsingFunctions.parseFundingTrees(mydata.funding); + + if(funding.funderName) { + this.datasetInfo.fundedByProjects[counter]['funderName'] = funding.funderName; + } + if(funding.funderShortname) { + this.datasetInfo.fundedByProjects[counter]['funderShortname'] = funding.funderShortname; + } + if(funding.stream) { + this.datasetInfo.fundedByProjects[counter]['funding'] = funding.stream; + } + } } else if(mydata['to'].class == "isRelatedTo") { let provenanceAction: string; if(mydata.provenanceaction in this.datasetInfo.provenanceVocabulary) { diff --git a/portal-2/src/app/landingPages/landing-utils/parsingFunctions.class.ts b/portal-2/src/app/landingPages/landing-utils/parsingFunctions.class.ts new file mode 100644 index 00000000..2c0700ca --- /dev/null +++ b/portal-2/src/app/landingPages/landing-utils/parsingFunctions.class.ts @@ -0,0 +1,69 @@ + +export class ParsingFunctions { + + constructor () {} + + public ngOnDestroy() {} + + public parseFundingTrees(fundingTree: any): {"funderName": string, "funderShortname": string, "stream": string} { + let funding: {"funderName": string, "funderShortname": string, "stream": string} = {"funderName": "", "funderShortname": "", "stream": ""}; + let length = Array.isArray(fundingTree) ? fundingTree.length : 1; + + for(let i=0; i - Show More + View more