mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added staring a device feature.
This commit is contained in:
parent
fe4b71dbed
commit
2d677298db
11 changed files with 159 additions and 30 deletions
|
@ -214,29 +214,60 @@
|
|||
}
|
||||
|
||||
.deviceNotifyDot {
|
||||
text-align:center;
|
||||
position:absolute;
|
||||
right:10px;
|
||||
top:0px;
|
||||
width:16px;
|
||||
height:16px;
|
||||
}
|
||||
|
||||
.deviceNotifyDotSub {
|
||||
text-align:center;
|
||||
color:#FFF;
|
||||
width:16px;
|
||||
background-color:#00F;
|
||||
padding:2px;
|
||||
border-radius:10px;
|
||||
box-shadow: 2px 2px 10px black;
|
||||
cursor:pointer;
|
||||
margin-left:3px;
|
||||
}
|
||||
|
||||
.deviceNotifyDot:hover {
|
||||
.deviceNotifyDotSub:hover {
|
||||
background-color:#44F;
|
||||
}
|
||||
|
||||
.deviceNotifyLargeDot {
|
||||
.deviceNotifySmallDot {
|
||||
position:absolute;
|
||||
right:10px;
|
||||
top:0px;
|
||||
height:10px;
|
||||
}
|
||||
|
||||
.deviceNotifySmallDotSub {
|
||||
text-align:center;
|
||||
color:#FFF;
|
||||
width:10px;
|
||||
padding:2px;
|
||||
background-color:#00F;
|
||||
border-radius:10px;
|
||||
box-shadow: 2px 2px 10px black;
|
||||
cursor:pointer;
|
||||
margin-left:2px;
|
||||
}
|
||||
|
||||
.deviceNotifySmallDotSub:hover {
|
||||
background-color:#44F;
|
||||
}
|
||||
|
||||
.deviceNotifyLargeDot {
|
||||
position:absolute;
|
||||
right:10px;
|
||||
top:10px;
|
||||
height:40px;
|
||||
}
|
||||
|
||||
.deviceNotifyLargeDotSub {
|
||||
text-align:center;
|
||||
width:40px;
|
||||
height:40px;
|
||||
color:#FFF;
|
||||
|
@ -245,9 +276,10 @@
|
|||
border-radius:20px;
|
||||
box-shadow: 2px 2px 10px black;
|
||||
cursor:pointer;
|
||||
margin-left:4px;
|
||||
}
|
||||
|
||||
.deviceNotifyLargeDot:hover {
|
||||
.deviceNotifyLargeDotSub:hover {
|
||||
background-color:#44F;
|
||||
}
|
||||
|
||||
|
@ -485,7 +517,10 @@
|
|||
</tr>
|
||||
</table>
|
||||
<div id=p10general style="overflow-y:scroll;position:absolute;top:55px;bottom:0px;width:100%">
|
||||
<img id="p10deviceNotify" onclick=showDeviceSessions() class=deviceNotifyLargeDot src=images/icon-relay-notify-40.png width=40 height=40>
|
||||
<div class="deviceNotifyLargeDot">
|
||||
<img id="p10deviceStar" class=deviceNotifyDotSub src=images/icon-star-notify-16.png width=16 height=16>
|
||||
<img id="p10deviceNotify" onclick=showDeviceSessions() class=deviceNotifyLargeDotSub src=images/icon-relay-notify-40.png width=40 height=40>
|
||||
</div>
|
||||
<div id="p10deviceBattery" class="deviceBatteryLarge deviceBatteryLarge1"></div>
|
||||
<div id=p10html style="margin-left:8px;margin-right:8px"></div>
|
||||
<div id=p10html2></div>
|
||||
|
@ -752,6 +787,7 @@
|
|||
var meshserver = null;
|
||||
var xdr = null;
|
||||
var usergroups = null;
|
||||
var stars = {}; // Devices that have been "stared" by the user.
|
||||
var serverinfo = null;
|
||||
var nodes = [];
|
||||
var meshes = {};
|
||||
|
@ -792,6 +828,9 @@
|
|||
meshserver.onMessage = onMessage;
|
||||
meshserver.Start();
|
||||
|
||||
// Setup stared devices
|
||||
try { stars = JSON.parse(getstore('stars', '{}')); } catch (ex) { }
|
||||
|
||||
// Load desktop settings
|
||||
var t = localStorage.getItem('desktopsettings');
|
||||
if (t != null) { desktopsettings = JSON.parse(t); }
|
||||
|
@ -1070,11 +1109,17 @@
|
|||
var webstate = JSON.parse(message.event.state);
|
||||
for (var i in webstate) { localStorage.setItem(i, webstate[i]); }
|
||||
|
||||
// Update stars
|
||||
if (webstate.stars != null) { stars = JSON.parse(webstate.stars); }
|
||||
|
||||
// Update the web page
|
||||
if ((webstate.loctag != null) && (webstate.loctag != oldLoctag)) {
|
||||
if (webstate.loctag != null) { args.locale = webstate.loctag; } else { delete args.locale; }
|
||||
updateDevices();
|
||||
updateMeshes();
|
||||
} else if (webstate.stars != null) {
|
||||
updateDevices();
|
||||
if (Q('SearchInput').value == '*') { onSearchInputChanged(); }
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1953,6 +1998,9 @@
|
|||
nodes[d].v = false;
|
||||
if (nodes[d].users && nodes[d].users.length > 0) { for (var i in nodes[d].users) { if (nodes[d].users[i].toLowerCase().indexOf(userSearch) >= 0) { nodes[d].v = true; } } }
|
||||
}
|
||||
} else if (x == '*') {
|
||||
// Star filter
|
||||
for (var d in nodes) { nodes[d].v = (stars[nodes[d]._id] == 1); }
|
||||
} else {
|
||||
// Device name search
|
||||
try {
|
||||
|
@ -2109,11 +2157,19 @@
|
|||
if (showRealNames == true && nodes[i].rname != null) name = EscapeHtml(nodes[i].rname);
|
||||
if (name.length == 0) { name = '<i>' + "None" + '</i>'; }
|
||||
|
||||
// Setup device notification
|
||||
var devNotify = '';
|
||||
// Add device notification icons
|
||||
var devNotify = '', devNotifySub = '';
|
||||
|
||||
// This device is "starred"
|
||||
if (stars[nodes[i]._id] == 1) {
|
||||
devNotifySub += '<img class=deviceNotifyDotSub src=images/icon-star-notify-16.png width=16 height=16>';
|
||||
}
|
||||
|
||||
// This device has session information
|
||||
if (nodes[i].sessions != null) {
|
||||
// Sessions are active
|
||||
if ((nodes[i].sessions.kvm != null) || (nodes[i].sessions.terminal != null) || (nodes[i].sessions.files != null) || (nodes[i].sessions.tcp != null) || (nodes[i].sessions.udp != null)) {
|
||||
devNotify = '<img class=deviceNotifyDot src=images/icon-relay-notify.png width=16 height=16>';
|
||||
devNotifySub += '<img class=deviceNotifyDotSub src=images/icon-relay-notify.png width=16 height=16>';
|
||||
}
|
||||
|
||||
// Battery state
|
||||
|
@ -2137,6 +2193,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Add any device icons
|
||||
if (devNotifySub != '') { devNotify += '<div class=deviceNotifyDot>' + devNotifySub + '</div>'; }
|
||||
|
||||
// Node
|
||||
var icon = nodes[i].icon, nodestate = NodeStateStr(nodes[i]);
|
||||
if ((!nodes[i].conn) || (nodes[i].conn == 0)) { icon += ' gray'; }
|
||||
|
@ -2310,6 +2369,7 @@
|
|||
|
||||
// Setup session notification
|
||||
QV('p10deviceNotify', (currentNode.sessions != null) && ((node.sessions.kvm != null) || (node.sessions.terminal != null) || (node.sessions.files != null) || (node.sessions.tcp != null) || (node.sessions.udp != null)));
|
||||
QV('p10deviceStar', stars[currentNode._id] == 1);
|
||||
|
||||
// Device Battery
|
||||
QV('p10deviceBattery', false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue