From 412ed213fefde027e493e15964d8b1a299bd9fa5 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 19 May 2023 19:09:37 +0300 Subject: [PATCH] [Library | explore-redesign]: Bug fixes in what is executed when tabs of search all are clicked - formPlaceholderText and simpleKeywordChanged(). 1. searchAll.component.ts: [Bug fix] From previous commit - Set formPlaceholderText outside if condition. 2. advancedSearchForm.component.ts: [Bug fix] In method "simpleKeywordChanged()", do not check for selectedEntity when !this.entitiesSelection (selectedEntity is changed only when exists . --- searchPages/find/searchAll.component.ts | 15 ++++++++++----- .../searchUtils/advancedSearchForm.component.ts | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/searchPages/find/searchAll.component.ts b/searchPages/find/searchAll.component.ts index f20784fd..990d5de7 100644 --- a/searchPages/find/searchAll.component.ts +++ b/searchPages/find/searchAll.component.ts @@ -303,52 +303,57 @@ export class SearchAllComponent { public searchResults() { this.advancedSearchLink = this.properties.searchLinkToAdvancedResults;//"/search/advanced/research-outcomes"; + this.formPlaceholderText = "Search by title, author, abstract, DOI, orcid..."; + if (this.reload[this.activeEntity] && this.fetchPublications.searchUtils.status != this.errorCodes.NONE) { this.reload[this.activeEntity] = false; this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword; - this.formPlaceholderText = "Search by title, author, abstract, DOI, orcid..."; } } public searchProjects() { this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;//"/search/advanced/projects"; + this.formPlaceholderText = "Search by title, acronym, project code..."; + if (this.reload[this.activeEntity] && this.fetchProjects.searchUtils.status != this.errorCodes.NONE ) { this.reload[this.activeEntity] = false; this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword=" + this.keyword; - this.formPlaceholderText = "Search by title, acronym, project code..."; } } public searchDataProviders() { this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;//"/search/advanced/dataproviders"; + this.formPlaceholderText = "Search by name, description, subject..."; + if ( this.reload[this.activeEntity] && this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE) { this.reload[this.activeEntity] = false; this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword=" + this.keyword; - this.formPlaceholderText = "Search by name, description, subject..."; } } public searchServices() { this.advancedSearchLink = this.properties.searchLinkToAdvancedServices;//"/search/advanced/services"; + this.formPlaceholderText = "Search by name, description, subject..."; + if ( this.reload[this.activeEntity] && this.fetchServices.searchUtils.status != this.errorCodes.NONE) { this.reload[this.activeEntity] = false; this.linkToSearchDataproviders = this.properties.searchLinkToServices;// + "?keyword=" + this.keyword; - this.formPlaceholderText = "Search by name, description, subject..."; } } public searchOrganizations() { this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;//"/search/advanced/organizations"; + this.formPlaceholderText = "Search by organization name..."; + if (this.reload[this.activeEntity] && this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE) { this.reload[this.activeEntity] = false; this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword=" + this.keyword; - this.formPlaceholderText = "Search by organization name..."; } } private prepareKeywordParam(keyword){ diff --git a/searchPages/searchUtils/advancedSearchForm.component.ts b/searchPages/searchUtils/advancedSearchForm.component.ts index 1b1fc5ce..8a046930 100644 --- a/searchPages/searchUtils/advancedSearchForm.component.ts +++ b/searchPages/searchUtils/advancedSearchForm.component.ts @@ -116,7 +116,7 @@ export class AdvancedSearchFormComponent implements OnInit, OnDestroy, OnChanges simpleKeywordChanged() { // this.selectedFields[0].value = $event.value; - if (this.selectedEntity == this.entityType) { + if ((this.selectedEntity == this.entityType) || !this.entitiesSelection) { this.queryChanged(); } else { this.router.navigate([this.selectedEntitySimpleUrl], {queryParams: {q: this.selectedFields[0].value, op: "and"}});