[Library|Trunk]

Advanced Search pages:
        remove EventEmitter queryChange 
        Clean up goTo function 
        add documentation
        remove unused functions/valiables



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58030 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-01-29 12:25:39 +00:00
parent 100d120018
commit 95122e54a7
5 changed files with 28 additions and 69 deletions

View File

@ -1,13 +1,11 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Observable} from 'rxjs';
import { Router, ActivatedRoute} from '@angular/router';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
@ -21,7 +19,6 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[(results)] = "results"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[(searchUtils)] = "searchUtils"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="datasources" simpleSearchLink="/search/find/dataproviders"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
@ -77,6 +74,7 @@ export class AdvancedSearchDataProvidersComponent {
this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
@ -172,15 +170,6 @@ export class AdvancedSearchDataProvidersComponent {
}
}
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
//this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
//console.info("queryChanged: Execute search query "+parameters);
}
private handleError(message: string, error) {
console.error("Content Providers advanced Search Page: "+message, error);
}

View File

@ -1,13 +1,11 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Observable} from 'rxjs';
import { Router, ActivatedRoute} from '@angular/router';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
@ -20,7 +18,6 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="organizations" simpleSearchLink="/search/find/organizations"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
@ -77,6 +74,7 @@ public resourcesQuery = "(oaftype exact organization)";
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
@ -177,15 +175,6 @@ public resourcesQuery = "(oaftype exact organization)";
//TODO set filters from
}
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
//this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
//console.info("queryChanged: Execute search query "+parameters);
}
private handleError(message: string, error) {
console.error("Organizations advanced Search Page: "+message, error);
}

View File

@ -1,13 +1,11 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Observable} from 'rxjs';
import { Router, ActivatedRoute} from '@angular/router';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchProjectsService} from '../../services/searchProjects.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
@ -19,7 +17,6 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="projects" simpleSearchLink="/search/find/projects"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
@ -78,6 +75,7 @@ export class AdvancedSearchProjectsComponent {
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
@ -175,18 +173,6 @@ export class AdvancedSearchProjectsComponent {
);
}
}
private setFilters(){
//TODO set filters from
}
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
//this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
//console.info("queryChanged: Execute search query "+parameters);
}
private handleError(message: string, error) {
console.error("Projects advanced Search Page: "+message, error);

View File

@ -20,7 +20,6 @@ import {EnvProperties} from '../../utils/properties/env-properties';
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" [csvPath]="getEntityName(resultType, true, false)"
[simpleSearchLink]="simpleSearchLink"
[disableForms]="disableForms"
@ -96,6 +95,7 @@ export class AdvancedSearchResearchResultsComponent {
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
@ -193,9 +193,7 @@ export class AdvancedSearchResearchResultsComponent {
}
}
public queryChanged($event) {
this.loadPaging = true;
}
private handleError(message: string, error) {
console.error(this.getEntityName(this.resultType, true, true)+" advanced Search Page: "+message, error);

View File

@ -59,7 +59,6 @@ export class AdvancedSearchPageComponent {
public errorCodes: ErrorCodes = new ErrorCodes();
url = null;
@Output() queryChange = new EventEmitter();
constructor(private route: ActivatedRoute,
private location: Location,
@ -193,6 +192,10 @@ export class AdvancedSearchPageComponent {
}
}
/**
* Create Page URL parameters based on the selected fields of the advanced form
* @param includePage
*/
private createUrlParameters(includePage: boolean) {
var params = "";
this.parameterNames.splice(0, this.parameterNames.length);
@ -248,6 +251,9 @@ export class AdvancedSearchPageComponent {
return '?' + params;
}
/**
* Create Search API query based on the selected fields of the advanced form
*/
public createQueryParameters() {
var params = "";
var countParams = 0;
@ -282,19 +288,10 @@ export class AdvancedSearchPageComponent {
}
clearFilters() {
}
goTo(page: number = 1) {
this.searchUtils.page = page;
var urlParameters = this.createUrlParameters(true);
var queryParameters = this.createQueryParameters();
//this.location.go(location.pathname,urlParameters);
this.createUrlParameters(true);
this.router.navigate([this.searchUtils.baseUrl], {queryParams: this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)});
this.queryChange.emit({
value: queryParameters
});
/* Code For Piwik*/
if (typeof localStorage !== 'undefined') {
//console.log("In PreviousRouteRecorder : "+this.router.url );