2020-02-29 20:01:09 -05:00
|
|
|
import React from 'react'
|
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.
2026-09-09 16:09:58 -04:00
|
|
|
import { Datagrid, SelectField, TextField } from 'react-admin'
|
2020-04-19 13:54:51 -04:00
|
|
|
import { useMediaQuery } from '@material-ui/core'
|
2020-05-15 10:20:11 -04:00
|
|
|
import { SimpleList, List } from '../common'
|
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.
2026-09-09 16:09:58 -04:00
|
|
|
import { TRANSCODING_BITRATE_CHOICES } from '../consts'
|
2020-04-27 21:23:15 -04:00
|
|
|
import config from '../config'
|
2020-02-29 20:01:09 -05:00
|
|
|
|
2020-04-19 13:54:51 -04:00
|
|
|
const TranscodingList = (props) => {
|
|
|
|
|
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
|
|
|
|
|
return (
|
2025-03-07 18:01:49 -05:00
|
|
|
<List
|
|
|
|
|
{...props}
|
|
|
|
|
exporter={false}
|
|
|
|
|
bulkActionButtons={config.enableTranscodingConfig}
|
|
|
|
|
>
|
2020-04-19 13:54:51 -04:00
|
|
|
{isXsmall ? (
|
|
|
|
|
<SimpleList
|
|
|
|
|
primaryText={(r) => r.name}
|
|
|
|
|
secondaryText={(r) => `format: ${r.targetFormat}`}
|
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.
2026-09-09 16:09:58 -04:00
|
|
|
tertiaryText={(r) => (
|
|
|
|
|
<SelectField
|
|
|
|
|
record={r}
|
|
|
|
|
source="defaultBitRate"
|
|
|
|
|
choices={TRANSCODING_BITRATE_CHOICES}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2020-04-19 13:54:51 -04:00
|
|
|
/>
|
|
|
|
|
) : (
|
2020-04-27 21:23:15 -04:00
|
|
|
<Datagrid rowClick={config.enableTranscodingConfig ? 'edit' : 'show'}>
|
2020-04-19 13:54:51 -04:00
|
|
|
<TextField source="name" />
|
|
|
|
|
<TextField source="targetFormat" />
|
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.
2026-09-09 16:09:58 -04:00
|
|
|
<SelectField
|
|
|
|
|
source="defaultBitRate"
|
|
|
|
|
choices={TRANSCODING_BITRATE_CHOICES}
|
|
|
|
|
/>
|
2020-04-19 13:54:51 -04:00
|
|
|
<TextField source="command" />
|
|
|
|
|
</Datagrid>
|
|
|
|
|
)}
|
|
|
|
|
</List>
|
|
|
|
|
)
|
|
|
|
|
}
|
2020-02-29 20:01:09 -05:00
|
|
|
|
|
|
|
|
export default TranscodingList
|