diff --git a/views/default.handlebars b/views/default.handlebars index 01f82532..f0a320ba 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -11057,13 +11057,14 @@ if (currentMesh.creation != null) { x += addHtmlValue("Creation Time", printDateTime(new Date(currentMesh.creation))); } // Display features - if (currentMesh.mtype == 2) { + if (currentMesh.mtype < 3) { var meshFeatures = []; if (currentMesh.flags) { if (currentMesh.flags & 1) { meshFeatures.push("Auto-Remove"); } if (currentMesh.flags & 2) { meshFeatures.push("Hostname Sync"); } if ((serverinfo.devGroupSessionRecording == 1) && (currentMesh.flags & 4)) { meshFeatures.push("Record Sessions"); } } + if ((typeof currentMesh.expireDevs == 'number') && (currentMesh.expireDevs > 0)) { meshFeatures.push("Remove inactive"); } meshFeatures = meshFeatures.join(', '); if (meshFeatures == '') { meshFeatures = '' + "None" + ''; } x += addHtmlValue("Features", addLinkConditional(meshFeatures, 'p20editmeshfeatures()', meshrights & 1)); @@ -11456,19 +11457,41 @@ function p20editmeshfeatures() { if (xxdialogMode) return; - var flags = (currentMesh.flags)?currentMesh.flags:0; - var x = '

'; - x += '

'; - if (serverinfo.devGroupSessionRecording == 1) { x += '

'; } + var flags = (currentMesh.flags)?currentMesh.flags:0, x = '', expire = 0; + if ((typeof currentMesh.expireDevs == 'number') && (currentMesh.expireDevs > 0)) { expire = currentMesh.expireDevs; if (expire > 2000) { expire = 2000; } } + if (serverinfo.devGroupSessionRecording == 1) { + x += '

'; + } + if (currentMesh.mtype == 2) { + x += '

'; + x += '

'; + } + x += '

'; + x += '
' + "Inactivate days until removal" + '
'; setDialogMode(2, "Edit Device Group Features", 3, p20editmeshfeaturesEx, x); + p20editmeshfeaturesValidate(); + } + + function p20editmeshfeaturesValidate() { + var flags = 0, ok = true; + if ((currentMesh.mtype == 2) && (Q('d20flag1').checked)) { flags += 1; } + QE('d20expireDevice', (flags & 1) == 0); + var x = ((flags & 1) == 0) && Q('d20expireDevice').checked; + QV('d20expireDeviceDev', x); + if (x) { var y = parseInt(Q('d20expireDeviceDays').value); if (isNaN(y) || (y < 1) || (y > 2000) || (y != Q('d20expireDeviceDays').value)) { ok = false; } } + QE('idx_dlgOkButton', ok); } function p20editmeshfeaturesEx() { var flags = 0; - if (Q('d20flag1').checked) { flags += 1; } - if (Q('d20flag2').checked) { flags += 2; } + if (currentMesh.mtype == 2) { + if (Q('d20flag1').checked) { flags += 1; } + if (Q('d20flag2').checked) { flags += 2; } + } if (serverinfo.devGroupSessionRecording == 1) { if (Q('d20flag4').checked) { flags += 4; } } - meshserver.send({ action: 'editmesh', meshid: currentMesh._id, flags: flags }); + cmd.expireDevs = 0; + if (((flags & 1) == 0) && Q('d20expireDevice').checked) { expireDevs = parseInt(Q('d20expireDeviceDays').value); } + meshserver.send({ action: 'editmesh', meshid: currentMesh._id, flags: flags, expireDevs: expireDevs }); } function p20showAddMeshUserDialog(userid, selected) {