aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/ComputedAttributePage.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/settings/ComputedAttributePage.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/settings/ComputedAttributePage.js')
-rw-r--r--modern/src/settings/ComputedAttributePage.js60
1 files changed, 33 insertions, 27 deletions
diff --git a/modern/src/settings/ComputedAttributePage.js b/modern/src/settings/ComputedAttributePage.js
index 73759fab..fea613a9 100644
--- a/modern/src/settings/ComputedAttributePage.js
+++ b/modern/src/settings/ComputedAttributePage.js
@@ -1,19 +1,19 @@
import React, { useState } from 'react';
-import { Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, FormControl, InputLabel, MenuItem, Select, TextField } from "@material-ui/core";
+import {
+ Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, FormControl, InputLabel, MenuItem, Select, TextField,
+} from '@material-ui/core';
+import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import t from '../common/localization';
import EditItemView from '../EditItemView';
-import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import positionAttributes from '../attributes/positionAttributes';
-
const useStyles = makeStyles(() => ({
details: {
flexDirection: 'column',
},
}));
-const ComputedAttributePage =() => {
-
+const ComputedAttributePage = () => {
const classes = useStyles();
const [item, setItem] = useState();
const [key, setKey] = useState();
@@ -24,20 +24,21 @@ const ComputedAttributePage =() => {
type: value.type,
}));
- const handleChange = event => {
+ const handleChange = (event) => {
const newValue = event.target.value;
setKey(newValue);
const positionAttribute = positionAttributes[newValue];
- if(positionAttribute && positionAttribute.type) {
- setItem({...item, attribute: newValue, type: positionAttribute.type});
+ if (positionAttribute && positionAttribute.type) {
+ setItem({ ...item, attribute: newValue, type: positionAttribute.type });
} else {
- setItem({...item, attribute: newValue});
+ setItem({ ...item, attribute: newValue });
}
- }
+ };
return (
<EditItemView endpoint="/attributes/computed" item={item} setItem={setItem}>
- {item &&
+ {item
+ && (
<Accordion defaultExpanded>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
<Typography variant="subtitle1">
@@ -48,46 +49,51 @@ const ComputedAttributePage =() => {
<TextField
margin="normal"
value={item.description || ''}
- onChange={event => setItem({...item, description: event.target.value})}
+ onChange={(event) => setItem({ ...item, description: event.target.value })}
label={t('sharedDescription')}
- variant="filled" />
+ variant="filled"
+ />
<FormControl variant="filled" margin="normal" fullWidth>
<InputLabel>{t('sharedAttribute')}</InputLabel>
- <Select
- value={item.attribute || ''}
- onChange={handleChange}>
+ <Select
+ value={item.attribute || ''}
+ onChange={handleChange}
+ >
{options.map((option) => (
<MenuItem key={option.key} value={option.key}>{option.name}</MenuItem>
))}
</Select>
- </FormControl>
+ </FormControl>
<TextField
margin="normal"
value={item.expression || ''}
- onChange={event => setItem({...item, expression: event.target.value})}
+ onChange={(event) => setItem({ ...item, expression: event.target.value })}
label={t('sharedExpression')}
multiline
rows={4}
- variant="filled" />
+ variant="filled"
+ />
<FormControl
variant="filled"
margin="normal"
fullWidth
- disabled={key in positionAttributes}>
+ disabled={key in positionAttributes}
+ >
<InputLabel>{t('sharedType')}</InputLabel>
<Select
value={item.type || ''}
- onChange={event => setItem({...item, type: event.target.value})}>
- <MenuItem value={'string'}>{t('sharedTypeString')}</MenuItem>
- <MenuItem value={'number'}>{t('sharedTypeNumber')}</MenuItem>
- <MenuItem value={'boolean'}>{t('sharedTypeBoolean')}</MenuItem>
+ onChange={(event) => setItem({ ...item, type: event.target.value })}
+ >
+ <MenuItem value="string">{t('sharedTypeString')}</MenuItem>
+ <MenuItem value="number">{t('sharedTypeNumber')}</MenuItem>
+ <MenuItem value="boolean">{t('sharedTypeBoolean')}</MenuItem>
</Select>
</FormControl>
</AccordionDetails>
</Accordion>
- }
+ )}
</EditItemView>
- )
-}
+ );
+};
export default ComputedAttributePage;