aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-09-27 19:52:54 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-09-27 19:52:54 -0700
commit3fdfe78d0f3568072f838a0721e9521258d95c1e (patch)
tree279912417462373459b87f87b68a471c15583b80
parent9bfda9e131ddda3076b4094a94795db41072a39c (diff)
downloadetbsa-traccar-web-3fdfe78d0f3568072f838a0721e9521258d95c1e.tar.gz
etbsa-traccar-web-3fdfe78d0f3568072f838a0721e9521258d95c1e.tar.bz2
etbsa-traccar-web-3fdfe78d0f3568072f838a0721e9521258d95c1e.zip
Add attributes to device
-rw-r--r--modern/src/DevicePage.js16
-rw-r--r--modern/src/attributes/deviceAttributes.js12
2 files changed, 28 insertions, 0 deletions
diff --git a/modern/src/DevicePage.js b/modern/src/DevicePage.js
index f298540..b531f46 100644
--- a/modern/src/DevicePage.js
+++ b/modern/src/DevicePage.js
@@ -6,6 +6,8 @@ import EditItemView from './EditItemView';
import { Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, FormControl, InputLabel, Select, FormControlLabel, Checkbox } from '@material-ui/core';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { useEffectAsync } from './reactHelper';
+import EditAttributesView from './attributes/EditAttributesView';
+import deviceAttributes from './attributes/deviceAttributes';
const useStyles = makeStyles(() => ({
details: {
@@ -130,6 +132,20 @@ const DevicePage = () => {
label={t('sharedDisabled')} />
</AccordionDetails>
</Accordion>
+ <Accordion>
+ <AccordionSummary expandIcon={<ExpandMoreIcon />}>
+ <Typography variant="subtitle1">
+ {t('sharedAttributes')}
+ </Typography>
+ </AccordionSummary>
+ <AccordionDetails className={classes.details}>
+ <EditAttributesView
+ attributes={item.attributes}
+ setAttributes={attributes => setItem({...item, attributes})}
+ definitions={deviceAttributes}
+ />
+ </AccordionDetails>
+ </Accordion>
</>
}
</EditItemView>
diff --git a/modern/src/attributes/deviceAttributes.js b/modern/src/attributes/deviceAttributes.js
new file mode 100644
index 0000000..891a225
--- /dev/null
+++ b/modern/src/attributes/deviceAttributes.js
@@ -0,0 +1,12 @@
+import t from '../common/localization'
+
+export default {
+ 'speedLimit': {
+ name: t('attributeSpeedLimit'),
+ type: 'string',
+ },
+ 'report.ignoreOdometer': {
+ name: t('attributeReportIgnoreOdometer'),
+ type: 'boolean',
+ },
+};