From c1af4972d8fb0f314ab96e8a0f0db608cfe511f8 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 19 Jan 2017 13:47:21 +0000 Subject: [PATCH] csv in search pages added (simple, advanced, data providers) | html tags not considered in description (search pages, publication landing, dataset landing) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@45484 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../app/deposit/depositResult.component.ts | 2 +- .../dataset/dataset.component.html | 2 +- .../publication/publication.component.html | 2 +- .../advancedSearchDataProviders.component.ts | 15 +++++++++---- .../advancedSearchDatasets.component.ts | 13 ++++++++--- .../advancedSearchOrganizations.component.ts | 12 ++++++++-- .../advancedSearchPeople.component.ts | 13 ++++++++--- .../advancedSearchProjects.component.ts | 13 ++++++++--- .../advancedSearchPublications.component.ts | 12 ++++++++-- .../compatibleDataProviders.component.ts | 8 +++++-- .../entityRegistries.component.ts | 8 +++++-- .../advancedSearchPage.component.ts | 4 +++- .../searchUtils/searchDownload.component.ts | 22 +++++++------------ .../searchUtils/searchPage.component.ts | 10 ++++----- .../searchUtils/searchResult.component.ts | 4 +++- .../simple/searchDataproviders.component.ts | 8 +++++-- .../simple/searchDatasets.component.ts | 10 +++++---- .../simple/searchOrganizations.component.ts | 5 ++++- .../simple/searchPeople.component.ts | 8 +++++-- .../simple/searchProjects.component.ts | 9 +++++--- .../simple/searchPublications.component.ts | 22 ++++++++++++------- .../services/searchDataproviders.service.ts | 5 ----- .../services/searchPublications.service.ts | 4 ++-- .../utils/properties/openaireProperties.ts | 2 +- 24 files changed, 140 insertions(+), 73 deletions(-) diff --git a/portal-2/src/app/deposit/depositResult.component.ts b/portal-2/src/app/deposit/depositResult.component.ts index 1f8531c6..9f0f1963 100644 --- a/portal-2/src/app/deposit/depositResult.component.ts +++ b/portal-2/src/app/deposit/depositResult.component.ts @@ -18,7 +18,7 @@ import {OrganizationService} from '../services/organization.service'; diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.html b/portal-2/src/app/landingPages/dataset/dataset.component.html index b2373577..c64e90ea 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.component.html +++ b/portal-2/src/app/landingPages/dataset/dataset.component.html @@ -34,7 +34,7 @@
-
+
{{datasetInfo.description}}
@@ -43,7 +44,8 @@ export class SearchCompatibleDataprovidersComponent { "export":[] }; public CSVDownloaded = false; - public resourcesQuery = "query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"; + public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"; + public csvParams: string; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; @@ -81,6 +83,8 @@ export class SearchCompatibleDataprovidersComponent { this.subResults.unsubscribe(); } } private _getResults(parameters:string,refine:boolean, page: number, size: number){ + this.csvParams = parameters+this.resourcesQuery+"&type=datasources"; + var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; this.searchPage.openLoading(); diff --git a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts index a439c56b..282bca55 100644 --- a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts @@ -18,7 +18,8 @@ import {ExportCSVComponent} from '../../utils/exportCSV.component'; + (downloadClick)="downloadClicked($event)" + [csvParams]="csvParams" csvPath="resources"> ` @@ -45,7 +46,8 @@ export class SearchEntityRegistriesComponent { public CSVDownloaded = false; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; - public resourcesQuery = "query=((oaftype exact datasource) and(datasourcetypeuiid = other))"; + public resourcesQuery = "&query=((oaftype exact datasource) and(datasourcetypeuiid = other))"; + public csvParams: string; constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { var errorCodes:ErrorCodes = new ErrorCodes(); @@ -82,6 +84,8 @@ export class SearchEntityRegistriesComponent { this.subResults.unsubscribe(); } } private _getResults(parameters:string,refine:boolean, page: number, size: number){ + this.csvParams = parameters+this.resourcesQuery+"&type=datasources"; + var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; this.searchPage.openLoading(); diff --git a/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts index 1990d7a9..48be2efa 100644 --- a/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts @@ -38,6 +38,7 @@ import {ModalLoading} from '../../utils/modal/loading.component'; +
@@ -62,7 +63,8 @@ export class AdvancedSearchPageComponent { @Input() selectedFields:AdvancedField[]; @Input() simpleSearchUrl: string; @ViewChild (ModalLoading) loading : ModalLoading ; - @Input() resourcesQuery = ""; + @Input() csvParams: string; + @Input() csvPath: string; public baseURLWithParameters:string = ''; diff --git a/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts b/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts index 1fd23492..26d51ce6 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts @@ -7,34 +7,28 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties'; selector: 'search-download', template: ` - + ` }) export class SearchDownloadComponent { @Input() totalResults:number = 0; + @Input() csvParams: string; + @Input() type: string; @ViewChild(AlertModal) alertApplyAll; @Output() downloadClick = new EventEmitter(); private downloadURLAPI: string; - constructor () { - - } + constructor () {} ngOnInit() { this.downloadURLAPI = OpenaireProperties.getCsvAPIURL(); diff --git a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts index 18538032..f8b461b7 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts @@ -39,8 +39,8 @@ import {ModalLoading} from '../../utils/modal/loading.component';
- +
@@ -48,11 +48,10 @@ import {ModalLoading} from '../../utils/modal/loading.component';
- - - + +
@@ -73,7 +72,8 @@ export class SearchPageComponent { @Input() showResultCount:boolean = true; @Input() showRefine:boolean = true; @Input() refineFields = []; - @Input() resourcesQuery = ""; + @Input() csvParams: string; + @Input() csvPath: string; @ViewChild (ModalLoading) loading : ModalLoading ; public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }}; private searchFieldsHelper:SearchFields = new SearchFields(); diff --git a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts index 53f56ff5..dea9cd0c 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts @@ -58,7 +58,9 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
-
+
+ {{result.description}} +
Embargo End Date: {{result.embargoEndDate}} diff --git a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts index 933c6ec0..72ae76ec 100644 --- a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts +++ b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts @@ -14,9 +14,10 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; selector: 'search-dataproviders', template: ` - + (queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)" + [csvParams]="csvParams" csvPath="datasources"> ` @@ -36,6 +37,7 @@ export class SearchDataprovidersComponent { "export":[] }; public CSVDownloaded = false; + public csvParams: string; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; @@ -212,6 +214,8 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number) this._getResults(parameters,refine,page,this.searchUtils.size); } private _getResults(parameters:string,refine:boolean, page: number, size: number){ + this.csvParams = parameters; + if(!refine && !this.searchPage){ this.searchPage = new SearchPageComponent(this._location); } diff --git a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts index b5ad4e5d..36835cae 100644 --- a/portal-2/src/app/searchPages/simple/searchDatasets.component.ts +++ b/portal-2/src/app/searchPages/simple/searchDatasets.component.ts @@ -17,12 +17,12 @@ import {DOI} from '../../utils/string-utils.class'; + [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" + [csvParams]="csvParams" csvPath="datasets"> - ` - }) + export class SearchDatasetsComponent { public results =[]; public filters: Filter[] =[]; @@ -37,7 +37,7 @@ export class SearchDatasetsComponent { public fieldIdsMap=this.searchFields.RESULT_FIELDS; private urlParams : Map; private _location:Location; - + public csvParams: string; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) { @@ -162,6 +162,8 @@ public getResults(keyword:string,refine:boolean, page: number, size: number){ this._getResults(parameters,refine,page,size); } private _getResults(parameters:string,refine:boolean, page: number, size: number){ + this.csvParams = parameters; + if(!refine && !this.searchPage){ this.searchPage = new SearchPageComponent(this._location); } diff --git a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts index 5247c911..7a3e5ae2 100644 --- a/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts +++ b/portal-2/src/app/searchPages/simple/searchOrganizations.component.ts @@ -15,7 +15,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; + [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" + [csvParams]="csvParams" csvPath="organizations"> ` @@ -33,6 +34,7 @@ export class SearchOrganizationsComponent { public fieldIdsMap = this.searchFields.ORGANIZATION_FIELDS; public urlParams : Map; public _location:Location; + public csvParams: string; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; @@ -75,6 +77,7 @@ export class SearchOrganizationsComponent { this._getResults(parameters,refine,page,this.searchUtils.size); } private _getResults(parameters:string,refine:boolean, page: number, size: number){ + this.csvParams = parameters; if(!refine && !this.searchPage){ this.searchPage = new SearchPageComponent(this._location); diff --git a/portal-2/src/app/searchPages/simple/searchPeople.component.ts b/portal-2/src/app/searchPages/simple/searchPeople.component.ts index 4259066a..6391dd10 100644 --- a/portal-2/src/app/searchPages/simple/searchPeople.component.ts +++ b/portal-2/src/app/searchPages/simple/searchPeople.component.ts @@ -16,8 +16,9 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; template: ` + [(results)] = "results" [(searchUtils)] = "searchUtils" + [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false + [csvParams]="csvParams" csvPath="people"> ` @@ -32,6 +33,7 @@ export class SearchPeopleComponent { public _location:Location; public searchFields:SearchFields = new SearchFields(); public refineFields = this.searchFields.PERSON_REFINE_FIELDS; + public csvParams: string; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; @@ -152,6 +154,8 @@ public getResults(keyword:string,refine:boolean, page: number, size: number){ this._getResults(parameters,refine,page,this.searchUtils.size); } private _getResults(parameters:string,refine:boolean, page: number, size: number){ + this.csvParams = parameters; + var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; this.searchPage.openLoading(); diff --git a/portal-2/src/app/searchPages/simple/searchProjects.component.ts b/portal-2/src/app/searchPages/simple/searchProjects.component.ts index e09d667d..96dc3b8e 100644 --- a/portal-2/src/app/searchPages/simple/searchProjects.component.ts +++ b/portal-2/src/app/searchPages/simple/searchProjects.component.ts @@ -14,9 +14,9 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; template: ` + [(results)] = "results" [(searchUtils)] = "searchUtils" + [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" + [csvParams]="csvParams" csvPath="projects"> ` @@ -33,6 +33,7 @@ export class SearchProjectsComponent { public fieldIdsMap = this.searchFields.PROJECT_FIELDS; public urlParams : Map; public _location:Location; + public csvParams: string; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; @@ -81,6 +82,8 @@ export class SearchProjectsComponent { this._getResults(parameters,refine,page,this.searchUtils.size); } private _getResults(parameters:string,refine:boolean, page: number, size: number){ + this.csvParams = parameters; + if(!refine && !this.searchPage){ this.searchPage = new SearchPageComponent(this._location); } diff --git a/portal-2/src/app/searchPages/simple/searchPublications.component.ts b/portal-2/src/app/searchPages/simple/searchPublications.component.ts index a6081e15..51353a65 100644 --- a/portal-2/src/app/searchPages/simple/searchPublications.component.ts +++ b/portal-2/src/app/searchPages/simple/searchPublications.component.ts @@ -17,10 +17,11 @@ import {DOI} from '../../utils/string-utils.class'; selector: 'search-publications', template: ` - + (queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)" + [csvParams]="csvParams" csvPath="publications"> ` @@ -47,6 +48,7 @@ export class SearchPublicationsComponent { "export":[] }; public CSVDownloaded = false; + public csvParams: string; constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) { var errorCodes:ErrorCodes = new ErrorCodes(); @@ -61,12 +63,11 @@ export class SearchPublicationsComponent { this.searchPage.type = "publication"; this.sub = this.route.queryParams.subscribe(params => { - this.searchUtils.keyword = (params['keyword']?params['keyword']:''); - this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; - - var queryParameters = this.searchPage.getQueryParametersFromUrl(params); - this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size); + this.searchUtils.keyword = (params['keyword']?params['keyword']:''); + this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; + var queryParameters = this.searchPage.getQueryParametersFromUrl(params); + this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size); }); } @@ -190,13 +191,18 @@ public getResults(keyword:string,refine:boolean, page: number, size: number){ } this._getResults(parameters,refine,page,size); } + private _getResults(parameters:string,refine:boolean, page: number, size: number){ + this.csvParams = parameters; + if(!refine && !this.searchPage){ this.searchPage = new SearchPageComponent(this._location); } + var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; this.searchPage.openLoading(); + this.subResults = this._searchPublicationsService.searchPublications(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe( data => { this.searchUtils.totalResults = data[0]; diff --git a/portal-2/src/app/services/searchDataproviders.service.ts b/portal-2/src/app/services/searchDataproviders.service.ts index ef323f6c..6dbe9507 100644 --- a/portal-2/src/app/services/searchDataproviders.service.ts +++ b/portal-2/src/app/services/searchDataproviders.service.ts @@ -49,7 +49,6 @@ export class SearchDataprovidersService { } url += "&page="+(page-1)+"&size="+size+"&format=json"; - url += "&format=json"; let key = url; if (this._cache.has(key)) { return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]) @@ -72,7 +71,6 @@ export class SearchDataprovidersService { url += refineParams; } url += "&page="+(page-1)+"&size="+size+"&format=json"; - url += "&format=json"; let key = url; if (this._cache.has(key)) { return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]); @@ -95,7 +93,6 @@ export class SearchDataprovidersService { url += refineParams; } url += "&page="+(page-1)+"&size="+size+"&format=json"; - url += "&format=json"; let key = url; if (this._cache.has(key)) { return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]); @@ -119,7 +116,6 @@ export class SearchDataprovidersService { } let url = link+"?query=(((deletedbyinference = false) AND (oaftype exact datasource)) "+((compatibilities && compatibilities.length > 0)?" "+compatibilities+" ":"")+") and (relorganizationid exact "+id+")"; url += "&page="+(page-1)+"&size="+size+"&format=json"; - url += "&format=json"; let key = url; if (this._cache.has(key)) { @@ -143,7 +139,6 @@ export class SearchDataprovidersService { } url += "&page="+(page-1)+"&size="+size+"&format=json"; - url += "&format=json"; let key = url; if (this._cache.has(key)) { return Observable.of(this._cache.get(key)).map(res => [res['meta'].total, this.parseResults(res['results'])]); diff --git a/portal-2/src/app/services/searchPublications.service.ts b/portal-2/src/app/services/searchPublications.service.ts index 6b5bfdc9..b0c25abb 100644 --- a/portal-2/src/app/services/searchPublications.service.ts +++ b/portal-2/src/app/services/searchPublications.service.ts @@ -20,7 +20,7 @@ export class SearchPublicationsService { let link = OpenaireProperties.getSearchAPIURLLast()+"publications"; - let url = link+"?"+"&format=json&"; + let url = link+"?"+"&format=json"; if(params!= null && params != '' ) { url += params; } @@ -47,7 +47,7 @@ export class SearchPublicationsService { let link = OpenaireProperties.getSearchAPIURLLast()+"publications"; - let url = link+"?"+"&format=json&"; + let url = link+"?"+"&format=json"; if(params!= null && params != '' ) { url += params; } diff --git a/portal-2/src/app/utils/properties/openaireProperties.ts b/portal-2/src/app/utils/properties/openaireProperties.ts index c06f32d8..5bebb27d 100644 --- a/portal-2/src/app/utils/properties/openaireProperties.ts +++ b/portal-2/src/app/utils/properties/openaireProperties.ts @@ -50,7 +50,7 @@ export class OpenaireProperties { //private static searchServiveURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/"; private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/"; // private static searchServiveURL = "http://services.openaire.eu:8380/search/"; - //private static searchServiveURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/"; + private static searchServiveURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/"; private static csvAPIURL = "http://beta.services.openaire.eu:8480/search/rest/v2/api/";//publications?format=csv