Mobile app speed up.

This commit is contained in:
Ylian Saint-Hilaire 2021-02-17 14:23:45 -08:00
parent ba56256fdc
commit 2c72c6b7c1

View File

@ -1794,8 +1794,7 @@
//onSortSelectChange(true);
//drawNotifications();
refreshDevice(node._id);
//updateMapMarkers();
mainUpdate(4);
updateDeviceViewDevice(node);
if (currentNode == node) { updateDeviceDetails(); }
//if ((currentNode == node) && (xxdialogMode != null) && (xxdialogTag == '@xxmap')) { p10showNodeLocationDialog(); }
@ -1853,9 +1852,8 @@
// Clear sesssion information if needed
if ((node.conn & 1) == 0) { delete node.sessions; }
mainUpdate(4);
refreshDevice(node._id);
//updateMapMarkers();
updateDeviceViewDevice(node);
}
break;
}
@ -1893,7 +1891,7 @@
}
refreshDevice(message.event.nodeid);
mainUpdate(4);
updateDeviceViewDevice(node);
//if ((currentNode != null) && (currentNode._id == message.event.nodeid)) { gotoDevice(currentNode._id, xxcurrentView, true); }
// If we are looking at the sessions dialog box for this device now, update it
@ -2774,14 +2772,26 @@
}
function onDevicesScrollEx() {
var devdivs = document.getElementsByName('xxdevice');
onDevicesScrollnagleTimer = null;
var visibleTop = Q('xdevices').scrollTop - 250, visibleBottom = Q('xdevices').scrollTop + Q('xdevices').clientHeight + 250, devdivs = document.getElementsByName('xxdevice');
for (var i = 0; i < devdivs.length; i++) {
if ((devdivs[i].offsetTop >= visibleTop) && (devdivs[i].offsetTop < visibleBottom)) {
// Show
var node = getNodeFromId(devdivs[i].id)
if (node == null) break;
updateDeviceViewHtml(devdivs[i], node);
}
}
// Update a single device in the current view
function updateDeviceViewDevice(node) {
if (node == null) return;
var devdiv = Q(node._id);
if ((devdiv != null) && (devdiv.innerHTML != '')) { updateDeviceViewHtml(devdiv, node); } // Only update if the device is visible
}
function updateDeviceViewHtml(div, node) {
var visibleTop = Q('xdevices').scrollTop - 250, visibleBottom = Q('xdevices').scrollTop + Q('xdevices').clientHeight + 250;
if ((div.offsetTop >= visibleTop) && (div.offsetTop < visibleBottom)) {
var title = EscapeHtml(node.name);
if (title.length == 0) { title = '<i>' + "None" + '</i>'; }
if ((node.rname != null) && (node.rname.length > 0)) { title += ' / ' + EscapeHtml(node.rname); }
@ -2841,10 +2851,9 @@
// Node
var icon = node.icon, nodestate = NodeStateStr(node);
if ((!node.conn) || (node.conn == 0)) { icon += ' gray'; }
devdivs[i].innerHTML = '<div>' + devNotify + '<div class="i' + icon + ' devList2"></div><div class=devList3><div class=devList4><b>' + name + '</b></div><div class=devList5>' + nodestate + '</div></div></div>';
div.innerHTML = '<div>' + devNotify + '<div class="i' + icon + ' devList2"></div><div class=devList3><div class=devList4><b>' + name + '</b></div><div class=devList5>' + nodestate + '</div></div></div>';
} else {
devdivs[i].innerHTML = ''; // Hide
}
div.innerHTML = ''; // Hide
}
}