From fadf75e5f4ea30274df281f988ca04a249550997 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 26 Jun 2017 12:37:18 +0000 Subject: [PATCH] (Issue #2922) Create Journal Compatible page (search & table view): this page includes Journals and Journal Aggregators | Journals and Journal Aggregators removed from pages for Content Providers git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@47697 d315682c-612b-4755-9ff5-7f18f6832af3 --- portal-2/src/app/app-routing.module.ts | 10 + .../compatibleDataProviders.component.ts | 6 +- .../compatibleDataProvidersTable.component.ts | 4 +- .../dataProviders/journals-routing.module.ts | 15 ++ .../dataProviders/journals.component.ts | 201 ++++++++++++++++++ .../dataProviders/journals.module.ts | 32 +++ .../journalsTable-routing.module.ts | 15 ++ .../dataProviders/journalsTable.component.ts | 201 ++++++++++++++++++ .../dataProviders/journalsTable.module.ts | 32 +++ .../searchPageTableView.component.ts | 2 +- .../services/searchDataproviders.service.ts | 48 ++++- .../navigationBar.component.ts | 2 + .../utils/properties/openaireProperties.ts | 8 + .../src/app/utils/properties/searchFields.ts | 1 + portal-2/src/server.routes.ts | 4 +- 15 files changed, 571 insertions(+), 10 deletions(-) create mode 100644 portal-2/src/app/searchPages/dataProviders/journals-routing.module.ts create mode 100644 portal-2/src/app/searchPages/dataProviders/journals.component.ts create mode 100644 portal-2/src/app/searchPages/dataProviders/journals.module.ts create mode 100644 portal-2/src/app/searchPages/dataProviders/journalsTable-routing.module.ts create mode 100644 portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts create mode 100644 portal-2/src/app/searchPages/dataProviders/journalsTable.module.ts diff --git a/portal-2/src/app/app-routing.module.ts b/portal-2/src/app/app-routing.module.ts index 0f1b15c7..bcfb6a15 100644 --- a/portal-2/src/app/app-routing.module.ts +++ b/portal-2/src/app/app-routing.module.ts @@ -83,6 +83,14 @@ export function getEntityRegistriesTableModule() { return System.import('./searchPages/dataProviders/entityRegistriesTable.module' + (process.env.AOT ? '.ngfactory' : '')) .then(mod => mod[(process.env.AOT ? 'EntityRegistriesTableModuleNgFactory' : 'EntityRegistriesTableModule')]); } +export function getJournalsModule() { + return System.import('./searchPages/dataProviders/journals.module' + (process.env.AOT ? '.ngfactory' : '')) + .then(mod => mod[(process.env.AOT ? 'JournalsModuleNgFactory' : 'JournalsModule')]); +} +export function getJournalsTableModule() { + return System.import('./searchPages/dataProviders/journalsTable.module' + (process.env.AOT ? '.ngfactory' : '')) + .then(mod => mod[(process.env.AOT ? 'JournalsTableModuleNgFactory' : 'JournalsTableModule')]); +} export function getAdvancedSearchPublicationsModule() { return System.import('./searchPages/advanced/advancedSearchPublications.module' + (process.env.AOT ? '.ngfactory' : '')) .then(mod => mod[(process.env.AOT ? 'AdvancedSearchPublicationsModuleNgFactory' : 'AdvancedSearchPublicationsModule')]); @@ -160,6 +168,8 @@ export function getUserModule() { { path: 'search/content-providers-table', loadChildren: getCompatibleDataProvidersTableModule }, { path: 'search/entity-registries', loadChildren: getEntityRegistriesModule }, { path: 'search/entity-registries-table', loadChildren: getEntityRegistriesTableModule }, + { path: 'search/journals', loadChildren: getJournalsModule }, + { path: 'search/journals-table', loadChildren: getJournalsTableModule }, { path: 'search/advanced/publications', loadChildren: getAdvancedSearchPublicationsModule }, { path: 'search/advanced/datasets', loadChildren: getAdvancedSearchDatasetsModule }, { path: 'search/advanced/organizations', loadChildren: getAdvancedSearchOrganizationsModule }, diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts index d54c9b83..08a6096b 100644 --- a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts @@ -48,7 +48,7 @@ export class SearchCompatibleDataprovidersComponent { "export":[] }; public CSVDownloaded = false; - public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"; + public resourcesQuery = '&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))'; public csvParams: string; public disableForms: boolean = false; @@ -154,12 +154,12 @@ export class SearchCompatibleDataprovidersComponent { "Institutional Repository", "Thematic Repository", "Publication Repository", "Institutional Repository Aggregator", "Thematic Repositories Aggregators", "Publication Repository Aggregator", - "Data Repository", "Data Repository Aggregator", "Journal", "Journal Aggregator\/Publisher", "CRIS Systems", "Publication Catalogue"], + "Data Repository", "Data Repository Aggregator", "CRIS Systems", "Publication Catalogue"], ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; var value_original_ids=[ ["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::institutional","aggregator::pubsrepository::thematic","aggregator::pubsrepository::unknown", - "datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"], + "datarepository::unknown", "aggregator::datarepository", "cris", "pubscatalogue::unknown"], //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"] ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; var filters: Filter[] =[]; diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts index 043ac071..c9a8e620 100644 --- a/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts @@ -151,7 +151,7 @@ export class SearchCompatibleDataprovidersTableComponent { "Institutional Repository", "Thematic Repository", "Publication Repository", "Institutional Repository Aggregator", "Thematic Repositories Aggregators", "Publication Repository Aggregator", - "Data Repository", "Data Repository Aggregator", "Journal", "Journal Aggregator\/Publisher", "CRIS Systems", "Publication Catalogue"], + "Data Repository", "Data Repository Aggregator", "CRIS Systems", "Publication Catalogue"], @@ -160,7 +160,7 @@ export class SearchCompatibleDataprovidersTableComponent { var value_original_ids=[ ["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::institutional","aggregator::pubsrepository::thematic","aggregator::pubsrepository::unknown", - "datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"], + "datarepository::unknown", "aggregator::datarepository", "cris", "pubscatalogue::unknown"], //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"] ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; var filters: Filter[] =[]; diff --git a/portal-2/src/app/searchPages/dataProviders/journals-routing.module.ts b/portal-2/src/app/searchPages/dataProviders/journals-routing.module.ts new file mode 100644 index 00000000..fb1549f1 --- /dev/null +++ b/portal-2/src/app/searchPages/dataProviders/journals-routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{SearchJournalsComponent} from './journals.component'; +import {FreeGuard} from'../../login/freeGuard.guard'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: SearchJournalsComponent, canActivate: [FreeGuard] } + + ]) + ] +}) +export class JournalsRoutingModule { } diff --git a/portal-2/src/app/searchPages/dataProviders/journals.component.ts b/portal-2/src/app/searchPages/dataProviders/journals.component.ts new file mode 100644 index 00000000..84951886 --- /dev/null +++ b/portal-2/src/app/searchPages/dataProviders/journals.component.ts @@ -0,0 +1,201 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import { ActivatedRoute} from '@angular/router'; + +import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; + +import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; +import {SearchResult} from '../../utils/entities/searchResult'; +import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {SearchFields} from '../../utils/properties/searchFields'; +import {SearchPageComponent } from '../searchUtils/searchPage.component'; +import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import {ExportCSVComponent} from '../../utils/exportCSV.class'; + +@Component({ + selector: 'search-journals', + template: ` + + + + ` + +}) +export class SearchJournalsComponent { + public results =[]; + public filters =[]; + public baseUrl:string; + public searchUtils:SearchUtilsClass = new SearchUtilsClass(); + public sub: any; public subResults: any; + public _location:Location; + public searchFields:SearchFields = new SearchFields(); + public refineFields: string[] = this.searchFields.JOURNAL_FIELDS; + public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS; + public _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[{field:"compatibility",opName:"cm",opValue:"not", values:["UNKNOWN","hostedBy","notCompatible"]},{field:"type",opName:"tp",opValue:"not",values: ["other"]}]; + // ["entityregistry","entityregistry::projects","entityregistry::repositories"]}]; + public _prefixQuery: string = ""; + + public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ], + "export":[] + }; + public CSVDownloaded = false; + public resourcesQuery = '&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))'; + //"&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"; + public csvParams: string; + public disableForms: boolean = false; + + @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; + + constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status =errorCodes.LOADING; + this.baseUrl = OpenaireProperties.getLinkToSearchJournals(); + for(var i = 0; i < this._prefixQueryFields.length; i++ ){ + for(var j =0; j < this._prefixQueryFields[i].values.length; j++){ + this._prefixQuery+="&" + this._prefixQueryFields[i].field + "=" + + this._prefixQueryFields[i].values[j] + "&" + + this._prefixQueryFields[i].opName + "=" + this._prefixQueryFields[i].opValue; + } + } + this._prefixQuery+="&"; + } + + public ngOnInit() { + this.searchPage.refineFields = this.refineFields; + this.searchPage.fieldIdsMap = this.fieldIdsMap; + this.sub = this.route.queryParams.subscribe(params => { + this.searchUtils.keyword = (params['keyword']?params['keyword']:''); + this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; + this.filters = this.createFilters(); + var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params); + console.info("|"+queryParameters+"|"); + this._getResults(queryParameters, false, this.searchUtils.page, this.searchUtils.size); + }); + } + + public ngOnDestroy() { + if(this.sub){ + this.sub.unsubscribe(); + } + if(this.subResults){ + 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(); + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; + + this.subResults = this._searchDataprovidersService.searchJournals(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + console.info("search Journals: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + this.searchPage.checkSelectedFilters(this.filters); + this.searchPage.updateBaseUrlWithParameters(this.filters); + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = errorCodes.NONE; + } + //this.searchPage.closeLoading(); + this.disableForms = false; + + }, + err => { + console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.ERROR; + //this.searchPage.closeLoading(); + this.disableForms = false; + + } + ); + } + private setFilters(){ + //TODO set filters from + } + + public queryChanged($event) { + var parameters = $event.index; + console.info("queryChanged: Execute search query "+parameters); + + this._getResults(parameters, false, this.searchUtils.page, this.searchUtils.size); + } + private createFilters():Filter[] { + var filter_names=["Type","Compatibility Level"]; + var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"]; + var searchFields = new SearchFields(); + var filter_original_ids = searchFields.JOURNAL_FIELDS; + var value_names=[ + /*[ + "Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository", + "Institutional Repositories Aggregators", + "Thematic Repositories Aggregators", "Other Repositories Aggregators", + "Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"], + */ + ["Journal", "Journal Aggregator\/Publisher"], + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; + + var value_original_ids=[ + ["pubsrepository::journal", "aggregator::pubsrepository::journals"], + //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"] + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; + var filters: Filter[] =[]; + for(var i =0 ; i < filter_names.length;i++){ + var values:Value[] = []; + for(var j =0 ; j < value_names[i].length;j++){ + var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false} + values.push(value); + } + var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' }; + filters.push(filter); + } + return filters; + } + + public downloadClicked($event) { + if(!this.CSVDownloaded) { + this.CSVDownloaded = false; + + var parameters = $event.value; + + //this.getResultsCSV(parameters, false, 1, 1000); + + this._searchDataprovidersService.searchCompatibleDataprovidersCSV(parameters,this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe( + data => { + this.CSV.export = data; + ExportCSVComponent.downloadCSV(this.CSV, "compatibleDataproviders.csv"); + + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.DONE; + }, + err => { + console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.ERROR; + } + ); + } + } + +} diff --git a/portal-2/src/app/searchPages/dataProviders/journals.module.ts b/portal-2/src/app/searchPages/dataProviders/journals.module.ts new file mode 100644 index 00000000..650e398a --- /dev/null +++ b/portal-2/src/app/searchPages/dataProviders/journals.module.ts @@ -0,0 +1,32 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ JournalsRoutingModule} from './journals-routing.module'; +import{SearchJournalsComponent} from './journals.component'; + +import {SearchResultsModule } from '../searchUtils/searchResults.module'; + +import {DataProvidersServiceModule} from '../../services/dataProvidersService.module'; +import {SearchFormModule} from '../searchUtils/searchForm.module'; +//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module'; +import {SearchPageModule} from '../searchUtils/searchPage.module'; +import {FreeGuard} from'../../login/freeGuard.guard'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + DataProvidersServiceModule, + SearchFormModule, SearchResultsModule, JournalsRoutingModule, SearchPageModule//, SearchFilterModalModule + + ], + declarations: [ + SearchJournalsComponent + ], + providers:[FreeGuard + ], + exports: [ + SearchJournalsComponent + ] +}) +export class JournalsModule { } diff --git a/portal-2/src/app/searchPages/dataProviders/journalsTable-routing.module.ts b/portal-2/src/app/searchPages/dataProviders/journalsTable-routing.module.ts new file mode 100644 index 00000000..2f92f754 --- /dev/null +++ b/portal-2/src/app/searchPages/dataProviders/journalsTable-routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import{SearchJournalsTableComponent} from './journalsTable.component'; +import {FreeGuard} from'../../login/freeGuard.guard'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: SearchJournalsTableComponent, canActivate: [FreeGuard] } + + ]) + ] +}) +export class JournalsTableRoutingModule { } diff --git a/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts b/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts new file mode 100644 index 00000000..d2e19786 --- /dev/null +++ b/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts @@ -0,0 +1,201 @@ +import {Component, Input, ViewChild} from '@angular/core'; +import { ActivatedRoute} from '@angular/router'; + +import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; + +import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; +import {SearchResult} from '../../utils/entities/searchResult'; +import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {SearchFields} from '../../utils/properties/searchFields'; +import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component'; +import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import {ExportCSVComponent} from '../../utils/exportCSV.class'; + +@Component({ + selector: 'search-journals-table', + template: ` + + + + ` + +}) +export class SearchJournalsTableComponent { + public results =[]; + public filters =[]; + public baseUrl:string; + public searchUtils:SearchUtilsClass = new SearchUtilsClass(); + public sub: any; public subResults: any; + public _location:Location; + public searchFields:SearchFields = new SearchFields(); + public refineFields: string[] = this.searchFields.JOURNAL_FIELDS; + + /*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ], + "export":[] + }; + public CSVDownloaded = false; + public csvParams: string; + public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/ + + public disableForms: boolean = false; + + @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; + + constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status =errorCodes.LOADING; + this.baseUrl = OpenaireProperties.getLinkToSearchJournalsTable(); + } + + public ngOnInit() { + this.searchPage.refineFields = this.refineFields; + this.sub = this.route.queryParams.subscribe(params => { + this.searchUtils.keyword = (params['keyword']?params['keyword']:''); + //this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; + this.filters = this.createFilters(); + this.searchPage.getParametersFromUrl(params); + this._getResults(); + }); + } + + public ngOnDestroy() { + if(this.sub){ + this.sub.unsubscribe(); + } + if(this.subResults){ + this.subResults.unsubscribe(); + } } + private _getResults(){ + //this.csvParams = this.resourcesQuery+"&type=datasources"; + + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.LOADING; + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; + + let size: number = 0; + this.subResults = this._searchDataprovidersService.searchJournalsTable().subscribe( + data => { + size = data; + if(size > 0) { + this.subResults = this._searchDataprovidersService.searchJournals("", null, 1, size, []).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + console.info("search Journals [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + + this.searchPage.checkSelectedFilters(this.filters); + + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = errorCodes.NONE; + } + this.disableForms = false; + }, + err => { + console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.ERROR; + this.disableForms = false; + + } + ); + } else { + this.searchPage.checkSelectedFilters(this.filters); + + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.NONE; + this.disableForms = false; + } + }, + err => { + console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.ERROR; + } + ); + + } + private setFilters(){ + //TODO set filters from + } + + private createFilters():Filter[] { + var filter_names=["Type","Compatibility Level"]; + var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"]; + var searchFields = new SearchFields(); + var filter_original_ids = searchFields.JOURNAL_FIELDS; + var value_names=[ + /*[ + "Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository", + "Institutional Repositories Aggregators", + "Thematic Repositories Aggregators", "Other Repositories Aggregators", + "Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"], + */ + ["Journal", "Journal Aggregator\/Publisher"], + + + + + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; + + var value_original_ids=[ + ["pubsrepository::journal", "aggregator::pubsrepository::journals"], + //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"] + ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]]; + var filters: Filter[] =[]; + for(var i =0 ; i < filter_names.length;i++){ + var values:Value[] = []; + for(var j =0 ; j < value_names[i].length;j++){ + var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false} + values.push(value); + } + var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or' }; + filters.push(filter); + } + return filters; + } +/* + public downloadClicked($event) { + if(!this.CSVDownloaded) { + this.CSVDownloaded = false; + + var parameters = $event.value; + + this._searchDataprovidersService.searchCompatibleDataprovidersCSV(parameters,this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe( + data => { + this.CSV.export = data; + ExportCSVComponent.downloadCSV(this.CSV, "compatibleDataproviders.csv"); + + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.DONE; + }, + err => { + console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = errorCodes.ERROR; + } + ); + } + } +*/ +} diff --git a/portal-2/src/app/searchPages/dataProviders/journalsTable.module.ts b/portal-2/src/app/searchPages/dataProviders/journalsTable.module.ts new file mode 100644 index 00000000..c6c3b00b --- /dev/null +++ b/portal-2/src/app/searchPages/dataProviders/journalsTable.module.ts @@ -0,0 +1,32 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import{ JournalsTableRoutingModule} from './journalsTable-routing.module'; +import{SearchJournalsTableComponent} from './journalsTable.component'; + +//import {DatasourceTableViewModule } from '../searchUtils/datasourceTableView.module'; + +import {DataProvidersServiceModule} from '../../services/dataProvidersService.module'; +import {SearchFormModule} from '../searchUtils/searchForm.module'; +//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module'; +import {SearchPageTableViewModule} from '../searchUtils/searchPageTableView.module'; +import {FreeGuard} from'../../login/freeGuard.guard'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, + DataProvidersServiceModule, + SearchFormModule, /*DatasourceTableViewModule,*/ JournalsTableRoutingModule, SearchPageTableViewModule//, SearchFilterModalModule + + ], + declarations: [ + SearchJournalsTableComponent + ], + providers:[FreeGuard + ], + exports: [ + SearchJournalsTableComponent + ] +}) +export class JournalsTableModule { } diff --git a/portal-2/src/app/searchPages/searchUtils/searchPageTableView.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPageTableView.component.ts index f1e534c4..ddf40ee5 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchPageTableView.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchPageTableView.component.ts @@ -55,7 +55,7 @@ import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersD - + diff --git a/portal-2/src/app/services/searchDataproviders.service.ts b/portal-2/src/app/services/searchDataproviders.service.ts index c6b1c504..c46b2990 100644 --- a/portal-2/src/app/services/searchDataproviders.service.ts +++ b/portal-2/src/app/services/searchDataproviders.service.ts @@ -66,7 +66,7 @@ export class SearchDataprovidersService { searchCompatibleDataprovidersTable ():any { let size: number = 0; let url: string= OpenaireProperties.getSearchResourcesAPIURL(); - url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))" + url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))'; url += "&page=0&size=1&format=json"; let key = url; @@ -84,7 +84,7 @@ export class SearchDataprovidersService { searchCompatibleDataproviders (params: string,refineParams:string, page: number, size: number, refineFields:string[] ):any { console.info("in search Compatible Dataproviders service function"); let url: string = OpenaireProperties.getSearchResourcesAPIURL(); - url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))" + url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))'; if(params!= null && params != '' ) { url += params; } @@ -146,6 +146,50 @@ export class SearchDataprovidersService { .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]); } + searchJournalsTable ():any { + let size: number = 0; + let url: string= OpenaireProperties.getSearchResourcesAPIURL(); + url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))'; + url += "&page=0&size=1&format=json"; + + let key = url; + if (this._cache.has(key)) { + return Observable.of(this._cache.get(key)).map(res => res['meta'].total); + } + + return this.http.get(url).map(res => res.json()) + .do(res => { + this._cache.set(key, res); + }) + .map(res => res['meta'].total); + } + + searchJournals (params: string,refineParams:string, page: number, size: number, refineFields:string[] ):any { + console.info("in search Journals service function"); + let url: string = OpenaireProperties.getSearchResourcesAPIURL(); + //url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))" + url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))'; + + if(params!= null && params != '' ) { + url += params; + } + if(refineParams!= null && refineParams != '' ) { + url += refineParams; + } + url += "&page="+(page-1)+"&size="+size+"&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")]); + } + return this.http.get(url) + .map(res => res.json()) + //.do(res => console.info(res)) + .do(res => { + this._cache.set(key, res); + }) + .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]); + } + searchDataprovidersForDeposit (id: string,type:string, page: number, size: number):any { let link = OpenaireProperties.getSearchResourcesAPIURL(); var compatibilities = ""; diff --git a/portal-2/src/app/sharedComponents/navigationBar.component.ts b/portal-2/src/app/sharedComponents/navigationBar.component.ts index 44d6edb1..173e9f12 100644 --- a/portal-2/src/app/sharedComponents/navigationBar.component.ts +++ b/portal-2/src/app/sharedComponents/navigationBar.component.ts @@ -47,6 +47,7 @@ import {Session} from '../login/utils/helper.class';
  • @@ -146,6 +147,7 @@ import {Session} from '../login/utils/helper.class'; diff --git a/portal-2/src/app/utils/properties/openaireProperties.ts b/portal-2/src/app/utils/properties/openaireProperties.ts index de47104e..e5b98da0 100644 --- a/portal-2/src/app/utils/properties/openaireProperties.ts +++ b/portal-2/src/app/utils/properties/openaireProperties.ts @@ -22,6 +22,8 @@ export class OpenaireProperties { public static searchLinkToCompatibleDataProvidersTable = "search/content-providers-table"; public static searchLinkToEntityRegistriesDataProviders = "search/entity-registries"; public static searchLinkToEntityRegistriesDataProvidersTable = "search/entity-registries-table"; + public static searchLinkToJournals = "search/journals"; + public static searchLinkToJournalsTable = "search/journals-table"; //Advanced Search pages public static searchLinkToAdvancedPublications = "search/advanced/publications"; @@ -130,6 +132,12 @@ export class OpenaireProperties { public static getLinkToSearchEntityRegistriesTable():string{ return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProvidersTable; } + public static getLinkToSearchJournals():string{ + return this.baseSearchLink + this.searchLinkToJournals; + } + public static getLinkToSearchJournalsTable():string{ + return this.baseSearchLink + this.searchLinkToJournalsTable; + } public static getLinkToSearchDatasets():string{ return this.baseSearchLink + this.searchLinkToDatasets; } diff --git a/portal-2/src/app/utils/properties/searchFields.ts b/portal-2/src/app/utils/properties/searchFields.ts index 3958efd5..feb942e1 100644 --- a/portal-2/src/app/utils/properties/searchFields.ts +++ b/portal-2/src/app/utils/properties/searchFields.ts @@ -95,6 +95,7 @@ export class SearchFields { public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"]; public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypename","datasourcecompatibilityname"]; + public JOURNAL_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"]; //ORGANIZATION diff --git a/portal-2/src/server.routes.ts b/portal-2/src/server.routes.ts index 944830f7..b1d91f8f 100644 --- a/portal-2/src/server.routes.ts +++ b/portal-2/src/server.routes.ts @@ -15,8 +15,8 @@ export const routes: string[] = [ 'search/find/people','search/find/publications','search/find/projects','search/find/datasets','search/find/dataproviders','search/find/organizations', 'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations', 'participate/deposit-publications','participate/deposit-datasets','participate/deposit-publications-result','participate/deposit-datasets-result', 'participate/deposit-subject-result', - 'search/content-providers','search/content-providers-table','search/entity-registries','search/entity-registries-table','project-report', - 'claims','myclaims','participate/claim', 'participate/direct-claim', 'claims-project-manager', + 'search/content-providers','search/content-providers-table','search/entity-registries','search/entity-registries-table','search/journals','search/journals-table', + 'project-report', 'claims','myclaims','participate/claim', 'participate/direct-claim', 'claims-project-manager', 'test', 'user-info', '**','error'