mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
networks: Hide deactivate/remove buttons for primary connections
Helps: #1962. Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
012a9a0fc7
commit
ce87de1dfb
@ -53,12 +53,14 @@
|
||||
|
||||
<td class="connection-actions">
|
||||
{% if connection.is_active %}
|
||||
<form class="form form-action" method="post"
|
||||
action="{% url 'networks:deactivate' connection.uuid %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-default btn-sm">
|
||||
{% trans "Deactivate" %}</button>
|
||||
</form>
|
||||
{% if not connection.primary %}
|
||||
<form class="form form-action" method="post"
|
||||
action="{% url 'networks:deactivate' connection.uuid %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-default btn-sm">
|
||||
{% trans "Deactivate" %}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<form class="form form-action" method="post"
|
||||
action="{% url 'networks:activate' connection.uuid %}">
|
||||
@ -68,13 +70,14 @@
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<a href="{% url 'networks:delete' connection.uuid %}"
|
||||
class="btn btn-default btn-sm"
|
||||
role="button"
|
||||
title="{% blocktrans with name=connection.name %}Delete connection {{ name }}{% endblocktrans %}">
|
||||
<span class="fa fa-trash-o"
|
||||
aria-hidden="true"></span>
|
||||
</a>
|
||||
{% if not connection.primary %}
|
||||
<a href="{% url 'networks:delete' connection.uuid %}"
|
||||
class="btn btn-default btn-sm"
|
||||
role="button"
|
||||
title="{% blocktrans with name=connection.name %}Delete connection {{ name }}{% endblocktrans %}">
|
||||
<span class="fa fa-trash-o" aria-hidden="true"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
@ -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'],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user