Skip to content

Commit

Permalink
Use order fields to sort by artist and album
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Apr 24, 2020
1 parent e6f7988 commit 3b3ad65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ui/src/album/AlbumListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ const AlbumListView = ({ hasShow, hasEdit, hasList, ...rest }) => {
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
return (
<Datagrid expand={<AlbumDetails />} rowClick={'show'} {...rest}>
<TextField source="name" />
<TextField source="name" sortBy={'orderAlbumName'} />
<FunctionField
source="artist"
render={(r) => (r.albumArtist ? r.albumArtist : r.artist)}
sortBy={'orderAlbumArtistName'}
/>
{isDesktop && <NumberField source="songCount" />}
{isDesktop && <NumberField source="playCount" />}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/artist/ArtistList.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ const ArtistList = (props) => (
<List
{...props}
title={<Title subTitle={'Artists'} />}
sort={{ field: 'name', order: 'ASC' }}
sort={{ field: 'orderArtistName', order: 'ASC' }}
exporter={false}
bulkActionButtons={false}
filters={<ArtistFilter />}
perPage={15}
pagination={<Pagination />}
>
<Datagrid rowClick={artistRowClick}>
<TextField source="name" />
<TextField source="name" sortBy={'orderArtistName'} />
<NumberField source="albumCount" />
</Datagrid>
</List>
Expand Down
6 changes: 4 additions & 2 deletions ui/src/song/SongList.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ const SongList = (props) => {
rowClick={(id, basePath, record) => dispatch(setTrack(record))}
>
<TextField source="title" />
{isDesktop && <AlbumLinkField source="album" />}
<TextField source="artist" />
{isDesktop && (
<AlbumLinkField source="album" sortBy={'orderAlbumName'} />
)}
<TextField source="artist" sortBy={'orderArtistName'} />
{isDesktop && <NumberField source="trackNumber" />}
{isDesktop && <NumberField source="playCount" />}
{isDesktop && (
Expand Down

0 comments on commit 3b3ad65

Please sign in to comment.