Add Size column to Artist and Album views

This commit is contained in:
Deluan 2023-01-16 15:00:50 -05:00
parent 4a054de3d5
commit 7682fddec0
4 changed files with 16 additions and 6 deletions

View File

@ -103,9 +103,10 @@ const AlbumList = (props) => {
'year',
'duration',
'rating',
'size',
'createdAt',
],
['createdAt']
['createdAt', 'size']
)
// If it does not have filter/sort params (usually coming from Menu),

View File

@ -19,6 +19,7 @@ import {
AlbumContextMenu,
RatingField,
useSelectedFields,
SizeField,
} from '../common'
import config from '../config'
import { DraggableTypes } from '../consts'
@ -95,6 +96,7 @@ const AlbumTableView = ({
<RangeField source={'year'} sortBy={'max_year'} sortByOrder={'DESC'} />
),
duration: isDesktop && <DurationField source="duration" />,
size: isDesktop && <SizeField source="size" />,
rating: config.enableStarRating && (
<RatingField
source={'rating'}

View File

@ -27,6 +27,7 @@ import {
RatingField,
useSelectedFields,
useResourceRefresh,
SizeField,
} from '../common'
import config from '../config'
import ArtistListActions from './ArtistListActions'
@ -115,6 +116,7 @@ const ArtistListView = ({ hasShow, hasEdit, hasList, width, ...rest }) => {
return {
albumCount: <NumberField source="albumCount" sortByOrder={'DESC'} />,
songCount: <NumberField source="songCount" sortByOrder={'DESC'} />,
size: !isXsmall && <SizeField source="size" />,
playCount: <NumberField source="playCount" sortByOrder={'DESC'} />,
rating: config.enableStarRating && (
<RatingField
@ -125,12 +127,15 @@ const ArtistListView = ({ hasShow, hasEdit, hasList, width, ...rest }) => {
/>
),
}
}, [classes.ratingField])
}, [classes.ratingField, isXsmall])
const columns = useSelectedFields({
resource: 'artist',
columns: toggleableFields,
})
const columns = useSelectedFields(
{
resource: 'artist',
columns: toggleableFields,
},
['size']
)
return isXsmall ? (
<ArtistSimpleList

View File

@ -46,6 +46,7 @@
"duration": "Time",
"songCount": "Songs",
"playCount": "Plays",
"size": "Size",
"name": "Name",
"genre": "Genre",
"compilation": "Compilation",
@ -80,6 +81,7 @@
"name": "Name",
"albumCount": "Album Count",
"songCount": "Song Count",
"size": "Size",
"playCount": "Plays",
"rating": "Rating",
"genre": "Genre"