From 7b42fc135b4e3228735412b1ff6392aab483ca4e Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 8 Mar 2017 11:37:31 +0000 Subject: [PATCH] Lazy routing disabled in datasources tab of dataprovider landing page (parameter lazy=false in searchResults page) | Added widget for publications and research data in project landing page | Project landing page: bug solved for publications in csv (not any more size=0) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46185 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../dataProvider/datasourcesTab.component.ts | 3 +- .../htmlProjectReport.component.ts | 2 +- .../project/project.component.html | 30 +++++++++++---- .../landingPages/project/project.component.ts | 37 ++++++++++++++++++- .../searchUtils/searchResult.component.ts | 11 +++++- .../fetchPublications.class.ts | 3 ++ 6 files changed, 74 insertions(+), 12 deletions(-) diff --git a/portal-2/src/app/landingPages/dataProvider/datasourcesTab.component.ts b/portal-2/src/app/landingPages/dataProvider/datasourcesTab.component.ts index bb19d0f8..0e598b35 100644 --- a/portal-2/src/app/landingPages/dataProvider/datasourcesTab.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/datasourcesTab.component.ts @@ -19,7 +19,8 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
View all {{fetchDataproviders.searchUtils.totalResults}} results
+ type="dataprovider" urlParam="datasourceId" + lazy=false> ` diff --git a/portal-2/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts b/portal-2/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts index fa174aae..afb72665 100644 --- a/portal-2/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts +++ b/portal-2/src/app/landingPages/htmlProjectReport/htmlProjectReport.component.ts @@ -9,7 +9,7 @@ import {ProjectService} from '../project/project.service'; selector: 'htmlProjectReport', template: `
- diff --git a/portal-2/src/app/landingPages/project/project.component.html b/portal-2/src/app/landingPages/project/project.component.html index 2d30208b..68e93fe9 100644 --- a/portal-2/src/app/landingPages/project/project.component.html +++ b/portal-2/src/app/landingPages/project/project.component.html @@ -177,12 +177,28 @@ View all Project Publications - +
  • +
    Dynamically incorporate publications in your site (HTML)
    + + +
    + +
    {{publications_dynamic}}
    +
    +
  • +
  • +
    Dynamically incorporate research data in your site (HTML)
    +
    + +
    {{datasets_dynamic}}
    +
    +
  • @@ -196,7 +212,7 @@ [linkname]="'Download '+ projectInfo.funder +' progress report (CSV)'" [filename]="'publications.csv'"> - + {{projectInfo.funder}} progress report (CSV) diff --git a/portal-2/src/app/landingPages/project/project.component.ts b/portal-2/src/app/landingPages/project/project.component.ts index 911b0fbd..5126e241 100644 --- a/portal-2/src/app/landingPages/project/project.component.ts +++ b/portal-2/src/app/landingPages/project/project.component.ts @@ -33,6 +33,9 @@ export class ProjectComponent{ public chartAccessModeUrl: string; public chartDatasourcesUrl: string; + public publications_dynamic: string; + public datasets_dynamic: string; + public project ; public downloadURLAPI: string; @@ -71,6 +74,26 @@ export class ProjectComponent{ this.projectId = params['projectId']; console.info("Id is :"+this.projectId); if(this.projectId){ + this.publications_dynamic = + ""; + + this.datasets_dynamic = + ""; + this.getProjectInfo(this.projectId); // this.subPublications = this.route.queryParams.subscribe(params => { this.searchPublications(); @@ -88,9 +111,18 @@ export class ProjectComponent{ } this.downloadURLAPI = OpenaireProperties.getCsvAPIURL(); - this.csvParams = "format=csv-special&page=0&size="+this.fetchPublications.searchUtils.totalResults+"&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))"; - }); + + if(typeof window !== undefined) { + let publ_clipboard, datasets_clipboard; + let Clipboard; + Clipboard = require('clipboard'); + publ_clipboard = new Clipboard('.publ_clipboard_btn'); + datasets_clipboard = new Clipboard('.datasets_clipboard_btn'); + } + + console.info(this.fetchPublications.searchUtils.totalResults + " just before csv"); + this.csvParams = "format=csv-special&page=0&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))&size="; } @@ -142,6 +174,7 @@ export class ProjectComponent{ ); } downloadfile(url:string){ + console.log("Downloading file: "+ url); this._reportsService.downloadCSVFile(url) .subscribe(data => window.open(window.URL.createObjectURL(data)), diff --git a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts index fb4e48f4..1f8ef8bc 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts @@ -16,7 +16,15 @@ import {RouterHelper} from '../../utils/routerHelper.class';

    - + +

    +

    +

    + {{result['title'].url}} +

    +
    +

    @@ -135,6 +143,7 @@ export class SearchResultComponent { @Input() type: string; @Input() urlParam: string; @Input() showLoading: boolean = false; + @Input() lazy: boolean = true; public errorCodes:ErrorCodes = new ErrorCodes(); public routerHelper:RouterHelper = new RouterHelper(); diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts index ef23f3fd..9e98fcf6 100644 --- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts +++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts @@ -118,10 +118,13 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number) } else if(entity == "person") { parameters = "people/"+id; } + if(parameters != "") { this._searchPublicationsService.searchPublicationsForEntity(parameters, page, size).subscribe( data => { this.searchUtils.totalResults = data[0]; + console.info(this.searchUtils.totalResults + " i think we got results"); + console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); this.results = data[1];