From bda90f2c389b95017b660c96ce0022d53575d1f0 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 16 May 2023 12:28:35 +0300 Subject: [PATCH] [Library | explore-redesign]: Bug fixes in range filter, advanced search link of search all page, search results "cards" in mobile screens. 1. rangeFilter.component: [Bug fix] Removed from method get disabled() check of isDisabled and added this check for class "disabled" in action/button (error on enter, because isDisabled was already true before triggering the action of yearChanged). 2. search-input.component.ts: [Bug fix] Added check for client side in ngAfterViewInit(), before calling "getComputedStyle". 3. searchAll.component: a. Set "advancedSearchLink" properly and pass it to each search entity page in "simpleSearchLink" parameter. b. In , pass parameters [entityType]="activeEntity" and [advancedSearchLink]="advancedSearchLink" [advancedSearchLinkParameters]="parameters". 4. advancedSearchForm.component.html: Removed check this.entityType == this.selectedEntity from advanced search link. 5. searchFilter.component.ts: In filterKeywords() method, added cdr.detectChanges(). 6. searchResult.component.html: [Bug fix] Reverted [isMobile] parameter to
+ [simpleSearchLink]="properties.searchLinkToResults" [customFilter]="customFilter"> + [simpleSearchLink]="properties.searchLinkToProjects" [customFilter]="customFilter"> + [simpleSearchLink]="properties.searchLinkToOrganizations" [customFilter]="customFilter"> + [simpleSearchLink]="properties.searchLinkToDataProviders" [customFilter]="customFilter"> diff --git a/searchPages/find/searchAll.component.ts b/searchPages/find/searchAll.component.ts index 261d36bf..706688c6 100644 --- a/searchPages/find/searchAll.component.ts +++ b/searchPages/find/searchAll.component.ts @@ -78,7 +78,7 @@ export class SearchAllComponent { showDataProviders: boolean = false; showServices: boolean = false; showOrganizations: boolean = false; - advancedSearchLink: string = "/search/advanced/publications"; + advancedSearchLink: string = properties.searchLinkToAdvancedResults; properties: EnvProperties; offset: number; public openaireEntities = OpenaireEntities; @@ -297,7 +297,7 @@ export class SearchAllComponent { } public searchResults() { - this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;//"/search/advanced/publications"; + this.advancedSearchLink = this.properties.searchLinkToAdvancedResults;//"/search/advanced/research-outcomes"; if (this.reload[this.activeEntity] && this.fetchPublications.searchUtils.status != this.errorCodes.NONE) { this.reload[this.activeEntity] = false; @@ -564,36 +564,38 @@ export class SearchAllComponent { } } - entityChanged(entity){ - if(this.activeEntity == "result") { - this.resultTypes = {publication: true, dataset: true, software: true, other: true}; - } - if(this.activeEntity == "result" && this.searchResearchResultsComponent){ - this.searchResearchResultsComponent.ngOnDestroy(); - }else if(this.activeEntity == "projects" && this.searchProjectsComponent){ - this.searchProjectsComponent.ngOnDestroy(); - }else if(this.activeEntity == "datasources" && this.searchDataprovidersComponent){ - this.searchDataprovidersComponent.ngOnDestroy(); - }else if(this.activeEntity == "services" && this.searchDataprovidersComponent){ - this.searchDataprovidersComponent.ngOnDestroy(); - }else if(this.activeEntity == "organizations" && this.searchOrganizationsComponent){ - this.searchOrganizationsComponent.ngOnDestroy(); - } - this.activeEntity = entity; - this.parameters = {}; - this.reload[entity]= true; - if ( this.keyword.length > 0) { - this.parameters["fv0"] = this.keyword; - this.parameters["f0"] = "q"; - } - if(this.customFilter){ - this.parameters = this.customFilter.getParameters(this.parameters); - } - if (entity == "result") { - entity = "research-outcomes"; - this.parameters["resultbestaccessright"] = '"' + encodeURIComponent("Open Access") + '"'; - } - this.router.navigate(["/search/find", entity], {queryParams: this.parameters}); + entityChanged(entity) { + if (this.activeEntity !== entity) { + if (this.activeEntity == "result") { + this.resultTypes = {publication: true, dataset: true, software: true, other: true}; + } + if (this.activeEntity == "result" && this.searchResearchResultsComponent) { + this.searchResearchResultsComponent.ngOnDestroy(); + } else if (this.activeEntity == "projects" && this.searchProjectsComponent) { + this.searchProjectsComponent.ngOnDestroy(); + } else if (this.activeEntity == "datasources" && this.searchDataprovidersComponent) { + this.searchDataprovidersComponent.ngOnDestroy(); + } else if (this.activeEntity == "services" && this.searchDataprovidersComponent) { + this.searchDataprovidersComponent.ngOnDestroy(); + } else if (this.activeEntity == "organizations" && this.searchOrganizationsComponent) { + this.searchOrganizationsComponent.ngOnDestroy(); + } + this.activeEntity = entity; + this.parameters = {}; + this.reload[entity] = true; + if (this.keyword.length > 0) { + this.parameters["fv0"] = this.keyword; + this.parameters["f0"] = "q"; + } + if (this.customFilter) { + this.parameters = this.customFilter.getParameters(this.parameters); + } + if (entity == "result") { + entity = "research-outcomes"; + this.parameters["resultbestaccessright"] = '"' + encodeURIComponent("Open Access") + '"'; + } + this.router.navigate(["/search/find", entity], {queryParams: this.parameters}); } + } } diff --git a/searchPages/searchUtils/advancedSearchForm.component.html b/searchPages/searchUtils/advancedSearchForm.component.html index 192957d9..84d87fcb 100644 --- a/searchPages/searchUtils/advancedSearchForm.component.html +++ b/searchPages/searchUtils/advancedSearchForm.component.html @@ -146,7 +146,8 @@
- + Advanced search diff --git a/searchPages/searchUtils/searchFilter.component.ts b/searchPages/searchUtils/searchFilter.component.ts index c6569607..ef1db9fe 100644 --- a/searchPages/searchUtils/searchFilter.component.ts +++ b/searchPages/searchUtils/searchFilter.component.ts @@ -121,6 +121,7 @@ export class SearchFilterComponent implements OnInit, OnChanges { } } this.hasMatch = true; + this.cdr.detectChanges(); return true; } diff --git a/searchPages/searchUtils/searchResult.component.html b/searchPages/searchUtils/searchResult.component.html index 99ecac47..e06fb724 100644 --- a/searchPages/searchUtils/searchResult.component.html +++ b/searchPages/searchUtils/searchResult.component.html @@ -3,7 +3,7 @@
  • + [isCard]="true" [isMobile]="isMobile" [prevPath]="prevPath">
  • diff --git a/sharedComponents/search-input/search-input.component.ts b/sharedComponents/search-input/search-input.component.ts index f2ae486e..ea7e87df 100644 --- a/sharedComponents/search-input/search-input.component.ts +++ b/sharedComponents/search-input/search-input.component.ts @@ -88,7 +88,9 @@ export class SearchInputComponent implements OnInit, AfterViewInit { } ngAfterViewInit() { - this.ratio = Number.parseFloat(getComputedStyle(this.searchInput.nativeElement).getPropertyValue('--search-input-icon-ratio')); + if(typeof document !== 'undefined') { + this.ratio = Number.parseFloat(getComputedStyle(this.searchInput.nativeElement).getPropertyValue('--search-input-icon-ratio')); + } } expand(value: boolean) { diff --git a/utils/rangeFilter/rangeFilter.component.html b/utils/rangeFilter/rangeFilter.component.html index 2bdbc6af..6db97076 100644 --- a/utils/rangeFilter/rangeFilter.component.html +++ b/utils/rangeFilter/rangeFilter.component.html @@ -13,7 +13,7 @@
    + [class.disabled]="disabled || isDisabled"> GO
    @@ -70,8 +70,6 @@
    - -
    diff --git a/utils/rangeFilter/rangeFilter.component.ts b/utils/rangeFilter/rangeFilter.component.ts index d99993c7..dcf0d9a3 100644 --- a/utils/rangeFilter/rangeFilter.component.ts +++ b/utils/rangeFilter/rangeFilter.component.ts @@ -58,7 +58,7 @@ export class RangeFilterComponent { } get disabled() { - return this.isDisabled || this.rangeForm.invalid || + return this.rangeForm.invalid || (!this.rangeForm.get('yearFrom').dirty && !this.rangeForm.get('yearTo').dirty) || this.rangeForm.get('yearFrom').invalid || this.rangeForm.get('yearTo').invalid }