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:
parent
d31cf0040c
commit
b383b7f585
@ -173,7 +173,11 @@ export class SearchQueryParser {
|
|||||||
|
|
||||||
|
|
||||||
const intFromRegexp = (str: string) => {
|
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) === ')') {
|
if (str.charAt(0) === '(' && str.charAt(str.length - 1) === ')') {
|
||||||
str = str.slice(1, str.length - 1);
|
str = str.slice(1, str.length - 1);
|
||||||
|
@ -9,14 +9,14 @@ import {PhotoDTO} from './PhotoDTO';
|
|||||||
|
|
||||||
|
|
||||||
export class ContentWrapper {
|
export class ContentWrapper {
|
||||||
private map: {
|
private map?: {
|
||||||
faces: string[],
|
faces: string[],
|
||||||
keywords: string[],
|
keywords: string[],
|
||||||
lens: string[],
|
lens: string[],
|
||||||
camera: string[],
|
camera: string[],
|
||||||
directories: DirectoryPathDTO[]
|
directories: DirectoryPathDTO[]
|
||||||
};
|
};
|
||||||
private reverseMap: {
|
private reverseMap?: {
|
||||||
faces: Map<string, number>,
|
faces: Map<string, number>,
|
||||||
keywords: Map<string, number>,
|
keywords: Map<string, number>,
|
||||||
lens: Map<string, number>,
|
lens: Map<string, number>,
|
||||||
@ -25,7 +25,7 @@ export class ContentWrapper {
|
|||||||
};
|
};
|
||||||
public directory: ParentDirectoryDTO;
|
public directory: ParentDirectoryDTO;
|
||||||
public searchResult: SearchResultDTO;
|
public searchResult: SearchResultDTO;
|
||||||
public notModified: boolean;
|
public notModified?: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
directory: ParentDirectoryDTO = null,
|
directory: ParentDirectoryDTO = null,
|
||||||
|
@ -111,10 +111,14 @@ export class ContentLoaderService {
|
|||||||
cw = await this.networkService.getJson<ContentWrapperWithError>('/search/' + query);
|
cw = await this.networkService.getJson<ContentWrapperWithError>('/search/' + query);
|
||||||
this.galleryCacheService.setSearch(cw);
|
this.galleryCacheService.setSearch(cw);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
cw = cw || {
|
||||||
|
directory: null,
|
||||||
|
searchResult: null
|
||||||
|
};
|
||||||
if (e.code === ErrorCodes.LocationLookUp_ERROR) {
|
if (e.code === ErrorCodes.LocationLookUp_ERROR) {
|
||||||
cw.error = 'Cannot find location: ' + e.message;
|
cw.error = $localize`Cannot find location` + ': ' + e.message;
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
cw.error = $localize`Unknown server error` + ': ' + e.message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,11 @@ import {PhotoDTO} from '../../../../common/entities/PhotoDTO';
|
|||||||
import {QueryParams} from '../../../../common/QueryParams';
|
import {QueryParams} from '../../../../common/QueryParams';
|
||||||
import {take} from 'rxjs/operators';
|
import {take} from 'rxjs/operators';
|
||||||
import {GallerySortingService, GroupedDirectoryContent} from './navigator/sorting.service';
|
import {GallerySortingService, GroupedDirectoryContent} from './navigator/sorting.service';
|
||||||
import {MediaDTO} from '../../../../common/entities/MediaDTO';
|
|
||||||
import {FilterService} from './filter/filter.service';
|
import {FilterService} from './filter/filter.service';
|
||||||
import {PiTitleService} from '../../model/pi-title.service';
|
import {PiTitleService} from '../../model/pi-title.service';
|
||||||
import {GPXFilesFilterPipe} from '../../pipes/GPXFilesFilterPipe';
|
import {GPXFilesFilterPipe} from '../../pipes/GPXFilesFilterPipe';
|
||||||
import {MDFilesFilterPipe} from '../../pipes/MDFilesFilterPipe';
|
import {MDFilesFilterPipe} from '../../pipes/MDFilesFilterPipe';
|
||||||
import { ContentLoaderService,ContentWrapperWithError } from './contentLoader.service';
|
import {ContentLoaderService, ContentWrapperWithError} from './contentLoader.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-gallery',
|
selector: 'app-gallery',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user