From 6810c7a24acc8d62db515a3263309f072599a2d6 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Mon, 19 Apr 2021 15:01:28 +0200 Subject: [PATCH] Fixing atocomplete/ "." searching error, by disabling it. --- angular.json | 12 ++++++++++++ .../gallery/lightbox/lightbox.gallery.component.ts | 11 +++++++---- .../app/ui/gallery/search/autocomplete.service.ts | 2 +- .../search-field/search-field.gallery.component.ts | 9 +-------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/angular.json b/angular.json index 8b6a4547..960a8947 100644 --- a/angular.json +++ b/angular.json @@ -93,6 +93,18 @@ "replace": "src/frontend/environments/environment.ts", "with": "src/frontend/environments/environment.prod.ts" } + ], + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } ] } } diff --git a/src/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.ts b/src/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.ts index a64e3dd2..b90193df 100644 --- a/src/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.ts +++ b/src/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.ts @@ -9,7 +9,7 @@ import {Subscription} from 'rxjs'; import {ActivatedRoute, Params, Router} from '@angular/router'; import {PageHelper} from '../../../model/page.helper'; import {QueryService} from '../../../model/query.service'; -import {MediaBaseDTO, MediaDTO} from '../../../../../common/entities/MediaDTO'; +import {MediaBaseDTO} from '../../../../../common/entities/MediaDTO'; import {QueryParams} from '../../../../../common/QueryParams'; import {GalleryService} from '../gallery.service'; import {PhotoDTO} from '../../../../../common/entities/PhotoDTO'; @@ -157,7 +157,7 @@ export class GalleryLightboxComponent implements OnDestroy, OnInit { } } -//noinspection JSUnusedGlobalSymbols + @HostListener('window:resize', ['$event']) onResize(): void { this.updatePhotoFrameDim(); @@ -340,11 +340,14 @@ export class GalleryLightboxComponent implements OnDestroy, OnInit { this.photoFrameDim.width = Math.max(window.innerWidth - this.infoPanelWidth, 0); this.photoFrameDim.height = window.innerHeight; this.photoFrameDim.aspect = Math.round(this.photoFrameDim.width / this.photoFrameDim.height * 100) / 100; - } + }; private navigateToPhoto(photoIndex: number): void { this.router.navigate([], - {queryParams: this.queryService.getParams(this.gridPhotoQL.toArray()[photoIndex].gridMedia.media)}).catch(console.error); + { + queryParams: + this.queryService.getParams(this.gridPhotoQL.toArray()[photoIndex].gridMedia.media) + }).catch(console.error); } private showPhoto(photoIndex: number, resize: boolean = true): void { diff --git a/src/frontend/app/ui/gallery/search/autocomplete.service.ts b/src/frontend/app/ui/gallery/search/autocomplete.service.ts index 52f01c09..fd028fcd 100644 --- a/src/frontend/app/ui/gallery/search/autocomplete.service.ts +++ b/src/frontend/app/ui/gallery/search/autocomplete.service.ts @@ -56,7 +56,7 @@ export class AutoCompleteService { const type = this.getTypeFromPrefix(text.current); const searchText = this.getPrefixLessSearchText(text.current); - if (searchText === '') { + if (searchText === '' || searchText === '.') { return items; } this.typedAutoComplete(searchText, text.current, type, items); diff --git a/src/frontend/app/ui/gallery/search/search-field/search-field.gallery.component.ts b/src/frontend/app/ui/gallery/search/search-field/search-field.gallery.component.ts index 1f574744..41df275f 100644 --- a/src/frontend/app/ui/gallery/search/search-field/search-field.gallery.component.ts +++ b/src/frontend/app/ui/gallery/search/search-field/search-field.gallery.component.ts @@ -1,11 +1,8 @@ import {Component, ElementRef, EventEmitter, forwardRef, OnDestroy, Output, ViewChild} from '@angular/core'; -import {ActivatedRoute, Router, RouterLink} from '@angular/router'; +import {Router, RouterLink} from '@angular/router'; import {BehaviorSubject, Subscription} from 'rxjs'; import {AutoCompleteService, RenderableAutoCompleteItem} from '../autocomplete.service'; import {MetadataSearchQueryTypes, SearchQueryTypes} from '../../../../../../common/entities/SearchQueryDTO'; -import {SearchQueryParserService} from '../search-query-parser.service'; -import {GalleryService} from '../../gallery.service'; -import {NavigationService} from '../../../../model/navigation.service'; import {Config} from '../../../../../../common/config/public/Config'; import {ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator} from '@angular/forms'; @@ -47,10 +44,6 @@ export class GallerySearchFieldComponent implements ControlValueAccessor, Valida private autoCompleteItems: BehaviorSubject; constructor(private autoCompleteService: AutoCompleteService, - private searchQueryParserService: SearchQueryParserService, - private galleryService: GalleryService, - private navigationService: NavigationService, - private route: ActivatedRoute, public router: Router) { this.SearchQueryTypes = SearchQueryTypes;