fix(ui): allow setting a transcoding Default Bit Rate of 0

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.
This commit is contained in:
Deluan 2026-09-09 16:09:58 -04:00
commit 8d77a49b31
6 changed files with 35 additions and 9 deletions

View file

@ -1,7 +1,8 @@
import React from 'react'
import { Show, SimpleShowLayout, TextField } from 'react-admin'
import { SelectField, Show, SimpleShowLayout, TextField } from 'react-admin'
import { Title } from '../common'
import { TranscodingNote } from './TranscodingNote'
import { TRANSCODING_BITRATE_CHOICES } from '../consts'
const TranscodingTitle = ({ record }) => {
return <Title subTitle={`Transcoding ${record ? record.name : ''}`} />
@ -16,7 +17,10 @@ const TranscodingShow = (props) => {
<SimpleShowLayout>
<TextField source="name" />
<TextField source="targetFormat" />
<TextField source="defaultBitRate" />
<SelectField
source="defaultBitRate"
choices={TRANSCODING_BITRATE_CHOICES}
/>
<TextField source="command" />
</SimpleShowLayout>
</Show>