[Trunk | Library]:

1. searchUtils.class.ts: In SearchUtilsClass added field "refineStatus:number = 1;" for refine queries.
2. searchResultsPerPage.component.ts & searchSorting.component.ts: [Bug fix] In EventEmitter (value change), emit raw value, not object with field "value".
3. searchDataProviders.component.ts & searchOrganizations.component.ts & searchProjects.component.ts & searchResearchResults.component.ts:
	a. Add subscriptions in array to unsubscribe in ngOnDestroy.
	b. Get properties from environment (no service needed).
	c. Separate queries for refine and results.
	d. Do not call refine query when page, results per page, sortBy change (there is still a bug here).
	e. For refine query, added field "disableRefineForms" default set to false - passed in <new-search-page>.
4. newSearchPage.component.html:
	a. Disable forms when "disableForms" or "disableRefineForms" is true.
	b. Do not show filters, until results query returns, but show results while refine is loading.
	c. Deleted old, unused code.
5. newSearchPage.component.ts:
	a. Added fields "@Input() disableRefineForms: boolean = false;", "@Input() sortedByChanged: string = "";", "@Input() resultsPerPageChanged: number;"
	b. When results per page or sortBy change, do not upadate immediately searchUtils values - do not query for refine when these change (there is still a bug here).


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59155 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-07-21 13:48:55 +00:00
parent 411b4fa3a6
commit b0af2de1bc
9 changed files with 570 additions and 454 deletions

View File

@ -10,6 +10,7 @@ import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.cl
import {EnvProperties} from '../utils/properties/env-properties';
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
import {properties} from "../../../environments/environment";
@Component({
@ -22,10 +23,12 @@ import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
type="content providers"
[results]="results"
[searchUtils]="searchUtils"
[sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size"
[fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
[csvParams]="csvParams" csvPath="datasources"
[simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
[disableForms]="disableForms"
[disableRefineForms]="disableRefineForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[openaireLink]=openaireLink
@ -63,6 +66,7 @@ export class SearchDataProvidersComponent {
public resourcesQuery = "(oaftype exact datasource)";
public csvParams: string;
public disableForms: boolean = false;
public disableRefineForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
public pagingLimit: number = 0;
@ -80,6 +84,9 @@ export class SearchDataProvidersComponent {
@Input() includeOnlyResultsAndFilter: boolean = false;
@Output() searchPageUpdates = new EventEmitter();
@Input() showAdvancedSearchLink:boolean;
subs: any[] = [];
constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
@ -92,31 +99,44 @@ export class SearchDataProvidersComponent {
if(this.showAdvancedSearchLink == null){
this.showAdvancedSearchLink = (this.type == "all");
}
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific;
// this.route.data
// .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= properties;
if (!this.simpleSearchLink) {
this.simpleSearchLink = this.properties.searchLinkToDataProviders;
} this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;
this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink;
this.pagingLimit = data.envSpecific.pagingLimit;
this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
this.pagingLimit = properties.pagingLimit;
this.isPiwikEnabled = properties.enablePiwikTrack;
});
// });
let firstLoad = true;
this.filters = DatasourcesHelperClass.createFilters(this.type);
this.sub = this.route.queryParams.subscribe(params => {
this.subs.push(this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
var refine = true;
if (this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) && this.filters && !firstLoad) {
if (
(this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
&& (this.searchUtils.page == 1 || params['page']))
&& this.filters && !firstLoad
) {
refine = false;
}
if (
(
this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
&& (this.searchUtils.size == 10 || params['size'])
)
&& this.filters && !firstLoad) {
refine = false;
this.searchUtils.status = this.errorCodes.DONE;
}
let page = (params['page']=== undefined)?0:+params['page'];
this.searchUtils.page = ( page < 1 ) ? 1 : page;
@ -133,14 +153,55 @@ export class SearchDataProvidersComponent {
}
// console.log(this.refineFields)
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
if(refine && (this.type == "all" || this.type == "deposit")) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
} else if(refine) { // static filters
this.searchUtils.refineStatus = this.errorCodes.LOADING;
}
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
firstLoad = false;
});
}));
}
ngOnDestroy() {
this.sub.unsubscribe();
for (let sub of this.subs) {
sub.unsubscribe();
}
}
sub: any;
public _getFilters(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){
if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) {
this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.disableRefineForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type);
this.subs.push(this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine && (this.type=="all" || this.type == "deposit")) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit"))
//.switchMap(
.subscribe(
data => {
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(data[2], data[0]);
}
this.searchUtils.refineStatus = this.errorCodes.DONE;
// if (this.searchUtils.totalResults == 0) {
// this.searchUtils.status = this.errorCodes.NONE;
// }
this.disableRefineForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
},
err => {
this.handleError("Error getting organizations: ", err);
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
this.disableRefineForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
}
));
}
}
public getResults(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){
if(page > this.pagingLimit ) {
size=0;
@ -160,23 +221,28 @@ export class SearchDataProvidersComponent {
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.results = [];
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Content Providers: Execute search query "+parameters);
let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type);
this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine && (this.type=="all" || this.type == "deposit")) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe(
data => {
//this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine && (this.type=="all" || this.type == "deposit")) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe(
this.subs.push(this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
//console.log(this.results);
if (refine) {
this.filters =
this.searchPage.prepareFiltersToShow((this.type=="all" || this.type == "deposit")?data[2]:this.filters, this.searchUtils.totalResults);
}else{
// if (refine) {
// this.filters =
// this.searchPage.prepareFiltersToShow((this.type=="all" || this.type == "deposit")?data[2]:this.filters, this.searchUtils.totalResults);
// }else{
if(!refine) {
this.searchPage.buildPageURLParameters(this.filters, [], false);
} else if(this.type != "all" && this.type != "deposit") { // static filters
this.filters = this.searchPage.prepareFiltersToShow(this.filters, this.searchUtils.totalResults);
this.searchUtils.refineStatus = this.errorCodes.DONE;
}
// this.searchPage.updateBaseUrlWithParameters();
//var errorCodes:ErrorCodes = new ErrorCodes();
@ -186,7 +252,7 @@ export class SearchDataProvidersComponent {
}
//this.searchPage.closeLoading();
this.disableForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit
@ -220,10 +286,10 @@ export class SearchDataProvidersComponent {
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
}
);
));
}
}

View File

@ -8,6 +8,7 @@ import {SearchFields} from '../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class';
import {EnvProperties} from '../utils/properties/env-properties';
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
import {properties} from "../../../environments/environment";
@Component({
@ -19,10 +20,12 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
type="organizations"
[results]="results"
[searchUtils]="searchUtils"
[sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size"
[fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
[csvParams]="csvParams" csvPath="organizations"
[simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
[disableForms]="disableForms"
[disableRefineForms]="disableRefineForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[openaireLink]=openaireLink
@ -52,6 +55,7 @@ export class SearchOrganizationsComponent {
public selectedFields:AdvancedField[] = [];
public csvParams: string;
public disableForms: boolean = false;
public disableRefineForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
public pagingLimit: number = 0;
@ -70,6 +74,9 @@ export class SearchOrganizationsComponent {
@Input() showAdvancedSearchLink:boolean = true;
public resourcesQuery = "(oaftype exact organization)";
subs: any[] = [];
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
@ -80,33 +87,48 @@ export class SearchOrganizationsComponent {
}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific;
// this.route.data
// .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= properties;
if (!this.simpleSearchLink) {
this.simpleSearchLink = this.properties.searchLinkToOrganizations;
}
this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;
this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink;
this.pagingLimit = data.envSpecific.pagingLimit;
this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
this.pagingLimit = properties.pagingLimit;
this.isPiwikEnabled = properties.enablePiwikTrack;
});
// });
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
var firstLoad = true;
this.sub = this.route.queryParams.subscribe(params => {
this.subs.push(this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
var refine = true;
if (this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) && this.filters && !firstLoad) {
if (
(
this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
&& (this.searchUtils.page == 1 || params['page'])
)
&& this.filters && !firstLoad) {
refine = false;
}
if (
(
this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
&& (this.searchUtils.size == 10 || params['size'])
)
&& this.filters && !firstLoad) {
refine = false;
this.searchUtils.status = this.errorCodes.DONE;
}
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
@ -122,15 +144,50 @@ export class SearchOrganizationsComponent {
// this.searchPage.customFilter = this.customFilter;
// this.searchPage.getSelectedFiltersFromUrl(params);
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "organization");
if(refine) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
}
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
firstLoad = false;
});
}));
}
ngOnDestroy() {
this.sub.unsubscribe();
for (let sub of this.subs) {
sub.unsubscribe();
}
}
sub: any;
public _getFilters(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){
if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) {
this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.disableRefineForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.subs.push(this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
//.switchMap(
.subscribe(
data => {
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(data[2], data[0]);
}
this.searchUtils.refineStatus = this.errorCodes.DONE;
// if (this.searchUtils.totalResults == 0) {
// this.searchUtils.status = this.errorCodes.NONE;
// }
this.disableRefineForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
},
err => {
this.handleError("Error getting organizations: ", err);
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
this.disableRefineForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
}
));
}
}
public getResults(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){
if(page > this.pagingLimit) {
size=0;
@ -149,19 +206,21 @@ export class SearchOrganizationsComponent {
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.results = [];
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Organizations: Execute search query "+parameters);
this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
//this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
this.subs.push(this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(data[2], this.searchUtils.totalResults);
}else{
// if (refine) {
// this.filters = this.searchPage.prepareFiltersToShow(data[2], this.searchUtils.totalResults);
// }else{
if(!refine) {
this.searchPage.buildPageURLParameters(this.filters, [],false);
}
// this.searchPage.updateBaseUrlWithParameters();
@ -172,7 +231,7 @@ export class SearchOrganizationsComponent {
}
//this.searchPage.closeLoading();
this.disableForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
@ -190,7 +249,7 @@ export class SearchOrganizationsComponent {
//console.log(err);
this.handleError("Error getting organizations", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.searchUtils.totalResults = 0;
//this.searchUtils.totalResults = 0;
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
@ -207,10 +266,10 @@ export class SearchOrganizationsComponent {
//this.searchPage.closeLoading();
this.disableForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
}
);
));
}
}

View File

@ -9,6 +9,7 @@ import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.cl
import {EnvProperties} from '../utils/properties/env-properties';
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
import {properties} from "../../../environments/environment";
@Component({
selector: 'search-projects',
@ -19,10 +20,12 @@ import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
type="projects"
[results]="results"
[searchUtils]="searchUtils"
[sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size"
[fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
[csvParams]="csvParams" csvPath="projects"
[simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
[disableForms]="disableForms"
[disableRefineForms]="disableRefineForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[openaireLink]=openaireLink
@ -60,6 +63,7 @@ export class SearchProjectsComponent {
public resourcesQuery = "(oaftype exact project)";
public csvParams: string;
public disableForms: boolean = false;
public disableRefineForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
public pagingLimit: number = 0;
@ -75,45 +79,74 @@ export class SearchProjectsComponent {
@Output() searchPageUpdates = new EventEmitter();
@Input() showAdvancedSearchLink:boolean = true;
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) {
subs: any[] = [];
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.refineStatus = this.errorCodes.LOADING;
}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific;
// this.route.data
// .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= properties;
if (!this.simpleSearchLink) {
this.simpleSearchLink = this.properties.searchLinkToProjects;
}
this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;
this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink;
this.pagingLimit = data.envSpecific.pagingLimit;
this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
this.pagingLimit = properties.pagingLimit;
this.isPiwikEnabled = properties.enablePiwikTrack;
});
// });
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
var firstLoad = true;
this.sub = this.route.queryParams.subscribe(params => {
this.subs.push(this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
var refine = true;
if (this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) && this.filters && !firstLoad) {
if (
(
this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
&& (this.searchUtils.page == 1 || params['page'])
)
&& this.filters && !firstLoad
) {
refine = false;
this.searchUtils.status = this.errorCodes.DONE;
}
if (
(
this.searchUtils.sortBy != ((params['sortBy'] === undefined) ? "" : params['sortBy'])
&& (this.searchUtils.sortBy == "" || params['sortBy'])
)
&& this.filters && !firstLoad
) {
refine = false;
this.searchUtils.status = this.errorCodes.DONE;
}
if (
(
this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
&& (this.searchUtils.size == 10 || params['size'])
)
&& this.filters && !firstLoad
) {
refine = false;
this.searchUtils.status = this.errorCodes.DONE;
}
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
@ -125,14 +158,51 @@ export class SearchProjectsComponent {
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields = [];
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, "project");
if(refine) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
}
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
firstLoad = false;
});
}));
}
ngOnDestroy() {
this.sub.unsubscribe();
for (let sub of this.subs) {
sub.unsubscribe();
}
}
sub: any;
public _getFilters(parameters: string, page: number, size: number, sortBy: string, refine: boolean, refineFieldsFilterQuery = null) {
if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) {
this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.disableRefineForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.subs.push(this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
//.switchMap(
.subscribe(
data => {
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(data[2], data[0]);
this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
}
this.searchUtils.refineStatus = this.errorCodes.DONE;
// if (this.searchUtils.totalResults == 0) {
// this.searchUtils.status = this.errorCodes.NONE;
// }
this.disableRefineForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
},
err => {
this.handleError("Error getting projects: ", err);
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
this.disableRefineForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
}
));
}
}
public getResults(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){
if(page > this.pagingLimit) {
size=0;
@ -153,20 +223,22 @@ export class SearchProjectsComponent {
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils});
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.results = [];
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Publications: Execute search query "+parameters);
this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
this.subs.push(this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
//this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
// this.searchPage.updateBaseUrlWithParameters();
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(data[2], this.searchUtils.totalResults);
this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
}else{
// if (refine) {
// this.filters = this.searchPage.prepareFiltersToShow(data[2], this.searchUtils.totalResults);
// this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
// }else{
if(!refine) {
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
}
@ -177,7 +249,7 @@ export class SearchProjectsComponent {
}
//this.searchPage.closeLoading();
this.disableForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils})
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
@ -195,7 +267,7 @@ export class SearchProjectsComponent {
//console.log(err);
this.handleError("Error getting projects", err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.searchUtils.totalResults = null;
//this.searchUtils.totalResults = null;
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
@ -212,10 +284,10 @@ export class SearchProjectsComponent {
//this.searchPage.closeLoading();
this.disableForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils})
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
}
);
));
}
}

View File

@ -11,7 +11,6 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
import {properties} from "../../../environments/environment";
@Component({
selector: 'search-research-results',
template: `
@ -21,10 +20,12 @@ import {properties} from "../../../environments/environment";
[type]="getEntityName(resultType, true, true)"
[results]="results"
[searchUtils]="searchUtils"
[sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size"
[fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
[csvParams]="csvParams" [csvPath]="getEntityName(resultType, true, false)"
[simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
[disableForms]="disableForms"
[disableRefineForms]="disableRefineForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[openaireLink]=openaireLink
@ -65,6 +66,7 @@ export class SearchResearchResultsComponent {
public resourcesQuery = "((oaftype exact result) and (resulttypeid exact " + this.resultType + "))";
public csvParams: string;
public disableForms: boolean = false;
public disableRefineForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
@Input() openaireLink: string;
@ -92,6 +94,7 @@ export class SearchResearchResultsComponent {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.refineStatus = this.errorCodes.LOADING;
}
ngOnInit() {
@ -108,16 +111,46 @@ export class SearchResearchResultsComponent {
this.searchUtils.status = this.errorCodes.LOADING;
var firstLoad = true;
this.subs.push(this.route.queryParams.subscribe(params => {
//this.subs.push(this.route.queryParams.switchMap(params => {
this.loadPaging = true;
if (params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
var refine = true;
if (this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) && this.filters && !firstLoad) {
if (
(
this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page'])
&& (this.searchUtils.page == 1 || params['page'])
)
&& this.filters && !firstLoad
) {
refine = false;
this.searchUtils.status = this.errorCodes.DONE;
}
if (
(
this.searchUtils.sortBy != ((params['sortBy'] === undefined) ? "" : params['sortBy'])
&& (this.searchUtils.sortBy == "" || params['sortBy'])
)
&& this.filters && !firstLoad
) {
refine = false;
this.searchUtils.status = this.errorCodes.DONE;
}
if (
(
this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size'])
&& (this.searchUtils.size == 10 || params['size'])
)
&& this.filters && !firstLoad
) {
refine = false;
this.searchUtils.status = this.errorCodes.DONE;
}
let page = (params['page'] === undefined) ? 1 : +params['page'];
this.searchUtils.page = (page <= 0) ? 1 : page;
@ -130,7 +163,11 @@ export class SearchResearchResultsComponent {
this.searchUtils.sortBy = "";
}
this.selectedFields = [];
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap, this.customFilter, params, this.resultType, this.quickFilter);
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter);
if(refine) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
}
this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRangeFields(params) + this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
firstLoad = false;
}));
@ -142,6 +179,38 @@ export class SearchResearchResultsComponent {
}
}
public _getFilters(parameters: string, page: number, size: number, sortBy: string, refine: boolean, refineFieldsFilterQuery = null) {
if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) {
this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.disableRefineForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
//.switchMap(
.subscribe(
data => {
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(data[2], data[0]);
this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
}
this.searchUtils.refineStatus = this.errorCodes.DONE;
// if (this.searchUtils.totalResults == 0) {
// this.searchUtils.status = this.errorCodes.NONE;
// }
this.disableRefineForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
},
err => {
this.handleError("Error getting " + this.getEntityName(this.resultType, true, true), err);
this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
this.disableRefineForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
}
));
}
}
public _getResults(parameters: string, page: number, size: number, sortBy: string, refine: boolean, refineFieldsFilterQuery = null) {
if (page > this.pagingLimit) {
size = 0;
@ -157,65 +226,66 @@ export class SearchResearchResultsComponent {
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils});
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.results = [];
this.searchUtils.totalResults = 0;
this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
//this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery)
.subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(data[2], this.searchUtils.totalResults);
this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
} else {
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
}
this.searchUtils.status = this.errorCodes.DONE;
if (this.searchUtils.totalResults == 0) {
this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils})
if (this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages: any = this.searchUtils.totalResults / (this.searchUtils.size);
if (!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if (totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
this.handleError("Error getting " + this.getEntityName(this.resultType, true, true), err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.searchUtils.totalResults = null;
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils})
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
// if (refine) {
// this.filters = this.searchPage.prepareFiltersToShow(data[2],this.searchUtils.totalResults);
// this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
// } else {
if(!refine) {
this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
}
));
this.searchUtils.status = this.errorCodes.DONE;
if (this.searchUtils.totalResults == 0) {
this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
if (this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages: any = this.searchUtils.totalResults / (this.searchUtils.size);
if (!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if (totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
this.handleError("Error getting " + this.getEntityName(this.resultType, true, true), err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils})
}
));
}
}

View File

@ -11,10 +11,11 @@
<ng-container *ngIf="selectedTypesNum > 0 && resultTypes">
<ng-container *ngFor="let type of resultTypeOptions; let i = index; let end = last; ">
<ng-container *ngIf="resultTypes[type.id] == true">
<span class="uk-grid-margin" [title]="'Remove '+ type.name" (click)="removeResultType(type.id) ">
<span [title]="'Remove '+ type.name" (click)="removeResultType(type.id) "
[class]="((disableForms || disableRefineForms) ? 'uk-disabled' : 'clickable') + ' uk-grid-margin'">
<span class="selectedFilterLabel ">
<a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '">
<span class=" clickable" aria-hidden="true">
<a class="uk-link-text">
<span aria-hidden="true">
<span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close"
ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path
@ -31,10 +32,11 @@
<ng-container *ngIf="selectedRangeFilters > 0">
<ng-container *ngFor="let filter of rangeFilters ">
<ng-container *ngIf="filter.selectedFromAndToValues">
<span [title]="'Remove '+ filter.selectedFromAndToValues" (click)="removeRangeFilter(filter) " class="uk-grid-margin" >
<span [title]="'Remove '+ filter.selectedFromAndToValues" (click)="removeRangeFilter(filter) "
[class]="((disableForms || disableRefineForms) ? 'uk-disabled' : 'clickable') + ' uk-grid-margin'">
<span class="selectedFilterLabel ">
<a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '">
<span class=" clickable" aria-hidden="true">
<a class="uk-link-text">
<span aria-hidden="true">
<span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6"
@ -54,11 +56,12 @@
<ng-container *ngFor="let filter of filters ">
<ng-container *ngIf="filter.countSelectedValues > 0">
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; "
[title]="'Remove '+value.name" (click)="removeFilter(value, filter) " class="uk-grid-margin" >
[title]="'Remove '+value.name" (click)="removeFilter(value, filter) "
[class]="((disableForms || disableRefineForms) ? 'uk-disabled' : 'clickable') + ' uk-grid-margin'">
<!-- if no grid on the div above, remove it and move class 'selectedFilterLabel' on top span -->
<span class="selectedFilterLabel ">
<a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '">
<span class=" clickable" aria-hidden="true">
<a class="uk-link-text">
<span aria-hidden="true">
<span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6"
@ -85,7 +88,7 @@
Filters
</h5>
<a *ngIf="(selectedRangeFilters+selectedFilters + selectedTypesNum)>1" (click)="clearFilters()"
[class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
[class]="((disableForms || disableRefineForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
</div>
@ -94,36 +97,43 @@
<ng-container *ngTemplateOutlet="selected_filters_pills; context: {}"></ng-container>
</div>
</div>
<div *ngIf="filters.length === 0 && results.length > 0" class="uk-margin-top">
<div *ngIf="searchUtils.refineStatus == errorCodes.LOADING && filters.length === 0"
class="'uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
<span class="loading-gif uk-align-center" ></span>
</div>
<div *ngIf="searchUtils.refineStatus == errorCodes.DONE && filters.length === 0 && results.length > 0" class="uk-margin-top">
<span class="uk-text-meta">No filters available</span>
</div>
<ul *ngIf="!showUnknownFilters"
[class]="'uk-list uk-list-divider' + (selectedRangeFilters == 0 && selectedFilters == 0 ? ' uk-margin-small-top' : '')">
<ng-container *ngIf="filters.length > 0 && filters[0].values.length >0 && filters[0].filterId ==
'resultbestaccessright'">
<!-- searchUtils.refineStatus == errorCodes.DONE &&-->
<ng-container *ngIf="filters.length > 0 && filters[0].values.length >0 && filters[0].filterId == 'resultbestaccessright'">
<li>
<search-filter [filterValuesNum]="filterValuesNum" [showMoreInline]="showMoreFilterValuesInline"
[isDisabled]="disableForms" [filter]="filters[0]" [showResultCount]=showResultCount
[isDisabled]="disableForms || disableRefineForms"
[filter]="filters[0]" [showResultCount]=showResultCount
(onFilterChange)="filterChanged($event)"></search-filter>
</li>
</ng-container>
<li *ngIf="resultTypes && (filters.length > 0)">
<quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()"
[isDisabled]="disableForms"
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
[properties]="properties" [vertical]="true" [delayTime]="0">
</quick-selections>
<quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()"
[isDisabled]="disableForms || disableRefineForms"
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
[properties]="properties" [vertical]="true" [delayTime]="0">
</quick-selections>
</li>
<ng-container *ngFor="let filter of rangeFilters">
<li>
<range-filter [isDisabled]="disableForms" [filter]="filter"
<range-filter [isDisabled]="disableForms || disableRefineForms" [filter]="filter"
(onFilterChange)="filterChanged($event)"></range-filter>
</li>
</ng-container>
<ng-container *ngFor="let filter of filters ">
<li *ngIf="filter.values && filter.filterId != 'resultbestaccessright'">
<search-filter [filterValuesNum]="filterValuesNum" [showMoreInline]="showMoreFilterValuesInline"
[isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount
[isDisabled]="disableForms || disableRefineForms"
[filter]="filter" [showResultCount]=showResultCount
(onFilterChange)="filterChanged($event)"></search-filter>
</li>
</ng-container>
@ -159,7 +169,7 @@
[fieldIdsMap]="fieldIdsMap"
[selectedFields]="selectedFields"
(queryChange)="queryChanged()"
[isDisabled]="disableForms"
[isDisabled]="disableForms || disableRefineForms"
[simpleSearchLink]="simpleSearchLink"
[advancedSearchLink]="advancedSearchLink"
[advancedSearchLinkParameters]
@ -192,9 +202,7 @@
addClass=" " [breadcrumbs]="breadcrumbs"></breadcrumbs>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']"></helper>
<div [class]="(showRefine && !this.properties.isDashboard)?
'uk-width-4-5@m uk-width-4-5@l uk-width-1-1@s'
:'uk-width-1-1'">
<div [class]="(showRefine && !properties.isDashboard)? 'uk-width-4-5@m uk-width-4-5@l uk-width-1-1@s' :'uk-width-1-1'">
<div *ngIf="showRefine" class="uk-offcanvas-content uk-hidden@m uk-margin-top">
<a href="#offcanvas-usage" uk-toggle>
@ -228,102 +236,7 @@
<div class="uk-offcanvas-bar offcanvas-white">
<button class="uk-offcanvas-close" type="button" uk-close></button>
<div class="uk-width-1-1">
<!-- <span *ngIf="tableViewLink " class="uk-width-expand">-->
<!-- <span *ngIf="tableViewLink">-->
<!-- <a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >-->
<!-- <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>-->
<!-- </a>-->
<!-- <span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>-->
<!-- </span>-->
<!-- </span>-->
<!-- <search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && ( entityType !=-->
<!-- 'community' && entityType != 'stakeholder') && usedBy == 'search'"-->
<!-- class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">-->
<!-- </search-download>-->
<!-- HERE-->
<!-- <div *ngIf="selectedRangeFilters > 0 || selectedFilters > 0" class="uk-margin-top uk-margin-small-bottom">-->
<!--&lt;!&ndash; <div class="uk-grid uk-margin-bottom uk-margin-top">&ndash;&gt;-->
<!--&lt;!&ndash; <span class="uk-text-bold uk-text-large">Filters</span>&ndash;&gt;-->
<!--&lt;!&ndash; <a *ngIf="selectedFilters>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">&ndash;&gt;-->
<!--&lt;!&ndash; Clear All&ndash;&gt;-->
<!--&lt;!&ndash; </a>&ndash;&gt;-->
<!--&lt;!&ndash; </div>&ndash;&gt;-->
<!-- <div class="uk-grid uk-flex uk-flex-bottom">-->
<!-- <h5 class="uk-text-bold">Filters</h5>-->
<!-- <a *ngIf="(selectedRangeFilters+selectedFilters)>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">-->
<!-- Clear All-->
<!-- </a>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div *ngIf="selectedRangeFilters > 0 || selectedFilters>0" class="uk-margin-medium-bottom uk-grid uk-grid-small uk-text-small" uk-grid>-->
<!-- <ng-container *ngIf="selectedRangeFilters > 0">-->
<!-- <ng-container *ngFor="let filter of rangeFilters " >-->
<!-- <ng-container *ngIf = "filter.selectedFromAndToValues">-->
<!-- <span [title]="'Remove '+ filter.selectedFromAndToValues" (click) = "removeRangeFilter(filter) " >-->
<!-- <span class="selectedFilterLabel ">-->
<!-- <a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '">-->
<!-- <span class=" clickable" aria-hidden="true">-->
<!-- <span class="uk-icon">-->
<!-- <svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>-->
<!-- </span>-->
<!-- </span>-->
<!-- <span class="uk-margin-small-left">{{filter.selectedFromAndToValues}}</span>-->
<!-- </a>-->
<!-- </span>-->
<!-- </span>-->
<!-- </ng-container>-->
<!-- </ng-container>-->
<!-- </ng-container>-->
<!-- <ng-container *ngFor="let filter of filters " >-->
<!-- <ng-container *ngIf = "filter.countSelectedValues > 0">-->
<!-- &lt;!&ndash; <span class="uk-text-bold">{{filter.title}}:</span>&ndash;&gt;-->
<!-- &lt;!&ndash; uk-margin-small-top uk-margin-small-right&ndash;&gt; &lt;!&ndash; if no grid on the div above, add it &ndash;&gt;-->
<!-- &lt;!&ndash; uk-label &ndash;&gt;-->
<!-- <span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; "-->
<!-- [title]="'Remove '+value.name" (click) = "removeFilter(value, filter) " >-->
<!-- &lt;!&ndash; if no grid on the div above, remove it and move class 'selectedFilterLabel' on top span &ndash;&gt;-->
<!-- <span class="selectedFilterLabel ">-->
<!-- <a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '">-->
<!-- <span class=" clickable" aria-hidden="true">-->
<!-- <span class="uk-icon">-->
<!-- <svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>-->
<!-- </span>-->
<!-- </span>-->
<!-- <span class="uk-margin-small-left" [innerHtml]="(value.name.length > 34)?value.name.substring(0,34)+'...':value.name"></span>-->
<!-- </a>-->
<!-- </span>-->
<!-- </span>-->
<!-- </ng-container>-->
<!-- </ng-container>-->
<!-- </div>-->
<!--&lt;!&ndash; <div class="uk-margin-small-bottom uk-margin-small-top uk-grid">&ndash;&gt;-->
<!--&lt;!&ndash; <a *ngIf= "showUnknownFilters" class = " portal-link" (click) = "clearFilters() " >Try new Query</a>&ndash;&gt;-->
<!--&lt;!&ndash; </div>&ndash;&gt;-->
<!-- <div *ngIf="filters.length === 0 && searchUtils.keyword.length === 0 && results.length > 0" class="uk-margin-top">-->
<!-- <span class="uk-text-meta">No filters available</span>-->
<!-- </div>-->
<!-- <ul *ngIf="!showUnknownFilters" class="uk-list uk-list-divider">-->
<!-- <ng-container *ngFor="let filter of rangeFilters">-->
<!-- <li>-->
<!-- <range-filter [isDisabled]="disableForms" [filter]="filter" (onFilterChange)="filterChanged($event)"></range-filter>-->
<!-- </li>-->
<!-- </ng-container>-->
<!-- <ng-container *ngFor="let filter of filters ">-->
<!-- <li *ngIf= "filter.values.length >0">-->
<!-- <search-filter [filterValuesNum]="filterValuesNum" [showMoreInline]="showMoreFilterValuesInline" [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (onFilterChange)="filterChanged($event)" ></search-filter>-->
<!-- </li>-->
<!-- </ng-container>-->
<!-- </ul>-->
<ng-container *ngTemplateOutlet="filters_column; context: {}"></ng-container>
<!-- END OF HERE-->
</div>
</div>
</div>
@ -335,7 +248,7 @@
<a *ngIf="showAdvancedSearchLink && advancedSearchLink" routerLinkActive="router-link-active"
[routerLink]="advancedSearchLink" style="z-index:1;"
[queryParams]="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
[class]="(disableForms?' uk-disabled uk-link-muted ':'') +' portal-link uk-float-right '">Advanced
[class]="((disableForms || disableRefineForms)?' uk-disabled uk-link-muted ':'') +' portal-link uk-float-right '">Advanced
search
</a>
<!-- <quick-selections [resultTypes]="resultTypes"
@ -347,209 +260,135 @@
</div>
<div class="uk-grid helper-grid uk-padding-small uk-padding-remove-vertical uk-margin-large-bottom">
<div *ngIf="showRefine && !properties.isDashboard" class="uk-width-1-4@m search-filters uk-visible@m">
<!-- top: #container-1; bottom: #true; -->
<!-- <div id="container-1" style="z-index: -1;" uk-sticky="top: #container-1; offset: 120; "> -->
<!-- <span *ngIf="tableViewLink" class="uk-width-expand">-->
<!-- <span *ngIf="tableViewLink">-->
<!-- <a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >-->
<!-- <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>-->
<!-- </a>-->
<!-- <span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>-->
<!-- </span>-->
<!-- </span>-->
<!-- <search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && ( entityType !=-->
<!-- 'community' && entityType != 'stakeholder') && usedBy == 'search'"-->
<!-- class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">-->
<!-- </search-download>-->
<!-- HERE-->
<!-- <div *ngIf="selectedRangeFilters > 0 || selectedFilters > 0" class="uk-width-1-1 uk-margin-top uk-margin-medium-bottom ">-->
<!-- <div class="uk-grid uk-flex uk-flex-bottom">-->
<!-- <h5 class="uk-text-bold">Filters</h5>-->
<!-- <a *ngIf="(selectedRangeFilters+selectedFilters)>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">-->
<!-- Clear All-->
<!-- </a>-->
<!-- </div>-->
<!-- &lt;!&ndash; uk-grid uk-grid-small" uk-grid&ndash;&gt;-->
<!-- &lt;!&ndash; uk-margin-left&ndash;&gt;-->
<!-- <div class="uk-grid uk-grid-small uk-text-small" uk-grid>-->
<!-- <ng-container *ngIf="selectedRangeFilters > 0">-->
<!-- <ng-container *ngFor="let filter of rangeFilters " >-->
<!-- <ng-container *ngIf = "filter.selectedFromAndToValues">-->
<!-- <span [title]="'Remove '+ filter.selectedFromAndToValues" (click) = "removeRangeFilter(filter) " >-->
<!-- <span class="selectedFilterLabel ">-->
<!-- <a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '">-->
<!-- <span class=" clickable" aria-hidden="true">-->
<!-- <span class="uk-icon">-->
<!-- <svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>-->
<!-- </span>-->
<!-- </span>-->
<!-- <span class="uk-margin-small-left">{{filter.selectedFromAndToValues}}</span>-->
<!-- </a>-->
<!-- </span>-->
<!-- </span>-->
<!-- </ng-container>-->
<!-- </ng-container>-->
<!-- </ng-container>-->
<!-- <ng-container *ngFor="let filter of filters " >-->
<!-- <ng-container *ngIf = "filter.countSelectedValues > 0">-->
<!-- &lt;!&ndash; <span class="uk-text-bold">{{filter.title}}:</span>&ndash;&gt;-->
<!-- &lt;!&ndash; uk-margin-small-top uk-margin-small-right&ndash;&gt; &lt;!&ndash; if no grid on the div above, add it &ndash;&gt;-->
<!-- &lt;!&ndash; uk-label &ndash;&gt;-->
<!-- <span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; "-->
<!-- [title]="'Remove '+value.name" (click) = "removeFilter(value, filter) " >-->
<!-- &lt;!&ndash; if no grid on the div above, remove it and move class 'selectedFilterLabel' on top span &ndash;&gt;-->
<!-- <span class="selectedFilterLabel ">-->
<!-- <a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '">-->
<!-- <span class=" clickable" aria-hidden="true">-->
<!-- <span class="uk-icon">-->
<!-- <svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>-->
<!-- </span>-->
<!-- </span>-->
<!-- <span class="uk-margin-small-left" [innerHtml]="(value.name.length > 34)?value.name.substring(0,34)+'...':value.name"></span>-->
<!-- </a>-->
<!-- </span>-->
<!-- </span>-->
<!-- </ng-container>-->
<!-- </ng-container>-->
<!-- </div>-->
<!-- &lt;!&ndash; <div class="uk-margin-small-bottom uk-margin-small-top uk-grid">&ndash;&gt;-->
<!-- &lt;!&ndash; <a *ngIf= "showUnknownFilters" class = " portal-link" (click) = "clearFilters() " >Try new Query</a>&ndash;&gt;-->
<!-- &lt;!&ndash; </div>&ndash;&gt;-->
<!-- </div>-->
<!-- <div *ngIf="filters.length === 0 && results.length > 0" class="uk-margin-top">-->
<!-- <span class="uk-text-meta">No filters available</span>-->
<!-- </div>-->
<!-- <ul *ngIf="!showUnknownFilters"-->
<!-- [class]="'uk-list uk-list-divider' + (selectedRangeFilters == 0 && selectedFilters == 0 ? ' uk-margin-small-top' : '')">-->
<!-- <ng-container *ngFor="let filter of rangeFilters">-->
<!-- <li>-->
<!-- <range-filter [isDisabled]="disableForms" [filter]="filter" (onFilterChange)="filterChanged($event)"></range-filter>-->
<!-- </li>-->
<!-- </ng-container>-->
<!-- <ng-container *ngFor="let filter of filters ">-->
<!-- <li *ngIf= "filter.values.length >0">-->
<!-- <search-filter [filterValuesNum]="filterValuesNum" [showMoreInline]="showMoreFilterValuesInline" [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (onFilterChange)="filterChanged($event)" ></search-filter>-->
<!-- </li>-->
<!-- </ng-container>-->
<!-- </ul>-->
<!--context: { dynamic_content: getDynamicContent(share_research_results_type) }">-->
<ng-container *ngTemplateOutlet="filters_column; context: {}"></ng-container>
<!-- END OF HERE-->
<!-- && searchUtils.refineStatus == errorCodes.LOADING-->
<div *ngIf="searchUtils.status == errorCodes.LOADING && filters.length == 0;
else elseGridBlock"
class="'uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
<span class="loading-gif uk-align-center" ></span>
</div>
<div class="uk-width-expand@m uk-with-1-1@s">
<div *ngIf="properties.isDashboard && selectedRangeFilters+selectedFilters + selectedTypesNum > 0"
class="uk-width-1-1 uk-margin-top uk-margin-medium-bottom ">
<div class="uk-flex uk-flex-bottom">
<span class="uk-margin-small-right">Filters: </span>
<ng-container *ngTemplateOutlet="selected_filters_pills; context: {}"></ng-container>
<div>
<ng-template #elseGridBlock>
<div *ngIf="showRefine && !properties.isDashboard" class="uk-width-1-4@m search-filters uk-visible@m">
<ng-container *ngTemplateOutlet="filters_column; context: {}"></ng-container>
</div>
</div>
<div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )"><a
class="uk-margin-top uk-button uk-button-text"
[href]="openaireLink+this.routerHelper.createQueryParamsString(this.parameterNames, this.parameterValues)"
target="_blank">Results in OpenAIRE</a></div>
<div class="uk-align-center uk-margin-remove-bottom">
<div
*ngIf="(results && searchUtils.totalResults > 0) || (!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING)"
class="uk-grid uk-margin-top uk-margin-bottom">
<div class="uk-width-expand@m uk-grid uk-grid-medium uk-margin-small-bottom">
<search-results-per-page [(size)]="searchUtils.size"
(sizeChange)="sizeChanged($event)"></search-results-per-page>
<search-sorting *ngIf="sort" [entityType]="entityType" [(sortBy)]="searchUtils.sortBy"
(sortByChange)="sortByChanged($event)"></search-sorting>
<div class="uk-width-expand@m uk-with-1-1@s">
<div *ngIf="properties.isDashboard && selectedRangeFilters+selectedFilters + selectedTypesNum > 0"
class="uk-width-1-1 uk-margin-top uk-margin-medium-bottom ">
<div class="uk-flex uk-flex-bottom">
<span class="uk-margin-small-right">Filters: </span>
<ng-container *ngTemplateOutlet="selected_filters_pills; context: {}"></ng-container>
</div>
</div>
<div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )"><a
class="uk-margin-top uk-button uk-button-text"
[href]="openaireLink+this.routerHelper.createQueryParamsString(this.parameterNames, this.parameterValues)"
target="_blank">Results in OpenAIRE</a></div>
<div class="uk-align-center uk-margin-remove-bottom">
<div
*ngIf="(results && searchUtils.totalResults > 0) || (!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING)"
class="uk-grid uk-margin-top uk-margin-bottom">
<div class="uk-width-expand@m uk-grid uk-grid-medium uk-margin-small-bottom">
<search-results-per-page [size]="searchUtils.size"
(sizeChange)="sizeChanged($event)"
[isDisabled]="disableForms || disableRefineForms">
</search-results-per-page>
<search-sorting *ngIf="sort"
[entityType]="entityType" [sortBy]="searchUtils.sortBy"
(sortByChange)="sortByChanged($event)"
[isDisabled]="disableForms || disableRefineForms">
</search-sorting>
</div>
<!-- uk-flex uk-flex-middle-->
<div class="uk-width-auto@m uk-margin-small-bottom">
<!-- !showUnknownFilters && (searchUtils.totalResults > 0 || !loadPaging)-->
<search-download
*ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
[isDisabled]="disableForms"
[type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
</search-download>
<div class="uk-width-auto@m uk-margin-small-bottom">
<!-- !showUnknownFilters && (searchUtils.totalResults > 0 || !loadPaging)-->
<search-download
*ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
[isDisabled]="disableForms || disableRefineForms"
[type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
</search-download>
<!--<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active"
[class]="((disableForms)?'uk-disabled uk-link-muted':'')+' uk-link-text uk-margin-small-left'"
[routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
Table view
</a>
&lt;!&ndash; <span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>&ndash;&gt;
</span>-->
<!--<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active"
[class]="((disableForms)?'uk-disabled uk-link-muted':'')+' uk-link-text uk-margin-small-left'"
[routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
Table view
</a>
&lt;!&ndash; <span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>&ndash;&gt;
</span>-->
</div>
</div>
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults"
[(searchUtils)]="searchUtils" [(results)]="results" [(baseUrl)]="searchUtils.baseUrl"
[(parameterNames)]="parameterNames" [(parameterValues)]="parameterValues"
[isDisabled]="disableForms || disableRefineForms">
</search-paging>
</div>
<!-- <search-download *ngIf= "( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"-->
<!-- class="uk-width-1-1@s uk-hidden@m"-->
<!-- [isDisabled]="disableForms"-->
<!-- [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">-->
<!-- </search-download>-->
<div *ngIf="(searchUtils.page <= pagingLimit)" class="uk-margin-large-bottom">
<search-result *ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
[results]="results"
[status]=searchUtils.status
[type]="entityType"
[showLoading]="true" [properties]=properties [showImpactFactors]="(customFilter &&
customFilter.queryFieldName == 'communityId' && customFilter.valueId == 'elixir-gr')">
</search-result>
<deposit-result *ngIf="usedBy == 'deposit'"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"
[zenodoInformation]="zenodoInformation"
[properties]=properties>
</deposit-result>
<portal-search-result
*ngIf="(entityType == 'community' || entityType == 'stakeholder') && usedBy == 'search'"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"
[showType]="false"
[showLoading]="true" [properties]=properties>
</portal-search-result>
</div>
<div [class]="searchUtils.page > pagingLimit ? 'search-results' : ''"
*ngIf="(searchUtils.page >= pagingLimit) && (searchUtils.totalResults > searchUtils.size*pagingLimit)">
<p class="uk-alert-warning" uk-alert>For more results please try a new, more specific query</p>
</div>
<div class="uk-align-center uk-margin-remove-bottom">
<!-- <div *ngIf="(results && searchUtils.totalResults > 0) || (!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING)"-->
<!-- class="uk-grid uk-margin-top uk-margin-bottom">-->
<!-- <search-results-per-page class="uk-width-1-2@m uk-width-1-1" [(size)]="searchUtils.size" (sizeChange)="sizeChanged($event)"></search-results-per-page>-->
<!-- <search-sorting class="uk-width-1-2@m uk-width-1-1" *ngIf="sort" [(sortBy)]="searchUtils.sortBy" (sortByChange)="sortByChanged($event)"></search-sorting>-->
<!-- </div>-->
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults"
[(searchUtils)]="searchUtils" [(results)]="results" [(baseUrl)]="searchUtils.baseUrl"
[(parameterNames)]="parameterNames" [(parameterValues)]="parameterValues"
[isDisabled]="disableForms || disableRefineForms">
</search-paging>
</div>
<a *ngIf="properties.showLastIndexInformationLink && lastIndex && searchUtils.status !== errorCodes.LOADING"
class="last_index_info uk-button-text uk-button"
[href]="properties.lastIndexInformationLink" target="_blank">
Last index information
</a>
</div>
</div>
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults"
[(searchUtils)]="searchUtils" [(results)]="results" [(baseUrl)]="searchUtils.baseUrl"
[(parameterNames)]="parameterNames"
[(parameterValues)]="parameterValues"></search-paging>
</div>
<!-- <search-download *ngIf= "( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"-->
<!-- class="uk-width-1-1@s uk-hidden@m"-->
<!-- [isDisabled]="disableForms"-->
<!-- [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">-->
<!-- </search-download>-->
<div *ngIf="(searchUtils.page <= pagingLimit)" class="uk-margin-large-bottom">
<search-result *ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
[results]="results"
[status]=searchUtils.status
[type]="entityType"
[showLoading]="true" [properties]=properties [showImpactFactors]="(customFilter &&
customFilter.queryFieldName == 'communityId' && customFilter.valueId == 'elixir-gr')">
</search-result>
<deposit-result *ngIf="usedBy == 'deposit'"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"
[zenodoInformation]="zenodoInformation"
[properties]=properties>
</deposit-result>
<portal-search-result
*ngIf="(entityType == 'community' || entityType == 'stakeholder') && usedBy == 'search'"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"
[showType]="false"
[showLoading]="true" [properties]=properties>
</portal-search-result>
</div>
<div [class]="searchUtils.page > pagingLimit ? 'search-results' : ''"
*ngIf="(searchUtils.page >= pagingLimit) && (searchUtils.totalResults > searchUtils.size*pagingLimit)">
<p class="uk-alert-warning" uk-alert>For more results please try a new, more specific query</p>
</div>
<div class="uk-align-center uk-margin-remove-bottom">
<!-- <div *ngIf="(results && searchUtils.totalResults > 0) || (!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING)"-->
<!-- class="uk-grid uk-margin-top uk-margin-bottom">-->
<!-- <search-results-per-page class="uk-width-1-2@m uk-width-1-1" [(size)]="searchUtils.size" (sizeChange)="sizeChanged($event)"></search-results-per-page>-->
<!-- <search-sorting class="uk-width-1-2@m uk-width-1-1" *ngIf="sort" [(sortBy)]="searchUtils.sortBy" (sortByChange)="sortByChanged($event)"></search-sorting>-->
<!-- </div>-->
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults"
[(searchUtils)]="searchUtils" [(results)]="results" [(baseUrl)]="searchUtils.baseUrl"
[(parameterNames)]="parameterNames"
[(parameterValues)]="parameterValues"></search-paging>
</div>
<a *ngIf="properties.showLastIndexInformationLink && lastIndex && searchUtils.status !== errorCodes.LOADING"
class="last_index_info uk-button-text uk-button"
[href]="properties.lastIndexInformationLink" target="_blank">
Last index information
</a>
</div>
</ng-template>
<!-- <div class="uk-visible@m uk-margin-top uk-width-1-5">-->
<!-- <search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>-->
<!-- </div>-->
<!-- <helper *ngIf="searchUtils.totalResults > csvLimit" class="uk-margin-top helper-left-right uk-visible@m" position="right"></helper> -->
</div>
</div>
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0"
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0"
[texts]="pageContents['bottom']"></helper>
</div>
</div>

View File

@ -47,11 +47,14 @@ export class NewSearchPageComponent {
@Input() simpleSearchLink: string = "";
@Input() advancedSearchLink: string = "";
@Input() disableForms: boolean = false;
@Input() disableRefineForms: boolean = false;
@Input() loadPaging: boolean = true;
@Input() oldTotalResults: number = 0;
@Input() openaireLink: string;
@Input() customFilter: SearchCustomFilter;
@Input() sort: boolean = true;
@Input() sortedByChanged: string = "";
@Input() resultsPerPageChanged: number;
@Input() searchFormClass: string = "searchForm";
//From simple:
@Input() rangeFilters: RangeFilter[] = [];
@ -153,6 +156,7 @@ export class NewSearchPageComponent {
}else if(!this.simpleView && this.advancedSearchLink) {
this.breadcrumbs.push({name: "Advanced Search", route: null});
}
//console.log(this.filters)
}
private getPageContents() {
@ -250,6 +254,7 @@ export class NewSearchPageComponent {
if (this.quickFilter) {
this.removeValueFromQuickFilter();
}
this.resultTypes = {};
for(let type of this.resultTypeOptions){
this.resultTypes[type.id]=false;
}
@ -289,12 +294,15 @@ export class NewSearchPageComponent {
sizeChanged($event) {
this.searchUtils.size = $event.value;
//this.searchUtils.size = $event.value;
this.resultsPerPageChanged = $event;
this.goTo(1);
}
sortByChanged($event) {
this.searchUtils.sortBy = $event.value;
//this.searchUtils.sortBy = $event.value;
this.sortedByChanged = $event;
this.goTo(1);
}
@ -1162,14 +1170,18 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
this.parameterValues.push("" + this.searchUtils.page);
}
if (this.searchUtils.size != this.resultsPerPage) {
//if (this.searchUtils.size != this.resultsPerPage) {
if (this.resultsPerPageChanged && this.resultsPerPageChanged != this.resultsPerPage) {
this.parameterNames.push("size");
this.parameterValues.push("" + this.searchUtils.size);
//this.parameterValues.push("" + this.searchUtils.size);
this.parameterValues.push("" + this.resultsPerPageChanged);
}
if (this.sort && this.searchUtils.sortBy) {
//if (this.sort && this.searchUtils.sortBy) {
if (this.sort && this.sortByChanged) {
this.parameterNames.push("sortBy");
this.parameterValues.push(this.searchUtils.sortBy);
//this.parameterValues.push(this.searchUtils.sortBy);
this.parameterValues.push(this.sortedByChanged);
}
for (let filter of filters) {
var filterLimits = "";
@ -1410,6 +1422,7 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
this.showUnknownFilters = true;
this.filters = filters;
}
this.buildPageURLParameters(this.URLCreatedFilters, this.URLCreatedRangeFilters, true);
//this.checkSelectedRangeFilters(this.rangeFilters);

View File

@ -30,8 +30,6 @@ export class SearchResultsPerPageComponent {
ngOnInit() {}
sizeChanged() {
this.sizeChange.emit({
value: this.size
});
this.sizeChange.emit(this.size);
}
}

View File

@ -44,8 +44,6 @@ export class SearchSortingComponent {
sortByChanged() {
this.sortByChange.emit({
value: this.sortBy
});
this.sortByChange.emit(this.sortBy);
}
}

View File

@ -2,6 +2,7 @@ export class SearchUtilsClass{
page:number = 1;
size:number = 10;
status:number = 1;
refineStatus:number = 1;
keyword:string = "";
baseUrl:string = "";
totalResults = null;