1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

Fixing Search error message (it was not showing) #683

This commit is contained in:
Patrik J. Braun 2023-09-08 23:09:44 +02:00
parent d31cf0040c
commit b383b7f585
4 changed files with 15 additions and 8 deletions

View File

@ -173,7 +173,11 @@ export class SearchQueryParser {
const intFromRegexp = (str: string) => {
return parseInt(new RegExp(/\d+/).exec(str)[0], 10);
const numSTR = new RegExp(/\d+/).exec(str);
if (!numSTR) {
return 0;
}
return parseInt(numSTR[0], 10);
};
if (str.charAt(0) === '(' && str.charAt(str.length - 1) === ')') {
str = str.slice(1, str.length - 1);

View File

@ -9,14 +9,14 @@ import {PhotoDTO} from './PhotoDTO';
export class ContentWrapper {
private map: {
private map?: {
faces: string[],
keywords: string[],
lens: string[],
camera: string[],
directories: DirectoryPathDTO[]
};
private reverseMap: {
private reverseMap?: {
faces: Map<string, number>,
keywords: Map<string, number>,
lens: Map<string, number>,
@ -25,7 +25,7 @@ export class ContentWrapper {
};
public directory: ParentDirectoryDTO;
public searchResult: SearchResultDTO;
public notModified: boolean;
public notModified?: boolean;
constructor(
directory: ParentDirectoryDTO = null,

View File

@ -111,10 +111,14 @@ export class ContentLoaderService {
cw = await this.networkService.getJson<ContentWrapperWithError>('/search/' + query);
this.galleryCacheService.setSearch(cw);
} catch (e) {
cw = cw || {
directory: null,
searchResult: null
};
if (e.code === ErrorCodes.LocationLookUp_ERROR) {
cw.error = 'Cannot find location: ' + e.message;
cw.error = $localize`Cannot find location` + ': ' + e.message;
} else {
throw e;
cw.error = $localize`Unknown server error` + ': ' + e.message;
}
}
}

View File

@ -13,12 +13,11 @@ import {PhotoDTO} from '../../../../common/entities/PhotoDTO';
import {QueryParams} from '../../../../common/QueryParams';
import {take} from 'rxjs/operators';
import {GallerySortingService, GroupedDirectoryContent} from './navigator/sorting.service';
import {MediaDTO} from '../../../../common/entities/MediaDTO';
import {FilterService} from './filter/filter.service';
import {PiTitleService} from '../../model/pi-title.service';
import {GPXFilesFilterPipe} from '../../pipes/GPXFilesFilterPipe';
import {MDFilesFilterPipe} from '../../pipes/MDFilesFilterPipe';
import { ContentLoaderService,ContentWrapperWithError } from './contentLoader.service';
import {ContentLoaderService, ContentWrapperWithError} from './contentLoader.service';
@Component({
selector: 'app-gallery',