aboutsummaryrefslogtreecommitdiff
path: root/modern/src/admin/ServerPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-07-10 15:24:10 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-07-10 15:24:10 -0700
commit0512964d71a25c172735f2149ef60c3a8b20f683 (patch)
treef47b42326a7e6a0eaa2715ca8066cb3ca7e7bb90 /modern/src/admin/ServerPage.js
parent627cf95d59f625dcb0544bfd4c067d99dee4bb93 (diff)
downloadtrackermap-web-0512964d71a25c172735f2149ef60c3a8b20f683.tar.gz
trackermap-web-0512964d71a25c172735f2149ef60c3a8b20f683.tar.bz2
trackermap-web-0512964d71a25c172735f2149ef60c3a8b20f683.zip
Use modified airbnb eslint
Diffstat (limited to 'modern/src/admin/ServerPage.js')
-rw-r--r--modern/src/admin/ServerPage.js56
1 files changed, 32 insertions, 24 deletions
diff --git a/modern/src/admin/ServerPage.js b/modern/src/admin/ServerPage.js
index 43664e54..7decac1a 100644
--- a/modern/src/admin/ServerPage.js
+++ b/modern/src/admin/ServerPage.js
@@ -1,18 +1,20 @@
import React from 'react';
import TextField from '@material-ui/core/TextField';
-import t from '../common/localization';
-import { Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, Button, FormControl, Container, Checkbox, FormControlLabel } from '@material-ui/core';
+import {
+ Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, Button, FormControl, Container, Checkbox, FormControlLabel,
+} from '@material-ui/core';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { useHistory } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
+import t from '../common/localization';
import MainToolbar from '../MainToolbar';
import { sessionActions } from '../store';
import EditAttributesView from '../attributes/EditAttributesView';
import deviceAttributes from '../attributes/deviceAttributes';
import userAttributes from '../attributes/userAttributes';
-const useStyles = makeStyles(theme => ({
+const useStyles = makeStyles((theme) => ({
container: {
marginTop: theme.spacing(2),
},
@@ -33,7 +35,7 @@ const ServerPage = () => {
const dispatch = useDispatch();
const classes = useStyles();
- const item = useSelector(state => state.session.server);
+ const item = useSelector((state) => state.session.server);
const setItem = (updatedItem) => dispatch(sessionActions.updateServer(updatedItem));
const handleSave = async () => {
@@ -51,8 +53,9 @@ const ServerPage = () => {
return (
<>
<MainToolbar />
- <Container maxWidth='xs' className={classes.container}>
- {item &&
+ <Container maxWidth="xs" className={classes.container}>
+ {item
+ && (
<>
<Accordion defaultExpanded>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
@@ -64,9 +67,10 @@ const ServerPage = () => {
<TextField
margin="normal"
value={item.announcement || ''}
- onChange={event => setItem({...item, announcement: event.target.value})}
+ onChange={(event) => setItem({ ...item, announcement: event.target.value })}
label={t('serverAnnouncement')}
- variant="filled" />
+ variant="filled"
+ />
</AccordionDetails>
</Accordion>
<Accordion>
@@ -77,17 +81,21 @@ const ServerPage = () => {
</AccordionSummary>
<AccordionDetails className={classes.details}>
<FormControlLabel
- control={<Checkbox checked={item.registration} onChange={event => setItem({...item, registration: event.target.checked})} />}
- label={t('serverRegistration')} />
+ control={<Checkbox checked={item.registration} onChange={(event) => setItem({ ...item, registration: event.target.checked })} />}
+ label={t('serverRegistration')}
+ />
<FormControlLabel
- control={<Checkbox checked={item.readonly} onChange={event => setItem({...item, readonly: event.target.checked})} />}
- label={t('serverReadonly')} />
+ control={<Checkbox checked={item.readonly} onChange={(event) => setItem({ ...item, readonly: event.target.checked })} />}
+ label={t('serverReadonly')}
+ />
<FormControlLabel
- control={<Checkbox checked={item.deviceReadonly} onChange={event => setItem({...item, deviceReadonly: event.target.checked})} />}
- label={t('userDeviceReadonly')} />
+ control={<Checkbox checked={item.deviceReadonly} onChange={(event) => setItem({ ...item, deviceReadonly: event.target.checked })} />}
+ label={t('userDeviceReadonly')}
+ />
<FormControlLabel
- control={<Checkbox checked={item.limitCommands} onChange={event => setItem({...item, limitCommands: event.target.checked})} />}
- label={t('userLimitCommands')} />
+ control={<Checkbox checked={item.limitCommands} onChange={(event) => setItem({ ...item, limitCommands: event.target.checked })} />}
+ label={t('userLimitCommands')}
+ />
</AccordionDetails>
</Accordion>
<Accordion>
@@ -99,19 +107,19 @@ const ServerPage = () => {
<AccordionDetails className={classes.details}>
<EditAttributesView
attributes={item.attributes}
- setAttributes={attributes => setItem({...item, attributes})}
- definitions={{...userAttributes, ...deviceAttributes}}
- />
+ setAttributes={(attributes) => setItem({ ...item, attributes })}
+ definitions={{ ...userAttributes, ...deviceAttributes }}
+ />
</AccordionDetails>
</Accordion>
</>
- }
- <FormControl fullWidth margin='normal'>
+ )}
+ <FormControl fullWidth margin="normal">
<div className={classes.buttons}>
- <Button type='button' color='primary' variant='outlined' onClick={() => history.goBack()}>
+ <Button type="button" color="primary" variant="outlined" onClick={() => history.goBack()}>
{t('sharedCancel')}
</Button>
- <Button type='button' color='primary' variant='contained' onClick={handleSave}>
+ <Button type="button" color="primary" variant="contained" onClick={handleSave}>
{t('sharedSave')}
</Button>
</div>
@@ -119,6 +127,6 @@ const ServerPage = () => {
</Container>
</>
);
-}
+};
export default ServerPage;