From 0df3f396098b106a33b9a695b0a9f46c65bafb66 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Tue, 15 Dec 2020 12:45:02 +0000 Subject: [PATCH] [Library|Trunk] Search all bug- freezing form: missing events to update disableForms. update search pages Piwik Service: add check about piwik ID git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60132 d315682c-612b-4755-9ff5-7f18f6832af3 --- searchPages/find/searchAll.component.ts | 6 ++++-- searchPages/searchDataProviders.component.ts | 6 ++++-- searchPages/searchOrganizations.component.ts | 6 ++++-- searchPages/searchProjects.component.ts | 5 +++-- searchPages/searchResearchResults.component.ts | 3 +-- utils/piwik/piwik.service.ts | 18 ++++++------------ 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/searchPages/find/searchAll.component.ts b/searchPages/find/searchAll.component.ts index 5f670f96..c8c7654f 100644 --- a/searchPages/find/searchAll.component.ts +++ b/searchPages/find/searchAll.component.ts @@ -463,8 +463,10 @@ export class SearchAllComponent { } activeEntityUpdate($event) { - this.disableForms = $event.disableForms; - let updated = true + if($event.searchUtils.status!=this.errorCodes.LOADING) { + this.disableForms = $event.disableForms; + } + let updated = true; if (this.activeEntity == "result") { if($event.searchUtils.status!=this.errorCodes.LOADING) { this.fetchPublications.searchUtils.totalResults = $event.searchUtils.totalResults; diff --git a/searchPages/searchDataProviders.component.ts b/searchPages/searchDataProviders.component.ts index da0ccb4e..4c3f98ee 100644 --- a/searchPages/searchDataProviders.component.ts +++ b/searchPages/searchDataProviders.component.ts @@ -181,7 +181,6 @@ export class SearchDataProvidersComponent { let totalResults = data[0]; let filters = data[2]; this.filtersReturned(refine, filters, totalResults, page); - this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) }, err => { this.handleError("Error getting organizations: ", err); @@ -223,6 +222,8 @@ export class SearchDataProvidersComponent { } 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){ @@ -260,7 +261,6 @@ export class SearchDataProvidersComponent { this.filtersReturned(refine, this.filters, totalResults, page); } this.resultsReturned(refine, results, totalResults, page); - this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); }, err => { //console.log(err); @@ -323,6 +323,8 @@ export class SearchDataProvidersComponent { } this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); + } private handleError(message: string, error) { diff --git a/searchPages/searchOrganizations.component.ts b/searchPages/searchOrganizations.component.ts index 388e4c14..2b5ff6a2 100644 --- a/searchPages/searchOrganizations.component.ts +++ b/searchPages/searchOrganizations.component.ts @@ -167,7 +167,6 @@ export class SearchOrganizationsComponent { let totalResults = data[0]; let filters = data[2]; this.filtersReturned(refine, filters, totalResults, page); - this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) }, err => { this.handleError("Error getting organizations: ", err); @@ -209,6 +208,8 @@ export class SearchOrganizationsComponent { } 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){ @@ -241,7 +242,6 @@ export class SearchOrganizationsComponent { let totalResults = data[0]; let results = data[1]; this.resultsReturned(refine, results, totalResults, page); - this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); }, err => { //console.log(err); @@ -305,6 +305,8 @@ export class SearchOrganizationsComponent { } this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + } private handleError(message: string, error) { diff --git a/searchPages/searchProjects.component.ts b/searchPages/searchProjects.component.ts index 1003a805..42ffc541 100644 --- a/searchPages/searchProjects.component.ts +++ b/searchPages/searchProjects.component.ts @@ -165,7 +165,7 @@ export class SearchProjectsComponent { let totalResults = data[0]; let filters = data[2]; this.filtersReturned(refine, filters, totalResults, page); - this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + }, err => { this.handleError("Error getting projects: ", err); @@ -209,6 +209,7 @@ export class SearchProjectsComponent { } 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){ @@ -242,7 +243,6 @@ export class SearchProjectsComponent { let totalResults = data[0]; let results = data[1]; this.resultsReturned(refine, results, totalResults, page); - this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); }, err => { //console.log(err); @@ -306,6 +306,7 @@ export class SearchProjectsComponent { } this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) } private handleError(message: string, error) { diff --git a/searchPages/searchResearchResults.component.ts b/searchPages/searchResearchResults.component.ts index be1d7168..ddc0d4c7 100644 --- a/searchPages/searchResearchResults.component.ts +++ b/searchPages/searchResearchResults.component.ts @@ -345,8 +345,6 @@ export class SearchResearchResultsComponent { // } // this.disableForms = false; this.resultsReturned(refine, results, totalResults, page); - - this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); }, err => { this.handleError("Error getting " + this.getEntityName(this.resultType, true, true), err); @@ -409,6 +407,7 @@ export class SearchResearchResultsComponent { } this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); } private handleError(message: string, error) { diff --git a/utils/piwik/piwik.service.ts b/utils/piwik/piwik.service.ts index 2938ac17..711cc153 100644 --- a/utils/piwik/piwik.service.ts +++ b/utils/piwik/piwik.service.ts @@ -1,11 +1,5 @@ import {Injectable} from '@angular/core'; -import {Http, Response, Headers, RequestOptions, URLSearchParams} from '@angular/http'; import {HttpClient} from "@angular/common/http"; -import {Observable} from 'rxjs'; - - - -import {Location} from '@angular/common'; import {StringUtils} from '../string-utils.class'; import {EnvProperties} from '../properties/env-properties'; @@ -13,15 +7,15 @@ import {EnvProperties} from '../properties/env-properties'; @Injectable() export class PiwikService { - private piwikbaseUrl:string = ""; - constructor(private http: HttpClient, private location: Location ) {} + constructor(private http: HttpClient ) {} trackView (properties:EnvProperties, title, siteId = null):any { - var ua = this.getUserAgent(); - var referrer = this.getReferrer(); - if(typeof location !== 'undefined'){ - var url = properties.piwikBaseUrl+((siteId!=null)?siteId:properties.piwikSiteId)+"&rec=1&url="+StringUtils.URIEncode(location.href)+"&action_name="+StringUtils.URIEncode(title)+ + let ua = this.getUserAgent(); + let referrer = this.getReferrer(); + let piwikId= ((siteId!=null)?siteId:properties.piwikSiteId); + if(typeof location !== 'undefined' && piwikId){ + var url = properties.piwikBaseUrl+piwikId+"&rec=1&url="+StringUtils.URIEncode(location.href)+"&action_name="+StringUtils.URIEncode(title)+ ((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+ ((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):''); //console.log("Piwik - View: " + url);