mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
names: Simplify showing current and available domains
- In the main domains list, only show currently configured domains. Allow operations such as edit/delete/configure on them. Actions are determined by the domain type. - Show domain types that can be added in a separate table. If an domain is present and only of that type can exist, it will not be shown in this table. Show add/configure action based on whether multiple domains can exist. Tests: - Configuring a singleton domain type puts it in the domains tables and removes it from the add domains table. De-configuring it or disabling it does the opposite. - For domain types with multiple domains (static/dynamic), entries are shown in domains if such domains exist. Entry in add domains tables always shows up. - All action buttons for all five domain types work. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
e8d2faecab
commit
889453daff
@ -28,24 +28,27 @@
|
||||
<td class="names-domain-column">{{ domain.name }}</td>
|
||||
<td>{{ domain.get_readable_services|join:', ' }}</td>
|
||||
<td>
|
||||
<a href="{% url domain.domain_type.configuration_url %}"
|
||||
role="button" class="btn btn-md btn-default">
|
||||
{% trans "Configure" %}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
{% for domain_type in status.unused_domain_types %}
|
||||
<tr>
|
||||
<td>{{ domain_type.display_name }}</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>
|
||||
<a href="{% url domain_type.configuration_url %}"
|
||||
role="button" class="btn btn-md btn-default">
|
||||
{% trans "Configure" %}
|
||||
</a>
|
||||
{% if domain.domain_type.configuration_url %}
|
||||
<a href="{% url domain.domain_type.configuration_url %}"
|
||||
role="button" class="btn btn-md btn-default">
|
||||
<span class="fa fa-wrench" aria-hidden="true"></span>
|
||||
{% trans "Configure" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if domain.domain_type.edit_url %}
|
||||
<a href="{% url domain.domain_type.edit_url domain.name %}"
|
||||
role="button" class="btn btn-md btn-default"
|
||||
title="{% trans 'Edit' %}">
|
||||
<span class="fa fa-pencil-square-o" aria-hidden="true"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if domain.domain_type.delete_url %}
|
||||
<a href="{% url domain.domain_type.delete_url domain.name %}"
|
||||
role="button" class="btn btn-md btn-default"
|
||||
title="{% trans 'Delete' %}">
|
||||
<span class="fa fa-trash-o" aria-hidden="true"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@ -53,6 +56,34 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h4>{% trans "Add Domains" %}</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div id="domains-add" class="list-group list-group-two-column">
|
||||
{% for domain_type in status.unused_domain_types %}
|
||||
<div class="list-group-item d-flex justify-content-between">
|
||||
<div>{{ domain_type.display_name }}</div>
|
||||
{% if domain_type.configuration_url %}
|
||||
<a href="{% url domain_type.configuration_url %}"
|
||||
role="button" class="btn btn-md btn-default">
|
||||
<span class="fa fa-wrench" aria-hidden="true"></span>
|
||||
{% trans "Configure" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if domain_type.add_url %}
|
||||
<a href="{% url domain_type.add_url %}"
|
||||
role="button" class="btn btn-md btn-default">
|
||||
<span class="fa fa-plus" aria-hidden="true"></span>
|
||||
{% trans "Add" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>{% trans "Resolver Status" %}</h3>
|
||||
|
||||
{% if resolved_installed and resolved_status %}
|
||||
|
||||
@ -142,7 +142,7 @@ def get_status():
|
||||
used_domain_types = {domain.domain_type for domain in domains}
|
||||
unused_domain_types = [
|
||||
domain_type for domain_type in components.DomainType.list().values()
|
||||
if domain_type not in used_domain_types
|
||||
if domain_type not in used_domain_types or domain_type.add_url
|
||||
]
|
||||
|
||||
return {'domains': domains, 'unused_domain_types': unused_domain_types}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user