aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-08-28 10:13:14 -0700
committerAnton Tananaev <anton@traccar.org>2022-08-28 10:13:14 -0700
commit8135f8a72d8fe4521e989356431f9a86c4139ed7 (patch)
tree2b9c9867e7c4c49297aa09229fe5c63146649529
parentec740a9802939662ecce049f82b33896b0d3b3a6 (diff)
downloadtrackermap-web-8135f8a72d8fe4521e989356431f9a86c4139ed7.tar.gz
trackermap-web-8135f8a72d8fe4521e989356431f9a86c4139ed7.tar.bz2
trackermap-web-8135f8a72d8fe4521e989356431f9a86c4139ed7.zip
Sort devices by name (fix #1018)
-rw-r--r--modern/src/main/MainPage.js4
-rw-r--r--modern/src/reports/components/ReportFilter.js4
2 files changed, 5 insertions, 3 deletions
diff --git a/modern/src/main/MainPage.js b/modern/src/main/MainPage.js
index 83440830..2d0671ae 100644
--- a/modern/src/main/MainPage.js
+++ b/modern/src/main/MainPage.js
@@ -310,7 +310,9 @@ const MainPage = () => {
onChange={(e) => setFilterGroups(e.target.value)}
multiple
>
- {Object.values(groups).map((group) => (<MenuItem key={group.id} value={group.id}>{group.name}</MenuItem>))}
+ {Object.values(groups).sort((a, b) => a.name.localeCompare(b.name)).map((group) => (
+ <MenuItem key={group.id} value={group.id}>{group.name}</MenuItem>
+ ))}
</Select>
</FormControl>
<FormControl>
diff --git a/modern/src/reports/components/ReportFilter.js b/modern/src/reports/components/ReportFilter.js
index d223b086..75c9d43d 100644
--- a/modern/src/reports/components/ReportFilter.js
+++ b/modern/src/reports/components/ReportFilter.js
@@ -80,7 +80,7 @@ const ReportFilter = ({ children, handleSubmit, showOnly, ignoreDevice, multiDev
onChange={(e) => (multiDevice ? setDeviceIds(e.target.value) : setDeviceId(e.target.value))}
multiple={multiDevice}
>
- {Object.values(devices).map((device) => (
+ {Object.values(devices).sort((a, b) => a.name.localeCompare(b.name)).map((device) => (
<MenuItem key={device.id} value={device.id}>{device.name}</MenuItem>
))}
</Select>
@@ -97,7 +97,7 @@ const ReportFilter = ({ children, handleSubmit, showOnly, ignoreDevice, multiDev
onChange={(e) => setGroupIds(e.target.value)}
multiple
>
- {Object.values(groups).map((group) => (
+ {Object.values(groups).sort((a, b) => a.name.localeCompare(b.name)).map((group) => (
<MenuItem key={group.id} value={group.id}>{group.name}</MenuItem>
))}
</Select>