Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
108 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react' | ||
import { | ||
TextInput, | ||
TextField, | ||
Edit, | ||
required, | ||
SimpleForm, | ||
SelectInput, | ||
ReferenceInput | ||
} from 'react-admin' | ||
import { Title } from '../common' | ||
|
||
const PlayerTitle = ({ record }) => { | ||
return <Title subTitle={`Player ${record ? record.name : ''}`} /> | ||
} | ||
|
||
const PlayerEdit = (props) => ( | ||
<Edit title={<PlayerTitle />} {...props}> | ||
<SimpleForm> | ||
<TextInput source="name" validate={[required()]} /> | ||
<ReferenceInput | ||
label="Transcoding" | ||
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' }, | ||
{ id: 0, name: 'Unlimited' } | ||
]} | ||
/> | ||
<TextField source="client" /> | ||
<TextField source="userName" /> | ||
</SimpleForm> | ||
</Edit> | ||
) | ||
|
||
export default PlayerEdit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react' | ||
import { | ||
Datagrid, | ||
List, | ||
TextField, | ||
DateField, | ||
FunctionField, | ||
ReferenceField | ||
} from 'react-admin' | ||
import { Title } from '../common' | ||
|
||
const PlayerList = (props) => ( | ||
<List title={<Title subTitle={'Players'} />} exporter={false} {...props}> | ||
<Datagrid rowClick="edit"> | ||
<TextField source="name" /> | ||
<ReferenceField | ||
label="Transcoding" | ||
source="transcodingId" | ||
reference="transcoding" | ||
> | ||
<TextField source="name" /> | ||
</ReferenceField> | ||
<FunctionField | ||
label="MaxBitRate" | ||
source="maxBitRate" | ||
render={(r) => (r.maxBitRate ? r.maxBitRate : 'Unlimited')} | ||
/> | ||
<DateField source="lastSeen" showTime /> | ||
</Datagrid> | ||
</List> | ||
) | ||
|
||
export default PlayerList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import RadioIcon from '@material-ui/icons/Radio' | ||
import PlayerList from './PlayerList' | ||
import PlayerEdit from './PlayerEdit' | ||
|
||
export default { | ||
list: PlayerList, | ||
edit: PlayerEdit, | ||
icon: RadioIcon | ||
} |