mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-08 10:27:08 +02:00
The Default Bit Rate dropdown on the Transcoding create/edit forms was fed BITRATE_CHOICES, which starts at 32. There was no way to pick 0, and the SelectInput was not resettable, so an admin could neither create nor restore a transcoding with no default bit rate, such as the default FLAC one (seeded with 0 in consts.DefaultTranscodings). Editing that row also rendered a blank dropdown, since its stored value matched no choice. Adds TRANSCODING_BITRATE_CHOICES, which prepends a 0 entry labelled 'None' to the shared list. The forms use it as SelectInput choices, and the list and read-only show view render it through SelectField, so all four screens resolve the label from the same array and cannot drift. The shared BITRATE_CHOICES is left untouched, because 0 is not a meaningful option for the player Max. Bit Rate or the share dialog. Reported in discussion #6107, where a user had deleted the default transcodings and could not recreate the FLAC one.
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import React from 'react'
|
|
import { Datagrid, SelectField, TextField } from 'react-admin'
|
|
import { useMediaQuery } from '@material-ui/core'
|
|
import { SimpleList, List } from '../common'
|
|
import { TRANSCODING_BITRATE_CHOICES } from '../consts'
|
|
import config from '../config'
|
|
|
|
const TranscodingList = (props) => {
|
|
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
|
|
return (
|
|
<List
|
|
{...props}
|
|
exporter={false}
|
|
bulkActionButtons={config.enableTranscodingConfig}
|
|
>
|
|
{isXsmall ? (
|
|
<SimpleList
|
|
primaryText={(r) => r.name}
|
|
secondaryText={(r) => `format: ${r.targetFormat}`}
|
|
tertiaryText={(r) => (
|
|
<SelectField
|
|
record={r}
|
|
source="defaultBitRate"
|
|
choices={TRANSCODING_BITRATE_CHOICES}
|
|
/>
|
|
)}
|
|
/>
|
|
) : (
|
|
<Datagrid rowClick={config.enableTranscodingConfig ? 'edit' : 'show'}>
|
|
<TextField source="name" />
|
|
<TextField source="targetFormat" />
|
|
<SelectField
|
|
source="defaultBitRate"
|
|
choices={TRANSCODING_BITRATE_CHOICES}
|
|
/>
|
|
<TextField source="command" />
|
|
</Datagrid>
|
|
)}
|
|
</List>
|
|
)
|
|
}
|
|
|
|
export default TranscodingList
|