diff options
-rw-r--r-- | modern/src/common/components/SelectField.jsx | 10 | ||||
-rw-r--r-- | modern/src/reports/components/ReportFilter.jsx | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/modern/src/common/components/SelectField.jsx b/modern/src/common/components/SelectField.jsx index c7efe75f..db8c30b0 100644 --- a/modern/src/common/components/SelectField.jsx +++ b/modern/src/common/components/SelectField.jsx @@ -1,5 +1,5 @@ import { - FormControl, InputLabel, MenuItem, Select, Autocomplete, TextField + FormControl, InputLabel, MenuItem, Select, Autocomplete, TextField, } from '@mui/material'; import React, { useState } from 'react'; import { useEffectAsync } from '../../reactHelper'; @@ -21,10 +21,10 @@ const SelectField = ({ const getOptionLabel = (option) => { if (typeof option !== 'object') { - option = items.find(obj => keyGetter(obj) === option); + option = items.find((obj) => keyGetter(obj) === option); } return option ? titleGetter(option) : emptyTitle; - } + }; useEffectAsync(async () => { if (endpoint) { @@ -62,9 +62,9 @@ const SelectField = ({ renderOption={(props, option) => ( <MenuItem {...props} key={keyGetter(option)} value={keyGetter(option)}>{titleGetter(option)}</MenuItem> )} - isOptionEqualToValue={(option, value) => keyGetter(option) == value} + isOptionEqualToValue={(option, value) => keyGetter(option) === value} value={value} - onChange={(_, value) => onChange({ target: { value: value ? keyGetter(value) : emptyValue }})} + onChange={(_, value) => onChange({ target: { value: value ? keyGetter(value) : emptyValue } })} renderInput={(params) => <TextField {...params} label={label} />} /> )} diff --git a/modern/src/reports/components/ReportFilter.jsx b/modern/src/reports/components/ReportFilter.jsx index 5b4c5786..e6e08f16 100644 --- a/modern/src/reports/components/ReportFilter.jsx +++ b/modern/src/reports/components/ReportFilter.jsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { - FormControl, InputLabel, Select, MenuItem, Button, TextField, Typography, Autocomplete + FormControl, InputLabel, Select, MenuItem, Button, TextField, Typography, } from '@mui/material'; import { useDispatch, useSelector } from 'react-redux'; import dayjs from 'dayjs'; @@ -92,7 +92,7 @@ const ReportFilter = ({ children, handleSubmit, handleSchedule, showOnly, ignore <div className={classes.filter}> {!ignoreDevice && ( <div className={classes.filterItem}> - <SelectField + <SelectField label={t(multiDevice ? 'deviceTitle' : 'reportDevice')} data={Object.values(devices).sort((a, b) => a.name.localeCompare(b.name))} value={multiDevice ? deviceIds : deviceId} @@ -104,13 +104,13 @@ const ReportFilter = ({ children, handleSubmit, handleSchedule, showOnly, ignore )} {includeGroups && ( <div className={classes.filterItem}> - <SelectField + <SelectField label={t('settingsGroups')} data={Object.values(groups).sort((a, b) => a.name.localeCompare(b.name))} value={groupIds} onChange={(e) => dispatch(reportsActions.updateGroupIds(e.target.value))} multiple - fullWidth + fullWidth /> </div> )} |