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

View File

@ -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});
}
}
}

View File

@ -146,7 +146,8 @@
<div *ngIf="simpleView" class="uk-flex uk-flex-center uk-flex-wrap">
<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">
<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"
[ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Advanced search
</a>

View File

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

View File

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

View File

@ -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) {

View File

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

View File

@ -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
}