searchPages/searchUtils/searchDownload.component.ts was missing from previous commit | countries information parsed in dataproviders landing page

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44583 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2016-11-21 10:43:40 +00:00
parent 5fe3a03af2
commit 3a19e4a366
6 changed files with 89 additions and 17 deletions

View File

@ -234,7 +234,7 @@
<li class="list-group-item" *ngIf="publicationInfo.collectedFrom != undefined">
<dl class="functionsSection">
<dt>Collected from</dt>
<dd *ngIf="showAllCollectedFrom">
<dd *ngIf="showAllCollectedFrom" class="text-right">
<a class="text-muted" (click)="showAllCollectedFrom = !showAllCollectedFrom;">
View less
</a>
@ -244,12 +244,12 @@
{{item['name']}}
</a>
</dd>
<dd *ngIf="showAllCollectedFrom">
<dd *ngIf="showAllCollectedFrom" class="text-right">
<a class="text-muted" (click)="showAllCollectedFrom = !showAllCollectedFrom;">
View less
</a>
</dd>
<dd *ngIf="!showAllCollectedFrom && publicationInfo.collectedFrom.length > 5">
<dd *ngIf="!showAllCollectedFrom && publicationInfo.collectedFrom.length > 5" class="text-right">
<a class="text-muted" (click)="showAllCollectedFrom = !showAllCollectedFrom;">
View more
</a>
@ -259,7 +259,7 @@
<li class="list-group-item" *ngIf="publicationInfo.downloadFrom != undefined && publicationInfo.downloadFrom.size > 0">
<dl class="functionsSection">
<dt class="title">Download from</dt>
<dd *ngIf="showAllDownloadFrom">
<dd *ngIf="showAllDownloadFrom" class="text-right">
<a class="text-muted" (click)="showAllDownloadFrom = !showAllDownloadFrom;">
View less
</a>
@ -279,12 +279,12 @@
</a>
</div>
</dd>
<dd *ngIf="showAllDownloadFrom">
<dd *ngIf="showAllDownloadFrom" class="text-right">
<a class="text-muted" (click)="showAllDownloadFrom = !showAllDownloadFrom;">
View less
</a>
</dd>
<dd *ngIf="!showAllDownloadFrom && publicationInfo.downloadFrom.length > 5">
<dd *ngIf="!showAllDownloadFrom && publicationInfo.downloadFrom.length > 5" class="text-right">
<a class="text-muted" (click)="showAllDownloadFrom = !showAllDownloadFrom;">
View more
</a>
@ -294,7 +294,7 @@
<li class="list-group-item" *ngIf="publicationInfo.publishedIn != undefined && publicationInfo.publishedIn.length > 0">
<dl class="functionsSection">
<dt class="title">Published in</dt>
<dd *ngIf="showAllPublishedIn">
<dd *ngIf="showAllPublishedIn" class="text-right">
<a class="text-muted" (click)="showAllPublishedIn = !showAllPublishedIn;">
View less
</a>
@ -314,12 +314,12 @@
</a>
</div>
</dd>
<dd *ngIf="showAllPublishedIn">
<dd *ngIf="showAllPublishedIn" class="text-right">
<a class="text-muted" (click)="showAllPublishedIn = !showAllPublishedIn;">
View less
</a>
</dd>
<dd *ngIf="!showAllPublishedIn && publicationInfo.publishedIn.length > 5">
<dd *ngIf="!showAllPublishedIn && publicationInfo.publishedIn.length > 5" class="text-right">
<a class="text-muted" (click)="showAllPublishedIn = !showAllPublishedIn;">
View more
</a>
@ -330,7 +330,7 @@
<li class="list-group-item">
<dl class="functionsSection" *ngIf="publicationInfo.fundedByProjects != undefined">
<dt class="title">Funded By</dt>
<dd *ngIf="showAllFundedBy">
<dd *ngIf="showAllFundedBy" class="text-right">
<a class="text-muted" (click)="showAllFundedBy = !showAllFundedBy;">
View less
</a>
@ -355,12 +355,12 @@
</a>
</div>
</dd>
<dd *ngIf="showAllFundedBy">
<dd *ngIf="showAllFundedBy" class="text-right">
<a class="text-muted" (click)="showAllFundedBy = !showAllFundedBy;">
View less
</a>
</dd>
<dd *ngIf="!showAllFundedBy && publicationInfo.fundedByProjects.length > 5">
<dd *ngIf="!showAllFundedBy && publicationInfo.fundedByProjects.length > 5" class="text-right">
<a class="text-muted" (click)="showAllFundedBy = !showAllFundedBy;">
View more
</a>

View File

@ -15,7 +15,7 @@ import {ExportCSVComponent} from '../utils/exportCSV.component';
<search-page pageTitle="Search Dataproviders" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl"
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl"
(queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)">
</search-page>
@ -57,7 +57,7 @@ export class SearchDataprovidersComponent {
this.sub = this.route.queryParams.subscribe(params => {
this.keyword = (params['keyword']?params['keyword']:'');
this.page = (params['page']=== undefined)?1:+params['page'];
console.info("PAGE init = "+this.page);
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.page, this.size);
@ -227,6 +227,7 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number){
private queryChanged($event) {
var parameters = $event.value;
console.info("PAGE queryChanged = "+this.page);
this._getResults(parameters, true, this.page, this.size);
}

View File

@ -0,0 +1,59 @@
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {AlertModal} from '../../utils/modal/alert';
@Component({
selector: 'search-download',
template: `
<div class= "searchDownload" *ngIf="totalResults > 0">
<div class="text-right" *ngIf="totalResults <= 100000">
<a (click)="download()">
<span class="glyphicon glyphicon-download" aria-hidden="true"></span>
Download report (CSV)
</a>
</div>
<div class="text-right" *ngIf="totalResults > 100000">
<a (click)="denialOfDownload()">
<span class="glyphicon glyphicon-download" aria-hidden="true"></span>
Download report (CSV)
</a>
</div>
</div>
<modal-alert></modal-alert>
`
})
export class SearchDownloadComponent {
@Input() totalResults:number = 0;
@ViewChild(AlertModal) alertApplyAll;
@Output() downloadClick = new EventEmitter();
constructor () {
}
ngOnInit() {
}
confirmClose(data){
}
download() {
this.downloadClick.emit({
value: true
});
}
denialOfDownload() {
this.alertApplyAll.isOpen = true;
this.alertApplyAll.cancelButton = true;
this.alertApplyAll.okButton = false;
this.alertApplyAll.alertTitle = "Download Results in CSV";
this.alertApplyAll.message = "Sorry, but the results are too many! Use the api instead!";
this.alertApplyAll.cancelButtonText = "Ok";
console.info("denial of Download");
}
}

View File

@ -253,12 +253,15 @@ export class SearchPageComponent {
goTo(page:number = 1){
this.page = page;
console.info("PAGE goto = "+this.page);
this.queryParameters = new Map<string,string>();
var urlParameters = this.createUrlParameters(this.filters,true);
console.info("urlParams : "+urlParameters);
this.updateBaseUrlWithParameters(this.filters);
var queryParameters = this.createSearchQueryParameters(this.filters);
console.info("queryParams : "+queryParameters);
var indexQuery = this.createIndexQueryParameters(this.filters);
this.location.go(location.pathname,urlParameters);
this.queryChange.emit({

View File

@ -87,6 +87,7 @@ export class DataProviderService {
if(data[4] != null) {
let mydata;
let counter = 0;
let countriesSet: Set<string>;
let length = data[4].length!=undefined ? data[4].length : 1;
for(let i=0; i<length; i++) {
@ -95,13 +96,21 @@ export class DataProviderService {
if(mydata['to'].class == "provides" && mydata['to'].type == "organization") {
if(this.dataProviderInfo.organizations == undefined) {
this.dataProviderInfo.organizations = new Array<{"name": string, "url": string}>();
this.dataProviderInfo.countries = new Set<string>();
this.dataProviderInfo.countries = new Array<string>();
countriesSet = new Set<string>();
}
this.dataProviderInfo.organizations[counter] = {"name": "", "url": ""};
this.dataProviderInfo.organizations[counter]['name'] = mydata.legalname;
this.dataProviderInfo.organizations[counter]['url'] = OpenaireProperties.getsearchLinkToOrganization()+mydata['to'].content;
if(mydata.country != '' && mydata['country'].classname != '') {
if(!countriesSet.has(mydata['country'].classname)) {
this.dataProviderInfo.countries.push(mydata['country'].classname);
countriesSet.add(mydata['country'].classname);
}
}
counter++;
}
}

View File

@ -3,7 +3,7 @@ export class DataProviderInfo {
type: string;
compatibility: string;
oaiPmhURL: string;
countries: Set<string>;
countries: string[];
tabs: {"name": string, "content": string}[];
tabsInTypes = {
"publicationsTab": new Set<string>(