diff --git a/netbox/extras/constants.py b/netbox/extras/constants.py index 48b44fb45..269ff21a0 100644 --- a/netbox/extras/constants.py +++ b/netbox/extras/constants.py @@ -1,3 +1,5 @@ +from extras.choices import LogLevelChoices + # Events EVENT_CREATE = 'create' EVENT_UPDATE = 'update' @@ -133,3 +135,12 @@ DEFAULT_DASHBOARD = [ } }, ] + +LOG_LEVEL_RANK = { + LogLevelChoices.LOG_DEFAULT: 0, + LogLevelChoices.LOG_DEBUG: 1, + LogLevelChoices.LOG_SUCCESS: 2, + LogLevelChoices.LOG_INFO: 3, + LogLevelChoices.LOG_WARNING: 4, + LogLevelChoices.LOG_FAILURE: 5, +} diff --git a/netbox/extras/views.py b/netbox/extras/views.py index 4fea13c2d..1a600d115 100644 --- a/netbox/extras/views.py +++ b/netbox/extras/views.py @@ -32,6 +32,7 @@ from utilities.templatetags.builtins.filters import render_markdown from utilities.views import ContentTypePermissionRequiredMixin, get_viewname, register_model_view from virtualization.models import VirtualMachine from . import filtersets, forms, tables +from .constants import LOG_LEVEL_RANK from .models import * from .scripts import run_script from .tables import ReportResultsTable, ScriptResultsTable @@ -1191,15 +1192,6 @@ class ScriptResultView(TableMixin, generic.ObjectView): table = None index = 0 - LOG_LEVEL_RANK = { - LogLevelChoices.LOG_DEFAULT: 0, - LogLevelChoices.LOG_DEBUG: 1, - LogLevelChoices.LOG_SUCCESS: 2, - LogLevelChoices.LOG_INFO: 3, - LogLevelChoices.LOG_WARNING: 4, - LogLevelChoices.LOG_FAILURE: 5, - } - log_level = LOG_LEVEL_RANK.get(request.GET.get('log_level', LogLevelChoices.LOG_DEFAULT)) if job.data: diff --git a/netbox/templates/extras/htmx/script_result.html b/netbox/templates/extras/htmx/script_result.html index bd6ab09c0..0545e2bd5 100644 --- a/netbox/templates/extras/htmx/script_result.html +++ b/netbox/templates/extras/htmx/script_result.html @@ -3,6 +3,19 @@ {% load i18n %}
+ {% if job.started %} + {% trans "Started" %}: {{ job.started|isodatetime }} + {% elif job.scheduled %} + {% trans "Scheduled for" %}: {{ job.scheduled|isodatetime }} + {% else %} + {% trans "Created" %}: {{ job.created|isodatetime }} + {% endif %} + {% if job.completed %} + {% trans "Duration" %}: {{ job.duration }} + {% endif %} + {% badge job.get_status_display job.get_status_color %} +
{% if job.completed %} {% if tests %} {# Summary of test methods #} diff --git a/netbox/templates/extras/script_result.html b/netbox/templates/extras/script_result.html index 6b7408ba6..e002f08d9 100644 --- a/netbox/templates/extras/script_result.html +++ b/netbox/templates/extras/script_result.html @@ -41,20 +41,6 @@ {# Object list tab #}- {% if job.started %} - {% trans "Started" %}: {{ job.started|isodatetime }} - {% elif job.scheduled %} - {% trans "Scheduled for" %}: {{ job.scheduled|isodatetime }} - {% else %} - {% trans "Created" %}: {{ job.created|isodatetime }} - {% endif %} - {% if job.completed %} - {% trans "Duration" %}: {{ job.duration }} - {% endif %} - {% badge job.get_status_display job.get_status_color %} -
- {# Object table controls #}