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.ormer = o
r.tableName = "album" r.tableName = "album"
r.sortMappings = map[string]string{ 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()", "random": "RANDOM()",
} }
r.filterMappings = map[string]filterFunc{ 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.ormer = o
r.indexGroups = utils.ParseIndexGroups(conf.Server.IndexGroups) r.indexGroups = utils.ParseIndexGroups(conf.Server.IndexGroups)
r.tableName = "artist" r.tableName = "artist"
r.sortMappings = map[string]string{
"name": "order_artist_name",
}
r.filterMappings = map[string]filterFunc{ r.filterMappings = map[string]filterFunc{
"name": fullTextFilter, "name": fullTextFilter,
} }

View file

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

View file

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

View file

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

View file

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