Added search pages for Compatible Dataproviders and Entity Registries in Table View (SearchPageTableView.component is called by both instead of SearchPage.component)
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@47386 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
a41bc713ae
commit
bb1f291406
|
@ -77,10 +77,18 @@ export function getCompatibleDataProvidersModule() {
|
|||
return System.import('./searchPages/dataProviders/compatibleDataProviders.module' + (process.env.AOT ? '.ngfactory' : ''))
|
||||
.then(mod => mod[(process.env.AOT ? 'CompatibleDataProvidersModuleNgFactory' : 'CompatibleDataProvidersModule')]);
|
||||
}
|
||||
export function getCompatibleDataProvidersTableModule() {
|
||||
return System.import('./searchPages/dataProviders/compatibleDataProvidersTable.module' + (process.env.AOT ? '.ngfactory' : ''))
|
||||
.then(mod => mod[(process.env.AOT ? 'CompatibleDataProvidersTableModuleNgFactory' : 'CompatibleDataProvidersTableModule')]);
|
||||
}
|
||||
export function getEntityRegistriesModule() {
|
||||
return System.import('./searchPages/dataProviders/entityRegistries.module' + (process.env.AOT ? '.ngfactory' : ''))
|
||||
.then(mod => mod[(process.env.AOT ? 'EntityRegistriesModuleNgFactory' : 'EntityRegistriesModule')]);
|
||||
}
|
||||
export function getEntityRegistriesTableModule() {
|
||||
return System.import('./searchPages/dataProviders/entityRegistriesTable.module' + (process.env.AOT ? '.ngfactory' : ''))
|
||||
.then(mod => mod[(process.env.AOT ? 'EntityRegistriesTableModuleNgFactory' : 'EntityRegistriesTableModule')]);
|
||||
}
|
||||
export function getAdvancedSearchPublicationsModule() {
|
||||
return System.import('./searchPages/advanced/advancedSearchPublications.module' + (process.env.AOT ? '.ngfactory' : ''))
|
||||
.then(mod => mod[(process.env.AOT ? 'AdvancedSearchPublicationsModuleNgFactory' : 'AdvancedSearchPublicationsModule')]);
|
||||
|
@ -160,7 +168,9 @@ export function getUserModule() {
|
|||
{ path: 'search/find/organizations', loadChildren: getSearchOrganizationsModule },
|
||||
{ path: 'search/find/people', loadChildren: getSearchPeopleModule },
|
||||
{ path: 'search/data-providers', loadChildren: getCompatibleDataProvidersModule },
|
||||
{ path: 'search/data-providers-table', loadChildren: getCompatibleDataProvidersTableModule },
|
||||
{ path: 'search/entity-registries', loadChildren: getEntityRegistriesModule },
|
||||
{ path: 'search/entity-registries-table', loadChildren: getEntityRegistriesTableModule },
|
||||
{ path: 'search/advanced/publications', loadChildren: getAdvancedSearchPublicationsModule },
|
||||
{ path: 'search/advanced/datasets', loadChildren: getAdvancedSearchDatasetsModule },
|
||||
{ path: 'search/advanced/organizations', loadChildren: getAdvancedSearchOrganizationsModule },
|
||||
|
|
|
@ -22,7 +22,8 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class';
|
|||
(queryChange)="queryChanged($event)"
|
||||
(downloadClick)="downloadClicked($event)"
|
||||
[csvParams]="csvParams" csvPath="resources"
|
||||
[disableForms]="disableForms">
|
||||
[disableForms]="disableForms"
|
||||
[tableViewLink]="'/search/data-providers-table'">
|
||||
</search-page>
|
||||
<!--table-view [(datasources)] = results></table-view-->
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ 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';
|
||||
|
||||
|
@ -16,7 +17,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
|
|||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
DataProvidersServiceModule,
|
||||
SearchFormModule, SearchResultsModule, CompatibleDataProvidersRoutingModule, SearchPageModule
|
||||
SearchFormModule, SearchResultsModule, CompatibleDataProvidersRoutingModule, SearchPageModule//, SearchFilterModalModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchCompatibleDataprovidersTableComponent} from './compatibleDataProvidersTable.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchCompatibleDataprovidersTableComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
})
|
||||
export class CompatibleDataProvidersTableRoutingModule { }
|
|
@ -0,0 +1,225 @@
|
|||
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-dataproviders-table',
|
||||
template: `
|
||||
|
||||
<search-page-table pageTitle="Compatible Dataproviders"
|
||||
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||
[baseUrl] = "baseUrl" [showResultCount]=false
|
||||
(queryChange)="queryChanged($event)"
|
||||
(downloadClick)="downloadClicked($event)"
|
||||
[csvParams]="csvParams" csvPath="resources"
|
||||
[disableForms]="disableForms"
|
||||
[searchViewLink]="'/search/data-providers'">
|
||||
</search-page-table>
|
||||
<!--table-view [(datasources)] = results></table-view-->
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
export class SearchCompatibleDataprovidersTableComponent {
|
||||
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.COMPATIBLE_DATAPROVIDER_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 = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";
|
||||
public csvParams: string;
|
||||
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.getLinkToSearchCompatibleDataProvidersTable();
|
||||
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);
|
||||
this._getResults(queryParameters, false, this.searchUtils.page);
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
if(this.sub){
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
if(this.subResults){
|
||||
this.subResults.unsubscribe();
|
||||
} }
|
||||
private _getResults(parameters:string,refine:boolean, page: 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;
|
||||
|
||||
let size: number = 0;
|
||||
this.subResults = this._searchDataprovidersService.searchCompatibleDataprovidersTable(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null).subscribe(
|
||||
data => {
|
||||
size = data;
|
||||
if(size > 0) {
|
||||
this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Data Providers: [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;
|
||||
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.searchPage.checkSelectedFilters(this.filters);
|
||||
this.searchPage.updateBaseUrlWithParameters(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;
|
||||
//this.searchPage.closeLoading();
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
private createFilters():Filter[] {
|
||||
var filter_names=["Type","Compatibility Level"];
|
||||
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
|
||||
var searchFields = new SearchFields();
|
||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_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"],
|
||||
["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::thematic","aggregator::pubsrepository::institutional","aggregator::pubsrepository::unknown",
|
||||
"datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "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[] =[];
|
||||
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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import{ CompatibleDataProvidersTableRoutingModule} from './compatibleDataProvidersTable-routing.module';
|
||||
import{SearchCompatibleDataprovidersTableComponent} from './compatibleDataProvidersTable.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,*/ CompatibleDataProvidersTableRoutingModule, SearchPageTableViewModule//, SearchFilterModalModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
SearchCompatibleDataprovidersTableComponent
|
||||
],
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchCompatibleDataprovidersTableComponent
|
||||
]
|
||||
})
|
||||
export class CompatibleDataProvidersTableModule { }
|
|
@ -1,74 +0,0 @@
|
|||
import {Component, Input, ViewChild} from '@angular/core';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'table-view',
|
||||
template: `
|
||||
|
||||
|
||||
<table class="uk-table uk-table-striped">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Country</th>
|
||||
<th>Institution</th>
|
||||
<th>Compatibility</th>
|
||||
</tr>
|
||||
<tr *ngFor="let result of datasources">
|
||||
<td>
|
||||
<a href="{{result['title'].url}}">
|
||||
<p *ngIf="result['title'].name != undefined && result['title'].name != ''">
|
||||
{{result['title'].name}}
|
||||
</p>
|
||||
<p *ngIf="result['title'].name == undefined || result['title'].name == ''">
|
||||
{{result['title'].url}}
|
||||
</p>
|
||||
</a>
|
||||
</td>
|
||||
<td> {{result['type']}}</td>
|
||||
<td>....</td>
|
||||
<td>
|
||||
<span *ngFor="let organization of result['organizations'] let i=index">
|
||||
<a *ngIf="organization.url != undefined" href="{{organization.url}}">
|
||||
{{organization.name}}
|
||||
</a>
|
||||
<span *ngIf="organization.url == undefined">
|
||||
{{organization.name}}
|
||||
</span>
|
||||
<span *ngIf="i < result['organizations'].length-1"> ,</span>
|
||||
</span>
|
||||
</td>
|
||||
<td>....</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
export class DatasourceTableViewComponent {
|
||||
@Input() datasources =[];
|
||||
// private results:{name:string, type:string, organizations:string, countries:string, compatibility:string}[] = [];
|
||||
constructor () {
|
||||
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
// // var results:{name:string, type:string, organizations:string, countries:string, compatibility:string}[] = []
|
||||
// for(var i =0; i < this.datasources.length; i++){
|
||||
// var datasource: {name:string, type:string, organizations:string, countries:string, compatibility:string} = {name:"",type:"",organizations:"", countries:"", compatibility:""};
|
||||
// datasource.name = '<a href="'+this.datasources[i]['title'].url+'" >' + (this.datasources[i]['title'].name)?this.datasources[i]['title'].name:this.datasources[i]['title'].url +'</a>';
|
||||
// datasource.type = this.datasources[i]['type'];
|
||||
// this.results.push(datasource);
|
||||
// }
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
|
||||
}
|
||||
sort(){
|
||||
// objs.sort(function(a,b) {return (a.last_nom > b.last_nom) ? 1 : ((b.last_nom > a.last_nom) ? -1 : 0);} );
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,8 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class';
|
|||
(queryChange)="queryChanged($event)"
|
||||
(downloadClick)="downloadClicked($event)"
|
||||
[csvParams]="csvParams" csvPath="resources"
|
||||
[disableForms]="disableForms">
|
||||
[disableForms]="disableForms"
|
||||
[tableViewLink]="'/search/entity-registries-table'">
|
||||
</search-page>
|
||||
|
||||
`
|
||||
|
|
|
@ -9,6 +9,7 @@ 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';
|
||||
|
||||
|
@ -16,7 +17,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
|
|||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
DataProvidersServiceModule,
|
||||
SearchFormModule, SearchResultsModule, EntityRegistriesRoutingModule, SearchPageModule
|
||||
SearchFormModule, SearchResultsModule, EntityRegistriesRoutingModule, SearchPageModule//, SearchFilterModalModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchEntityRegistriesTableComponent} from './entityRegistriesTable.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchEntityRegistriesTableComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
})
|
||||
export class EntityRegistriesTableRoutingModule { }
|
|
@ -0,0 +1,255 @@
|
|||
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-entity-registries-table',
|
||||
template: `
|
||||
|
||||
<search-page-table pageTitle="Entity Registries"
|
||||
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||
[baseUrl] = "baseUrl" [showResultCount]=false
|
||||
(queryChange)="queryChanged($event)"
|
||||
(downloadClick)="downloadClicked($event)"
|
||||
[csvParams]="csvParams" csvPath="resources"
|
||||
[disableForms]="disableForms"
|
||||
[searchViewLink]="'/search/entity-registries'">
|
||||
</search-page-table>
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
export class SearchEntityRegistriesTableComponent {
|
||||
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.ENTITY_REGISTRIES_FIELDS;
|
||||
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
|
||||
public _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[
|
||||
{field:"type",opName:"tp",opValue:"and",values: ["other"]}];
|
||||
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
|
||||
public _prefixQuery: string = "";
|
||||
|
||||
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
|
||||
"export":[]
|
||||
};
|
||||
public CSVDownloaded = false;
|
||||
public disableForms: boolean = false;
|
||||
|
||||
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
|
||||
public resourcesQuery = "&query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
|
||||
public csvParams: string;
|
||||
|
||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status =errorCodes.LOADING;
|
||||
this.baseUrl = OpenaireProperties.getLinkToSearchEntityRegistriesTable();
|
||||
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);
|
||||
this._getResults(queryParameters, false, this.searchUtils.page);
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
if(this.sub){
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
if(this.subResults){
|
||||
this.subResults.unsubscribe();
|
||||
} }
|
||||
private _getResults(parameters:string,refine:boolean, page: 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;
|
||||
|
||||
let size: number = 0;
|
||||
this.subResults = this._searchDataprovidersService.searchEntityRegistriesTable(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null).subscribe(
|
||||
data => {
|
||||
size = data;
|
||||
if(size > 0) {
|
||||
this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Entity Registries: [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;
|
||||
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.searchPage.checkSelectedFilters(this.filters);
|
||||
this.searchPage.updateBaseUrlWithParameters(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;
|
||||
//this.searchPage.closeLoading();
|
||||
}
|
||||
);
|
||||
/*
|
||||
this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Entity Registries: [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);
|
||||
}
|
||||
private createFilters():Filter[] {
|
||||
var filter_names=["Type","Compatibility Level"];
|
||||
var filter_ids=["datasourcetypename","datasourcecompatibilityname"];
|
||||
var searchFields = new SearchFields();
|
||||
var filter_original_ids = searchFields.ENTITY_REGISTRIES_FIELDS;
|
||||
var value_names=[
|
||||
["Funder database","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"],
|
||||
|
||||
["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=[
|
||||
["Funder database","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"],
|
||||
//["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"],
|
||||
//["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.searchEntityRegistriesCSV(parameters, this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe(
|
||||
data => {
|
||||
this.CSV.export = data;
|
||||
ExportCSVComponent.downloadCSV(this.CSV, "etityRegistries.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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import{ EntityRegistriesTableRoutingModule} from './entityRegistriesTable-routing.module';
|
||||
import{SearchEntityRegistriesTableComponent} from './entityRegistriesTable.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,*/ EntityRegistriesTableRoutingModule, SearchPageTableViewModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
SearchEntityRegistriesTableComponent
|
||||
],
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchEntityRegistriesTableComponent
|
||||
]
|
||||
})
|
||||
export class EntityRegistriesTableModule { }
|
|
@ -16,6 +16,7 @@ import {OrganizationsServiceModule} from '../../services/organizationsService.mo
|
|||
import {PeopleServiceModule} from '../../services/peopleService.module';
|
||||
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module';
|
||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
|
@ -23,7 +24,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
|
|||
CommonModule, FormsModule, RouterModule,
|
||||
DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule,
|
||||
PublicationsServiceModule, OrganizationsServiceModule, PeopleServiceModule,
|
||||
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule
|
||||
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule//, SearchFilterModalModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import {SearchFilterComponent} from './searchFilter.component';
|
||||
import{SearchFilterModalComponent} from './searchFilterModal.component';
|
||||
import {ModalModule} from '../../utils/modal/modal.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule, ModalModule
|
||||
],
|
||||
declarations: [
|
||||
SearchFilterComponent, SearchFilterModalComponent
|
||||
],
|
||||
|
||||
providers:[
|
||||
],
|
||||
exports: [
|
||||
SearchFilterComponent, SearchFilterModalComponent
|
||||
|
||||
]
|
||||
})
|
||||
export class SearchFilterModule { }
|
|
@ -50,11 +50,28 @@ import {SearchFilterModalComponent} from './searchFilterModal.component';
|
|||
<div class="uk-width-3-4@m uk-width-3-4@l uk-width-1-1@s uk-first-column" >
|
||||
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
|
||||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
|
||||
<search-result [results]="results"
|
||||
<!--p class="uk-text-right" *ngIf="totalResults <= 10000">
|
||||
<span class="clickable" (click)="downloadfile(downloadURLAPI+type+'?format=csv&page=0&size='+totalResults+csvParams,type+'-report-'+totalResults)">
|
||||
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
|
||||
<span uk-icon="icon: download"></span> Results (CSV)
|
||||
</span>
|
||||
</p-->
|
||||
<p *ngIf="tableViewLink" class="uk-text-right">
|
||||
<a target="_blank" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >Show results in table view</a>
|
||||
</p>
|
||||
|
||||
<search-result *ngIf="!tableView"
|
||||
[results]="results"
|
||||
[status]=searchUtils.status
|
||||
[type]="entityType" [urlParam]="urlParam"
|
||||
[showLoading]="true">
|
||||
</search-result>
|
||||
<table-view *ngIf="tableView"
|
||||
[results]="results"
|
||||
[status]=searchUtils.status
|
||||
[type]="entityType" [urlParam]="urlParam"
|
||||
[showLoading]="true">
|
||||
</table-view>
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -66,11 +83,18 @@ import {SearchFilterModalComponent} from './searchFilterModal.component';
|
|||
<search-form [isDisabled]="disableForms" [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
|
||||
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues"></search-paging>
|
||||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
|
||||
<search-result [results]="results"
|
||||
<search-result *ngIf="!tableView"
|
||||
[results]="results"
|
||||
[status]=searchUtils.status
|
||||
[type]="entityType" [urlParam]="urlParam"
|
||||
[showLoading]="true">
|
||||
</search-result>
|
||||
<table-view *ngIf="tableView"
|
||||
[results]="results"
|
||||
[status]=searchUtils.status
|
||||
[type]="entityType" [urlParam]="urlParam"
|
||||
[showLoading]="true">
|
||||
</table-view>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -97,7 +121,9 @@ export class SearchPageComponent {
|
|||
@Input() csvParams: string;
|
||||
@Input() csvPath: string;
|
||||
@Input() advancedSearchLink: string = "";
|
||||
@Input() tableViewLink: string;
|
||||
@Input() disableForms: boolean = false;
|
||||
@Input() tableView: boolean = false;
|
||||
|
||||
@ViewChild (ModalLoading) loading : ModalLoading ;
|
||||
public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
|
||||
|
|
|
@ -6,8 +6,10 @@ import { RouterModule } from '@angular/router';
|
|||
import{SearchPageComponent} from './searchPage.component';
|
||||
import{SearchFormModule} from './searchForm.module';
|
||||
import{SearchResultsModule} from './searchResults.module';
|
||||
import{SearchFilterComponent} from './searchFilter.component';
|
||||
import{SearchFilterModalComponent} from './searchFilterModal.component';
|
||||
//import{DatasourceTableViewModule} from './datasourceTableView.module';
|
||||
//import{SearchFilterComponent} from './searchFilter.component';
|
||||
//import{SearchFilterModalComponent} from './searchFilterModal.component';
|
||||
import {SearchFilterModule} from './searchFilter.module';
|
||||
import{LoadingModalModule} from '../../utils/modal/loadingModal.module';
|
||||
import {ReportsServiceModule} from '../../services/reportsService.module';
|
||||
import{SearchPagingModule} from './searchPaging.module';
|
||||
|
@ -17,20 +19,23 @@ import {ModalModule} from '../../utils/modal/modal.module';
|
|||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule, LoadingModalModule, ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule
|
||||
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule,
|
||||
/*DatasourceTableViewModule,*/ LoadingModalModule, ReportsServiceModule,
|
||||
SearchPagingModule, SearchDownloadModule, ModalModule, SearchFilterModule
|
||||
],
|
||||
declarations: [
|
||||
SearchPageComponent,
|
||||
SearchFilterComponent,
|
||||
SearchFilterModalComponent
|
||||
SearchPageComponent//,
|
||||
//SearchFilterComponent,
|
||||
//SearchFilterModalComponent
|
||||
,
|
||||
],
|
||||
|
||||
providers:[
|
||||
],
|
||||
exports: [
|
||||
SearchPageComponent,
|
||||
SearchFilterComponent
|
||||
SearchPageComponent//,
|
||||
//SearchFilterComponent,
|
||||
//SearchFilterModalComponent
|
||||
]
|
||||
})
|
||||
export class SearchPageModule { }
|
||||
|
|
|
@ -0,0 +1,653 @@
|
|||
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Location} from '@angular/common';
|
||||
import { Filter, Value} from './searchHelperClasses.class';
|
||||
import {SearchResult} from '../../utils/entities/searchResult';
|
||||
import {SearchFields} from '../../utils/properties/searchFields';
|
||||
import {SearchUtilsClass} from './searchUtils.class';
|
||||
import {DOI, StringUtils} from '../../utils/string-utils.class';
|
||||
import {ModalLoading} from '../../utils/modal/loading.component';
|
||||
import { Meta} from '../../../angular2-meta';
|
||||
import{SearchFilterComponent} from './searchFilter.component';
|
||||
import {SearchFilterModalComponent} from './searchFilterModal.component';
|
||||
import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
|
||||
@Component({
|
||||
selector: 'search-page-table',
|
||||
template: `
|
||||
|
||||
<div class="uk-margin-top">
|
||||
<div class="page-header">
|
||||
<h1>{{pageTitle}}</h1>
|
||||
</div>
|
||||
<div>
|
||||
<div *ngIf="showRefine" >
|
||||
<div class="uk-width-1-1 uk-margin uk-padding uk-panel uk-background-muted">
|
||||
<search-form [isDisabled]="disableForms" [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
|
||||
<div *ngIf="isFiltered()" class = " uk-text-center ">
|
||||
<span *ngIf = "searchUtils.keyword.length > 0">Keywords: <span>{{searchUtils.keyword}}<a (click) = "clearKeywords() " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable " aria-hidden="true"><span uk-icon="icon: close"></span></span></a></span>
|
||||
</span>
|
||||
<span *ngFor="let filter of filters " >
|
||||
<span *ngIf = "filter.countSelectedValues > 0"> {{filter.title}}:
|
||||
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; " >{{value.name}}<a (click) = "removeFilter(value, filter) " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable" aria-hidden="true"><span uk-icon="icon: close"></span></span></a>
|
||||
<span *ngIf="!end">, </span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<a (click)="clearFilters()" [class]="(disableForms)?'uk-disabled uk-link-muted':''">
|
||||
Clear All
|
||||
</a>
|
||||
</div>
|
||||
<a *ngIf = "advancedSearchLink && advancedSearchLink.length > 0" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-float-right uk-disabled uk-link-muted':'uk-float-right'" [routerLink]=advancedSearchLink >More search options <span uk-icon="icon: chevron-right"></span></a>
|
||||
</div>
|
||||
<div class="uk-grid uk-width-1-1 uk-margin">
|
||||
<div class=" search-filters uk-width-1-4@l uk-width-1-4@m uk-width-1-1@s ">
|
||||
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)"></search-filter>
|
||||
</div>
|
||||
|
||||
<div class="uk-width-3-4@m uk-width-3-4@l uk-width-1-1@s uk-first-column" >
|
||||
|
||||
<div *ngIf="searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No Results found</div>
|
||||
<div *ngIf="searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
|
||||
<div *ngIf="searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
|
||||
<div *ngIf="searchUtils.status == errorCodes.LOADING && showLoading" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">Loading...</div>
|
||||
|
||||
<div *ngIf="results && results.length > 0" class="uk-overflow-container custom-dataTable-content">
|
||||
<table id="{{searchUtils.page}}" class="uk-table uk-table-striped"
|
||||
[mfData]="results" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [mfActivePage]="searchUtils.page">
|
||||
<!--[(mfSortBy)]="sortByClaimDate1" (mfSortOrder)="sortOrder"-->
|
||||
<thead>
|
||||
<tr><td colspan="5" class="uk-padding-remove-bottom uk-padding-remove-right">
|
||||
{{searchUtils.totalResults}} datasources, page {{searchUtils.page}} of {{(totalPages())}}
|
||||
|
||||
<paging-no-load class="uk-float-right" [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [size]="rowsOnPage" (pageChange)="refreshTable($event)"></paging-no-load>
|
||||
</td></tr>
|
||||
<tr><td colspan="5" class="uk-padding-remove">
|
||||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
|
||||
</td></tr>
|
||||
<tr *ngIf="searchViewLink"><td colspan="5" class="uk-padding-remove-top uk-padding-remove-right uk-text-right">
|
||||
<p>
|
||||
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >Show results in default view</a>
|
||||
</p>
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<!-- Name Type Country Institution Compatibility -->
|
||||
<th class="uk-text-center"><mfDefaultSorter by="title.name">Name</mfDefaultSorter></th>
|
||||
<th class="uk-text-center"><mfDefaultSorter by="type">Type</mfDefaultSorter></th>
|
||||
<th class="uk-text-center"><mfDefaultSorter by="countries">Country</mfDefaultSorter></th>
|
||||
<th class="uk-text-center"><mfDefaultSorter by="organization.name">Institution</mfDefaultSorter></th>
|
||||
<th class="uk-text-center"><mfDefaultSorter by="compatibility">Compatibility</mfDefaultSorter></th>
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="uk-table-middle" *ngFor="let dataprovider of mf.data">
|
||||
<td class="uk-width-1-5 uk-text-center">
|
||||
<a [queryParams]="{datasourceId: dataprovider.id}" routerLinkActive="router-link-active" routerLink="/search/dataprovider">
|
||||
<span *ngIf="dataprovider.title.name"
|
||||
[innerHTML]="dataprovider.title.name">
|
||||
</span>
|
||||
<span *ngIf="!dataprovider.title.name">
|
||||
[no title available]
|
||||
</span>
|
||||
</a>
|
||||
</td>
|
||||
<td class="uk-width-1-5 uk-text-center">
|
||||
<span *ngIf="dataprovider.type">{{dataprovider.type}}</span>
|
||||
<span *ngIf="!dataprovider.type">-</span>
|
||||
</td>
|
||||
<td class="uk-width-1-5 uk-text-center">
|
||||
<span *ngFor="let country of dataprovider['countries'].slice(0,5) let i = index">{{country}}{{(i < ( dataprovider['countries'].slice(0,5).length-1))?", ":""}}{{(i == dataprovider['countries'].slice(0,5).length-1 && dataprovider['countries'].length > 5)?"...":""}}</span>
|
||||
<span *ngIf="dataprovider.countries.length == 0">-</span>
|
||||
</td>
|
||||
<td class="uk-width-1-5 uk-text-center">
|
||||
<span *ngFor="let org of dataprovider['organizations'].slice(0,5) let i = index">
|
||||
<a *ngIf="org.id" [queryParams]="{organizationId: org.id}" routerLinkActive="router-link-active" routerLink="/search/organization">{{org.name}}</a><span *ngIf="!org.id">{{org.name}}</span>{{(i < ( dataprovider['organizations'].slice(0,5).length-1))?", ":""}}{{(i == dataprovider['organizations'].slice(0,5).length-1 && dataprovider['organizations'].length > 5)?"...":""}}
|
||||
</span>
|
||||
<span *ngIf="dataprovider.organizations.length == 0">-</span>
|
||||
</td>
|
||||
<td class="uk-width-1-5 uk-text-center">
|
||||
<span *ngIf="dataprovider.compatibility">{{dataprovider.compatibility}}</span>
|
||||
<span *ngIf="!dataprovider.compatibility">-</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<!--paging-no-load [currentPage]="1" [totalResults]="pending_claims.length" [size]="rowsOnPage" ></paging-no-load-->
|
||||
|
||||
<tfoot class="uk-child-width-1-1">
|
||||
<!--paging-no-load class="uk-width-1-1" [currentPage]="1" [totalResults]="pending_claims.length" [size]="rowsOnPage" (pageChange)="refreshTable(mf1, $event)"></paging-no-load-->
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!--table-view *ngIf="tableView"
|
||||
[results]="results"
|
||||
[status]=searchUtils.status
|
||||
[type]="entityType" [urlParam]="urlParam"
|
||||
[showLoading]="true"
|
||||
[activePage]="activePage">
|
||||
</table-view-->
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--modal-loading [message]= "'Loading results...'"></modal-loading-->
|
||||
|
||||
<modal-search-filter [filter]="currentFilter" [showResultCount]=showResultCount (modalChange)="filterChanged($event)"></modal-search-filter>
|
||||
|
||||
`
|
||||
})
|
||||
export class SearchPageTableViewComponent {
|
||||
@Input() pageTitle = "";
|
||||
@Input() results = [];
|
||||
@Input() filters = [];
|
||||
@Input() type:string = "";
|
||||
@Input() entityType: string = "";
|
||||
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||
@Output() queryChange = new EventEmitter();
|
||||
@Output() downloadClick = new EventEmitter();
|
||||
@Input() baseUrl:string = '';
|
||||
@Input() showResultCount:boolean = true;
|
||||
@Input() showRefine:boolean = true;
|
||||
@Input() refineFields = [];
|
||||
@Input() csvParams: string;
|
||||
@Input() csvPath: string;
|
||||
@Input() advancedSearchLink: string = "";
|
||||
@Input() searchViewLink: string;
|
||||
@Input() disableForms: boolean = false;
|
||||
|
||||
@ViewChild (ModalLoading) loading : ModalLoading ;
|
||||
public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
|
||||
private searchFieldsHelper:SearchFields = new SearchFields();
|
||||
private queryParameters: Map<string, string> = new Map<string,string>();
|
||||
private baseURLWithParameters:string = '';
|
||||
private sub: any;
|
||||
public countFilters= 0;
|
||||
public urlParam: string;
|
||||
public parameterNames:string[] =[];
|
||||
public parameterValues:string[] =[];
|
||||
|
||||
//public activePage: number = 1;
|
||||
public rowsOnPage = 10;
|
||||
public sortOrder = "asc";
|
||||
@ViewChild('mf') table: any;//DataTable;
|
||||
|
||||
@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
|
||||
public currentFilter: Filter;
|
||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
constructor (private location: Location , private _meta: Meta) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.updateBaseUrlWithParameters(this.filters);
|
||||
this.defineUrlParam();
|
||||
this.updateTitle(this.pageTitle);
|
||||
this.updateDescription("Openaire, search, repositories, open access, type, data provider, funder, project, " + this.type + "," +this.pageTitle);
|
||||
// console.info(this.entityType + " " + this.urlParam + this.type);
|
||||
}
|
||||
ngAfterViewChecked(){
|
||||
|
||||
}
|
||||
|
||||
totalPages(): number {
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.rowsOnPage);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
return totalPages;
|
||||
}
|
||||
|
||||
refreshTable($event:any) {
|
||||
this.searchUtils.page=$event.value;
|
||||
this.table.mfActivePage=$event.value;
|
||||
this.table.setPage(this.table.mfActivePage, this.rowsOnPage);
|
||||
}
|
||||
|
||||
toggleModal($event) {
|
||||
this.currentFilter = $event.value;
|
||||
this.searchFilterModal.open();
|
||||
}
|
||||
|
||||
updateDescription(description:string){
|
||||
this._meta.updateMeta("description", description);
|
||||
this._meta.updateMeta("og:description", description);
|
||||
}
|
||||
updateTitle(title:string){
|
||||
var _suffix ="| OpenAIRE";
|
||||
var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix;
|
||||
this._meta.setTitle(_title );
|
||||
this._meta.updateMeta("og:title",_title);
|
||||
}
|
||||
private defineUrlParam() {
|
||||
if(this.entityType == "publication") {
|
||||
this.urlParam = "articleId";
|
||||
} else if(this.entityType == "dataset") {
|
||||
this.urlParam = "datasetId";
|
||||
} else if(this.entityType == "project") {
|
||||
this.urlParam = "projectId";
|
||||
} else if(this.entityType == "organization") {
|
||||
this.urlParam = "organizationId";
|
||||
} else if(this.entityType == "person") {
|
||||
this.urlParam = "personId";
|
||||
} else {
|
||||
this.urlParam = "datasourceId";
|
||||
}
|
||||
}
|
||||
|
||||
public getQueryParametersFromUrl(params){
|
||||
// var parameters = "";
|
||||
var allFqs = "";
|
||||
|
||||
for(var i=0; i< this.refineFields.length ; i++){
|
||||
var filterId = this.refineFields[i];
|
||||
|
||||
if(params[filterId] != undefined) {
|
||||
if(this.queryParameters == undefined){
|
||||
this.queryParameters = new Map<string,string>();
|
||||
}
|
||||
this.queryParameters[filterId]=StringUtils.URIDecode(params[filterId]);
|
||||
let values = (StringUtils.URIDecode(this.queryParameters[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
|
||||
var countvalues = 0;
|
||||
var fq = "";
|
||||
for(let value of values) {
|
||||
countvalues++;
|
||||
var paramId = this.fieldIdsMap[filterId].param;
|
||||
// parameters+='&' + paramId+ '='+ value;//+"&" + this.fieldIdsMap[paramId].operator + "="+((countvalues == 1)?"and":"or");
|
||||
fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId +" exact " +value;// StringUtils.quote(value) ;
|
||||
}
|
||||
if(countvalues > 0){
|
||||
fq="&fq="+fq;
|
||||
}
|
||||
allFqs += fq;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
var keyword = params['keyword'];
|
||||
var doiQuery = "";
|
||||
var keywordQuery = "";
|
||||
if((keyword && keyword.length > 0)){
|
||||
if((this.type == 'publications' ||this.type == 'datasets')){
|
||||
var DOIs:string[] = DOI.getDOIsFromString(keyword);
|
||||
var doisParams = "";
|
||||
|
||||
for(var i =0 ;i < DOIs.length; i++){
|
||||
doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
|
||||
}
|
||||
if(doisParams.length > 0){
|
||||
doiQuery += "&"+doisParams;
|
||||
}else {
|
||||
keywordQuery += "&q="+StringUtils.URIEncode(keyword);
|
||||
}
|
||||
}else{
|
||||
keywordQuery += "&q="+StringUtils.URIEncode(keyword);
|
||||
|
||||
}
|
||||
}
|
||||
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
|
||||
}
|
||||
public getIndexQueryParametersFromUrl(params){
|
||||
// var parameters = "";
|
||||
var allFqs = "";
|
||||
|
||||
for(var i=0; i< this.refineFields.length ; i++){
|
||||
var filterId = this.refineFields[i];
|
||||
var fq = "";
|
||||
if(params[filterId] != undefined) {
|
||||
if(this.queryParameters == undefined){
|
||||
this.queryParameters = new Map<string,string>();
|
||||
}
|
||||
this.queryParameters[filterId]=decodeURIComponent(params[filterId]);
|
||||
let values = (decodeURIComponent(this.queryParameters[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
|
||||
var countvalues = 0
|
||||
for(let value of values) {
|
||||
countvalues++;
|
||||
// parameters+= ((countvalues == 1)?" and (":" or ")+ filterId+ '='+ value;
|
||||
fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId + " exact " + value;//StringUtils.quote(value);
|
||||
}
|
||||
// parameters+= " ) ";
|
||||
if(countvalues > 0){
|
||||
fq="&fq="+fq;
|
||||
}
|
||||
allFqs += fq;
|
||||
}
|
||||
|
||||
}
|
||||
var keyword = params['keyword'];
|
||||
var doiQuery = "";
|
||||
var keywordQuery = "";
|
||||
if((keyword && keyword.length > 0)){
|
||||
if((this.type == 'publications' ||this.type == 'datasets')){
|
||||
var DOIs:string[] = DOI.getDOIsFromString(keyword);
|
||||
var doisParams = "";
|
||||
|
||||
for(var i =0 ;i < DOIs.length; i++){
|
||||
doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
|
||||
}
|
||||
if(doisParams.length > 0){
|
||||
doiQuery += "&"+doisParams;
|
||||
}
|
||||
}else{
|
||||
keywordQuery += "and ("+StringUtils.quote(StringUtils.URIEncode(keyword)) +")";
|
||||
|
||||
}
|
||||
}
|
||||
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
|
||||
|
||||
}
|
||||
/*
|
||||
* Mark as check the new filters that are selected, when you get them from search
|
||||
*/
|
||||
public checkSelectedFilters(filters:Filter[]){
|
||||
this.filters = filters;
|
||||
for(var i=0; i< filters.length ; i++){
|
||||
var filter:Filter = filters[i];
|
||||
filter.countSelectedValues = 0;
|
||||
if(this.queryParameters[filter.filterId] != undefined) {
|
||||
let values = (decodeURIComponent(this.queryParameters[filter.filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
|
||||
for(let filterValue of filter.values) {
|
||||
if(values.indexOf(StringUtils.quote(filterValue.id)) > -1) {
|
||||
filterValue.selected = true;
|
||||
filter.countSelectedValues++;
|
||||
}else{
|
||||
filterValue.selected = false;
|
||||
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(let filterValue of filter.values) {
|
||||
filterValue.selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return filters;
|
||||
}
|
||||
/*
|
||||
* Update the url with proper parameters. This is used as base url in Paging Component
|
||||
*/
|
||||
public updateBaseUrlWithParameters(filters:Filter[]){
|
||||
this.baseURLWithParameters = this.baseUrl + this.createUrlParameters(filters,false);
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
private createUrlParameters(filters:Filter[], includePage:boolean){
|
||||
var allLimits="";//location.search.slice(1);
|
||||
this.parameterNames.splice(0,this.parameterNames.length);
|
||||
this.parameterValues.splice(0,this.parameterValues.length);
|
||||
|
||||
for (let filter of filters){
|
||||
var filterLimits="";
|
||||
if(filter.countSelectedValues > 0){
|
||||
for (let value of filter.values){
|
||||
if(value.selected == true){
|
||||
filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
|
||||
}
|
||||
}
|
||||
this.queryParameters[filter.filterId]=filterLimits;
|
||||
if(filterLimits.length > 0){
|
||||
this.parameterNames.push(filter.filterId);
|
||||
this.parameterValues.push(filterLimits);
|
||||
}
|
||||
allLimits+=(allLimits.length==0?"?":"&")+((filterLimits.length == 0 )?'':filter.filterId + '='+ filterLimits) ;
|
||||
}
|
||||
}
|
||||
if(this.searchUtils.keyword.length > 0 ){
|
||||
allLimits+=(allLimits.length==0?"?":"&")+'keyword=' + this.searchUtils.keyword;
|
||||
this.parameterNames.push("keyword");
|
||||
this.parameterValues.push(this.searchUtils.keyword);
|
||||
}
|
||||
if(this.searchUtils.page != 1 && includePage){
|
||||
allLimits+=((allLimits.length == 0)?'?':'&') + 'page=' + this.searchUtils.page;
|
||||
}
|
||||
|
||||
return allLimits;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
private createSearchQueryParameters(filters:Filter[]){
|
||||
var allFqs = "";
|
||||
for (let filter of filters){
|
||||
if(filter.countSelectedValues > 0){
|
||||
var fq = "";
|
||||
var count_selected=0;
|
||||
for (let value of filter.values){
|
||||
if(value.selected == true){
|
||||
count_selected++;
|
||||
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + StringUtils.quote(StringUtils.URIEncode(value.id));
|
||||
}
|
||||
}
|
||||
fq="&fq="+fq;
|
||||
allFqs += fq;
|
||||
}
|
||||
}
|
||||
var doiQuery = "";
|
||||
var keywordQuery = "";
|
||||
if((this.searchUtils.keyword && this.searchUtils.keyword.length > 0)){
|
||||
if((this.type == 'publications' ||this.type == 'datasets')){
|
||||
var DOIs:string[] = DOI.getDOIsFromString(this.searchUtils.keyword);
|
||||
var doisParams = "";
|
||||
|
||||
for(var i =0 ;i < DOIs.length; i++){
|
||||
doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
|
||||
}
|
||||
if(doisParams.length > 0){
|
||||
doiQuery += "&"+doisParams;
|
||||
}else{
|
||||
keywordQuery += "&q="+StringUtils.URIEncode(this.searchUtils.keyword);
|
||||
}
|
||||
}else{
|
||||
keywordQuery += "&q="+StringUtils.URIEncode(this.searchUtils.keyword);
|
||||
}
|
||||
}
|
||||
|
||||
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
|
||||
|
||||
}
|
||||
private createIndexQueryParameters(filters:Filter[]){
|
||||
var allFqs = "";
|
||||
for (let filter of filters){
|
||||
if(filter.countSelectedValues > 0){
|
||||
var count_selected=0;
|
||||
var fq = "";
|
||||
for (let value of filter.values){
|
||||
if(value.selected == true){
|
||||
count_selected++;
|
||||
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + StringUtils.quote(StringUtils.URIEncode(value.id));
|
||||
}
|
||||
}
|
||||
if(count_selected > 0){
|
||||
fq="&fq="+fq;
|
||||
allFqs += fq;
|
||||
}
|
||||
}
|
||||
}
|
||||
var doiQuery = "";
|
||||
var keywordQuery = "";
|
||||
if((this.searchUtils.keyword && this.searchUtils.keyword.length > 0)){
|
||||
if((this.type == 'publications' ||this.type == 'datasets')){
|
||||
var DOIs:string[] = DOI.getDOIsFromString(this.searchUtils.keyword);
|
||||
var doisParams = "";
|
||||
for(var i =0 ;i < DOIs.length; i++){
|
||||
doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
|
||||
}
|
||||
if(doisParams.length > 0){
|
||||
doiQuery += "&"+doisParams;
|
||||
}
|
||||
}else{
|
||||
keywordQuery += " and ("+StringUtils.quote(StringUtils.URIEncode(this.searchUtils.keyword)) +")"
|
||||
|
||||
}
|
||||
}
|
||||
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
|
||||
|
||||
}
|
||||
private isFiltered(){
|
||||
var filtered=false;
|
||||
for (let filter of this.filters){
|
||||
if(filter.countSelectedValues > 0){
|
||||
filtered = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(this.searchUtils.keyword.length > 0 ){
|
||||
filtered = true;
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
private clearKeywords(){
|
||||
if(this.searchUtils.keyword.length > 0 ){
|
||||
this.searchUtils.keyword ='';
|
||||
}
|
||||
this.goTo(1);
|
||||
}
|
||||
private clearFilters(){
|
||||
for (var i =0 ; i < this.filters.length; i++){
|
||||
for (var j=0; j < this.filters[i].countSelectedValues; j++){
|
||||
if(this.filters[i].values[j].selected){
|
||||
this.filters[i].values[j].selected = false;
|
||||
}
|
||||
this.filters[i].countSelectedValues = 0;
|
||||
}
|
||||
}
|
||||
this.clearKeywords();
|
||||
|
||||
}
|
||||
private removeFilter(value:Value,filter:Filter){
|
||||
filter.countSelectedValues--;
|
||||
if(value.selected == true){
|
||||
value.selected = false;
|
||||
}
|
||||
this.goTo(1);
|
||||
|
||||
}
|
||||
goTo(page:number = 1){
|
||||
this.searchUtils.page = page;
|
||||
console.info("searchUtils.page goto = "+this.searchUtils.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({
|
||||
value: queryParameters,
|
||||
index:indexQuery
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
filterChanged($event){
|
||||
console.info("filter Changed");
|
||||
this.goTo(1);
|
||||
}
|
||||
keywordChanged($event) {
|
||||
this.searchUtils.keyword = $event.value;
|
||||
this.goTo(1);
|
||||
}
|
||||
|
||||
downloadClicked($event) {
|
||||
if($event.value == true) {
|
||||
var queryParameters = this.createSearchQueryParameters(this.filters);
|
||||
|
||||
this.downloadClick.emit({
|
||||
value: queryParameters
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get A sub-array of this.refineFields array, which contains the ids of the selected filters
|
||||
*/
|
||||
public getSelectedFilters():string[] {
|
||||
var selected:string[] = [];
|
||||
for(var i=0; i < this.filters.length; i++){
|
||||
var filter:Filter = this.filters[i];
|
||||
if(filter.countSelectedValues > 0){
|
||||
selected.push(filter.filterId);
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
/*
|
||||
* Get A sub-array of this.refineFields array, which contains the ids of the selected parameters
|
||||
*/
|
||||
private getSelectedParameters():string[] {
|
||||
var selected:string[] = [];
|
||||
var params:string[] = Object.keys(this.queryParameters);
|
||||
for(var i=0; i < params.length; i++){
|
||||
if(this.refineFields.indexOf(params[i]) > -1){
|
||||
selected.push(params[i]);
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
/*
|
||||
* Get A sub-array of this.refineFields array, which hides hidden fields (e.g Funding level 0,1,2,..), and contains those that depend on another fields (e.g Funding level 0 if Funder is selected )
|
||||
*/
|
||||
public getFields():string[] {
|
||||
var selected_filters:string[] = this.getSelectedFilters();
|
||||
if(selected_filters.length == 0){
|
||||
selected_filters = this.getSelectedParameters();
|
||||
}
|
||||
var fields:string[] = [];
|
||||
for(var i =0 ; i < this.refineFields.length;i++){
|
||||
var dependentTo = this.searchFieldsHelper.DEPENDENT_FIELDS[this.refineFields[i]];
|
||||
|
||||
//if filter is not marked as hidden OR it is hidden but it is dependent to a field that it IS selected
|
||||
if(this.searchFieldsHelper.HIDDEN_FIELDS.indexOf(this.refineFields[i]) == -1 || (selected_filters.indexOf(dependentTo) != -1) ){
|
||||
fields.push(this.refineFields[i]);
|
||||
}
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
/*
|
||||
* Get a query string of all fields, that want to get from search (e.g. &fields=funderid&fields=projectstartyear&...))
|
||||
*/
|
||||
public getRefineFieldsQuery():string{
|
||||
|
||||
var fields:string[] = this.getFields();
|
||||
var fieldsStr = ""
|
||||
for(var i =0 ; i < fields.length ;i++){
|
||||
fieldsStr+="&fields="+fields[i];
|
||||
}
|
||||
return "&refine=true"+fieldsStr;
|
||||
}
|
||||
|
||||
// for loading
|
||||
public openLoading(){
|
||||
if(this.loading){
|
||||
this.loading.open();
|
||||
}
|
||||
}
|
||||
public closeLoading(){
|
||||
if(this.loading){
|
||||
this.loading.close();
|
||||
}
|
||||
}
|
||||
getSelectedValues(filter):any{
|
||||
var selected = [];
|
||||
if(filter.countSelectedValues >0){
|
||||
for (var i=0; i < filter.values.length; i++){
|
||||
if(filter.values[i].selected){
|
||||
selected.push(filter.values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchPageTableViewComponent} from './searchPageTableView.component';
|
||||
import{SearchFormModule} from './searchForm.module';
|
||||
import{SearchResultsModule} from './searchResults.module';
|
||||
//import{DatasourceTableViewModule} from './datasourceTableView.module';
|
||||
//import{SearchFilterComponent} from './searchFilter.component';
|
||||
//import{SearchFilterModalComponent} from './searchFilterModal.component';
|
||||
import {SearchFilterModule} from './searchFilter.module';
|
||||
import{LoadingModalModule} from '../../utils/modal/loadingModal.module';
|
||||
import {ReportsServiceModule} from '../../services/reportsService.module';
|
||||
import{SearchPagingModule} from './searchPaging.module';
|
||||
import {SearchDownloadModule} from './searchDownload.module';
|
||||
import {ModalModule} from '../../utils/modal/modal.module';
|
||||
import {PagingModule} from '../../utils/paging.module';
|
||||
import {DataTableModule} from "angular2-datatable";
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule, /*DatasourceTableViewModule,*/ LoadingModalModule,
|
||||
ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule, DataTableModule, SearchFilterModule
|
||||
],
|
||||
declarations: [
|
||||
SearchPageTableViewComponent//,
|
||||
//SearchFilterComponent,
|
||||
//SearchFilterModalComponent
|
||||
,
|
||||
],
|
||||
|
||||
providers:[
|
||||
],
|
||||
exports: [
|
||||
SearchPageTableViewComponent//,
|
||||
//SearchFilterComponent,
|
||||
//SearchFilterModalComponent
|
||||
]
|
||||
})
|
||||
export class SearchPageTableViewModule { }
|
|
@ -9,6 +9,7 @@ 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';
|
||||
|
||||
|
@ -17,7 +18,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
|
|||
CommonModule, FormsModule,
|
||||
|
||||
DataProvidersServiceModule,
|
||||
SearchFormModule, SearchResultsModule, SearchDataProvidersRoutingModule, SearchPageModule
|
||||
SearchFormModule, SearchResultsModule, SearchDataProvidersRoutingModule, SearchPageModule//, SearchFilterModalModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
|
|
|
@ -9,6 +9,7 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
|
||||
import {DatasetsServiceModule} from '../../services/datasetsService.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';
|
||||
|
||||
|
@ -17,7 +18,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
|
|||
CommonModule, FormsModule,
|
||||
|
||||
DatasetsServiceModule,
|
||||
SearchFormModule, SearchResultsModule, SearchDatasetsRoutingModule, SearchPageModule
|
||||
SearchFormModule, SearchResultsModule, SearchDatasetsRoutingModule, SearchPageModule//, SearchFilterModalModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
|
|
|
@ -9,6 +9,7 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
|
||||
import {OrganizationsServiceModule} from '../../services/organizationsService.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';
|
||||
|
||||
|
@ -17,7 +18,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
|
|||
CommonModule, FormsModule,
|
||||
|
||||
OrganizationsServiceModule,
|
||||
SearchFormModule, SearchResultsModule, SearchOrganizationsRoutingModule, SearchPageModule
|
||||
SearchFormModule, SearchResultsModule, SearchOrganizationsRoutingModule, SearchPageModule//, SearchFilterModalModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
|
|
|
@ -9,6 +9,7 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
|
||||
import {PeopleServiceModule} from '../../services/peopleService.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';
|
||||
|
||||
|
@ -17,7 +18,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
|
|||
CommonModule, FormsModule,
|
||||
|
||||
PeopleServiceModule,
|
||||
SearchFormModule, SearchResultsModule, SearchPeopleRoutingModule, SearchPageModule
|
||||
SearchFormModule, SearchResultsModule, SearchPeopleRoutingModule, SearchPageModule//, SearchFilterModalModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
|
|
|
@ -9,6 +9,7 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
|
||||
import {ProjectsServiceModule} from '../../services/projectsService.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';
|
||||
|
||||
|
@ -17,7 +18,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
|
|||
CommonModule, FormsModule,
|
||||
|
||||
ProjectsServiceModule,
|
||||
SearchFormModule, SearchResultsModule, SearchProjectsRoutingModule, SearchPageModule
|
||||
SearchFormModule, SearchResultsModule, SearchProjectsRoutingModule, SearchPageModule//, SearchFilterModalModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
|
|
|
@ -9,6 +9,7 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
|
||||
import {PublicationsServiceModule} from '../../services/publicationsService.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';
|
||||
|
||||
|
@ -17,7 +18,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
|
|||
CommonModule, FormsModule,
|
||||
|
||||
PublicationsServiceModule,
|
||||
SearchFormModule, SearchResultsModule, SearchPublicationsRoutingModule, SearchPageModule
|
||||
SearchFormModule, SearchResultsModule, SearchPublicationsRoutingModule, SearchPageModule//, SearchFilterModalModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
|
|
|
@ -62,8 +62,34 @@ export class SearchDataprovidersService {
|
|||
})
|
||||
.map(res => [res['meta'].total, this.parseResults(res['results'])])
|
||||
}
|
||||
|
||||
searchCompatibleDataprovidersTable (params: string,refineParams:string):any {
|
||||
let size: number = 0;
|
||||
let url: string= OpenaireProperties.getSearchResourcesAPIURL();
|
||||
url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
|
||||
if(params!= null && params != '' ) {
|
||||
url += params;
|
||||
}
|
||||
if(refineParams!= null && refineParams != '' ) {
|
||||
url += refineParams;
|
||||
}
|
||||
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 => <any> res.json())
|
||||
.do(res => {
|
||||
this._cache.set(key, res);
|
||||
})
|
||||
.map(res => res['meta'].total);
|
||||
}
|
||||
|
||||
searchCompatibleDataproviders (params: string,refineParams:string, page: number, size: number, refineFields:string[] ):any {
|
||||
let url = OpenaireProperties.getSearchResourcesAPIURL();
|
||||
console.info("in search Compatible Dataproviders service function");
|
||||
let url: string = OpenaireProperties.getSearchResourcesAPIURL();
|
||||
url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
|
||||
if(params!= null && params != '' ) {
|
||||
url += params;
|
||||
|
@ -84,9 +110,34 @@ export class SearchDataprovidersService {
|
|||
})
|
||||
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]);
|
||||
}
|
||||
|
||||
searchEntityRegistriesTable (params: string,refineParams:string):any {
|
||||
let size: number = 0;
|
||||
let url: string= OpenaireProperties.getSearchResourcesAPIURL();
|
||||
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
|
||||
if(params!= null && params != '' ) {
|
||||
url += params;
|
||||
}
|
||||
if(refineParams!= null && refineParams != '' ) {
|
||||
url += refineParams;
|
||||
}
|
||||
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 => <any> res.json())
|
||||
.do(res => {
|
||||
this._cache.set(key, res);
|
||||
})
|
||||
.map(res => res['meta'].total);
|
||||
}
|
||||
|
||||
searchEntityRegistries (params: string,refineParams:string, page: number, size: number, refineFields:string[] ):any {
|
||||
let url = OpenaireProperties.getSearchResourcesAPIURL();
|
||||
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))"
|
||||
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
|
||||
if(params!= null && params != '' ) {
|
||||
url += params;
|
||||
}
|
||||
|
@ -287,7 +338,7 @@ export class SearchDataprovidersService {
|
|||
result['type'] = this.getDataproviderType(resData);
|
||||
|
||||
let typeid: string = resData['datasourcetype'].classid;
|
||||
console.info(typeid);
|
||||
//console.info(typeid);
|
||||
if(typeid != "entityregistry" && typeid != "entityregistry::projects" && typeid != "entityregistry::repositories") {
|
||||
|
||||
if(resData.hasOwnProperty('accessinfopackage')) {
|
||||
|
|
|
@ -15,7 +15,10 @@ export class OpenaireProperties {
|
|||
private static searchLinkToOrganizations = "search/find/organizations";
|
||||
private static searchLinkToPeople = "search/find/people";
|
||||
public static searchLinkToCompatibleDataProviders = "search/data-providers";
|
||||
public static searchLinkToCompatibleDataProvidersTable = "search/data-providers-table";
|
||||
public static searchLinkToEntityRegistriesDataProviders = "search/entity-registries";
|
||||
public static searchLinkToEntityRegistriesDataProvidersTable = "search/entity-registries-table";
|
||||
|
||||
//Advanced Search pages
|
||||
public static searchLinkToAdvancedPublications = "search/advanced/publications";
|
||||
public static searchLinkToAdvancedProjects = "search/advanced/projects";
|
||||
|
@ -106,9 +109,15 @@ export class OpenaireProperties {
|
|||
public static getLinkToSearchCompatibleDataProviders():string{
|
||||
return this.baseSearchLink + this.searchLinkToCompatibleDataProviders;
|
||||
}
|
||||
public static getLinkToSearchCompatibleDataProvidersTable():string{
|
||||
return this.baseSearchLink + this.searchLinkToCompatibleDataProvidersTable;
|
||||
}
|
||||
public static getLinkToSearchEntityRegistries():string{
|
||||
return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProviders;
|
||||
}
|
||||
public static getLinkToSearchEntityRegistriesTable():string{
|
||||
return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProvidersTable;
|
||||
}
|
||||
public static getLinkToSearchDatasets():string{
|
||||
return this.baseSearchLink + this.searchLinkToDatasets;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ 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/data-providers','search/entity-registries', 'project-report',
|
||||
'search/data-providers','search/data-providers-table','search/entity-registries','search/entity-registries-table','project-report',
|
||||
'claims','myclaims','participate/claim', 'participate/direct-claim', 'claims-project-manager',
|
||||
'test', 'user-info',
|
||||
'**','error'
|
||||
|
|
Loading…
Reference in New Issue