[Library|Trunk]
Simple 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@58029 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
659fab0b1b
commit
100d120018
|
@ -33,7 +33,6 @@ import {RouterHelper} from "../utils/routerHelper.class";
|
|||
formPlaceholderText = "Search by title, country, organization, subject, type..."
|
||||
type="content providers" entityType="dataprovider" [(filters)] = "filters"
|
||||
[(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
|
||||
(queryChange)="queryChanged($event)"
|
||||
[csvParams]="csvParams" csvPath="datasources"
|
||||
[disableForms]="disableForms"
|
||||
[loadPaging]="loadPaging"
|
||||
|
@ -101,6 +100,7 @@ export class SearchDataprovidersToDepositComponent {
|
|||
var firstLoad =true;
|
||||
|
||||
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;
|
||||
|
@ -202,9 +202,6 @@ export class SearchDataprovidersToDepositComponent {
|
|||
}
|
||||
}
|
||||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
}
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error("Content Providers simple Search Page: "+message, error);
|
||||
|
|
|
@ -20,7 +20,6 @@ import{EnvProperties} from '../../utils/properties/env-properties';
|
|||
type="content providers" entityType="dataprovider" [(filters)] = "filters"
|
||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||
[baseUrl] = "baseUrl" [showResultCount]=false
|
||||
(queryChange)="queryChanged($event)"
|
||||
[csvParams]="csvParams" csvPath="datasources"
|
||||
[disableForms]="disableForms"
|
||||
[tableViewLink]="'/search/content-providers-table'"
|
||||
|
@ -51,7 +50,6 @@ export class SearchCompatibleDataprovidersComponent {
|
|||
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
|
||||
"export":[]
|
||||
};
|
||||
public CSVDownloaded = false;
|
||||
public resourcesQuery = '((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))';
|
||||
public csvParams: string;
|
||||
public disableForms: boolean = false;
|
||||
|
@ -161,14 +159,7 @@ properties:EnvProperties;
|
|||
//TODO set filters from
|
||||
}
|
||||
|
||||
public queryChanged($event) {
|
||||
var parameters = $event.index;
|
||||
var csv_parameters = $event.value;
|
||||
|
||||
//console.info("queryChanged: Execute search query "+parameters);
|
||||
|
||||
//this._getResults(parameters, csv_parameters, false, this.searchUtils.page, this.searchUtils.size);
|
||||
}
|
||||
private createFilters():Filter[] {
|
||||
var filter_names=["Type","Compatibility Level"];
|
||||
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
|
||||
|
|
|
@ -19,7 +19,6 @@ import{EnvProperties} from '../../utils/properties/env-properties';
|
|||
type="content providers" entityType="dataprovider" [(filters)] = "filters"
|
||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||
[baseUrl] = "baseUrl" [showResultCount]=false
|
||||
(queryChange)="queryChanged($event)"
|
||||
[csvParams]="csvParams" csvPath="datasources"
|
||||
[disableForms]="disableForms"
|
||||
[tableViewLink]="'/search/entity-registries-table'"
|
||||
|
@ -51,7 +50,6 @@ export class SearchEntityRegistriesComponent {
|
|||
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
|
||||
"export":[]
|
||||
};
|
||||
public CSVDownloaded = false;
|
||||
public disableForms: boolean = false;
|
||||
|
||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||
|
@ -161,13 +159,6 @@ properties:EnvProperties;
|
|||
//TODO set filters from
|
||||
}
|
||||
|
||||
public queryChanged($event) {
|
||||
var parameters = $event.index;
|
||||
//console.info("queryChanged: Execute search query "+parameters);
|
||||
var csv_parameters = $event.value;
|
||||
|
||||
//this._getResults(parameters, csv_parameters, false, this.searchUtils.page, this.searchUtils.size);
|
||||
}
|
||||
private createFilters():Filter[] {
|
||||
var filter_names=["Type","Compatibility Level"];
|
||||
var filter_ids=["datasourcetypename","datasourcecompatibilityname"];
|
||||
|
|
|
@ -21,7 +21,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
|
|||
type="content providers" entityType="dataprovider" [(filters)] = "filters"
|
||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||
[baseUrl] = "baseUrl" [showResultCount]=false
|
||||
(queryChange)="queryChanged($event)"
|
||||
|
||||
[csvParams]="csvParams" csvPath="datasources"
|
||||
[disableForms]="disableForms"
|
||||
searchFormClass="journalsSearchForm"
|
||||
|
@ -51,7 +51,6 @@ export class SearchJournalsComponent {
|
|||
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
|
||||
"export":[]
|
||||
};
|
||||
public CSVDownloaded = false;
|
||||
public resourcesQuery = '((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))';
|
||||
//"&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";
|
||||
public csvParams: string;
|
||||
|
@ -161,13 +160,6 @@ properties:EnvProperties;
|
|||
//TODO set filters from
|
||||
}
|
||||
|
||||
public queryChanged($event) {
|
||||
var parameters = $event.index;
|
||||
//console.info("queryChanged: Execute search query "+parameters);
|
||||
var csv_parameters = $event.value;
|
||||
|
||||
//this._getResults(parameters,csv_parameters, false, this.searchUtils.page, this.searchUtils.size);
|
||||
}
|
||||
private createFilters():Filter[] {
|
||||
var filter_names=["Type","Compatibility Level"];
|
||||
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {ViewChild, Output} from '@angular/core';
|
||||
import {EventEmitter} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
import { Location} from '@angular/common';
|
||||
import {Router, ActivatedRoute} from '@angular/router';
|
||||
import {Title, Meta} from '@angular/platform-browser';
|
||||
|
||||
|
@ -37,7 +36,6 @@ export class SearchPageComponent {
|
|||
@Input() filterValuesNum: number = 5;
|
||||
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
||||
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||
@Output() queryChange = new EventEmitter();
|
||||
@Input() baseUrl:string = '';
|
||||
@Input() showResultCount:boolean = true;
|
||||
@Input() showRefine:boolean = true;
|
||||
|
@ -172,6 +170,10 @@ export class SearchPageComponent {
|
|||
return this.queryParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Search API query based on the page URL parameters
|
||||
* @param params page URL parameters
|
||||
*/
|
||||
public getQueryParametersFromUrl(params){ // called by ngOnInit function of search find pages
|
||||
// var parameters = "";
|
||||
var allFqs = "";
|
||||
|
@ -361,9 +363,11 @@ export class SearchPageComponent {
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
*Get The filters and create url parameters
|
||||
*/
|
||||
/**
|
||||
* Get The filters and create page URL parameters
|
||||
* @param filters
|
||||
* @param includePage
|
||||
*/
|
||||
private createUrlParameters(filters:Filter[], includePage:boolean){
|
||||
var allLimits="";//location.search.slice(1);
|
||||
this.queryParameters = new Map<string,string>();
|
||||
|
@ -561,14 +565,7 @@ export class SearchPageComponent {
|
|||
}
|
||||
goTo(page:number = 1){
|
||||
this.searchUtils.page = page;
|
||||
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.createUrlParameters(this.filters,true);
|
||||
this.router.navigate( [this.baseUrl], { queryParams: this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues) } );
|
||||
|
||||
/* Code For Piwik*/
|
||||
|
@ -578,12 +575,6 @@ export class SearchPageComponent {
|
|||
if(this.isPiwikEnabled && (typeof document !== 'undefined')){
|
||||
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
|
||||
}
|
||||
/* End Piwik Code */
|
||||
this.queryChange.emit({
|
||||
value: queryParameters,
|
||||
index:indexQuery,
|
||||
params: this.queryParameters
|
||||
});
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
filterChanged($event){
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import {Component, Input, ViewChild} from '@angular/core';
|
||||
import { ActivatedRoute} from '@angular/router';
|
||||
import {Location} from '@angular/common';
|
||||
import { Filter, Value} 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 {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
|
||||
import {SearchFields} from '../../utils/properties/searchFields';
|
||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
|
||||
import{EnvProperties} from '../../utils/properties/env-properties';
|
||||
|
@ -19,7 +17,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
|
|||
formPlaceholderText = "Search for Content Providers"
|
||||
type="content providers" entityType="dataprovider" [(filters)] = "filters"
|
||||
[(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
|
||||
(queryChange)="queryChanged($event)"
|
||||
|
||||
[csvParams]="csvParams" csvPath="datasources" advancedSearchLink="/search/advanced/dataproviders"
|
||||
[disableForms]="disableForms"
|
||||
[loadPaging]="loadPaging"
|
||||
|
@ -50,7 +48,6 @@ export class SearchDataprovidersComponent {
|
|||
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
|
||||
"export":[]
|
||||
};
|
||||
public CSVDownloaded = false;
|
||||
public csvParams: string;
|
||||
|
||||
public disableForms: boolean = false;
|
||||
|
@ -82,6 +79,7 @@ properties: EnvProperties;
|
|||
var firstLoad =true;
|
||||
|
||||
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;
|
||||
|
@ -387,12 +385,6 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
|
|||
//TODO set filters from
|
||||
}
|
||||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
var parameters = $event.value;
|
||||
//this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||
}
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error("Content Providers simple Search Page: "+message, error);
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import {Component, Input, ViewChild} from '@angular/core';
|
||||
import { ActivatedRoute} from '@angular/router';
|
||||
import {Location} from '@angular/common';
|
||||
import { Filter, Value} 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 {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
|
||||
import {SearchFields} from '../../utils/properties/searchFields';
|
||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
|
||||
import{EnvProperties} from '../../utils/properties/env-properties';
|
||||
|
@ -19,7 +17,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
|
|||
formPlaceholderText = "Search for Organizations"
|
||||
type="organizations" entityType="organization" [(filters)] = "filters"
|
||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
|
||||
[baseUrl] = "baseUrl"
|
||||
[csvParams]="csvParams" csvPath="organizations" advancedSearchLink="/search/advanced/organizations"
|
||||
[disableForms]="disableForms"
|
||||
[loadPaging]="loadPaging"
|
||||
|
@ -45,7 +43,6 @@ export class SearchOrganizationsComponent {
|
|||
public searchFields:SearchFields = new SearchFields();
|
||||
public refineFields: string[] = this.searchFields.ORGANIZATION_REFINE_FIELDS;
|
||||
public fieldIdsMap = this.searchFields.ORGANIZATION_FIELDS;
|
||||
public urlParams : Map<string, string>;
|
||||
public _location:Location;
|
||||
public csvParams: string;
|
||||
public disableForms: boolean = false;
|
||||
|
@ -77,6 +74,7 @@ properties: EnvProperties;
|
|||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||
var firstLoad = true;
|
||||
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;
|
||||
|
@ -188,13 +186,6 @@ properties: EnvProperties;
|
|||
}
|
||||
|
||||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
var parameters = $event.value;
|
||||
//console.info("queryChanged: Execute search query "+parameters);
|
||||
//this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||
}
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error("Organizations simple Search Page: "+message, error);
|
||||
|
|
|
@ -19,7 +19,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
|
|||
formPlaceholderText = "Search for Projects"
|
||||
type="projects" entityType="project" [(filters)] = "filters"
|
||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
|
||||
[baseUrl] = "baseUrl"
|
||||
[csvParams]="csvParams" csvPath="projects" advancedSearchLink="/search/advanced/projects"
|
||||
[disableForms]="disableForms"
|
||||
[loadPaging]="loadPaging"
|
||||
|
@ -45,7 +45,6 @@ export class SearchProjectsComponent {
|
|||
public searchFields:SearchFields = new SearchFields();
|
||||
public refineFields: string[] = this.searchFields.PROJECT_REFINE_FIELDS;
|
||||
public fieldIdsMap = this.searchFields.PROJECT_FIELDS;
|
||||
public urlParams : Map<string, string>;
|
||||
public _location:Location;
|
||||
public csvParams: string;
|
||||
public disableForms: boolean = false;
|
||||
|
@ -78,6 +77,7 @@ properties: EnvProperties;
|
|||
//get refine field filters from url parameters
|
||||
var firstLoad = true;
|
||||
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;
|
||||
|
@ -226,13 +226,13 @@ properties: EnvProperties;
|
|||
}
|
||||
|
||||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
this.urlParams = undefined;
|
||||
var parameters = $event.value;
|
||||
//this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||
}
|
||||
// public queryChanged($event) {
|
||||
// this.loadPaging = true;
|
||||
//
|
||||
// this.urlParams = undefined;
|
||||
// var parameters = $event.value;
|
||||
// //this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||
// }
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error("Projects simple Search Page: "+message, error);
|
||||
|
|
|
@ -19,7 +19,6 @@ import {EnvProperties} from '../../utils/properties/env-properties';
|
|||
[type]="getEntityName(resultType, true, true)" [entityType]="resultType"
|
||||
[(filters)] = "filters" [(results)] = "results"
|
||||
[(searchUtils)] = "searchUtils" [(baseUrl)] = baseUrl
|
||||
(queryChange)="queryChanged($event)"
|
||||
[csvParams]="csvParams" [csvPath]="getEntityName(resultType, true, false)"
|
||||
[advancedSearchLink]="advancedSearchLink"
|
||||
[disableForms]="disableForms"
|
||||
|
@ -53,7 +52,6 @@ export class SearchResearchResultsComponent {
|
|||
public searchFields:SearchFields = new SearchFields();
|
||||
public refineFields: string[] = this.searchFields.RESULT_REFINE_FIELDS;
|
||||
public fieldIdsMap=this.searchFields.RESULT_FIELDS;
|
||||
public urlParams : Map<string, string>;
|
||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||
public _location:Location;
|
||||
|
||||
|
@ -108,6 +106,7 @@ export class SearchResearchResultsComponent {
|
|||
this.searchPage.type = this.getEntityName(this.resultType, true, true);
|
||||
var firstLoad =true;
|
||||
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;
|
||||
|
@ -231,9 +230,9 @@ export class SearchResearchResultsComponent {
|
|||
}
|
||||
}
|
||||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
}
|
||||
// public queryChanged($event) {
|
||||
// // this.loadPaging = true;
|
||||
// }
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error(this.getEntityName(this.resultType, true, true)+" simple Search Page (SearchResearchResultsComponent): "+message, error);
|
||||
|
|
Loading…
Reference in New Issue