Fix various small sort issues

This commit is contained in:
Deluan 2020-04-24 17:37:28 -04:00
parent 1dd3a794f8
commit 8dcca76ec9
6 changed files with 11 additions and 11 deletions

View file

@ -26,7 +26,7 @@ func NewAlbumRepository(ctx context.Context, o orm.Ormer) model.AlbumRepository
r.ormer = o
r.tableName = "album"
r.sortMappings = map[string]string{
"artist": "compilation asc, album_artist asc, name asc",
"artist": "compilation asc, order_album_artist_name asc, order_album_name asc",
"random": "RANDOM()",
}
r.filterMappings = map[string]filterFunc{

View file

@ -26,6 +26,9 @@ func NewArtistRepository(ctx context.Context, o orm.Ormer) model.ArtistRepositor
r.ormer = o
r.indexGroups = utils.ParseIndexGroups(conf.Server.IndexGroups)
r.tableName = "artist"
r.sortMappings = map[string]string{
"name": "order_artist_name",
}
r.filterMappings = map[string]filterFunc{
"name": fullTextFilter,
}

View file

@ -23,8 +23,8 @@ func NewMediaFileRepository(ctx context.Context, o orm.Ormer) *mediaFileReposito
r.ormer = o
r.tableName = "media_file"
r.sortMappings = map[string]string{
"artist": "artist asc, album asc, disc_number asc, track_number asc",
"album": "album asc, disc_number asc, track_number asc",
"artist": "order_artist_name asc, album asc, disc_number asc, track_number asc",
"album": "order_album_name asc, disc_number asc, track_number asc",
}
r.filterMappings = map[string]filterFunc{
"title": fullTextFilter,

View file

@ -29,11 +29,10 @@ const AlbumListView = ({ hasShow, hasEdit, hasList, ...rest }) => {
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
return (
<Datagrid expand={<AlbumDetails />} rowClick={'show'} {...rest}>
<TextField source="name" sortBy={'orderAlbumName'} />
<TextField source="name" />
<FunctionField
source="artist"
render={(r) => (r.albumArtist ? r.albumArtist : r.artist)}
sortBy={'orderAlbumArtistName'}
/>
{isDesktop && <NumberField source="songCount" />}
{isDesktop && <NumberField source="playCount" />}

View file

@ -26,7 +26,7 @@ const ArtistList = (props) => (
<List
{...props}
title={<Title subTitle={'Artists'} />}
sort={{ field: 'orderArtistName', order: 'ASC' }}
sort={{ field: 'name', order: 'ASC' }}
exporter={false}
bulkActionButtons={false}
filters={<ArtistFilter />}
@ -34,7 +34,7 @@ const ArtistList = (props) => (
pagination={<Pagination />}
>
<Datagrid rowClick={artistRowClick}>
<TextField source="name" sortBy={'orderArtistName'} />
<TextField source="name" />
<NumberField source="albumCount" />
</Datagrid>
</List>

View file

@ -63,10 +63,8 @@ const SongList = (props) => {
rowClick={(id, basePath, record) => dispatch(setTrack(record))}
>
<TextField source="title" />
{isDesktop && (
<AlbumLinkField source="album" sortBy={'orderAlbumName'} />
)}
<TextField source="artist" sortBy={'orderArtistName'} />
{isDesktop && <AlbumLinkField source="album" />}
<TextField source="artist" />
{isDesktop && <NumberField source="trackNumber" />}
{isDesktop && <NumberField source="playCount" />}
{isDesktop && (