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
+3 -3
View File
@@ -84,9 +84,9 @@ const AlbumListView = ({ hasShow, hasEdit, hasList, ...rest }) => {
<AlbumDatagrid expand={<AlbumDetails />} rowClick={'show'} {...rest}> <AlbumDatagrid expand={<AlbumDetails />} rowClick={'show'} {...rest}>
<TextField source="name" /> <TextField source="name" />
<ArtistLinkField /> <ArtistLinkField />
{isDesktop && <NumberField source="songCount" />} {isDesktop && <NumberField source="songCount" sortByOrder={'DESC'} />}
{isDesktop && <NumberField source="playCount" />} {isDesktop && <NumberField source="playCount" sortByOrder={'DESC'} />}
<RangeField source={'year'} sortBy={'maxYear'} /> <RangeField source={'year'} sortBy={'maxYear'} sortByOrder={'DESC'} />
{isDesktop && <DurationField source="duration" />} {isDesktop && <DurationField source="duration" />}
<AlbumContextMenu /> <AlbumContextMenu />
</AlbumDatagrid> </AlbumDatagrid>
+2 -2
View File
@@ -24,8 +24,8 @@ const ArtistList = (props) => (
> >
<Datagrid rowClick={artistLink}> <Datagrid rowClick={artistLink}>
<TextField source="name" /> <TextField source="name" />
<NumberField source="albumCount" /> <NumberField source="albumCount" sortByOrder={'DESC'} />
<NumberField source="songCount" /> <NumberField source="songCount" sortByOrder={'DESC'} />
</Datagrid> </Datagrid>
</List> </List>
) )
+1 -1
View File
@@ -29,7 +29,7 @@ const PlayerList = (props) => {
source="maxBitRate" source="maxBitRate"
render={(r) => (r.maxBitRate ? r.maxBitRate : '-')} render={(r) => (r.maxBitRate ? r.maxBitRate : '-')}
/> />
<DateField source="lastSeen" showTime /> <DateField source="lastSeen" showTime sortByOrder={'DESC'} />
</Datagrid> </Datagrid>
)} )}
</List> </List>
+6 -2
View File
@@ -63,8 +63,12 @@ const PlaylistList = ({ permissions, ...props }) => (
<TextField source="owner" /> <TextField source="owner" />
<NumberField source="songCount" /> <NumberField source="songCount" />
<DurationField source="duration" /> <DurationField source="duration" />
<DateField source="updatedAt" /> <DateField source="updatedAt" sortByOrder={'DESC'} />
<TogglePublicInput source="public" permissions={permissions} /> <TogglePublicInput
source="public"
permissions={permissions}
sortByOrder={'DESC'}
/>
<Writable> <Writable>
<EditButton /> <EditButton />
</Writable> </Writable>
+10 -3
View File
@@ -87,14 +87,21 @@ const SongList = (props) => {
{isDesktop && <AlbumLinkField source="album" />} {isDesktop && <AlbumLinkField source="album" />}
<TextField source="artist" /> <TextField source="artist" />
{isDesktop && <NumberField source="trackNumber" />} {isDesktop && <NumberField source="trackNumber" />}
{isDesktop && <NumberField source="playCount" />}
{isDesktop && ( {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" /> <DurationField source="duration" />
<SongContextMenu <SongContextMenu
source={'starred'} source={'starred'}
sortBy={'starred DESC, starredAt DESC'} sortBy={'starred ASC, starredAt ASC'}
sortByOrder={'DESC'}
label={ label={
<StarBorderIcon <StarBorderIcon
fontSize={'small'} fontSize={'small'}
+2 -2
View File
@@ -40,8 +40,8 @@ const UserList = (props) => {
<TextField source="userName" /> <TextField source="userName" />
<TextField source="name" /> <TextField source="name" />
<BooleanField source="isAdmin" /> <BooleanField source="isAdmin" />
<DateField source="lastLoginAt" locales="pt-BR" /> <DateField source="lastLoginAt" sortByOrder={'DESC'} />
<DateField source="updatedAt" locales="pt-BR" /> <DateField source="updatedAt" sortByOrder={'DESC'} />
</Datagrid> </Datagrid>
)} )}
</List> </List>