mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-07-22 11:59:33 +00:00
names: Don't show resolver status if package is not installed
Tests: - Ensure that systemd-resolved package is not installed. - Resolver status table is now shown. - Instead a message is shown with button to re-run setup. Clicking the button re-runs setup of the names app. - Configuration form is also now shown. - If systemd-resolved package is installed during re-run of setup, then status table is shown. - Message to install systemd-resolved is not shown. - Configuration form is shown. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
0a10ced950
commit
5c06b6c31a
@ -55,7 +55,7 @@
|
||||
|
||||
<h3>{% trans "Resolver Status" %}</h3>
|
||||
|
||||
{% if resolved_status %}
|
||||
{% if resolved_installed and resolved_status %}
|
||||
<div class="table-responsive">
|
||||
<table class="table resolved-status-table">
|
||||
<tbody>
|
||||
@ -107,6 +107,20 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% elif not resolved_installed %}
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
systemd-resolved package is not installed. Install it for additional
|
||||
functionality.
|
||||
{% endblocktrans %}
|
||||
<form class="form form-install-resolved" method="post"
|
||||
action="{% url 'rerun-setup' app_id='names' %}">
|
||||
{% csrf_token %}
|
||||
|
||||
<input type="submit" class="btn btn-primary" name="install_resolved"
|
||||
value="{% trans 'Install' %}"/>
|
||||
</form>
|
||||
</p>
|
||||
{% else %}
|
||||
<div class="alert alert-danger">
|
||||
{% trans "Error retrieving status:" %} {{ resolved_status_error }}
|
||||
@ -114,3 +128,9 @@
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block configuration %}
|
||||
{% if resolved_installed %}
|
||||
{{ block.super }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
@ -31,17 +31,21 @@ class NamesAppView(AppView):
|
||||
def get_initial(self):
|
||||
"""Return the values to fill in the form."""
|
||||
initial = super().get_initial()
|
||||
initial.update(privileged.get_resolved_configuration())
|
||||
if names.is_resolved_installed():
|
||||
initial.update(privileged.get_resolved_configuration())
|
||||
|
||||
return initial
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
"""Add additional context data for template."""
|
||||
context = super().get_context_data(*args, **kwargs)
|
||||
context['status'] = get_status()
|
||||
try:
|
||||
context['resolved_status'] = resolved.get_status()
|
||||
except Exception as exception:
|
||||
context['resolved_status_error'] = exception
|
||||
context['resolved_installed'] = names.is_resolved_installed()
|
||||
if context['resolved_installed']:
|
||||
try:
|
||||
context['resolved_status'] = resolved.get_status()
|
||||
except Exception as exception:
|
||||
context['resolved_status_error'] = exception
|
||||
|
||||
return context
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user