feat: add artist filter to album view

This commit is contained in:
Deluan
2020-03-25 18:51:13 -04:00
committed by Deluan Quintão
parent c84a58ff7d
commit 100db2bcfd
11 changed files with 129 additions and 59 deletions
+12 -2
View File
@@ -9,9 +9,11 @@ import {
FunctionField,
SearchInput,
NumberInput,
BooleanInput,
NullableBooleanInput,
Show,
SimpleShowLayout,
ReferenceInput,
AutocompleteInput,
TextField
} from 'react-admin'
import { DurationField, Pagination, Title } from '../common'
@@ -20,7 +22,15 @@ import { useMediaQuery } from '@material-ui/core'
const AlbumFilter = (props) => (
<Filter {...props}>
<SearchInput source="name" alwaysOn />
<BooleanInput source="compilation" />
<ReferenceInput
source="artist_id"
reference="artist"
sort={{ field: 'name', order: 'ASC' }}
filterToQuery={(searchText) => ({ name: [searchText] })}
>
<AutocompleteInput emptyText="-- None --" />
</ReferenceInput>
<NullableBooleanInput source="compilation" />
<NumberInput source="year" />
</Filter>
)
+3 -1
View File
@@ -17,7 +17,9 @@ const ArtistFilter = (props) => (
const artistRowClick = (id, basePath, record) => {
const filter = { artist_id: id }
return `/album?filter=${JSON.stringify(filter)}&order=ASC&sort=year`
return `/album?filter=${JSON.stringify(
filter
)}&order=ASC&sort=year&displayedFilters={"compilation":true}`
}
const ArtistList = (props) => (