2020-03-12 05:38:07 -08:00
|
|
|
import {
|
|
|
|
|
TextInput,
|
2020-11-28 06:24:55 -09:00
|
|
|
BooleanInput,
|
2020-03-12 05:38:07 -08:00
|
|
|
TextField,
|
|
|
|
|
Edit,
|
|
|
|
|
required,
|
|
|
|
|
SimpleForm,
|
|
|
|
|
SelectInput,
|
|
|
|
|
ReferenceInput,
|
2020-04-27 19:22:17 -08:00
|
|
|
useTranslate,
|
2020-03-12 05:38:07 -08:00
|
|
|
} from 'react-admin'
|
|
|
|
|
import { Title } from '../common'
|
2021-06-25 18:37:58 -08:00
|
|
|
import config from '../config'
|
2023-01-21 20:49:22 -09:00
|
|
|
import { BITRATE_CHOICES } from '../consts'
|
2020-03-12 05:38:07 -08:00
|
|
|
|
|
|
|
|
const PlayerTitle = ({ record }) => {
|
2020-04-27 19:22:17 -08:00
|
|
|
const translate = useTranslate()
|
|
|
|
|
const resourceName = translate('resources.player.name', { smart_count: 1 })
|
|
|
|
|
return <Title subTitle={`${resourceName} ${record ? record.name : ''}`} />
|
2020-03-12 05:38:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const PlayerEdit = (props) => (
|
|
|
|
|
<Edit title={<PlayerTitle />} {...props}>
|
2020-08-17 07:19:39 -08:00
|
|
|
<SimpleForm variant={'outlined'}>
|
2020-03-12 05:38:07 -08:00
|
|
|
<TextInput source="name" validate={[required()]} />
|
|
|
|
|
<ReferenceInput
|
|
|
|
|
source="transcodingId"
|
|
|
|
|
reference="transcoding"
|
|
|
|
|
sort={{ field: 'name', order: 'ASC' }}
|
|
|
|
|
>
|
|
|
|
|
<SelectInput source="name" resettable />
|
|
|
|
|
</ReferenceInput>
|
2023-01-21 20:49:22 -09:00
|
|
|
<SelectInput source="maxBitRate" resettable choices={BITRATE_CHOICES} />
|
2020-11-28 06:24:55 -09:00
|
|
|
<BooleanInput source="reportRealPath" fullWidth />
|
2021-11-17 17:11:53 -09:00
|
|
|
{(config.lastFMEnabled || config.listenBrainzEnabled) && (
|
2021-06-25 18:37:58 -08:00
|
|
|
<BooleanInput source="scrobbleEnabled" fullWidth />
|
|
|
|
|
)}
|
2020-03-12 05:38:07 -08:00
|
|
|
<TextField source="client" />
|
|
|
|
|
<TextField source="userName" />
|
|
|
|
|
</SimpleForm>
|
|
|
|
|
</Edit>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
export default PlayerEdit
|