Added online filter in web app
Ylian Saint-Hilaire committed
May 7, 2020 at 18:58 UTC
25c8a934c7d911f5d50d650fdee7ead7acfeb3c1
3 files changed
+19
-1
translate/translate.json
+13
-1
@@ -19030,6 +19030,12 @@
19030
"default.handlebars->25->119"
19031
]
19032
},
19033
+ {
19034
+ "en": "Online",
19035
+ "xloc": [
19036
+ "default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->devListToolbar->9->1"
19037
+ ]
19038
+ },
19039
{
19040
"cs": "Připojených uživatelů",
19041
"de": "Benutzer online",
@@ -19066,6 +19072,12 @@
19072
"default.handlebars->25->746"
19073
]
19074
},
19075
+ {
19076
+ "en": "Only show devices that are online",
19077
+ "xloc": [
19078
+ "default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->devListToolbar->9"
19079
+ ]
19080
+ },
19081
{
19082
"cs": "Otevřít soubor…",
19083
"de": "Datei öffnen...",
@@ -30926,4 +30938,4 @@
30938
]
30939
}
30940
]
30929
-}
30941
+}
\ No newline at end of file
views/default.handlebars
+5
@@ -232,6 +232,7 @@
232
<input type=button id=GroupActionButton disabled="disabled" value="Group Action" onclick=groupActionFunction() />
233
<input id=SearchInput type=text placeholder=Filter onchange=onDeviceSearchChanged(event) onkeyup=onDeviceSearchChanged(event) autocomplete=off onfocus=onSearchFocus(1) onblur=onSearchFocus(0) />
234
<label><input type=checkbox id=RealNameCheckBox onclick=onRealNameCheckBox() /><span title="Show devices operating system name">OS Name</span></label>
235
+ <label><input type=checkbox id=OnlineCheckBox onclick=onDeviceSearchChanged(event) /><span title="Only show devices that are online">Online</span></label>
236
</td>
237
<td id=kvmListToolbar class=style14 style="display:none">
238
<input type="button" onclick="connectAllKvmFunction()" value="Connect All" />
@@ -4089,6 +4090,10 @@
4090
}
4091
} catch (ex) { for (var d in nodes) { nodes[d].v = true; } }
4092
}
4093
+
4094
+ // Check power state
4095
+ var onlineOnly = Q('OnlineCheckBox').checked;
4096
+ if (onlineOnly) { for (var d in nodes) { if ((nodes[d].conn == null) || (nodes[d].conn == 0)) { nodes[d].v = false; } } }
4097
}
4098
4099
var contextelement = null;
webserver.js
+1
@@ -3524,6 +3524,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3524
} else if (req.query.meshaction != null) {
3525
if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL key
3526
var user = obj.users[req.session.userid];
3527
+ if (user == null) { res.sendStatus(404); return; }
3528
if ((req.query.meshaction == 'route') && (req.query.nodeid != null)) {
3529
obj.db.Get(req.query.nodeid, function (err, nodes) {
3530
if (nodes.length != 1) { res.sendStatus(401); return; }