aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-08-17 08:53:54 -0700
committerAnton Tananaev <anton@traccar.org>2022-08-17 08:53:54 -0700
commit1184b5902be66c474f904fdbd8deb4445f4fc092 (patch)
tree2596821637794f5d6b12278ffe35055688d4c6ae /modern
parent56b523894acbb757f14867c3ceb9da504455b17a (diff)
downloadtrackermap-web-1184b5902be66c474f904fdbd8deb4445f4fc092.tar.gz
trackermap-web-1184b5902be66c474f904fdbd8deb4445f4fc092.tar.bz2
trackermap-web-1184b5902be66c474f904fdbd8deb4445f4fc092.zip
Device numbers by status
Diffstat (limited to 'modern')
-rw-r--r--modern/src/main/MainPage.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/modern/src/main/MainPage.js b/modern/src/main/MainPage.js
index c42b5be5..59141cf6 100644
--- a/modern/src/main/MainPage.js
+++ b/modern/src/main/MainPage.js
@@ -178,6 +178,8 @@ const MainPage = () => {
setDevicesOpen(!devicesOpen);
};
+ const deviceStatusCount = (status) => Object.values(devices).filter((d) => d.status === status).length;
+
useEffect(() => setDevicesOpen(desktop), [desktop]);
useEffect(() => {
@@ -299,9 +301,9 @@ const MainPage = () => {
onChange={(e) => setFilterStatuses(e.target.value)}
multiple
>
- <MenuItem value="online">{t('deviceStatusOnline')}</MenuItem>
- <MenuItem value="offline">{t('deviceStatusOffline')}</MenuItem>
- <MenuItem value="unknown">{t('deviceStatusUnknown')}</MenuItem>
+ <MenuItem value="online">{`${t('deviceStatusOnline')} (${deviceStatusCount('online')})`}</MenuItem>
+ <MenuItem value="offline">{`${t('deviceStatusOffline')} (${deviceStatusCount('offline')})`}</MenuItem>
+ <MenuItem value="unknown">{`${t('deviceStatusUnknown')} (${deviceStatusCount('unknown')})`}</MenuItem>
</Select>
</FormControl>
<FormControl>