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

This commit is contained in:
jeremystretch 2021-09-15 15:14:24 -04:00
parent e738ff2fa7
commit de58f53f9f
4 changed files with 42 additions and 33 deletions

View File

@ -7,6 +7,7 @@
* [#6387](https://github.com/netbox-community/netbox/issues/6387) - Add xDSL interface type * [#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 * [#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 * [#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 * [#7239](https://github.com/netbox-community/netbox/issues/7239) - Redirect global search to filtered object list when an object type is selected
### Bug Fixes ### Bug Fixes

View File

@ -1,4 +1,4 @@
{% extends 'base/layout.html' %} {% extends 'generic/object.html' %}
{% load helpers %} {% load helpers %}
{% block title %}{{ report.name }}{% endblock %} {% 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> <li class="breadcrumb-item"><a href="{% url 'extras:report_list' %}#module.{{ report.module }}">{{ report.module|bettertitle }}</a></li>
{% endblock %} {% endblock %}
{% block content %} {% block subtitle %}
{% if report.description %} {% if report.description %}
<p class="text-muted">{{ report.description|render_markdown }}</p> <div class="object-subtitle">
{% endif %} <div class="text-muted">{{ report.description|render_markdown }}</div>
{% 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 %}
</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 %} {% endblock %}

View File

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

View File

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