[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 <advanced-search-form>, 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 <result-preview" (removed by mistake in a previous merge).
This commit is contained in:
Konstantina Galouni 2023-05-16 12:28:35 +03:00
parent 53d3afefd1
commit bda90f2c38
8 changed files with 50 additions and 45 deletions

View File

@ -10,7 +10,8 @@
<div class="uk-grid uk-flex uk-flex-middle uk-flex-center" uk-grid> <div class="uk-grid uk-flex uk-flex-middle uk-flex-center" uk-grid>
<div class="uk-width-1-1 uk-width-auto@m"><div id="searchImage"></div></div> <div class="uk-width-1-1 uk-width-auto@m"><div id="searchImage"></div></div>
<advanced-search-form class="uk-width-expand uk-padding-remove-vertical" <advanced-search-form class="uk-width-expand uk-padding-remove-vertical"
entityType="all" [entityType]="activeEntity"
[advancedSearchLink]="advancedSearchLink" [advancedSearchLinkParameters]="parameters"
(queryChange)="keywordChanged($event)" (queryChange)="keywordChanged($event)"
[isDisabled]="disableForms" [isDisabled]="disableForms"
[simpleView]="true" [formPlaceholderText]="formPlaceholderText" [simpleView]="true" [formPlaceholderText]="formPlaceholderText"
@ -100,25 +101,25 @@
<search-research-results *ngIf="activeEntity == 'result'" resultType="result" [includeOnlyResultsAndFilter]="true" <search-research-results *ngIf="activeEntity == 'result'" resultType="result" [includeOnlyResultsAndFilter]="true"
(searchPageUpdates)="activeEntityUpdate($event)" [showSwitchSearchLink]="false" (searchPageUpdates)="activeEntityUpdate($event)" [showSwitchSearchLink]="false"
simpleSearchLink="/search/find" [customFilter]="customFilter"></search-research-results> [simpleSearchLink]="properties.searchLinkToResults" [customFilter]="customFilter"></search-research-results>
<search-projects *ngIf="activeEntity == 'projects'" [includeOnlyResultsAndFilter]="true" [showSwitchSearchLink]="false" <search-projects *ngIf="activeEntity == 'projects'" [includeOnlyResultsAndFilter]="true" [showSwitchSearchLink]="false"
(searchPageUpdates)="activeEntityUpdate($event)" (searchPageUpdates)="activeEntityUpdate($event)"
simpleSearchLink="/search/find" [customFilter]="customFilter"> [simpleSearchLink]="properties.searchLinkToProjects" [customFilter]="customFilter">
</search-projects> </search-projects>
<search-organizations *ngIf="activeEntity == 'organizations'" [includeOnlyResultsAndFilter]="true" [showSwitchSearchLink]="false" <search-organizations *ngIf="activeEntity == 'organizations'" [includeOnlyResultsAndFilter]="true" [showSwitchSearchLink]="false"
(searchPageUpdates)="activeEntityUpdate($event)" (searchPageUpdates)="activeEntityUpdate($event)"
simpleSearchLink="/search/find" [customFilter]="customFilter"> [simpleSearchLink]="properties.searchLinkToOrganizations" [customFilter]="customFilter">
</search-organizations> </search-organizations>
<search-dataproviders *ngIf="activeEntity == 'datasources'" [includeOnlyResultsAndFilter]="true" [showSwitchSearchLink]="false" <search-dataproviders *ngIf="activeEntity == 'datasources'" [includeOnlyResultsAndFilter]="true" [showSwitchSearchLink]="false"
(searchPageUpdates)="activeEntityUpdate($event)" (searchPageUpdates)="activeEntityUpdate($event)"
simpleSearchLink="/search/find" [customFilter]="customFilter"> [simpleSearchLink]="properties.searchLinkToDataProviders" [customFilter]="customFilter">
</search-dataproviders> </search-dataproviders>
<search-dataproviders *ngIf="activeEntity == 'services'" [includeOnlyResultsAndFilter]="true" [showSwitchSearchLink]="false" <search-dataproviders *ngIf="activeEntity == 'services'" [includeOnlyResultsAndFilter]="true" [showSwitchSearchLink]="false"
(searchPageUpdates)="activeEntityUpdate($event)" (searchPageUpdates)="activeEntityUpdate($event)"
simpleSearchLink="/search/find" [customFilter]="customFilter" [simpleSearchLink]="properties.searchLinkToServices" [customFilter]="customFilter"
type="services" entityType="service" [typeName]="openaireEntities.SERVICES"> type="services" entityType="service" [typeName]="openaireEntities.SERVICES">
</search-dataproviders> </search-dataproviders>

View File

@ -78,7 +78,7 @@ export class SearchAllComponent {
showDataProviders: boolean = false; showDataProviders: boolean = false;
showServices: boolean = false; showServices: boolean = false;
showOrganizations: boolean = false; showOrganizations: boolean = false;
advancedSearchLink: string = "/search/advanced/publications"; advancedSearchLink: string = properties.searchLinkToAdvancedResults;
properties: EnvProperties; properties: EnvProperties;
offset: number; offset: number;
public openaireEntities = OpenaireEntities; public openaireEntities = OpenaireEntities;
@ -297,7 +297,7 @@ export class SearchAllComponent {
} }
public searchResults() { public searchResults() {
this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;//"/search/advanced/publications"; this.advancedSearchLink = this.properties.searchLinkToAdvancedResults;//"/search/advanced/research-outcomes";
if (this.reload[this.activeEntity] && if (this.reload[this.activeEntity] &&
this.fetchPublications.searchUtils.status != this.errorCodes.NONE) { this.fetchPublications.searchUtils.status != this.errorCodes.NONE) {
this.reload[this.activeEntity] = false; this.reload[this.activeEntity] = false;
@ -564,29 +564,30 @@ export class SearchAllComponent {
} }
} }
entityChanged(entity){ entityChanged(entity) {
if(this.activeEntity == "result") { if (this.activeEntity !== entity) {
if (this.activeEntity == "result") {
this.resultTypes = {publication: true, dataset: true, software: true, other: true}; this.resultTypes = {publication: true, dataset: true, software: true, other: true};
} }
if(this.activeEntity == "result" && this.searchResearchResultsComponent){ if (this.activeEntity == "result" && this.searchResearchResultsComponent) {
this.searchResearchResultsComponent.ngOnDestroy(); this.searchResearchResultsComponent.ngOnDestroy();
}else if(this.activeEntity == "projects" && this.searchProjectsComponent){ } else if (this.activeEntity == "projects" && this.searchProjectsComponent) {
this.searchProjectsComponent.ngOnDestroy(); this.searchProjectsComponent.ngOnDestroy();
}else if(this.activeEntity == "datasources" && this.searchDataprovidersComponent){ } else if (this.activeEntity == "datasources" && this.searchDataprovidersComponent) {
this.searchDataprovidersComponent.ngOnDestroy(); this.searchDataprovidersComponent.ngOnDestroy();
}else if(this.activeEntity == "services" && this.searchDataprovidersComponent){ } else if (this.activeEntity == "services" && this.searchDataprovidersComponent) {
this.searchDataprovidersComponent.ngOnDestroy(); this.searchDataprovidersComponent.ngOnDestroy();
}else if(this.activeEntity == "organizations" && this.searchOrganizationsComponent){ } else if (this.activeEntity == "organizations" && this.searchOrganizationsComponent) {
this.searchOrganizationsComponent.ngOnDestroy(); this.searchOrganizationsComponent.ngOnDestroy();
} }
this.activeEntity = entity; this.activeEntity = entity;
this.parameters = {}; this.parameters = {};
this.reload[entity]= true; this.reload[entity] = true;
if ( this.keyword.length > 0) { if (this.keyword.length > 0) {
this.parameters["fv0"] = this.keyword; this.parameters["fv0"] = this.keyword;
this.parameters["f0"] = "q"; this.parameters["f0"] = "q";
} }
if(this.customFilter){ if (this.customFilter) {
this.parameters = this.customFilter.getParameters(this.parameters); this.parameters = this.customFilter.getParameters(this.parameters);
} }
if (entity == "result") { if (entity == "result") {
@ -595,5 +596,6 @@ export class SearchAllComponent {
} }
this.router.navigate(["/search/find", entity], {queryParams: this.parameters}); this.router.navigate(["/search/find", entity], {queryParams: this.parameters});
} }
}
} }

View File

@ -146,7 +146,8 @@
<div *ngIf="simpleView" class="uk-flex uk-flex-center uk-flex-wrap"> <div *ngIf="simpleView" class="uk-flex uk-flex-center uk-flex-wrap">
<div class="uk-width-xlarge@l uk-width-large"> <div class="uk-width-xlarge@l uk-width-large">
<div class="uk-text-small uk-flex uk-flex-right" [class.uk-light]="dark" *ngIf="showSwitchSearchLink"> <div class="uk-text-small uk-flex uk-flex-right" [class.uk-light]="dark" *ngIf="showSwitchSearchLink">
<a *ngIf ="this.entityType !='all' && this.entityType == this.selectedEntity && advancedSearchLink" <!-- && this.entityType == this.selectedEntity-->
<a *ngIf ="this.entityType !='all' && advancedSearchLink"
[routerLink]="advancedSearchLink" [queryParams]="advancedSearchLinkParameters" class="uk-margin-small-bottom" [routerLink]="advancedSearchLink" [queryParams]="advancedSearchLinkParameters" class="uk-margin-small-bottom"
[ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Advanced search [ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Advanced search
</a> </a>

View File

@ -121,6 +121,7 @@ export class SearchFilterComponent implements OnInit, OnChanges {
} }
} }
this.hasMatch = true; this.hasMatch = true;
this.cdr.detectChanges();
return true; return true;
} }

View File

@ -3,7 +3,7 @@
<li *ngFor="let result of previewResults"> <li *ngFor="let result of previewResults">
<result-preview [properties]="properties" [showOrganizations]="showOrganizations" <result-preview [properties]="properties" [showOrganizations]="showOrganizations"
[showSubjects]="showSubjects" [result]="result" [showEnermaps]="showEnermaps" [showSubjects]="showSubjects" [result]="result" [showEnermaps]="showEnermaps"
[isCard]="true" [prevPath]="prevPath"> [isCard]="true" [isMobile]="isMobile" [prevPath]="prevPath">
</result-preview> </result-preview>
</li> </li>
</ul> </ul>

View File

@ -88,8 +88,10 @@ export class SearchInputComponent implements OnInit, AfterViewInit {
} }
ngAfterViewInit() { ngAfterViewInit() {
if(typeof document !== 'undefined') {
this.ratio = Number.parseFloat(getComputedStyle(this.searchInput.nativeElement).getPropertyValue('--search-input-icon-ratio')); this.ratio = Number.parseFloat(getComputedStyle(this.searchInput.nativeElement).getPropertyValue('--search-input-icon-ratio'));
} }
}
expand(value: boolean) { expand(value: boolean) {
this.expanded = value; this.expanded = value;

View File

@ -13,7 +13,7 @@
<div #input class="uk-width-4-5" input [formInput]="rangeForm" type="year-range" [yearRange]="yearRange" [extendEnter]="onEnter" <div #input class="uk-width-4-5" input [formInput]="rangeForm" type="year-range" [yearRange]="yearRange" [extendEnter]="onEnter"
inputClass="flat small background"> inputClass="flat small background">
<div action (click)="yearChanged()" class="action-icon" <div action (click)="yearChanged()" class="action-icon"
[class.disabled]="disabled"> [class.disabled]="disabled || isDisabled">
<icon name="chevron_right" [flex]="true"></icon> <icon name="chevron_right" [flex]="true"></icon>
<span class="visually-hidden">GO</span> <span class="visually-hidden">GO</span>
</div> </div>
@ -70,8 +70,6 @@
</li> </li>
</ul> </ul>
</div> </div>
<!-- End of Natalia's suggestion -->
</div> </div>
</div> </div>
</div> </div>

View File

@ -58,7 +58,7 @@ export class RangeFilterComponent {
} }
get disabled() { 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').dirty && !this.rangeForm.get('yearTo').dirty) ||
this.rangeForm.get('yearFrom').invalid || this.rangeForm.get('yearTo').invalid this.rangeForm.get('yearFrom').invalid || this.rangeForm.get('yearTo').invalid
} }