mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
Add UI components to display alert backend failure status
Co-authored-by: vanschelven <223833+vanschelven@users.noreply.github.com>
This commit is contained in:
committed by
Klaas van Schelven
parent
b564774f21
commit
21ee428938
@@ -42,8 +42,22 @@
|
||||
{% for service_config in service_configs %}
|
||||
<tr class="bg-white dark:bg-slate-900 border-slate-200 dark:border-slate-700 border-b-2">
|
||||
<td class="w-full p-4">
|
||||
<div>
|
||||
<a href="{% url "project_messaging_service_edit" project_pk=project.pk service_pk=service_config.pk %}" class="text-xl text-cyan-500 dark:text-cyan-300 font-bold">{{ service_config.display_name }}</a>
|
||||
<div class="flex items-center">
|
||||
<div class="flex-grow">
|
||||
<a href="{% url "project_messaging_service_edit" project_pk=project.pk service_pk=service_config.pk %}" class="text-xl text-cyan-500 dark:text-cyan-300 font-bold">{{ service_config.display_name }}</a>
|
||||
{% if service_config.has_recent_failure %}
|
||||
<div class="text-sm text-red-600 dark:text-red-400 mt-1">
|
||||
<span class="inline-flex items-center">
|
||||
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
Last alert failed ({{ service_config.last_failure_timestamp|date:"M j, H:i" }})
|
||||
</span>
|
||||
<a href="{% url "project_messaging_service_edit" project_pk=project.pk service_pk=service_config.pk %}#failure-details"
|
||||
class="text-red-700 dark:text-red-300 underline ml-2">View details</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
@@ -25,6 +25,31 @@
|
||||
<h1 class="text-4xl my-4 font-bold">Messaging Service | {{ project.name }}</h1>
|
||||
</div>
|
||||
|
||||
{% if service_config.has_recent_failure %}
|
||||
<div id="failure-details" class="bg-red-50 dark:bg-red-900 border-2 border-red-200 dark:border-red-700 p-4 rounded-lg mb-6">
|
||||
<h2 class="text-xl font-bold text-red-800 dark:text-red-200 mb-2 flex items-center">
|
||||
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
Alert Backend Failure
|
||||
</h2>
|
||||
<div class="text-red-700 dark:text-red-300">
|
||||
<p><strong>Last failure:</strong> {{ service_config.last_failure_timestamp|date:"F j, Y, g:i A" }}</p>
|
||||
<p><strong>Error type:</strong> {{ service_config.last_failure_error_type }}</p>
|
||||
{% if service_config.last_failure_status_code %}
|
||||
<p><strong>HTTP Status:</strong> {{ service_config.last_failure_status_code }}</p>
|
||||
{% endif %}
|
||||
<p><strong>Error message:</strong> {{ service_config.last_failure_error_message }}</p>
|
||||
{% if service_config.last_failure_response_text %}
|
||||
<div class="mt-2">
|
||||
<p><strong>Response{% if service_config.last_failure_is_json %} (JSON){% endif %}:</strong></p>
|
||||
<pre class="bg-red-100 dark:bg-red-800 p-2 rounded text-sm mt-1 overflow-x-auto">{{ service_config.last_failure_response_text }}</pre>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% for field in form %}
|
||||
{% tailwind_formfield field %}
|
||||
{% endfor %}
|
||||
|
||||
@@ -501,6 +501,7 @@ def project_messaging_service_edit(request, project_pk, service_pk):
|
||||
|
||||
return render(request, 'projects/project_messaging_service_edit.html', {
|
||||
'project': project,
|
||||
'service_config': instance,
|
||||
'form': form,
|
||||
'config_form': config_form,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user