Skip to content

Commit 739af5e

Browse files
committed
Put hidden SSIDs at end of list
1 parent be22bc5 commit 739af5e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

octoprint_netconnectd/static/js/netconnectd.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ $(function() {
138138
"wifis",
139139
{
140140
"ssid": function (a, b) {
141+
// hidden SSIDs always go at the end, sorted by MAC
142+
if (!a["ssid"] && b["ssid"]) return 1;
143+
if (!b["ssid"] && a["ssid"]) return -1;
144+
if (!a["ssid"] && !b["ssid"]) {
145+
if (a["address"] < b["address"]) return -1;
146+
if (a["address"] > b["address"]) return 1;
147+
}
141148
// sorts ascending
142149
if (a["ssid"].toLocaleLowerCase() < b["ssid"].toLocaleLowerCase()) return -1;
143150
if (a["ssid"].toLocaleLowerCase() > b["ssid"].toLocaleLowerCase()) return 1;
@@ -462,4 +469,4 @@ $(function() {
462469

463470
// view model class, parameters for constructor, container to bind to
464471
ADDITIONAL_VIEWMODELS.push([NetconnectdViewModel, ["loginStateViewModel", "settingsViewModel"], "#settings_plugin_netconnectd"]);
465-
});
472+
});

0 commit comments

Comments
 (0)