Project landing: small bug fixed in statistics tab | Link to table view of dataproviders opens on the same tab | filters of compatible data providers changed | Datatable of dataproviders updated

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@47619 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2017-06-22 12:09:07 +00:00
parent a8add8b475
commit 983c2e324d
9 changed files with 233 additions and 462 deletions

View File

@ -140,13 +140,13 @@
<!--div *ngIf="fetchPublications.searchUtils.totalResults == 0 && fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary">
There are no statistics
</div-->
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.NONE && DatasetsComponent.searchUtils.status == errorCodes.NONE"
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE && fetchDatasets.searchUtils.status == errorCodes.NONE"
class="uk-alert uk-alert-primary uk-animation-fade" role="alert">There are no statistics</div>
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.ERROR || DatasetsComponent.searchUtils.status == errorCodes.ERROR"
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR || fetchDatasets.searchUtils.status == errorCodes.ERROR"
class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.NOT_AVAILABLE || DatasetsComponent.searchUtils.status == errorCodes.NOT_AVAILABLE"
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE || fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE"
class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.LOADING || DatasetsComponent.searchUtils.status == errorCodes.LOADING"
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING || fetchDatasets.searchUtils.status == errorCodes.LOADING"
class="uk-alert uk-alert-primary uk-animation-fade" role="alert">Loading...</div>
<div *ngIf="statsClicked && (fetchPublications.searchUtils.totalResults != 0 || fetchDatasets.searchUtils.totalResults != 0)">

View File

@ -144,11 +144,17 @@ export class SearchCompatibleDataprovidersComponent {
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"],
*/
[
"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"],
["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=[

View File

@ -15,18 +15,13 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class';
selector: 'search-content-providers-table',
template: `
<search-page-table pageTitle="OpenAIRE Content Providers"
<search-page-table pageTitle="OpenAIRE Content Providers Table"
type="datasources" entityType="dataprovider" [(filters)] = "filters"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" [showResultCount]=false
(queryChange)="queryChanged($event)"
(downloadClick)="downloadClicked($event)"
[csvParams]="csvParams" csvPath="resources"
[showResultCount]=false
[disableForms]="disableForms"
[searchViewLink]="'/search/content-providers'">
</search-page-table>
<!--table-view [(datasources)] = results></table-view-->
`
})
@ -39,17 +34,14 @@ export class SearchCompatibleDataprovidersTableComponent {
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" ],
/*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
public CSVDownloaded = false;
public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";
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 ;
@ -58,25 +50,16 @@ export class SearchCompatibleDataprovidersTableComponent {
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.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);
this.searchPage.getParametersFromUrl(params);
this._getResults();
});
}
@ -87,36 +70,34 @@ export class SearchCompatibleDataprovidersTableComponent {
if(this.subResults){
this.subResults.unsubscribe();
} }
private _getResults(parameters:string,refine:boolean, page: number){
this.csvParams = parameters+this.resourcesQuery+"&type=datasources";
private _getResults(){
//this.csvParams = 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(
this.subResults = this._searchDataprovidersService.searchCompatibleDataprovidersTable().subscribe(
data => {
size = data;
if(size > 0) {
this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders("", null, 1, size, []).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search Data Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
console.info("search Data Providers [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);
@ -126,14 +107,12 @@ export class SearchCompatibleDataprovidersTableComponent {
// }
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;
@ -148,7 +127,6 @@ export class SearchCompatibleDataprovidersTableComponent {
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//this.searchPage.closeLoading();
}
);
@ -157,26 +135,31 @@ export class SearchCompatibleDataprovidersTableComponent {
//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"],
*/
[
"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"],
["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",
["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"],
//["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)"]];
@ -192,15 +175,13 @@ export class SearchCompatibleDataprovidersTableComponent {
}
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;
@ -221,5 +202,5 @@ export class SearchCompatibleDataprovidersTableComponent {
);
}
}
*/
}

View File

@ -18,10 +18,7 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class';
<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"
[showResultCount]=false
[disableForms]="disableForms"
[searchViewLink]="'/search/entity-registries'">
</search-page-table>
@ -38,46 +35,32 @@ export class SearchEntityRegistriesTableComponent {
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" ],
/*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
public CSVDownloaded = false;
public resourcesQuery = "&query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
public csvParams: string;
*/
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.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);
this.searchPage.getParametersFromUrl(params);
this._getResults("", false, this.searchUtils.page);
});
}
@ -89,33 +72,31 @@ export class SearchEntityRegistriesTableComponent {
this.subResults.unsubscribe();
} }
private _getResults(parameters:string,refine:boolean, page: number){
this.csvParams = parameters+this.resourcesQuery+"&type=datasources";
//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(
this.subResults = this._searchDataprovidersService.searchEntityRegistriesTable().subscribe(
data => {
size = data;
if(size > 0) {
this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
this.subResults = this._searchDataprovidersService.searchEntityRegistries("",null, page, size, []).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search Entity Registries: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
console.info("search Entity Registries [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;
},
@ -127,14 +108,12 @@ export class SearchEntityRegistriesTableComponent {
// }
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;
@ -149,7 +128,6 @@ export class SearchEntityRegistriesTableComponent {
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//this.searchPage.closeLoading();
}
);
/*
@ -188,11 +166,7 @@ export class SearchEntityRegistriesTableComponent {
//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"];
@ -223,7 +197,7 @@ export class SearchEntityRegistriesTableComponent {
}
/*
public downloadClicked($event) {
if(!this.CSVDownloaded) {
this.CSVDownloaded = false;
@ -252,4 +226,5 @@ export class SearchEntityRegistriesTableComponent {
);
}
}
*/
}

View File

@ -59,7 +59,7 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
</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>
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >Show results in table view</a>
</p>
<search-result *ngIf="!tableView"

View File

@ -12,6 +12,7 @@ import{SearchFilterComponent} from './searchFilter.component';
import {SearchFilterModalComponent} from './searchFilterModal.component';
import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersDatatable.pipe';
@Component({
selector: 'search-page-table',
@ -40,7 +41,6 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
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 ">
@ -48,25 +48,25 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
</div>
<div class="uk-width-3-4@m uk-width-3-4@l uk-width-1-1@s uk-first-column" >
<div class="uk-overflow-container custom-dataTable-content">
<table class="uk-table uk-table-striped" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage"
[mfData]="results | contentProvidersDatatable : [searchUtils, filters, triggerPipe]">
<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="searchUtils.status == errorCodes.LOADING" 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>
<thead *ngIf="searchUtils.totalResults > 0">
<tr><td colspan="5" class="uk-padding-remove-bottom uk-padding-remove-right">
<span>
{{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>
</span>
<paging-no-load class="uk-float-right" [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [size]="rowsOnPage" (pageChange)="goTo($event.value, false)"></paging-no-load>
</td></tr>
<tr><td colspan="5" class="uk-padding-remove">
<!--tr><td colspan="5" class="uk-padding-remove">
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
</td></tr>
</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>
@ -78,12 +78,12 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
<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]="sortByOrganization">Institution</mfDefaultSorter></th>
<th class="uk-text-center"><mfDefaultSorter by="compatibility">Compatibility</mfDefaultSorter></th>
</tr>
</thead>
<tbody>
<tbody *ngIf="searchUtils.totalResults > 0">
<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">
@ -115,21 +115,8 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
</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>
@ -138,45 +125,37 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
</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() 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 = '';
//@Output() downloadClick = new EventEmitter();
@Input() showResultCount:boolean = true;
@Input() showRefine:boolean = true;
@Input() refineFields = [];
@Input() csvParams: string;
@Input() csvPath: string;
@Input() advancedSearchLink: string = "";
//@Input() csvParams: string;
//@Input() csvPath: 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";
public triggerPipe: boolean = false;
public rowsOnPage:number = 10;
@ViewChild('mf') table: any;//DataTable;
@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
@ -187,16 +166,16 @@ export class SearchPageTableViewComponent {
}
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);
this.updateUrl(OpenaireProperties.getBaseLink()+location.pathname);
// console.info(this.entityType + " " + this.urlParam + this.type);
}
ngAfterViewChecked(){
public sortByOrganization = (dataprovider: any) => {
if(dataprovider.organizations && dataprovider.organizations.length > 0) {
return dataprovider.organizations[0].name.toUpperCase();
}
return "-";
}
totalPages(): number {
@ -207,10 +186,10 @@ export class SearchPageTableViewComponent {
return totalPages;
}
refreshTable($event:any) {
this.searchUtils.page=$event.value;
this.table.mfActivePage=$event.value;
this.table.setPage(this.table.mfActivePage, this.rowsOnPage);
refreshTable(page:number) {
this.searchUtils.page=page;
//this.table.mfActivePage=$event.value;
this.table.setPage(this.searchUtils.page, this.rowsOnPage);
}
toggleModal($event) {
@ -231,131 +210,28 @@ export class SearchPageTableViewComponent {
updateUrl(url:string){
this._meta.updateProperty("og:url", url);
}
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 = "";
public getParametersFromUrl(params) {
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) {
@ -364,7 +240,6 @@ export class SearchPageTableViewComponent {
filter.countSelectedValues++;
}else{
filterValue.selected = false;
}
}
}else{
@ -376,12 +251,7 @@ export class SearchPageTableViewComponent {
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);
}
/*
*
*/
@ -411,92 +281,14 @@ export class SearchPageTableViewComponent {
this.parameterNames.push("keyword");
this.parameterValues.push(this.searchUtils.keyword);
}
if(this.searchUtils.page != 1 && includePage){
allLimits+=((allLimits.length == 0)?'?':'&') + 'page=' + this.searchUtils.page;
}
//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){
@ -514,57 +306,47 @@ export class SearchPageTableViewComponent {
if(this.searchUtils.keyword.length > 0 ){
this.searchUtils.keyword ='';
}
this.goTo(1);
this.goTo(1, true);
}
private clearFilters(){
for (var i =0 ; i < this.filters.length; i++) {
for (var j=0; j < this.filters[i].countSelectedValues; j++){
for (var j=0; j < this.filters[i].values.length; j++) {
if(this.filters[i].values[j].selected) {
this.filters[i].values[j].selected = false;
}
this.filters[i].countSelectedValues = 0;
}
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);
this.goTo(1, true);
}
goTo(page:number = 1){
this.searchUtils.page = page;
console.info("searchUtils.page goto = "+this.searchUtils.page);
this.queryParameters = new Map<string,string>();
goTo(page:number = 1, triggerPipe:boolean = true){
this.refreshTable(page);
if(triggerPipe) {
this.triggerPipe = !this.triggerPipe;
}
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);
this.goTo(1, true);
}
keywordChanged($event) {
this.searchUtils.keyword = $event.value;
this.goTo(1);
this.goTo(1, true);
}
/*
downloadClicked($event) {
if($event.value == true) {
var queryParameters = this.createSearchQueryParameters(this.filters);
@ -574,76 +356,9 @@ export class SearchPageTableViewComponent {
});
}
}
/*
* 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){

View File

@ -17,6 +17,7 @@ import {SearchDownloadModule} from './searchDownload.module';
import {ModalModule} from '../../utils/modal/modal.module';
import {PagingModule} from '../../utils/paging.module';
import {DataTableModule} from "angular2-datatable";
import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersDatatable.pipe';
@NgModule({
@ -29,6 +30,7 @@ import {DataTableModule} from "angular2-datatable";
//SearchFilterComponent,
//SearchFilterModalComponent
,
ContentProvidersDatatablePipe
],
providers:[
@ -37,6 +39,8 @@ import {DataTableModule} from "angular2-datatable";
SearchPageTableViewComponent//,
//SearchFilterComponent,
//SearchFilterModalComponent
,
ContentProvidersDatatablePipe
]
})
export class SearchPageTableViewModule { }

View File

@ -63,16 +63,10 @@ export class SearchDataprovidersService {
.map(res => [res['meta'].total, this.parseResults(res['results'])])
}
searchCompatibleDataprovidersTable (params: string,refineParams:string):any {
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))"
if(params!= null && params != '' ) {
url += params;
}
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page=0&size=1&format=json";
let key = url;
@ -111,16 +105,10 @@ export class SearchDataprovidersService {
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]);
}
searchEntityRegistriesTable (params: string,refineParams:string):any {
searchEntityRegistriesTable ():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;

View File

@ -0,0 +1,102 @@
import { Pipe, PipeTransform} from '@angular/core';
import { Filter, Value} from '../../searchPages/searchUtils/searchHelperClasses.class';
import { SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
import { ErrorCodes} from '../properties/openaireProperties';
@Pipe({
name: 'contentProvidersDatatable'
})
export class ContentProvidersDatatablePipe implements PipeTransform {
transform(array: any[], args: any[]): any {
if(array.length > 0) {
let searchUtils: SearchUtilsClass = args[0];
let filters:Filter[] = args[1];
var errorCodes:ErrorCodes = new ErrorCodes();
searchUtils.status = errorCodes.LOADING;
var result = array.filter(row=>this.filterAll(row, searchUtils.keyword, filters));
searchUtils.totalResults = result.length;
var errorCodes:ErrorCodes = new ErrorCodes();
searchUtils.status = errorCodes.DONE;
if(searchUtils.totalResults == 0 ){
searchUtils.status = errorCodes.NONE;
}
return result;
}
return [];
}
filterAll(row: any, query: string, filters:Filter[]) {
let returnValue: boolean = false;
if(query) {
if(row.title.name.indexOf(query) > -1) {
returnValue = true;
}
if(row.type.indexOf(query) > -1) {
returnValue = true;
}
if(row.countries.indexOf(query) > -1) {
returnValue = true;
}
if(row.compatibility.indexOf(query) > -1) {
returnValue = true;
}
if(row.organizations > 0) {
for(let organization of row.organizations) {
if(row.organization.indexOf(query) > -1) {
returnValue = true;
break;
}
}
}
if(!returnValue) {
return false;
}
}
for (let filter of filters){
if(filter.countSelectedValues > 0){
for (let value of filter.values){
if(value.selected == true){
// make it generic in future commit
let field:string = "";
if(filter.title == "Type") {
field = "type";
} else if(filter.title == "Compatibility Level") {
field = "compatibility";
}
if(row[field] == value.name) {
returnValue = true;
if(filter.filterOperator == "or") {
break;
}
} else {
if(filter.filterOperator == "and") {
return false;
}
returnValue = false;
}
}
}
if(!returnValue) {
return false;
}
}
}
return true;
}
}