mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-24 13:13:13 -05:00
Sorting fix, #3178
This commit is contained in:
parent
8c71d5a9be
commit
fc2765c62e
@ -3222,10 +3222,26 @@
|
||||
deviceHeaderTotal = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
function meshSort(a, b) { if (a.meshnamel > b.meshnamel) return 1; if (a.meshnamel < b.meshnamel) return -1; if (a.meshid == b.meshid) { if (showRealNames == true) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; } else { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } } return 0; }
|
||||
function powerSort(a, b) { var ap = a.pwr ? a.pwr : 0; var bp = b.pwr ? b.pwr : 0; if (ap == bp) { if (showRealNames == true) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; } else { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } } if (ap > bp) return 1; if (ap < bp) return -1; return 0; }
|
||||
function deviceSort(a, b) { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; }
|
||||
function deviceHostSort(a, b) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; }
|
||||
*/
|
||||
|
||||
var sortCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
|
||||
function meshSort(a, b) {
|
||||
var x = sortCollator.compare(a.meshnamel, b.meshnamel);
|
||||
if (x != 0) return x;
|
||||
x = sortCollator.compare(a.meshid, b.meshid);
|
||||
if (x != 0) return x;
|
||||
if (showRealNames == true) { return sortCollator.compare(a.rnamel, b.rnamel); }
|
||||
return sortCollator.compare(a.namel, b.namel);
|
||||
}
|
||||
function powerSort(a, b) { var ap = a.pwr ? a.pwr : 0; var bp = b.pwr ? b.pwr : 0; if (ap > bp) return -1; if (ap < bp) return 1; if (ap == bp) { if (showRealNames == true) { return sortCollator.compare(a.rnamel, b.rnamel); } else { return sortCollator.compare(a.namel, b.namel); } } }
|
||||
function deviceSort(a, b) { return sortCollator.compare(a.namel, b.namel); }
|
||||
function deviceHostSort(a, b) { return sortCollator.compare(a.rnamel, b.rnamel); }
|
||||
|
||||
|
||||
//
|
||||
// MY DEVICE
|
||||
|
@ -4009,7 +4009,8 @@
|
||||
if ((sort == 3) || (sort == 4)) {
|
||||
var groupNames = [], tagDeviceHeaderId = 0;
|
||||
for (var i in groups) { groupNames.push(i); }
|
||||
groupNames.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); });
|
||||
//groupNames.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); });
|
||||
groupNames.sort(function (a, b) { return sortCollator.compare(a.toLowerCase(), b.toLowerCase()); });
|
||||
for (var j in groupNames) {
|
||||
var i = groupNames[j];
|
||||
if (view == 2) {
|
||||
@ -5411,7 +5412,8 @@
|
||||
if (!skipsave) { putstore('sort', sort); }
|
||||
}
|
||||
|
||||
function nameSort(a, b) { var aa = a.name.toLowerCase(), bb = b.name.toLowerCase(); if (aa > bb) return 1; if (aa < bb) return -1; return 0; }
|
||||
/*
|
||||
function nameSort(a, b) { var aa = a.name.toLowerCase(), bb = b.name.toLowerCase(); return sortCollator.compare(a.namel, b.namel); }
|
||||
function meshSort(a, b) {
|
||||
if (a.meshnamel > b.meshnamel) return 1;
|
||||
if (a.meshnamel < b.meshnamel) return -1;
|
||||
@ -5425,6 +5427,23 @@
|
||||
function deviceSort(a, b) { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; }
|
||||
function deviceHostSort(a, b) { if (a.rnamel > b.rnamel) return 1; if (a.rnamel < b.rnamel) return -1; return 0; }
|
||||
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); }
|
||||
*/
|
||||
|
||||
var sortCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
|
||||
function nameSort(a, b) { var aa = a.name.toLowerCase(), bb = b.name.toLowerCase(); return sortCollator.compare(aa, bb); }
|
||||
function meshSort(a, b) {
|
||||
var x = sortCollator.compare(a.meshnamel, b.meshnamel);
|
||||
if (x != 0) return x;
|
||||
x = sortCollator.compare(a.meshid, b.meshid);
|
||||
if (x != 0) return x;
|
||||
if (showRealNames == true) { return sortCollator.compare(a.rnamel, b.rnamel); }
|
||||
return sortCollator.compare(a.namel, b.namel);
|
||||
}
|
||||
function powerSort(a, b) { var ap = a.pwr?a.pwr:0; var bp = b.pwr?b.pwr:0; if (ap > bp) return -1; if (ap < bp) return 1; if (ap == bp) { if (showRealNames == true) { return sortCollator.compare(a.rnamel, b.rnamel); } else { return sortCollator.compare(a.namel, b.namel); } } }
|
||||
function deviceSort(a, b) { return sortCollator.compare(a.namel, b.namel); }
|
||||
function deviceHostSort(a, b) { return sortCollator.compare(a.rnamel, b.rnamel); }
|
||||
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); }
|
||||
|
||||
function onSearchFocus(x) { searchFocus = x; }
|
||||
function clearDeviceSearch() { Q('KvmSearchInput').value = Q('SearchInput').value = ''; Q('DevFilterSelect').value = 0; onOnlineCheckBox(); mainUpdate(1); }
|
||||
function onMapSearchFocus(x) { mapSearchFocus = x; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user