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
This commit is contained in:
konstantina.galouni 2017-03-08 11:37:31 +00:00
parent 89c18ce14f
commit 7b42fc135b
6 changed files with 74 additions and 12 deletions

View File

@ -19,7 +19,8 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
<div class = "uk-text-right" *ngIf = "fetchDataproviders.searchUtils.totalResults > 10" ><a [href] = "linkToSearchDataproviders" >View all {{fetchDataproviders.searchUtils.totalResults}} results</a></div> <div class = "uk-text-right" *ngIf = "fetchDataproviders.searchUtils.totalResults > 10" ><a [href] = "linkToSearchDataproviders" >View all {{fetchDataproviders.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="fetchDataproviders.results" <search-result [(results)]="fetchDataproviders.results"
[(status)]= "fetchDataproviders.status" [(status)]= "fetchDataproviders.status"
type="dataprovider" urlParam="datasourceId"> type="dataprovider" urlParam="datasourceId"
lazy=false>
</search-result> </search-result>
</div> </div>
` `

View File

@ -9,7 +9,7 @@ import {ProjectService} from '../project/project.service';
selector: 'htmlProjectReport', selector: 'htmlProjectReport',
template: ` template: `
<div class="uk-container uk-margin-top"> <div class="uk-container uk-margin-top">
<button class="uk-button uk-button-primary btn" (click)="copied = true;"> <button class="uk-icon-clipboard uk-button uk-button-primary btn" (click)="copied = true;">
Copy to clipboard Copy to clipboard
</button> </button>
<!--span *ngIf="copied" class="uk-badge uk-badge-success">Success</span--> <!--span *ngIf="copied" class="uk-badge uk-badge-success">Success</span-->

View File

@ -177,12 +177,28 @@
View all Project Publications View all Project Publications
</a> </a>
</li> </li>
<!--li> <li>
<span class="clickable"> <div class="clickable" data-uk-toggle="{target:'#publications_dynamic', animation:'uk-animation-fade'}">Dynamically incorporate publications in your site (HTML)</div>
<span aria-hidden="true"></span>
<span class="uk-icon-download">Dynamically incorporate publications in your site (HTML)</span> <!--div class="uk-hidden uk-panel uk-panel-box" id="publications_dynamic">
</span> {{publications_dynamic}}
</li--> </div-->
<div class="uk-vertical-align uk-hidden" id="publications_dynamic">
<button class="uk-float-right uk-icon-clipboard uk-button publ_clipboard_btn" data-clipboard-target="#publ_clipboard">
Copy to clipboard
</button>
<pre><code id="publ_clipboard">{{publications_dynamic}}</code></pre>
</div>
</li>
<li>
<div class="clickable" data-uk-toggle="{target:'#datasets_dynamic', animation:'uk-animation-fade'}">Dynamically incorporate research data in your site (HTML)</div>
<div class="uk-vertical-align uk-hidden" id="datasets_dynamic">
<button class="uk-float-right uk-icon-clipboard uk-button datasets_clipboard_btn" data-clipboard-target="#datasets_clipboard">
Copy to clipboard
</button>
<pre><code id="datasets_clipboard">{{datasets_dynamic}}</code></pre>
</div>
</li>
<!--li (click)="showHTML()"--> <!--li (click)="showHTML()"-->
<li> <li>
@ -196,7 +212,7 @@
[linkname]="'Download '+ projectInfo.funder +' progress report (CSV)'" [linkname]="'Download '+ projectInfo.funder +' progress report (CSV)'"
[filename]="'publications.csv'"> [filename]="'publications.csv'">
</export--> </export-->
<span class="clickable" (click)="downloadfile(downloadURLAPI+'resources?'+csvParams)"> <span class="clickable" (click)="downloadfile(downloadURLAPI+'resources?'+csvParams+fetchPublications.searchUtils.totalResults)">
<span aria-hidden="true" class="glyphicon glyphicon-download"></span> <span aria-hidden="true" class="glyphicon glyphicon-download"></span>
<span class="uk-icon-download">{{projectInfo.funder}} progress report (CSV)</span> <span class="uk-icon-download">{{projectInfo.funder}} progress report (CSV)</span>
</span> </span>

View File

@ -33,6 +33,9 @@ export class ProjectComponent{
public chartAccessModeUrl: string; public chartAccessModeUrl: string;
public chartDatasourcesUrl: string; public chartDatasourcesUrl: string;
public publications_dynamic: string;
public datasets_dynamic: string;
public project ; public project ;
public downloadURLAPI: string; public downloadURLAPI: string;
@ -71,6 +74,26 @@ export class ProjectComponent{
this.projectId = params['projectId']; this.projectId = params['projectId'];
console.info("Id is :"+this.projectId); console.info("Id is :"+this.projectId);
if(this.projectId){ if(this.projectId){
this.publications_dynamic =
"<script type=\"text/javascript\">"
+ "\n<!--"
+ "\ndocument.write('<div id=\"oa_widget\"></div>');"
+ "\ndocument.write('<script type=\"text/javascript\""
+ "\nsrc=\"https://beta.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId="
+ this.projectId + "&type=publication\"></script>');"
+ "\n-->"
+ "\n</script>";
this.datasets_dynamic =
"<script type=\"text/javascript\">"
+ "\n<!--"
+ "\ndocument.write('<div id=\"oa_widget\"></div>');"
+ "\ndocument.write('<script type=\"text/javascript\""
+ "\nsrc=\"https://beta.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId="
+ this.projectId + "&type=dataset\"></script>');"
+ "\n-->"
+ "\n</script>";
this.getProjectInfo(this.projectId); this.getProjectInfo(this.projectId);
// this.subPublications = this.route.queryParams.subscribe(params => { // this.subPublications = this.route.queryParams.subscribe(params => {
this.searchPublications(); this.searchPublications();
@ -88,9 +111,18 @@ export class ProjectComponent{
} }
this.downloadURLAPI = OpenaireProperties.getCsvAPIURL(); 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){ downloadfile(url:string){
console.log("Downloading file: "+ url); console.log("Downloading file: "+ url);
this._reportsService.downloadCSVFile(url) this._reportsService.downloadCSVFile(url)
.subscribe(data => window.open(window.URL.createObjectURL(data)), .subscribe(data => window.open(window.URL.createObjectURL(data)),

View File

@ -16,7 +16,15 @@ import {RouterHelper} from '../../utils/routerHelper.class';
<h4 class = "{{result.title.accessMode}} {{result.title.sc39}}" [title] = result.title.accessMode > <h4 class = "{{result.title.accessMode}} {{result.title.sc39}}" [title] = result.title.accessMode >
<!--a href="{{result['title'].url}}"--> <!--a href="{{result['title'].url}}"-->
<!--a [queryParams]="{articleId: 'od_______908::3a5b2885656a91307156325644e73b92'}" routerLinkActive="router-link-active" routerLink="search/publication"--> <!--a [queryParams]="{articleId: 'od_______908::3a5b2885656a91307156325644e73b92'}" routerLinkActive="router-link-active" routerLink="search/publication"-->
<a [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}"> <a *ngIf="lazy" [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
[innerHTML]="result['title'].name">
</p>
<p *ngIf="result['title'].name == undefined || result['title'].name == ''">
{{result['title'].url}}
</p>
</a>
<a *ngIf="!lazy" href="/search/{{type}}?{{urlParam}}={{result.id}}">
<p *ngIf="result['title'].name != undefined && result['title'].name != ''" <p *ngIf="result['title'].name != undefined && result['title'].name != ''"
[innerHTML]="result['title'].name"> [innerHTML]="result['title'].name">
</p> </p>
@ -135,6 +143,7 @@ export class SearchResultComponent {
@Input() type: string; @Input() type: string;
@Input() urlParam: string; @Input() urlParam: string;
@Input() showLoading: boolean = false; @Input() showLoading: boolean = false;
@Input() lazy: boolean = true;
public errorCodes:ErrorCodes = new ErrorCodes(); public errorCodes:ErrorCodes = new ErrorCodes();
public routerHelper:RouterHelper = new RouterHelper(); public routerHelper:RouterHelper = new RouterHelper();

View File

@ -118,10 +118,13 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
} else if(entity == "person") { } else if(entity == "person") {
parameters = "people/"+id; parameters = "people/"+id;
} }
if(parameters != "") { if(parameters != "") {
this._searchPublicationsService.searchPublicationsForEntity(parameters, page, size).subscribe( this._searchPublicationsService.searchPublicationsForEntity(parameters, page, size).subscribe(
data => { data => {
this.searchUtils.totalResults = data[0]; 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+"]"); console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1]; this.results = data[1];