Bläddra i källkod

Closes #7208: Add navigation breadcrumbs for custom scripts & reports

jeremystretch 4 år sedan
förälder
incheckning
de58f53f9f

+ 1 - 0
docs/release-notes/version-3.0.md

@@ -7,6 +7,7 @@
 * [#6387](https://github.com/netbox-community/netbox/issues/6387) - Add xDSL interface type
 * [#6988](https://github.com/netbox-community/netbox/issues/6988) - Order tenants alphabetically without regard to group assignment
 * [#7032](https://github.com/netbox-community/netbox/issues/7032) - Add URM port types
+* [#7208](https://github.com/netbox-community/netbox/issues/7208) - Add navigation breadcrumbs for custom scripts & reports
 * [#7239](https://github.com/netbox-community/netbox/issues/7239) - Redirect global search to filtered object list when an object type is selected
 
 ### Bug Fixes

+ 35 - 27
netbox/templates/extras/report.html

@@ -1,4 +1,4 @@
-{% extends 'base/layout.html' %}
+{% extends 'generic/object.html' %}
 {% load helpers %}
 
 {% block title %}{{ report.name }}{% endblock %}
@@ -8,31 +8,39 @@
   <li class="breadcrumb-item"><a href="{% url 'extras:report_list' %}#module.{{ report.module }}">{{ report.module|bettertitle }}</a></li>
 {% endblock %}
 
-{% block content %}
-{% if report.description %}
-    <p class="text-muted">{{ report.description|render_markdown }}</p>
-{% endif %}
-{% if perms.extras.run_report %}
-<div class="float-end noprint">
-    <form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
-        {% csrf_token %}
-        <button type="submit" name="_run" class="btn btn-primary">
-            {% if report.result %}
-                <i class="mdi mdi-replay"></i> Run Again
-            {% else %}
-                <i class="mdi mdi-play"></i> Run Report
-            {% endif %}
-        </button>
-    </form>
-</div>
-{% endif %}
-<div class="row">
-    <div class="col col-md-12">
-        {% if report.result %}
-            Last run: <a href="{% url 'extras:report_result' job_result_pk=report.result.pk %}">
-                <strong>{{ report.result.created|annotated_date }}</strong>
-            </a>
-        {% endif %}
+{% block subtitle %}
+  {% if report.description %}
+    <div class="object-subtitle">
+      <div class="text-muted">{{ report.description|render_markdown }}</div>
     </div>
-</div>
+  {% endif %}
+{% endblock %}
+
+{% block controls %}{% endblock %}
+{% block tabs %}{% endblock %}
+
+{% block content-wrapper %}
+  {% if perms.extras.run_report %}
+    <div class="px-3 float-end noprint">
+        <form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
+            {% csrf_token %}
+            <button type="submit" name="_run" class="btn btn-primary">
+                {% if report.result %}
+                    <i class="mdi mdi-replay"></i> Run Again
+                {% else %}
+                    <i class="mdi mdi-play"></i> Run Report
+                {% endif %}
+            </button>
+        </form>
+    </div>
+  {% endif %}
+  <div class="row px-3">
+      <div class="col col-md-12">
+          {% if report.result %}
+              Last run: <a href="{% url 'extras:report_result' job_result_pk=report.result.pk %}">
+                  <strong>{{ report.result.created|annotated_date }}</strong>
+              </a>
+          {% endif %}
+      </div>
+  </div>
 {% endblock %}

+ 3 - 5
netbox/templates/extras/report_result.html

@@ -2,15 +2,13 @@
 {% load helpers %}
 {% load static %}
 
-{% block title %}{{ report.name }} <span id="pending-result-label">{% include 'extras/inc/job_label.html' with result=result %}</span>{% endblock %}
-
 {% block head %}
 <script src="{% static 'jobs.js' %}?v{{ settings.VERSION }}"
         onerror="window.location='{% url 'media_failure' %}?filename=jobs.js'"></script>
 {% endblock %}
 
-{% block content %}
-<div class="row">
+{% block content-wrapper %}
+<div class="row px-3">
     <div class="col col-md-12">
         <p>
             Run: <strong>{{ result.created|annotated_date }}</strong>
@@ -21,7 +19,7 @@
                     <span class="visually-hidden">Loading...</span>
                 </div>
             {% endif %}
-            
+            <span id="pending-result-label">{% include 'extras/inc/job_label.html' with result=result %}</span>
         </p>
         {% if result.completed %}
             <div class="card">

+ 3 - 1
netbox/templates/extras/script.html

@@ -1,4 +1,4 @@
-{% extends 'base/layout.html' %}
+{% extends 'generic/object.html' %}
 {% load helpers %}
 {% load form_helpers %}
 {% load log_levels %}
@@ -16,6 +16,8 @@
   </div>
 {% endblock %}
 
+{% block controls %}{% endblock %}
+
 {% block tabs %}
 <ul class="nav nav-tabs px-3">
   <li class="nav-item" role="presentation">