Changed LogLevelChoices order; Changed ScriptResultView to select LogLevelChoices to LOG_DEFAULT and setup the html template to put (All) in the last one

This commit is contained in:
Renato Almeida de Oliveira Zaroubin 2025-01-27 18:17:38 +00:00
parent 57fa1dd18d
commit ebef1b983a
3 changed files with 4 additions and 4 deletions

View File

@ -162,12 +162,12 @@ class LogLevelChoices(ChoiceSet):
LOG_FAILURE = 'failure'
CHOICES = (
(LOG_DEBUG, _('Debug'), 'teal'),
(LOG_DEFAULT, _('Default'), 'gray'),
(LOG_INFO, _('Info'), 'cyan'),
(LOG_SUCCESS, _('Success'), 'green'),
(LOG_WARNING, _('Warning'), 'yellow'),
(LOG_FAILURE, _('Failure'), 'red'),
(LOG_DEBUG, _('Debug'), 'teal'),
)
SYSTEM_LEVELS = {

View File

@ -1374,9 +1374,9 @@ class ScriptResultView(TableMixin, generic.ObjectView):
if job.completed:
table = self.get_table(job, request, bulk_actions=False)
log_threshold = request.GET.get('log_threshold', LogLevelChoices.LOG_DEBUG)
log_threshold = request.GET.get('log_threshold', LogLevelChoices.LOG_DEFAULT)
if log_threshold not in LOG_LEVEL_RANK:
log_threshold = LogLevelChoices.LOG_DEBUG
log_threshold = LogLevelChoices.LOG_DEFAULT
context = {
'script': job.object,

View File

@ -53,7 +53,7 @@
<div class="dropdown-menu">
{% for level, name in log_levels.items %}
<a class="dropdown-item d-flex justify-content-between" href="{% url 'extras:script_result' job_pk=job.pk %}?log_threshold={{ level }}">
{{ name }}{% if forloop.first %} ({% trans "All" %}){% endif %}
{{ name }}{% if forloop.last %} ({% trans "All" %}){% endif %}
{% if level == log_threshold %}<span class="badge bg-green ms-auto"></span>{% endif %}
</a>
{% endfor %}