add last boot up time to sort

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Mar 6, 2026 at 14:28 UTC e8c53ffd59dd6b4e73a611cc40ecd8c7dd9a2122
3 files changed +29 -3
translate/translate.json
+3 -1
@@ -42275,11 +42275,13 @@
42275 "default.handlebars->121->1615",
42276 "default.handlebars->121->365",
42277 "default.handlebars->121->398",
42278 + "default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->9->devListToolbarSort->sortselect->13",
42279 "default3.handlebars->119->1594",
42280 "default3.handlebars->119->1599",
42281 "default3.handlebars->119->1600",
42282 "default3.handlebars->119->361",
42282 - "default3.handlebars->119->394"
42283 + "default3.handlebars->119->394",
42284 + "default3.handlebars->container->column_l->p1->devListToolbarSpan->7->devListToolbarSort->sortselect->13"
42285 ]
42286 },
42287 {
views/default.handlebars
+13 -1
@@ -385,6 +385,7 @@
385 <option>Tags</option>
386 <option>Group-Tags</option>
387 <option>Last Seen</option>
388 + <option>Last Boot Up Time</option>
389 </select>
390 &nbsp;
391 </div>
@@ -4448,6 +4449,16 @@
4449 }
4450 nodes.sort(lastConnectSort);
4451 }
4452 + else if (sort == 6) {
4453 + // Last Boot Up Time
4454 + if (!(deviceViewSettings && deviceViewSettings.devsCols && deviceViewSettings.devsCols.indexOf('lastbootuptime') >= 0)) {
4455 + // Force initialize the view settings
4456 + if (deviceViewSettings == null) { deviceViewSettings = {}; }
4457 + if (!Array.isArray(deviceViewSettings.devsCols)) { deviceViewSettings.devsCols = ['user','ip','conn', 'lastbootuptime']; }
4458 + else { deviceViewSettings.devsCols.push('lastbootuptime'); }
4459 + }
4460 + nodes.sort(lastBootUpTimeSort);
4461 + }
4462
4463 // Compute the width of the device view.
4464 var totalDeviceViewWidth = Q('column_l').clientWidth - 60;
@@ -4518,7 +4529,7 @@
4529 c = 0;
4530 if ((view == 1) || (view == 3) || (view == 5)) { r += '<div id=DevxCol' + deviceHeaderId + ((collapsed === true)?' style=display:none':'') + '>'; } // Open collapse div
4531 }
4521 - } else if (sort == 2 || sort == 5) {
4532 + } else if (sort == 2 || sort == 5 || sort == 6) {
4533 // Device header
4534 if (current == null) { current = '1'; }
4535 }
@@ -6341,6 +6352,7 @@
6352 function deviceSort(a, b) { return sortCollator.compare(a.namel, b.namel); }
6353 function deviceHostSort(a, b) { return sortCollator.compare(a.rnamel, b.rnamel); }
6354 function lastConnectSort(a, b) { var aa = a.lastconnect, bb = b.lastconnect; if (aa == null) { aa = 99999999999999; } if (bb == null) { bb = 99999999999999; } if (a.conn > 0) { aa = 99999999999998; } if (b.conn > 0) { bb = 99999999999998; } if (aa == bb) { return nameSort(a, b); } return (aa - bb); }
6355 + function lastBootUpTimeSort(a, b) { var aa = a.lastbootuptime, bb = b.lastbootuptime; if (aa == null) { aa = 99999999999999; } if (bb == null) { bb = 99999999999999; } if (aa == bb) { return nameSort(a, b); } return (aa - bb); }
6356
6357 function onSearchFocus(x) { searchFocus = x; }
6358 function clearDeviceSearch() { Q('KvmSearchInput').value = Q('SearchInput').value = ''; onOnlineCheckBox(); mainUpdate(1); }
views/default3.handlebars
+13 -1
@@ -535,6 +535,7 @@
535 <option>Tags</option>
536 <option>Group-Tags</option>
537 <option>Last Seen</option>
538 + <option>Last Boot Up Time</option>
539 </select>
540 &nbsp;
541 </div>
@@ -5141,6 +5142,16 @@
5142 }
5143 nodes.sort(lastConnectSort);
5144 }
5145 + else if (sort == 6) {
5146 + // Last Boot Up Time
5147 + if (!(deviceViewSettings && deviceViewSettings.devsCols && deviceViewSettings.devsCols.indexOf('lastbootuptime') >= 0)) {
5148 + // Force initialize the view settings
5149 + if (deviceViewSettings == null) { deviceViewSettings = {}; }
5150 + if (!Array.isArray(deviceViewSettings.devsCols)) { deviceViewSettings.devsCols = ['user', 'ip', 'conn', 'lastbootuptime']; }
5151 + else { deviceViewSettings.devsCols.push('lastbootuptime'); }
5152 + }
5153 + nodes.sort(lastBootUpTimeSort);
5154 + }
5155
5156 // Compute the width of the device view.
5157 var totalDeviceViewWidth = Q('column_l').clientWidth - 60;
@@ -5211,7 +5222,7 @@
5222 c = 0;
5223 if ((view == 1) || (view == 3) || (view == 5)) { r += '<div id=DevxCol' + deviceHeaderId + ((collapsed === true) ? ' style=display:none' : '') + '>'; } // Open collapse div
5224 }
5214 - } else if (sort == 2 || sort == 5) {
5225 + } else if (sort == 2 || sort == 5 || sort == 6) {
5226 // Device header
5227 if (current == null) { current = '1'; }
5228 }
@@ -7230,6 +7241,7 @@
7241 function deviceSort(a, b) { return sortCollator.compare(a.namel, b.namel); }
7242 function deviceHostSort(a, b) { return sortCollator.compare(a.rnamel, b.rnamel); }
7243 function lastConnectSort(a, b) { var aa = a.lastconnect, bb = b.lastconnect; if (aa == null) { aa = 99999999999999; } if (bb == null) { bb = 99999999999999; } if (a.conn > 0) { aa = 99999999999998; } if (b.conn > 0) { bb = 99999999999998; } if (aa == bb) { return nameSort(a, b); } return (aa - bb); }
7244 + function lastBootUpTimeSort(a, b) { var aa = a.lastbootuptime, bb = b.lastbootuptime; if (aa == null) { aa = 99999999999999; } if (bb == null) { bb = 99999999999999; } if (aa == bb) { return nameSort(a, b); } return (aa - bb); }
7245
7246 function onSearchFocus(x) { searchFocus = x; }
7247 function clearDeviceSearch() { Q('KvmSearchInput').value = Q('SearchInput').value = ''; onOnlineCheckBox(); mainUpdate(1); }