fix: nexus network sorting order

Also push connecting and saved networks up
And display whether a network is saved
This commit is contained in:
2 * r + 2 * t 2026-06-07 00:42:59 +10:00
parent ab87ba51da
commit 108821b2fe

View file

@ -69,13 +69,12 @@ PageBase {
list.anchors.top: scanningIndicator.bottom list.anchors.top: scanningIndicator.bottom
model: ScriptModel { model: ScriptModel {
values: [...Nmcli.networks].sort((a, b) => { values: {
if (a.active) const connecting = Nmcli.connectingSsid();
return -1; // Lower rank sorts higher in the list
if (b.active) const rank = n => n.active ? 0 : n.ssid === connecting ? 1 : Nmcli.hasSavedProfile(n.ssid) ? 2 : 3;
return 1; return [...Nmcli.networks].sort((a, b) => rank(a) - rank(b) || b.strength - a.strength);
return b.strength - a.strength; }
})
} }
delegate: StateLayer { delegate: StateLayer {
@ -155,7 +154,7 @@ PageBase {
StyledText { StyledText {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Security: %1").arg(network.modelData.security) text: qsTr("Security: %1%2").arg(network.modelData.security).arg(Nmcli.hasSavedProfile(network.modelData.ssid) ? qsTr(" • Saved") : "")
color: Colours.tPalette.m3outline color: Colours.tPalette.m3outline
font: Tokens.font.label.small font: Tokens.font.label.small
elide: Text.ElideRight elide: Text.ElideRight