aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatjaž Črnko <m.crnko@txt.si>2024-01-22 14:55:53 +0100
committerMatjaž Črnko <m.crnko@txt.si>2024-01-22 14:55:53 +0100
commitb39ffd97e355dc2a6bba65ffa56947734455ed24 (patch)
treef5571cf555acc7e8b509e40b1f43278783942012
parent783eccb019824946d758c31f2f945ce2fc80fc2a (diff)
downloadtrackermap-web-b39ffd97e355dc2a6bba65ffa56947734455ed24.tar.gz
trackermap-web-b39ffd97e355dc2a6bba65ffa56947734455ed24.tar.bz2
trackermap-web-b39ffd97e355dc2a6bba65ffa56947734455ed24.zip
fix: Migrate ReportFilter to SelectField
-rw-r--r--modern/src/reports/components/ReportFilter.jsx43
1 files changed, 8 insertions, 35 deletions
diff --git a/modern/src/reports/components/ReportFilter.jsx b/modern/src/reports/components/ReportFilter.jsx
index de64188c..9e6a0a23 100644
--- a/modern/src/reports/components/ReportFilter.jsx
+++ b/modern/src/reports/components/ReportFilter.jsx
@@ -92,41 +92,14 @@ const ReportFilter = ({ children, handleSubmit, handleSchedule, showOnly, ignore
<div className={classes.filter}>
{!ignoreDevice && (
<div className={classes.filterItem}>
- <FormControl fullWidth>
- {multiDevice ? (
- <>
- <InputLabel>{t('deviceTitle')}</InputLabel>
- <Select
- label={t('deviceTitle')}
- value={deviceIds}
- onChange={(e) => dispatch(devicesActions.selectIds(e.target.value))}
- multiple
- >
- {Object.values(devices).sort((a, b) => a.name.localeCompare(b.name)).map((device) => (
- <MenuItem key={device.id} value={device.id}>{device.name}</MenuItem>
- ))}
- </Select>
- </>
- ) : (
- <>
- <Autocomplete
- size="small"
- options={Object.values(devices).sort((a, b) => a.name.localeCompare(b.name))}
- getOptionLabel={(option) => option?.name ?? ''}
- renderOption={(props, option) => (
- <MenuItem {...props} key={option.id}>
- {option.name}
- </MenuItem>
- )}
- value={devices[deviceId] || null}
- onChange={(event, newValue) => {
- dispatch(devicesActions.selectId(newValue?.id ?? null))
- }}
- renderInput={(params) => <TextField {...params} label={t('reportDevice')} />}
- />
- </>
- )}
- </FormControl>
+ <SelectField
+ label={t(multiDevice ? 'deviceTitle' : 'reportDevice')}
+ data={Object.values(devices).sort((a, b) => a.name.localeCompare(b.name))}
+ value={multiDevice ? deviceIds : deviceId || null}
+ onChange={(e) => dispatch(multiDevice ? devicesActions.selectIds(e.target.value) : devicesActions.selectId(e.target.value))}
+ multiple={multiDevice}
+ fullWidth
+ />
</div>
)}
{includeGroups && (