diff --git a/views/default.handlebars b/views/default.handlebars index 52bb4e46..cdcc2c30 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -8408,7 +8408,7 @@ meshserver.send({ action: 'editmesh', meshid: currentMesh._id, flags: flags }); } - function p20showAddMeshUserDialog(userid) { + function p20showAddMeshUserDialog(userid, selected) { if (xxdialogMode) return false; var x = ''; if (userid == null) { @@ -8432,11 +8432,12 @@ for (var i in meshes) { if ((currentUserGroup.links == null) || (currentUserGroup.links[i] == null)) { y += ''; } } x += addHtmlValue("Device Group", '
'); } else if (userid === 4) { - var y = '', firstMeshId = null; - for (var i in meshes) { y += ''; if (firstMeshId == null) { firstMeshId = meshes[i]._id; } } + var y = '', selectedMeshId = null, selectedNode = null; + if (selected != null) { selectedNode = getNodeFromId(decodeURIComponent(selected)); if (selectedNode != null) { selectedMeshId = selectedNode.meshid; } } + for (var i in meshes) { if (selectedMeshId == null) { selectedMeshId = meshes[i]._id; } y += ''; } x += addHtmlValue("Device Group", ''); y = ''; - for (var i in nodes) { if (nodes[i].meshid == firstMeshId) { y += ''; } } + for (var i in nodes) { if (nodes[i].meshid == selectedMeshId) { y += ''; } } x += addHtmlValue("Device", ''); } else { userid = decodeURIComponent(userid); @@ -8482,7 +8483,9 @@ } else if (userid === 3) { setDialogMode(2, "Add Device Group", 3, p20showAddMeshUserDialogEx, x, userid); } else if (userid === 4) { - setDialogMode(2, "Add Device", 3, p20showAddMeshUserDialogEx, x, userid); + setDialogMode(2, (selected == null)?"Add Device Permissions":"Edit Device Permissions", 3, p20showAddMeshUserDialogEx, x, userid); + QE('dp2meshid', selected == null); + QE('dp2nodeid', selected == null); } else { if (userid.startsWith('ugrp/')) { setDialogMode(2, "Edit Device Group Permissions", 7, p20showAddMeshUserDialogEx, x, userid); @@ -10236,7 +10239,7 @@ var nodename = node?EscapeHtml(node.name):('' + "Unknown Device" + ''); if (r == 0xFFFFFFFF) rights = "Full Device Rights"; else if (r == 0) rights = "No Rights"; if ((currentUser._id != userinfo._id) && ((cr & 2) != 0)) { trash = ''; } - x += '