diff --git a/package.json b/package.json index 00057982..120523a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.6-n", + "version": "0.4.6-o", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default.handlebars b/views/default.handlebars index 38cf5d9b..66be1c47 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -1119,6 +1119,8 @@ if (pluginHandlerBuilder != null) { pluginHandler = new pluginHandlerBuilder(); } var installedPluginList = null; var goBackStack = []; + var CollapsedGroups = {}; + try { CollapsedGroups = JSON.parse(getstore('_collapse', '{}')); } catch(ex) {} // Console Message Display Timers var p11DeskConsoleMsgTimer = null; @@ -2785,7 +2787,7 @@ if (sort == 0) { // Mesh header if (node.meshid != current) { - if ((view == 1) && (current != null)) { r += ''; } // Close collapse div + if (((view == 1) || (view == 3)) && (current != null)) { r += ''; } // Close collapse div deviceHeaderSet(); var extra = ''; if (view == 2) { r += ''; } @@ -2795,27 +2797,36 @@ r += '
'; r += '' + extra; r += ''; - var collapsed = CollapsedGroups[node.meshid]; - r += ''; // Collapse action + if ((view == 1) || (view == 3)) { + var collapsed = CollapsedGroups[node.meshid]; + r += ''; // Collapse action + } r += '' + EscapeHtml(meshes[node.meshid].name) + '' + getMeshActions(mesh2, meshrights) + '
'; if (view == 2) { r += ''; } current = node.meshid; displayedMeshes[current] = 1; c = 0; - if (view == 1) { r += '
'; } // Open collapse div + if ((view == 1) || (view == 3)) { r += '
'; } // Open collapse div } } else if (sort == 1) { // Power header var pwr = node.pwr?node.pwr:0; if (pwr !== current) { + if (((view == 1) || (view == 3)) && (current != null)) { r += '
'; } // Close collapse div deviceHeaderSet(); if ((view == 1) && (current !== null)) { if (c == 2) { r += '
'; } if (r != '') { r += ''; } } if (view == 2) { r += ''; } - r += '
' + PowerStateStr2(node.pwr) + '
'; + r += '
'; + if ((view == 1) || (view == 3)) { + var collapsed = CollapsedGroups['pwr:' + pwr]; + r += ''; // Collapse action + } + r += '' + PowerStateStr2(node.pwr) + '
'; current = pwr; c = 0; + if ((view == 1) || (view == 3)) { r += '
'; } // Open collapse div } } else if (sort == 2) { // Device header @@ -2865,7 +2876,7 @@ } } - // If we are displaying devices by group, put the device in the right group. + // If we are displaying devices by tags, put the device in the right tag group. if ((sort == 3) && (r != '')) { if (node.tags) { for (var j in node.tags) { @@ -2889,7 +2900,7 @@ // If displaying devices by groups, sort the group names and display the devices. if (sort == 3) { - var groupNames = []; + var groupNames = [], tagDeviceHeaderId = 0; for (var i in groups) { groupNames.push(i); } groupNames.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); }); for (var j in groupNames) { @@ -2897,7 +2908,14 @@ if (view == 2) { r += '
' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '' + i + '
' + groups[i]; } else { - r += '
' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '' + i + '
' + groups[i]; + r += '
' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + ''; + var collapsed = CollapsedGroups['tag:' + i]; + r += ''; // Collapse action + r += '' + i + '
'; + r += '
'; // Open collapse div + r += groups[i]; + r += '
'; + tagDeviceHeaderId++; } } } @@ -3055,12 +3073,12 @@ oldviewmode = view; } - var CollapsedGroups = {}; function toggleCollapseGroup(id, id2) { var x = (QS('DevxCol' + id)['display'] == 'none'); if (x) { delete CollapsedGroups[id2]; } else { CollapsedGroups[id2] = true; } Q('DevxColImg' + id).src = x?'images/c2.png':'images/c1.png'; QV('DevxCol' + id, x); + putstore('_collapse', JSON.stringify(CollapsedGroups)); } function toggleKvmDevice(node) {