Better defaults to sort orders in List views

This commit is contained in:
Deluan 2020-06-09 07:45:23 -04:00
parent b54d4c75ae
commit 82d437f004
6 changed files with 24 additions and 13 deletions

View File

@ -84,9 +84,9 @@ const AlbumListView = ({ hasShow, hasEdit, hasList, ...rest }) => {
<AlbumDatagrid expand={<AlbumDetails />} rowClick={'show'} {...rest}>
<TextField source="name" />
<ArtistLinkField />
{isDesktop && <NumberField source="songCount" />}
{isDesktop && <NumberField source="playCount" />}
<RangeField source={'year'} sortBy={'maxYear'} />
{isDesktop && <NumberField source="songCount" sortByOrder={'DESC'} />}
{isDesktop && <NumberField source="playCount" sortByOrder={'DESC'} />}
<RangeField source={'year'} sortBy={'maxYear'} sortByOrder={'DESC'} />
{isDesktop && <DurationField source="duration" />}
<AlbumContextMenu />
</AlbumDatagrid>

View File

@ -24,8 +24,8 @@ const ArtistList = (props) => (
>
<Datagrid rowClick={artistLink}>
<TextField source="name" />
<NumberField source="albumCount" />
<NumberField source="songCount" />
<NumberField source="albumCount" sortByOrder={'DESC'} />
<NumberField source="songCount" sortByOrder={'DESC'} />
</Datagrid>
</List>
)

View File

@ -29,7 +29,7 @@ const PlayerList = (props) => {
source="maxBitRate"
render={(r) => (r.maxBitRate ? r.maxBitRate : '-')}
/>
<DateField source="lastSeen" showTime />
<DateField source="lastSeen" showTime sortByOrder={'DESC'} />
</Datagrid>
)}
</List>

View File

@ -63,8 +63,12 @@ const PlaylistList = ({ permissions, ...props }) => (
<TextField source="owner" />
<NumberField source="songCount" />
<DurationField source="duration" />
<DateField source="updatedAt" />
<TogglePublicInput source="public" permissions={permissions} />
<DateField source="updatedAt" sortByOrder={'DESC'} />
<TogglePublicInput
source="public"
permissions={permissions}
sortByOrder={'DESC'}
/>
<Writable>
<EditButton />
</Writable>

View File

@ -87,14 +87,21 @@ const SongList = (props) => {
{isDesktop && <AlbumLinkField source="album" />}
<TextField source="artist" />
{isDesktop && <NumberField source="trackNumber" />}
{isDesktop && <NumberField source="playCount" />}
{isDesktop && (
<FunctionField source="year" render={(r) => r.year || ''} />
<NumberField source="playCount" sortByOrder={'DESC'} />
)}
{isDesktop && (
<FunctionField
source="year"
render={(r) => r.year || ''}
sortByOrder={'DESC'}
/>
)}
<DurationField source="duration" />
<SongContextMenu
source={'starred'}
sortBy={'starred DESC, starredAt DESC'}
sortBy={'starred ASC, starredAt ASC'}
sortByOrder={'DESC'}
label={
<StarBorderIcon
fontSize={'small'}

View File

@ -40,8 +40,8 @@ const UserList = (props) => {
<TextField source="userName" />
<TextField source="name" />
<BooleanField source="isAdmin" />
<DateField source="lastLoginAt" locales="pt-BR" />
<DateField source="updatedAt" locales="pt-BR" />
<DateField source="lastLoginAt" sortByOrder={'DESC'} />
<DateField source="updatedAt" sortByOrder={'DESC'} />
</Datagrid>
)}
</List>