Added device list to device group view.
Ylian Saint-Hilaire committed
May 7, 2021 at 14:29 UTC
2b69231d7dd89ff96ab382d08a797ae776600224
1 file changed
+28
-1
views/default.handlebars
+28
-1
@@ -938,6 +938,7 @@
938
<h1>General - <span id=p20meshName></span></h1>
939
</div>
940
<p id=p20info></p>
941
+ <p id=p20info2></p>
942
</div>
943
</div>
944
<div id=p21 style="display:none">
@@ -3008,6 +3009,9 @@
3009
mainUpdate(2 | 8 | 16);
3010
refreshDevice(node._id);
3011
3012
+ // If we are looking at the device group for this device, update that.
3013
+ if ((xxcurrentView == 20) && (currentMesh != null) && (currentMesh._id == node.meshid)) { mainUpdate(4096); }
3014
+
3015
if ((currentNode == node) && (xxdialogMode != null) && (xxdialogTag == '@xxmap')) { p10showNodeLocationDialog(); }
3016
}
3017
break;
@@ -3103,6 +3107,9 @@
3107
mainUpdate(1 | 16);
3108
}
3109
refreshDevice(node._id);
3110
+
3111
+ // If we are looking at the device group for this device, update that.
3112
+ if ((xxcurrentView == 20) && (currentMesh != null) && (currentMesh._id == node.meshid)) { mainUpdate(4096); }
3113
}
3114
break;
3115
}
@@ -10862,11 +10869,31 @@
10869
}
10870
10871
x += '</tbody></table>';
10872
+
10873
+ // Display list of devices in this device group
10874
+ count = 0;
10875
+ nodes.sort(deviceSort);
10876
+ var y = '<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>' + "Devices" + '</th><th scope=col style=text-align:left></th></tr>';
10877
+ for (var i in nodes) {
10878
+ var node = nodes[i], gray = ((node.conn > 0)?'':' gray');
10879
+ if (currentMesh._id != node.meshid) continue;
10880
+ y += '<tr style=' + (((count % 2) == 0) ? ';background-color:#DDD' : '') + '><td style=width:30%><div onclick=\'gotoDevice("' + node._id + '",10);haltEvent(event);\' style=float:left class="j' + node.icon + gray + '"></div> <a onclick=\'gotoDevice("' + node._id + '",10);haltEvent(event);\'>' + EscapeHtml(node.name) + '</a></div></div></td><td style=width:70%><div style=float:right>' + PowerStateStr(node.pwr) + ' </div><div>' + (node.osdesc ? EscapeHtml(node.osdesc) : '') + '</div></td></tr>';
10881
+ ++count;
10882
+ }
10883
+ y += '</tbody></table>';
10884
+ if (count == 0) { y = ''; }
10885
10886
// If we are full administrator on this mesh, allow deletion of the mesh
10867
- if (meshrights == 0xFFFFFFFF) { x += '<div style=font-size:small;text-align:right><span><a href=# onclick=p20showDeleteMeshDialog() style=cursor:pointer>' + "Delete Group" + '</a></span></div>'; }
10887
+ if (meshrights == 0xFFFFFFFF) {
10888
+ if (count == 0) {
10889
+ x += '<div style=font-size:small;text-align:right><span><a href=# onclick=p20showDeleteMeshDialog() style=cursor:pointer>' + "Delete Group" + '</a></span></div>';
10890
+ } else {
10891
+ y += '<div style=font-size:small;text-align:right><span><a href=# onclick=p20showDeleteMeshDialog() style=cursor:pointer>' + "Delete Group" + '</a></span></div>';
10892
+ }
10893
+ }
10894
10895
QH('p20info', x);
10896
+ QH('p20info2', y);
10897
10898
// Change the URL
10899
var urlviewmode = '';