feat: add searching by tags (#15395)
* feat: add searching by tags * fix: fix merge --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
type SmartSearchDto,
|
||||
type MetadataSearchDto,
|
||||
type AlbumResponseDto,
|
||||
getTagById,
|
||||
} from '@immich/sdk';
|
||||
import { mdiArrowLeft, mdiDotsVertical, mdiImageOffOutline, mdiPlus, mdiSelectAll } from '@mdi/js';
|
||||
import type { Viewport } from '$lib/stores/assets.store';
|
||||
@@ -194,6 +195,7 @@
|
||||
model: $t('camera_model'),
|
||||
lensModel: $t('lens_model'),
|
||||
personIds: $t('people'),
|
||||
tagIds: $t('tags'),
|
||||
originalFileName: $t('file_name'),
|
||||
};
|
||||
return keyMap[key] || key;
|
||||
@@ -215,6 +217,18 @@
|
||||
return personNames.join(', ');
|
||||
}
|
||||
|
||||
async function getTagNames(tagIds: string[]) {
|
||||
const tagNames = await Promise.all(
|
||||
tagIds.map(async (tagId) => {
|
||||
const tag = await getTagById({ id: tagId });
|
||||
|
||||
return tag.value;
|
||||
}),
|
||||
);
|
||||
|
||||
return tagNames.join(', ');
|
||||
}
|
||||
|
||||
const triggerAssetUpdate = () => (searchResultAssets = searchResultAssets);
|
||||
|
||||
const onAddToAlbum = (assetIds: string[]) => {
|
||||
@@ -299,6 +313,10 @@
|
||||
{#await getPersonName(value) then personName}
|
||||
{personName}
|
||||
{/await}
|
||||
{:else if key === 'tagIds' && Array.isArray(value)}
|
||||
{#await getTagNames(value) then tagNames}
|
||||
{tagNames}
|
||||
{/await}
|
||||
{:else if value === null || value === ''}
|
||||
{$t('unknown')}
|
||||
{:else}
|
||||
|
||||
Reference in New Issue
Block a user