Skip to content

Commit 6c0b3be

Browse files
martinpittmvollmer
authored andcommitted
FIXUP: Remove unnecessary ssid aliases
Most of these only appear in debug statements. connectToAP() actually uses the value for configuring NM, but we only call it on known networks, so assert that Ssid is valid. #22884 (comment)
1 parent d28a831 commit 6c0b3be

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

pkg/networkmanager/network-interface.jsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -869,25 +869,25 @@ export const NetworkInterfacePage = ({
869869
const visibleAPs = Array.from(apBySsid.values());
870870

871871
function forgetNetwork(ap) {
872-
const ssid = ap.Ssid || "";
873-
utils.debug("Forgetting network", ssid);
872+
utils.debug("Forgetting network", ap.Ssid);
874873

875874
if (ap.Connection) {
876875
ap.Connection.delete_()
877-
.then(() => utils.debug("Forgot network", ssid))
876+
.then(() => utils.debug("Forgot network", ap.Ssid))
878877
.catch(show_unexpected_error);
879878
}
880879
}
881880

882881
function connectToAP(ap) {
883-
const ssid = ap.Ssid || "";
884-
utils.debug("Connecting to", ssid);
882+
// we don't show a Connect button for hidden networks
883+
cockpit.assert(ap.Ssid);
884+
utils.debug("Connecting to", ap.Ssid);
885885

886886
if (ap.Connection) {
887887
// Activate existing connection (which already has password if needed)
888-
utils.debug("Activating existing connection for", ssid);
888+
utils.debug("Activating existing connection for", ap.Ssid);
889889
ap.Connection.activate(dev, ap)
890-
.then(() => utils.debug("Connected successfully to", ssid))
890+
.then(() => utils.debug("Connected successfully to", ap.Ssid))
891891
.catch(show_unexpected_error);
892892
return;
893893
}
@@ -897,27 +897,27 @@ export const NetworkInterfacePage = ({
897897

898898
if (isSecured) {
899899
// Show password dialog for secured networks
900-
utils.debug("Showing password dialog for", ssid);
901-
Dialogs.show(<WiFiConnectDialog dev={dev} ap={ap} ssid={ssid} model={model} />);
900+
utils.debug("Showing password dialog for", ap.Ssid);
901+
Dialogs.show(<WiFiConnectDialog dev={dev} ap={ap} ssid={ap.Ssid} model={model} />);
902902
return;
903903
}
904904

905905
// Create new connection for open networks
906-
utils.debug("Creating new connection for", ssid);
906+
utils.debug("Creating new connection for", ap.Ssid);
907907
const settings = {
908908
connection: {
909-
id: ssid,
909+
id: ap.Ssid,
910910
type: "802-11-wireless",
911911
autoconnect: true,
912912
},
913913
"802-11-wireless": {
914-
ssid: utils.ssid_to_nm(ssid),
914+
ssid: utils.ssid_to_nm(ap.Ssid),
915915
mode: "infrastructure",
916916
}
917917
};
918918

919919
dev.activate_with_settings(settings, ap)
920-
.then(result => utils.debug("Connected successfully to", ssid))
920+
.then(result => utils.debug("Connected successfully to", ap.Ssid))
921921
.catch(show_unexpected_error);
922922
}
923923

@@ -943,8 +943,7 @@ export const NetworkInterfacePage = ({
943943
const unknownRows = [];
944944

945945
namedRows.forEach(r => {
946-
const ssid = r.props["data-ssid"];
947-
const isActive = activeSSID && ssid === activeSSID;
946+
const isActive = activeSSID && r.props["data-ssid"] === activeSSID;
948947
if (isActive) {
949948
activeRows.push(r);
950949
} else {

0 commit comments

Comments
 (0)