quintodrome/ui/src/player/PlayerEdit.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-03-12 05:38:07 -08:00
import React from 'react'
import {
TextInput,
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'
import config from '../config'
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}>
<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>
<SelectInput
source="maxBitRate"
choices={[
{ id: 32, name: '32' },
{ id: 48, name: '48' },
{ id: 64, name: '64' },
{ id: 80, name: '80' },
{ id: 96, name: '96' },
{ id: 112, name: '112' },
{ id: 128, name: '128' },
{ id: 160, name: '160' },
{ id: 192, name: '192' },
{ id: 256, name: '256' },
{ id: 320, name: '320' },
2020-05-04 16:27:09 -08:00
{ id: 0, name: '-' },
2020-03-12 05:38:07 -08:00
]}
/>
<BooleanInput source="reportRealPath" fullWidth />
{config.lastFMEnabled && (
<BooleanInput source="scrobbleEnabled" fullWidth />
)}
2020-03-12 05:38:07 -08:00
<TextField source="client" />
<TextField source="userName" />
</SimpleForm>
</Edit>
)
export default PlayerEdit