mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
support multiselect for nd album artist_id filter
This commit is contained in:
@@ -322,13 +322,17 @@ export const NavidromeController: InternalControllerEndpoint = {
|
|||||||
? query.genreIds
|
? query.genreIds
|
||||||
: query.genreIds?.[0];
|
: query.genreIds?.[0];
|
||||||
|
|
||||||
|
const artistIds = hasFeature(apiClientProps.server, ServerFeature.BFR)
|
||||||
|
? query.artistIds
|
||||||
|
: query.artistIds?.[0];
|
||||||
|
|
||||||
const res = await ndApiClient(apiClientProps).getAlbumList({
|
const res = await ndApiClient(apiClientProps).getAlbumList({
|
||||||
query: {
|
query: {
|
||||||
_end: query.startIndex + (query.limit || 0),
|
_end: query.startIndex + (query.limit || 0),
|
||||||
_order: sortOrderMap.navidrome[query.sortOrder],
|
_order: sortOrderMap.navidrome[query.sortOrder],
|
||||||
_sort: albumListSortMap.navidrome[query.sortBy],
|
_sort: albumListSortMap.navidrome[query.sortBy],
|
||||||
_start: query.startIndex,
|
_start: query.startIndex,
|
||||||
artist_id: query.artistIds?.[0],
|
artist_id: artistIds,
|
||||||
compilation: query.compilation,
|
compilation: query.compilation,
|
||||||
genre_id: genres,
|
genre_id: genres,
|
||||||
has_rating: query.hasRating,
|
has_rating: query.hasRating,
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
|||||||
import { ChangeEvent, useMemo } from 'react';
|
import { ChangeEvent, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import {
|
import { MultiSelectWithInvalidData } from '/@/renderer/components/select-with-invalid-data';
|
||||||
MultiSelectWithInvalidData,
|
|
||||||
SelectWithInvalidData,
|
|
||||||
} from '/@/renderer/components/select-with-invalid-data';
|
|
||||||
import { useListContext } from '/@/renderer/context/list-context';
|
import { useListContext } from '/@/renderer/context/list-context';
|
||||||
import { useAlbumListFilters } from '/@/renderer/features/albums/hooks/use-album-list-filters';
|
import { useAlbumListFilters } from '/@/renderer/features/albums/hooks/use-album-list-filters';
|
||||||
import { artistsQueries } from '/@/renderer/features/artists/api/artists-api';
|
import { artistsQueries } from '/@/renderer/features/artists/api/artists-api';
|
||||||
@@ -187,14 +184,14 @@ export const NavidromeAlbumFilters = ({ disableArtistFilter }: NavidromeAlbumFil
|
|||||||
searchable
|
searchable
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<SelectWithInvalidData
|
<MultiSelectWithInvalidData
|
||||||
clearable
|
clearable
|
||||||
data={selectableAlbumArtists}
|
data={selectableAlbumArtists}
|
||||||
defaultValue={query.artistIds?.[0] || undefined}
|
defaultValue={query.artistIds || []}
|
||||||
disabled={disableArtistFilter}
|
disabled={disableArtistFilter}
|
||||||
label={t('entity.artist', { count: 1, postProcess: 'titleCase' })}
|
label={t('entity.artist', { count: 2, postProcess: 'sentenceCase' })}
|
||||||
limit={300}
|
limit={300}
|
||||||
onChange={(e) => setAlbumArtist(e ? [e] : null)}
|
onChange={(e) => (e && e.length > 0 ? setAlbumArtist(e) : setAlbumArtist(null))}
|
||||||
rightSection={albumArtistListQuery.isFetching ? <SpinnerIcon /> : undefined}
|
rightSection={albumArtistListQuery.isFetching ? <SpinnerIcon /> : undefined}
|
||||||
searchable
|
searchable
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ const albumList = z.array(album);
|
|||||||
const albumListParameters = paginationParameters.extend({
|
const albumListParameters = paginationParameters.extend({
|
||||||
_sort: z.nativeEnum(NDAlbumListSort).optional(),
|
_sort: z.nativeEnum(NDAlbumListSort).optional(),
|
||||||
album_id: z.string().optional(),
|
album_id: z.string().optional(),
|
||||||
artist_id: z.string().optional(),
|
artist_id: z.union([z.string(), z.string().array()]).optional(),
|
||||||
compilation: z.boolean().optional(),
|
compilation: z.boolean().optional(),
|
||||||
// in older versions, this was a single string. post BFR, you can repeat it multiple times
|
// in older versions, this was a single string. post BFR, you can repeat it multiple times
|
||||||
genre_id: z.union([z.string(), z.string().array()]).optional(),
|
genre_id: z.union([z.string(), z.string().array()]).optional(),
|
||||||
|
|||||||
Reference in New Issue
Block a user