diff --git a/plinth/modules/networks/templates/connections_list.html b/plinth/modules/networks/templates/connections_list.html index 987786794..50b43a119 100644 --- a/plinth/modules/networks/templates/connections_list.html +++ b/plinth/modules/networks/templates/connections_list.html @@ -53,12 +53,14 @@ {% if connection.is_active %} -
- {% csrf_token %} - -
+ {% if not connection.primary %} +
+ {% csrf_token %} + +
+ {% endif %} {% else %}
@@ -68,13 +70,14 @@
{% endif %} - - - + {% if not connection.primary %} + + + + {% endif %} {% endfor %} diff --git a/plinth/network.py b/plinth/network.py index 1a79adfff..1c07efec9 100644 --- a/plinth/network.py +++ b/plinth/network.py @@ -217,8 +217,10 @@ def _get_wifi_channel_from_frequency(frequency): def get_connection_list(): """Get a list of active and available connections.""" - active_uuids = [] client = get_nm_client() + primary_connection = client.get_primary_connection() + + active_uuids = [] for connection in client.get_active_connections(): active_uuids.append(connection.get_uuid()) @@ -241,6 +243,9 @@ def get_connection_list(): 'type': connection_type, 'type_name': connection_type_name, 'is_active': connection.get_uuid() in active_uuids, + 'primary': + (primary_connection + and primary_connection.get_uuid() == connection.get_uuid()), 'zone': zone, }) connections.sort(key=lambda connection: connection['is_active'],