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:
parent
a8add8b475
commit
983c2e324d
|
@ -140,13 +140,13 @@
|
||||||
<!--div *ngIf="fetchPublications.searchUtils.totalResults == 0 && fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary">
|
<!--div *ngIf="fetchPublications.searchUtils.totalResults == 0 && fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary">
|
||||||
There are no statistics
|
There are no statistics
|
||||||
</div-->
|
</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>
|
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>
|
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>
|
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>
|
class="uk-alert uk-alert-primary uk-animation-fade" role="alert">Loading...</div>
|
||||||
|
|
||||||
<div *ngIf="statsClicked && (fetchPublications.searchUtils.totalResults != 0 || fetchDatasets.searchUtils.totalResults != 0)">
|
<div *ngIf="statsClicked && (fetchPublications.searchUtils.totalResults != 0 || fetchDatasets.searchUtils.totalResults != 0)">
|
||||||
|
|
|
@ -144,11 +144,17 @@ export class SearchCompatibleDataprovidersComponent {
|
||||||
var searchFields = new SearchFields();
|
var searchFields = new SearchFields();
|
||||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
|
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
|
||||||
var value_names=[
|
var value_names=[
|
||||||
[
|
/*[
|
||||||
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
|
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
|
||||||
"Institutional Repositories Aggregators",
|
"Institutional Repositories Aggregators",
|
||||||
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
|
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
|
||||||
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
|
"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)"]];
|
["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=[
|
var value_original_ids=[
|
||||||
|
|
|
@ -15,18 +15,13 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class';
|
||||||
selector: 'search-content-providers-table',
|
selector: 'search-content-providers-table',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<search-page-table pageTitle="OpenAIRE Content Providers"
|
<search-page-table pageTitle="OpenAIRE Content Providers Table"
|
||||||
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||||
[baseUrl] = "baseUrl" [showResultCount]=false
|
[showResultCount]=false
|
||||||
(queryChange)="queryChanged($event)"
|
|
||||||
(downloadClick)="downloadClicked($event)"
|
|
||||||
[csvParams]="csvParams" csvPath="resources"
|
|
||||||
[disableForms]="disableForms"
|
[disableForms]="disableForms"
|
||||||
[searchViewLink]="'/search/content-providers'">
|
[searchViewLink]="'/search/content-providers'">
|
||||||
</search-page-table>
|
</search-page-table>
|
||||||
<!--table-view [(datasources)] = results></table-view-->
|
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -39,17 +34,14 @@ export class SearchCompatibleDataprovidersTableComponent {
|
||||||
public _location:Location;
|
public _location:Location;
|
||||||
public searchFields:SearchFields = new SearchFields();
|
public searchFields:SearchFields = new SearchFields();
|
||||||
public refineFields: string[] = this.searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
|
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":[]
|
"export":[]
|
||||||
};
|
};
|
||||||
public CSVDownloaded = false;
|
public CSVDownloaded = false;
|
||||||
public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";
|
|
||||||
public csvParams: string;
|
public csvParams: string;
|
||||||
|
public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/
|
||||||
|
|
||||||
public disableForms: boolean = false;
|
public disableForms: boolean = false;
|
||||||
|
|
||||||
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
|
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
|
||||||
|
@ -58,25 +50,16 @@ export class SearchCompatibleDataprovidersTableComponent {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
this.baseUrl = OpenaireProperties.getLinkToSearchCompatibleDataProvidersTable();
|
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() {
|
public ngOnInit() {
|
||||||
this.searchPage.refineFields = this.refineFields;
|
this.searchPage.refineFields = this.refineFields;
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
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();
|
this.filters = this.createFilters();
|
||||||
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
|
this.searchPage.getParametersFromUrl(params);
|
||||||
this._getResults(queryParameters, false, this.searchUtils.page);
|
this._getResults();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,36 +70,34 @@ export class SearchCompatibleDataprovidersTableComponent {
|
||||||
if(this.subResults){
|
if(this.subResults){
|
||||||
this.subResults.unsubscribe();
|
this.subResults.unsubscribe();
|
||||||
} }
|
} }
|
||||||
private _getResults(parameters:string,refine:boolean, page: number){
|
private _getResults(){
|
||||||
this.csvParams = parameters+this.resourcesQuery+"&type=datasources";
|
//this.csvParams = this.resourcesQuery+"&type=datasources";
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.LOADING;
|
this.searchUtils.status = errorCodes.LOADING;
|
||||||
//this.searchPage.openLoading();
|
|
||||||
this.disableForms = true;
|
this.disableForms = true;
|
||||||
this.results = [];
|
this.results = [];
|
||||||
this.searchUtils.totalResults = 0;
|
this.searchUtils.totalResults = 0;
|
||||||
|
|
||||||
let size: number = 0;
|
let size: number = 0;
|
||||||
this.subResults = this._searchDataprovidersService.searchCompatibleDataprovidersTable(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null).subscribe(
|
this.subResults = this._searchDataprovidersService.searchCompatibleDataprovidersTable().subscribe(
|
||||||
data => {
|
data => {
|
||||||
size = data;
|
size = data;
|
||||||
if(size > 0) {
|
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 => {
|
data => {
|
||||||
this.searchUtils.totalResults = data[0];
|
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.results = data[1];
|
||||||
|
|
||||||
this.searchPage.checkSelectedFilters(this.filters);
|
this.searchPage.checkSelectedFilters(this.filters);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.searchUtils.totalResults == 0 ){
|
if(this.searchUtils.totalResults == 0 ){
|
||||||
this.searchUtils.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
//this.searchPage.closeLoading();
|
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
|
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
@ -126,14 +107,12 @@ export class SearchCompatibleDataprovidersTableComponent {
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.ERROR;
|
this.searchUtils.status = errorCodes.ERROR;
|
||||||
//this.searchPage.closeLoading();
|
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.searchPage.checkSelectedFilters(this.filters);
|
this.searchPage.checkSelectedFilters(this.filters);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
|
@ -148,7 +127,6 @@ export class SearchCompatibleDataprovidersTableComponent {
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.ERROR;
|
this.searchUtils.status = errorCodes.ERROR;
|
||||||
//this.searchPage.closeLoading();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -157,26 +135,31 @@ export class SearchCompatibleDataprovidersTableComponent {
|
||||||
//TODO set filters from
|
//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[] {
|
private createFilters():Filter[] {
|
||||||
var filter_names=["Type","Compatibility Level"];
|
var filter_names=["Type","Compatibility Level"];
|
||||||
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
|
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
|
||||||
var searchFields = new SearchFields();
|
var searchFields = new SearchFields();
|
||||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
|
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
|
||||||
var value_names=[
|
var value_names=[
|
||||||
[
|
/*[
|
||||||
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
|
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
|
||||||
"Institutional Repositories Aggregators",
|
"Institutional Repositories Aggregators",
|
||||||
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
|
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
|
||||||
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
|
"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)"]];
|
["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=[
|
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"],
|
"datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
|
||||||
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
|
//["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)"]];
|
["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;
|
return filters;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
public downloadClicked($event) {
|
public downloadClicked($event) {
|
||||||
if(!this.CSVDownloaded) {
|
if(!this.CSVDownloaded) {
|
||||||
this.CSVDownloaded = false;
|
this.CSVDownloaded = false;
|
||||||
|
|
||||||
var parameters = $event.value;
|
var parameters = $event.value;
|
||||||
|
|
||||||
//this.getResultsCSV(parameters, false, 1, 1000);
|
|
||||||
|
|
||||||
this._searchDataprovidersService.searchCompatibleDataprovidersCSV(parameters,this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe(
|
this._searchDataprovidersService.searchCompatibleDataprovidersCSV(parameters,this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.CSV.export = data;
|
this.CSV.export = data;
|
||||||
|
@ -221,5 +202,5 @@ export class SearchCompatibleDataprovidersTableComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,7 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class';
|
||||||
<search-page-table pageTitle="Entity Registries"
|
<search-page-table pageTitle="Entity Registries"
|
||||||
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
type="datasources" entityType="dataprovider" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||||
[baseUrl] = "baseUrl" [showResultCount]=false
|
[showResultCount]=false
|
||||||
(queryChange)="queryChanged($event)"
|
|
||||||
(downloadClick)="downloadClicked($event)"
|
|
||||||
[csvParams]="csvParams" csvPath="resources"
|
|
||||||
[disableForms]="disableForms"
|
[disableForms]="disableForms"
|
||||||
[searchViewLink]="'/search/entity-registries'">
|
[searchViewLink]="'/search/entity-registries'">
|
||||||
</search-page-table>
|
</search-page-table>
|
||||||
|
@ -38,46 +35,32 @@ export class SearchEntityRegistriesTableComponent {
|
||||||
public _location:Location;
|
public _location:Location;
|
||||||
public searchFields:SearchFields = new SearchFields();
|
public searchFields:SearchFields = new SearchFields();
|
||||||
public refineFields: string[] = this.searchFields.ENTITY_REGISTRIES_FIELDS;
|
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":[]
|
"export":[]
|
||||||
};
|
};
|
||||||
public CSVDownloaded = false;
|
public CSVDownloaded = false;
|
||||||
|
public resourcesQuery = "&query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
|
||||||
|
public csvParams: string;
|
||||||
|
*/
|
||||||
public disableForms: boolean = false;
|
public disableForms: boolean = false;
|
||||||
|
|
||||||
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
|
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
|
||||||
public resourcesQuery = "&query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
|
|
||||||
public csvParams: string;
|
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status =errorCodes.LOADING;
|
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() {
|
public ngOnInit() {
|
||||||
this.searchPage.refineFields = this.refineFields;
|
this.searchPage.refineFields = this.refineFields;
|
||||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
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();
|
this.filters = this.createFilters();
|
||||||
|
|
||||||
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
|
this.searchPage.getParametersFromUrl(params);
|
||||||
this._getResults(queryParameters, false, this.searchUtils.page);
|
this._getResults("", false, this.searchUtils.page);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,33 +72,31 @@ export class SearchEntityRegistriesTableComponent {
|
||||||
this.subResults.unsubscribe();
|
this.subResults.unsubscribe();
|
||||||
} }
|
} }
|
||||||
private _getResults(parameters:string,refine:boolean, page: number){
|
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();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.LOADING;
|
this.searchUtils.status = errorCodes.LOADING;
|
||||||
//this.searchPage.openLoading();
|
|
||||||
this.disableForms = true;
|
this.disableForms = true;
|
||||||
this.results = [];
|
this.results = [];
|
||||||
this.searchUtils.totalResults = 0;
|
this.searchUtils.totalResults = 0;
|
||||||
|
|
||||||
let size: number = 0;
|
let size: number = 0;
|
||||||
this.subResults = this._searchDataprovidersService.searchEntityRegistriesTable(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null).subscribe(
|
this.subResults = this._searchDataprovidersService.searchEntityRegistriesTable().subscribe(
|
||||||
data => {
|
data => {
|
||||||
size = data;
|
size = data;
|
||||||
if(size > 0) {
|
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 => {
|
data => {
|
||||||
this.searchUtils.totalResults = data[0];
|
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.results = data[1];
|
||||||
this.searchPage.checkSelectedFilters(this.filters);
|
this.searchPage.checkSelectedFilters(this.filters);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.DONE;
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
if(this.searchUtils.totalResults == 0 ){
|
if(this.searchUtils.totalResults == 0 ){
|
||||||
this.searchUtils.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
}
|
}
|
||||||
//this.searchPage.closeLoading();
|
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -127,14 +108,12 @@ export class SearchEntityRegistriesTableComponent {
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.ERROR;
|
this.searchUtils.status = errorCodes.ERROR;
|
||||||
//this.searchPage.closeLoading();
|
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.searchPage.checkSelectedFilters(this.filters);
|
this.searchPage.checkSelectedFilters(this.filters);
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
|
||||||
|
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.NONE;
|
this.searchUtils.status = errorCodes.NONE;
|
||||||
|
@ -149,7 +128,6 @@ export class SearchEntityRegistriesTableComponent {
|
||||||
// }
|
// }
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.ERROR;
|
this.searchUtils.status = errorCodes.ERROR;
|
||||||
//this.searchPage.closeLoading();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/*
|
/*
|
||||||
|
@ -188,11 +166,7 @@ export class SearchEntityRegistriesTableComponent {
|
||||||
//TODO set filters from
|
//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[] {
|
private createFilters():Filter[] {
|
||||||
var filter_names=["Type","Compatibility Level"];
|
var filter_names=["Type","Compatibility Level"];
|
||||||
var filter_ids=["datasourcetypename","datasourcecompatibilityname"];
|
var filter_ids=["datasourcetypename","datasourcecompatibilityname"];
|
||||||
|
@ -223,7 +197,7 @@ export class SearchEntityRegistriesTableComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
public downloadClicked($event) {
|
public downloadClicked($event) {
|
||||||
if(!this.CSVDownloaded) {
|
if(!this.CSVDownloaded) {
|
||||||
this.CSVDownloaded = false;
|
this.CSVDownloaded = false;
|
||||||
|
@ -252,4 +226,5 @@ export class SearchEntityRegistriesTableComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||||
</span>
|
</span>
|
||||||
</p-->
|
</p-->
|
||||||
<p *ngIf="tableViewLink" class="uk-text-right">
|
<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>
|
</p>
|
||||||
|
|
||||||
<search-result *ngIf="!tableView"
|
<search-result *ngIf="!tableView"
|
||||||
|
|
|
@ -12,6 +12,7 @@ import{SearchFilterComponent} from './searchFilter.component';
|
||||||
import {SearchFilterModalComponent} from './searchFilterModal.component';
|
import {SearchFilterModalComponent} from './searchFilterModal.component';
|
||||||
import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||||
|
import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersDatatable.pipe';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-page-table',
|
selector: 'search-page-table',
|
||||||
|
@ -40,7 +41,6 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||||
Clear All
|
Clear All
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</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>
|
||||||
<div class="uk-grid uk-width-1-1 uk-margin">
|
<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 ">
|
<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>
|
||||||
|
|
||||||
<div class="uk-width-3-4@m uk-width-3-4@l uk-width-1-1@s uk-first-column" >
|
<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.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.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.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">
|
<thead *ngIf="searchUtils.totalResults > 0">
|
||||||
<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">
|
<tr><td colspan="5" class="uk-padding-remove-bottom uk-padding-remove-right">
|
||||||
|
<span>
|
||||||
{{searchUtils.totalResults}} datasources, page {{searchUtils.page}} of {{(totalPages())}}
|
{{searchUtils.totalResults}} datasources, page {{searchUtils.page}} of {{(totalPages())}}
|
||||||
|
</span>
|
||||||
<paging-no-load class="uk-float-right" [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [size]="rowsOnPage" (pageChange)="refreshTable($event)"></paging-no-load>
|
<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>
|
</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>
|
<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">
|
<tr *ngIf="searchViewLink"><td colspan="5" class="uk-padding-remove-top uk-padding-remove-right uk-text-right">
|
||||||
<p>
|
<p>
|
||||||
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >Show results in default view</a>
|
<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="title.name">Name</mfDefaultSorter></th>
|
||||||
<th class="uk-text-center"><mfDefaultSorter by="type">Type</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="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>
|
<th class="uk-text-center"><mfDefaultSorter by="compatibility">Compatibility</mfDefaultSorter></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody *ngIf="searchUtils.totalResults > 0">
|
||||||
<tr class="uk-table-middle" *ngFor="let dataprovider of mf.data">
|
<tr class="uk-table-middle" *ngFor="let dataprovider of mf.data">
|
||||||
<td class="uk-width-1-5 uk-text-center">
|
<td class="uk-width-1-5 uk-text-center">
|
||||||
<a [queryParams]="{datasourceId: dataprovider.id}" routerLinkActive="router-link-active" routerLink="/search/dataprovider">
|
<a [queryParams]="{datasourceId: dataprovider.id}" routerLinkActive="router-link-active" routerLink="/search/dataprovider">
|
||||||
|
@ -115,21 +115,8 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</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>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--table-view *ngIf="tableView"
|
|
||||||
[results]="results"
|
|
||||||
[status]=searchUtils.status
|
|
||||||
[type]="entityType" [urlParam]="urlParam"
|
|
||||||
[showLoading]="true"
|
|
||||||
[activePage]="activePage">
|
|
||||||
</table-view-->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,45 +125,37 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--modal-loading [message]= "'Loading results...'"></modal-loading-->
|
|
||||||
|
|
||||||
<modal-search-filter [filter]="currentFilter" [showResultCount]=showResultCount (modalChange)="filterChanged($event)"></modal-search-filter>
|
<modal-search-filter [filter]="currentFilter" [showResultCount]=showResultCount (modalChange)="filterChanged($event)"></modal-search-filter>
|
||||||
|
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class SearchPageTableViewComponent {
|
export class SearchPageTableViewComponent {
|
||||||
@Input() pageTitle = "";
|
@Input() pageTitle = "";
|
||||||
@Input() results = [];
|
@Input() results;
|
||||||
@Input() filters = [];
|
@Input() filters = [];
|
||||||
@Input() type:string = "";
|
@Input() type:string = "";
|
||||||
@Input() entityType: string = "";
|
@Input() entityType: string = "";
|
||||||
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
@Output() queryChange = new EventEmitter();
|
//@Output() downloadClick = new EventEmitter();
|
||||||
@Output() downloadClick = new EventEmitter();
|
|
||||||
@Input() baseUrl:string = '';
|
|
||||||
@Input() showResultCount:boolean = true;
|
@Input() showResultCount:boolean = true;
|
||||||
@Input() showRefine:boolean = true;
|
@Input() showRefine:boolean = true;
|
||||||
@Input() refineFields = [];
|
@Input() refineFields = [];
|
||||||
@Input() csvParams: string;
|
//@Input() csvParams: string;
|
||||||
@Input() csvPath: string;
|
//@Input() csvPath: string;
|
||||||
@Input() advancedSearchLink: string = "";
|
|
||||||
@Input() searchViewLink: string;
|
@Input() searchViewLink: string;
|
||||||
@Input() disableForms: boolean = false;
|
@Input() disableForms: boolean = false;
|
||||||
|
|
||||||
@ViewChild (ModalLoading) loading : ModalLoading ;
|
@ViewChild (ModalLoading) loading : ModalLoading ;
|
||||||
public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
|
|
||||||
private searchFieldsHelper:SearchFields = new SearchFields();
|
private searchFieldsHelper:SearchFields = new SearchFields();
|
||||||
private queryParameters: Map<string, string> = new Map<string,string>();
|
private queryParameters: Map<string, string> = new Map<string,string>();
|
||||||
private baseURLWithParameters:string = '';
|
|
||||||
private sub: any;
|
private sub: any;
|
||||||
public countFilters= 0;
|
public countFilters= 0;
|
||||||
public urlParam: string;
|
|
||||||
public parameterNames:string[] =[];
|
public parameterNames:string[] =[];
|
||||||
public parameterValues:string[] =[];
|
public parameterValues:string[] =[];
|
||||||
|
|
||||||
//public activePage: number = 1;
|
public triggerPipe: boolean = false;
|
||||||
public rowsOnPage = 10;
|
|
||||||
public sortOrder = "asc";
|
public rowsOnPage:number = 10;
|
||||||
@ViewChild('mf') table: any;//DataTable;
|
@ViewChild('mf') table: any;//DataTable;
|
||||||
|
|
||||||
@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
|
@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
|
||||||
|
@ -187,16 +166,16 @@ export class SearchPageTableViewComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.updateBaseUrlWithParameters(this.filters);
|
|
||||||
this.defineUrlParam();
|
|
||||||
this.updateTitle(this.pageTitle);
|
this.updateTitle(this.pageTitle);
|
||||||
this.updateDescription("Openaire, search, repositories, open access, type, data provider, funder, project, " + this.type + "," +this.pageTitle);
|
this.updateDescription("Openaire, search, repositories, open access, type, data provider, funder, project, " + this.type + "," +this.pageTitle);
|
||||||
this.updateUrl(OpenaireProperties.getBaseLink()+location.pathname);
|
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 {
|
totalPages(): number {
|
||||||
|
@ -207,10 +186,10 @@ export class SearchPageTableViewComponent {
|
||||||
return totalPages;
|
return totalPages;
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshTable($event:any) {
|
refreshTable(page:number) {
|
||||||
this.searchUtils.page=$event.value;
|
this.searchUtils.page=page;
|
||||||
this.table.mfActivePage=$event.value;
|
//this.table.mfActivePage=$event.value;
|
||||||
this.table.setPage(this.table.mfActivePage, this.rowsOnPage);
|
this.table.setPage(this.searchUtils.page, this.rowsOnPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleModal($event) {
|
toggleModal($event) {
|
||||||
|
@ -231,131 +210,28 @@ export class SearchPageTableViewComponent {
|
||||||
updateUrl(url:string){
|
updateUrl(url:string){
|
||||||
this._meta.updateProperty("og:url", url);
|
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++) {
|
for(var i=0; i< this.refineFields.length ; i++) {
|
||||||
var filterId = this.refineFields[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(params[filterId] != undefined) {
|
||||||
if(this.queryParameters == undefined){
|
if(this.queryParameters == undefined){
|
||||||
this.queryParameters = new Map<string,string>();
|
this.queryParameters = new Map<string,string>();
|
||||||
}
|
}
|
||||||
this.queryParameters[filterId]=decodeURIComponent(params[filterId]);
|
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
|
* Mark as check the new filters that are selected, when you get them from search
|
||||||
*/
|
*/
|
||||||
public checkSelectedFilters(filters:Filter[]){
|
public checkSelectedFilters(filters:Filter[]){
|
||||||
|
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
for(var i=0; i< filters.length ; i++){
|
for(var i=0; i< filters.length ; i++){
|
||||||
var filter:Filter = filters[i];
|
var filter:Filter = filters[i];
|
||||||
filter.countSelectedValues = 0;
|
filter.countSelectedValues = 0;
|
||||||
|
|
||||||
if(this.queryParameters[filter.filterId] != undefined) {
|
if(this.queryParameters[filter.filterId] != undefined) {
|
||||||
let values = (decodeURIComponent(this.queryParameters[filter.filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
|
let values = (decodeURIComponent(this.queryParameters[filter.filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
|
||||||
for(let filterValue of filter.values) {
|
for(let filterValue of filter.values) {
|
||||||
|
@ -364,7 +240,6 @@ export class SearchPageTableViewComponent {
|
||||||
filter.countSelectedValues++;
|
filter.countSelectedValues++;
|
||||||
}else{
|
}else{
|
||||||
filterValue.selected = false;
|
filterValue.selected = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
@ -376,12 +251,7 @@ export class SearchPageTableViewComponent {
|
||||||
|
|
||||||
return filters;
|
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.parameterNames.push("keyword");
|
||||||
this.parameterValues.push(this.searchUtils.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;
|
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(){
|
private isFiltered(){
|
||||||
var filtered=false;
|
var filtered=false;
|
||||||
for (let filter of this.filters){
|
for (let filter of this.filters){
|
||||||
|
@ -514,57 +306,47 @@ export class SearchPageTableViewComponent {
|
||||||
if(this.searchUtils.keyword.length > 0 ){
|
if(this.searchUtils.keyword.length > 0 ){
|
||||||
this.searchUtils.keyword ='';
|
this.searchUtils.keyword ='';
|
||||||
}
|
}
|
||||||
this.goTo(1);
|
this.goTo(1, true);
|
||||||
}
|
}
|
||||||
private clearFilters(){
|
private clearFilters(){
|
||||||
for (var i =0 ; i < this.filters.length; i++) {
|
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) {
|
if(this.filters[i].values[j].selected) {
|
||||||
this.filters[i].values[j].selected = false;
|
this.filters[i].values[j].selected = false;
|
||||||
}
|
}
|
||||||
this.filters[i].countSelectedValues = 0;
|
|
||||||
}
|
}
|
||||||
|
this.filters[i].countSelectedValues = 0;
|
||||||
}
|
}
|
||||||
this.clearKeywords();
|
this.clearKeywords();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private removeFilter(value:Value,filter:Filter){
|
private removeFilter(value:Value,filter:Filter){
|
||||||
filter.countSelectedValues--;
|
filter.countSelectedValues--;
|
||||||
if(value.selected == true){
|
if(value.selected == true){
|
||||||
value.selected = false;
|
value.selected = false;
|
||||||
}
|
}
|
||||||
this.goTo(1);
|
this.goTo(1, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
goTo(page:number = 1){
|
goTo(page:number = 1, triggerPipe:boolean = true){
|
||||||
this.searchUtils.page = page;
|
this.refreshTable(page);
|
||||||
console.info("searchUtils.page goto = "+this.searchUtils.page);
|
if(triggerPipe) {
|
||||||
this.queryParameters = new Map<string,string>();
|
this.triggerPipe = !this.triggerPipe;
|
||||||
|
}
|
||||||
|
|
||||||
var urlParameters = this.createUrlParameters(this.filters,true);
|
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.location.go(location.pathname,urlParameters);
|
||||||
|
|
||||||
this.queryChange.emit({
|
|
||||||
value: queryParameters,
|
|
||||||
index:indexQuery
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filterChanged($event){
|
filterChanged($event){
|
||||||
console.info("filter Changed");
|
console.info("filter Changed");
|
||||||
this.goTo(1);
|
this.goTo(1, true);
|
||||||
}
|
}
|
||||||
keywordChanged($event) {
|
keywordChanged($event) {
|
||||||
this.searchUtils.keyword = $event.value;
|
this.searchUtils.keyword = $event.value;
|
||||||
this.goTo(1);
|
this.goTo(1, true);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
downloadClicked($event) {
|
downloadClicked($event) {
|
||||||
if($event.value == true) {
|
if($event.value == true) {
|
||||||
var queryParameters = this.createSearchQueryParameters(this.filters);
|
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{
|
getSelectedValues(filter):any{
|
||||||
var selected = [];
|
var selected = [];
|
||||||
if(filter.countSelectedValues >0){
|
if(filter.countSelectedValues >0){
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {SearchDownloadModule} from './searchDownload.module';
|
||||||
import {ModalModule} from '../../utils/modal/modal.module';
|
import {ModalModule} from '../../utils/modal/modal.module';
|
||||||
import {PagingModule} from '../../utils/paging.module';
|
import {PagingModule} from '../../utils/paging.module';
|
||||||
import {DataTableModule} from "angular2-datatable";
|
import {DataTableModule} from "angular2-datatable";
|
||||||
|
import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersDatatable.pipe';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -29,6 +30,7 @@ import {DataTableModule} from "angular2-datatable";
|
||||||
//SearchFilterComponent,
|
//SearchFilterComponent,
|
||||||
//SearchFilterModalComponent
|
//SearchFilterModalComponent
|
||||||
,
|
,
|
||||||
|
ContentProvidersDatatablePipe
|
||||||
],
|
],
|
||||||
|
|
||||||
providers:[
|
providers:[
|
||||||
|
@ -37,6 +39,8 @@ import {DataTableModule} from "angular2-datatable";
|
||||||
SearchPageTableViewComponent//,
|
SearchPageTableViewComponent//,
|
||||||
//SearchFilterComponent,
|
//SearchFilterComponent,
|
||||||
//SearchFilterModalComponent
|
//SearchFilterModalComponent
|
||||||
|
,
|
||||||
|
ContentProvidersDatatablePipe
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class SearchPageTableViewModule { }
|
export class SearchPageTableViewModule { }
|
||||||
|
|
|
@ -63,16 +63,10 @@ export class SearchDataprovidersService {
|
||||||
.map(res => [res['meta'].total, this.parseResults(res['results'])])
|
.map(res => [res['meta'].total, this.parseResults(res['results'])])
|
||||||
}
|
}
|
||||||
|
|
||||||
searchCompatibleDataprovidersTable (params: string,refineParams:string):any {
|
searchCompatibleDataprovidersTable ():any {
|
||||||
let size: number = 0;
|
let size: number = 0;
|
||||||
let url: string= OpenaireProperties.getSearchResourcesAPIURL();
|
let url: string= OpenaireProperties.getSearchResourcesAPIURL();
|
||||||
url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
|
url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
|
||||||
if(params!= null && params != '' ) {
|
|
||||||
url += params;
|
|
||||||
}
|
|
||||||
if(refineParams!= null && refineParams != '' ) {
|
|
||||||
url += refineParams;
|
|
||||||
}
|
|
||||||
url += "&page=0&size=1&format=json";
|
url += "&page=0&size=1&format=json";
|
||||||
|
|
||||||
let key = url;
|
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")]);
|
.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 size: number = 0;
|
||||||
let url: string= OpenaireProperties.getSearchResourcesAPIURL();
|
let url: string= OpenaireProperties.getSearchResourcesAPIURL();
|
||||||
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
|
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";
|
url += "&page=0&size=1&format=json";
|
||||||
|
|
||||||
let key = url;
|
let key = url;
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue