Added online filter in web app

This commit is contained in:
Ylian Saint-Hilaire 2020-05-07 18:58:02 -07:00
parent 7b7581519a
commit 5f8c9e6ee2
3 changed files with 19 additions and 1 deletions

View File

@ -19030,6 +19030,12 @@
"default.handlebars->25->119" "default.handlebars->25->119"
] ]
}, },
{
"en": "Online",
"xloc": [
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->devListToolbar->9->1"
]
},
{ {
"cs": "Připojených uživatelů", "cs": "Připojených uživatelů",
"de": "Benutzer online", "de": "Benutzer online",
@ -19066,6 +19072,12 @@
"default.handlebars->25->746" "default.handlebars->25->746"
] ]
}, },
{
"en": "Only show devices that are online",
"xloc": [
"default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->devListToolbar->9"
]
},
{ {
"cs": "Otevřít soubor…", "cs": "Otevřít soubor…",
"de": "Datei öffnen...", "de": "Datei öffnen...",

View File

@ -232,6 +232,7 @@
<input type=button id=GroupActionButton disabled="disabled" value="Group Action" onclick=groupActionFunction() />&nbsp; <input type=button id=GroupActionButton disabled="disabled" value="Group Action" onclick=groupActionFunction() />&nbsp;
<input id=SearchInput type=text placeholder=Filter onchange=onDeviceSearchChanged(event) onkeyup=onDeviceSearchChanged(event) autocomplete=off onfocus=onSearchFocus(1) onblur=onSearchFocus(0) />&nbsp; <input id=SearchInput type=text placeholder=Filter onchange=onDeviceSearchChanged(event) onkeyup=onDeviceSearchChanged(event) autocomplete=off onfocus=onSearchFocus(1) onblur=onSearchFocus(0) />&nbsp;
<label><input type=checkbox id=RealNameCheckBox onclick=onRealNameCheckBox() /><span title="Show devices operating system name">OS Name</span></label> <label><input type=checkbox id=RealNameCheckBox onclick=onRealNameCheckBox() /><span title="Show devices operating system name">OS Name</span></label>
<label><input type=checkbox id=OnlineCheckBox onclick=onDeviceSearchChanged(event) /><span title="Only show devices that are online">Online</span></label>
</td> </td>
<td id=kvmListToolbar class=style14 style="display:none"> <td id=kvmListToolbar class=style14 style="display:none">
&nbsp;&nbsp;<input type="button" onclick="connectAllKvmFunction()" value="Connect All" />&nbsp; &nbsp;&nbsp;<input type="button" onclick="connectAllKvmFunction()" value="Connect All" />&nbsp;
@ -4089,6 +4090,10 @@
} }
} catch (ex) { for (var d in nodes) { nodes[d].v = true; } } } catch (ex) { for (var d in nodes) { nodes[d].v = true; } }
} }
// Check power state
var onlineOnly = Q('OnlineCheckBox').checked;
if (onlineOnly) { for (var d in nodes) { if ((nodes[d].conn == null) || (nodes[d].conn == 0)) { nodes[d].v = false; } } }
} }
var contextelement = null; var contextelement = null;

View File

@ -3524,6 +3524,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
} else if (req.query.meshaction != null) { } else if (req.query.meshaction != null) {
if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL key if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL key
var user = obj.users[req.session.userid]; var user = obj.users[req.session.userid];
if (user == null) { res.sendStatus(404); return; }
if ((req.query.meshaction == 'route') && (req.query.nodeid != null)) { if ((req.query.meshaction == 'route') && (req.query.nodeid != null)) {
obj.db.Get(req.query.nodeid, function (err, nodes) { obj.db.Get(req.query.nodeid, function (err, nodes) {
if (nodes.length != 1) { res.sendStatus(401); return; } if (nodes.length != 1) { res.sendStatus(401); return; }