|
@@ -42,7 +42,7 @@ export const getDefaultOptions = async (files: EnteFile[]) => {
|
|
return [
|
|
return [
|
|
await getIndexStatusSuggestion(),
|
|
await getIndexStatusSuggestion(),
|
|
...convertSuggestionsToOptions(await getAllPeopleSuggestion(), files),
|
|
...convertSuggestionsToOptions(await getAllPeopleSuggestion(), files),
|
|
- ];
|
|
|
|
|
|
+ ].filter((t) => !!t);
|
|
};
|
|
};
|
|
|
|
|
|
export const getAutoCompleteSuggestions =
|
|
export const getAutoCompleteSuggestions =
|
|
@@ -176,7 +176,9 @@ function getYearSuggestion(searchPhrase: string): Suggestion[] {
|
|
|
|
|
|
export async function getAllPeopleSuggestion(): Promise<Array<Suggestion>> {
|
|
export async function getAllPeopleSuggestion(): Promise<Array<Suggestion>> {
|
|
try {
|
|
try {
|
|
|
|
+ addLogLine('getAllPeopleSuggestion called');
|
|
const people = await getAllPeople(200);
|
|
const people = await getAllPeople(200);
|
|
|
|
+ addLogLine(`found people: ${people?.length ?? 0}`);
|
|
return people.map((person) => ({
|
|
return people.map((person) => ({
|
|
label: person.name,
|
|
label: person.name,
|
|
type: SuggestionType.PERSON,
|
|
type: SuggestionType.PERSON,
|
|
@@ -190,28 +192,32 @@ export async function getAllPeopleSuggestion(): Promise<Array<Suggestion>> {
|
|
}
|
|
}
|
|
|
|
|
|
export async function getIndexStatusSuggestion(): Promise<Suggestion> {
|
|
export async function getIndexStatusSuggestion(): Promise<Suggestion> {
|
|
- const config = await getMLSyncConfig();
|
|
|
|
- const indexStatus = await mlIDbStorage.getIndexStatus(config.mlVersion);
|
|
|
|
-
|
|
|
|
- let label;
|
|
|
|
- if (!indexStatus.localFilesSynced) {
|
|
|
|
- label = t('INDEXING_SCHEDULED');
|
|
|
|
- } else if (indexStatus.outOfSyncFilesExists) {
|
|
|
|
- label = t('ANALYZING_PHOTOS', {
|
|
|
|
- indexStatus,
|
|
|
|
- });
|
|
|
|
- } else if (!indexStatus.peopleIndexSynced) {
|
|
|
|
- label = t('INDEXING_PEOPLE', { indexStatus });
|
|
|
|
- } else {
|
|
|
|
- label = t('INDEXING_DONE', { indexStatus });
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ const config = await getMLSyncConfig();
|
|
|
|
+ const indexStatus = await mlIDbStorage.getIndexStatus(config.mlVersion);
|
|
|
|
+
|
|
|
|
+ let label;
|
|
|
|
+ if (!indexStatus.localFilesSynced) {
|
|
|
|
+ label = t('INDEXING_SCHEDULED');
|
|
|
|
+ } else if (indexStatus.outOfSyncFilesExists) {
|
|
|
|
+ label = t('ANALYZING_PHOTOS', {
|
|
|
|
+ indexStatus,
|
|
|
|
+ });
|
|
|
|
+ } else if (!indexStatus.peopleIndexSynced) {
|
|
|
|
+ label = t('INDEXING_PEOPLE', { indexStatus });
|
|
|
|
+ } else {
|
|
|
|
+ label = t('INDEXING_DONE', { indexStatus });
|
|
|
|
+ }
|
|
|
|
|
|
- return {
|
|
|
|
- label,
|
|
|
|
- type: SuggestionType.INDEX_STATUS,
|
|
|
|
- value: indexStatus,
|
|
|
|
- hide: true,
|
|
|
|
- };
|
|
|
|
|
|
+ return {
|
|
|
|
+ label,
|
|
|
|
+ type: SuggestionType.INDEX_STATUS,
|
|
|
|
+ value: indexStatus,
|
|
|
|
+ hide: true,
|
|
|
|
+ };
|
|
|
|
+ } catch (e) {
|
|
|
|
+ logError(e, 'getIndexStatusSuggestion failed');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
function getDateSuggestion(searchPhrase: string): Suggestion[] {
|
|
function getDateSuggestion(searchPhrase: string): Suggestion[] {
|