update extras templates

This commit is contained in:
checktheroads 2021-04-16 14:58:44 -07:00
parent 59256cf8b3
commit 3c0f4278c7
8 changed files with 121 additions and 77 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -165,6 +165,18 @@ span.color-label {
padding: $badge-padding-y $badge-padding-x; padding: $badge-padding-y $badge-padding-x;
} }
pre {
border-radius: $border-radius;
border: 1px solid $gray-200;
background-color: $gray-100;
padding: $spacer;
white-space: pre;
}
.btn {
white-space: nowrap;
}
.card { .card {
box-shadow: $box-shadow-sm; box-shadow: $box-shadow-sm;
.card-header { .card-header {

View File

@ -3,11 +3,11 @@
{% elif result.status == 'errored' %} {% elif result.status == 'errored' %}
<span class="badge bg-danger">Errored</span> <span class="badge bg-danger">Errored</span>
{% elif result.status == 'pending' %} {% elif result.status == 'pending' %}
<span class="badge bg-light">Pending</span> <span class="badge bg-info">Pending</span>
{% elif result.status == 'running' %} {% elif result.status == 'running' %}
<span class="badge bg-warning">Running</span> <span class="badge bg-warning">Running</span>
{% elif result.status == 'completed' %} {% elif result.status == 'completed' %}
<span class="badge bg-success">Completed</span> <span class="badge bg-success">Completed</span>
{% else %} {% else %}
<span class="badge bg-light">N/A</span> <span class="badge bg-secondary">N/A</span>
{% endif %} {% endif %}

View File

@ -1,10 +1,11 @@
{% extends 'base.html' %} {% extends 'layout.html' %}
{% load helpers %} {% load helpers %}
{% block title %}Reports{% endblock %}
{% block content %} {% block content %}
<h1>{% block title %}Reports{% endblock %}</h1>
<div class="row"> <div class="row">
<div class="col-md-9"> <div class="col-md-8">
{% if reports %} {% if reports %}
{% for module, module_reports in reports %} {% for module, module_reports in reports %}
<h3><a name="module.{{ module }}"></a>{{ module|bettertitle }}</h3> <h3><a name="module.{{ module }}"></a>{{ module|bettertitle }}</h3>
@ -14,7 +15,7 @@
<th>Name</th> <th>Name</th>
<th>Status</th> <th>Status</th>
<th>Description</th> <th>Description</th>
<th class="text-right">Last Run</th> <th class="text-end">Last Run</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@ -30,7 +31,7 @@
{% include 'extras/inc/job_label.html' with result=report.result %} {% include 'extras/inc/job_label.html' with result=report.result %}
</td> </td>
<td>{{ report.description|placeholder }}</td> <td>{{ report.description|placeholder }}</td>
<td class="text-right"> <td class="text-end">
{% if report.result %} {% if report.result %}
<a href="{% url 'extras:report_result' job_result_pk=report.result.pk %}">{{ report.result.created }}</a> <a href="{% url 'extras:report_result' job_result_pk=report.result.pk %}">{{ report.result.created }}</a>
{% else %} {% else %}
@ -39,10 +40,10 @@
</td> </td>
<td> <td>
{% if perms.extras.run_report %} {% if perms.extras.run_report %}
<div class="pull-right noprint"> <div class="float-end noprint">
<form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post"> <form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
{% csrf_token %} {% csrf_token %}
<button type="submit" name="_run" class="btn btn-primary btn-xs"> <button type="submit" name="_run" class="btn btn-primary btn-sm">
{% if report.result %} {% if report.result %}
<i class="mdi mdi-replay"></i> Run Again <i class="mdi mdi-replay"></i> Run Again
{% else %} {% else %}
@ -59,11 +60,11 @@
<td colspan="4" class="method"> <td colspan="4" class="method">
{{ method }} {{ method }}
</td> </td>
<td class="text-right text-nowrap report-stats"> <td class="text-end text-nowrap report-stats">
<label class="label label-success">{{ stats.success }}</label> <span class="badge bg-success">{{ stats.success }}</span>
<label class="label label-info">{{ stats.info }}</label> <span class="badge bg-info">{{ stats.info }}</span>
<label class="label label-warning">{{ stats.warning }}</label> <span class="badge bg-warning">{{ stats.warning }}</span>
<label class="label label-danger">{{ stats.failure }}</label> <span class="badge bg-danger">{{ stats.failure }}</span>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -72,30 +73,34 @@
</table> </table>
{% endfor %} {% endfor %}
{% else %} {% else %}
<div class="alert alert-info"> <div class="alert alert-info" role="alert">
<p><strong>No reports found.</strong></p> <h4 class="alert-heading">No Reports Found</h4>
<p>Reports should be saved to <code>{{ settings.REPORTS_ROOT }}</code>. (This path can be changed by setting <code>REPORTS_ROOT</code> in NetBox's configuration.)</p> Reports should be saved to <code>{{ settings.REPORTS_ROOT }}</code>.
<hr/>
<small>This path can be changed by setting <code>REPORTS_ROOT</code> in NetBox's configuration.</small>
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div class="col-md-3"> <div class="col-md-4">
{% if reports %} {% if reports %}
<div class="panel panel-default"> <div class="card">
{% for module, module_reports in reports %} <div class="card-body">
<div class="panel-heading"> {% for module, module_reports in reports %}
<strong>{{ module|bettertitle }}</strong> <h5>{{ module|bettertitle }}</h5>
</div> <div class="small mb-2">
<ul class="list-group"> <ul class="list-group list-group-flush">
{% for report in module_reports %} {% for report in module_reports %}
<a href="#{{ report.module }}.{{ report.class_name }}" class="list-group-item"> <a href="#{{ report.module }}.{{ report.class_name }}" class="list-group-item">
<i class="mdi mdi-file-chart-outline"></i> {{ report.name }} <i class="mdi mdi-file-chart-outline"></i> {{ report.name }}
<div class="pull-right"> <div class="float-end">
{% include 'extras/inc/job_label.html' with result=report.result %} {% include 'extras/inc/job_label.html' with result=report.result %}
</div> </div>
</a> </a>
{% endfor %} {% endfor %}
</ul> </ul>
</div>
{% endfor %} {% endfor %}
</div>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -1,28 +1,29 @@
{% extends 'base.html' %} {% extends 'layout.html' %}
{% load helpers %} {% load helpers %}
{% load form_helpers %} {% load form_helpers %}
{% load log_levels %} {% load log_levels %}
{% block title %}{{ script }}{% endblock %} {% block title %}{{ script }}{% endblock %}
{% block breadcrumb_main %}
<nav class="breadcrumb-container" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Home</a></li>
<li class="breadcrumb-item"><a href="{% url 'extras:script_list' %}">Scripts</a></li>
<li class="breadcrumb-item"><a href="{% url 'extras:script_list' %}#module.{{ module }}">{{ module|bettertitle }}</a></li>
<li class="breadcrumb-item">{{ script }}</li>
</ol>
</nav>
{% endblock %}
{% block content %} {% block content %}
<div class="row noprint"> <div class="text-muted">{{ script.Meta.description|render_markdown }}</div>
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="{% url 'extras:script_list' %}">Scripts</a></li>
<li><a href="{% url 'extras:script_list' %}#module.{{ module }}">{{ module|bettertitle }}</a></li>
<li>{{ script }}</li>
</ol>
</div>
</div>
<h1 class="title">{{ script }}</h1>
<p>{{ script.Meta.description|render_markdown }}</p>
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"> <li class="nav-item" role="presentation">
<a href="#run" role="tab" data-toggle="tab" class="active">Run</a> <a href="#run" role="tab" data-bs-toggle="tab" class="nav-link active">Run</a>
</li> </li>
<li role="presentation"> <li class="nav-item" role="presentation">
<a href="#source" role="tab" data-toggle="tab">Source</a> <a href="#source" role="tab" data-bs-toggle="tab" class="nav-link">Source</a>
</li> </li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
@ -38,11 +39,11 @@
<form action="" method="post" enctype="multipart/form-data" class="form form-horizontal"> <form action="" method="post" enctype="multipart/form-data" class="form form-horizontal">
{% csrf_token %} {% csrf_token %}
{% if form.requires_input %} {% if form.requires_input %}
<div class="panel panel-default"> <div class="card my-3">
<div class="panel-heading"> <h5 class="card-header">
<strong>Script Data</strong> Script Data
</div> </h5>
<div class="panel-body"> <div class="card-body">
{% render_form form %} {% render_form form %}
</div> </div>
</div> </div>
@ -53,16 +54,16 @@
</div> </div>
{% render_form form %} {% render_form form %}
{% endif %} {% endif %}
<div class="pull-right"> <div class="float-end">
<button type="submit" name="_run" class="btn btn-primary"{% if not perms.extras.run_script %} disabled="disabled"{% endif %}><i class="mdi mdi-play"></i> Run Script</button> <a href="{% url 'extras:script_list' %}" class="btn btn-outline-danger btn-sm">Cancel</a>
<a href="{% url 'extras:script_list' %}" class="btn btn-default">Cancel</a> <button type="submit" name="_run" class="btn btn-primary btn-sm"{% if not perms.extras.run_script %} disabled="disabled"{% endif %}><i class="mdi mdi-play"></i> Run Script</button>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
<div role="tabpanel" class="tab-pane" id="source"> <div role="tabpanel" class="tab-pane" id="source">
<p><code>{{ script.filename }}</code></p> <code class="h6 my-3 d-block">{{ script.filename }}</code>
<pre>{{ script.source }}</pre> <pre>{{ script.source }}</pre>
</div> </div>
</div> </div>

View File

@ -1,8 +1,9 @@
{% extends 'base.html' %} {% extends 'layout.html' %}
{% load helpers %} {% load helpers %}
{% block title %}Scripts{% endblock %}
{% block content %} {% block content %}
<h1>{% block title %}Scripts{% endblock %}</h1>
<div class="row"> <div class="row">
<div class="col-md-9"> <div class="col-md-9">
{% if scripts %} {% if scripts %}
@ -14,7 +15,7 @@
<th>Name</th> <th>Name</th>
<th>Status</th> <th>Status</th>
<th>Description</th> <th>Description</th>
<th class="text-right">Last Run</th> <th class="text-end">Last Run</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -28,11 +29,11 @@
</td> </td>
<td>{{ script.Meta.description|render_markdown }}</td> <td>{{ script.Meta.description|render_markdown }}</td>
{% if script.result %} {% if script.result %}
<td class="text-right"> <td class="text-end">
<a href="{% url 'extras:script_result' job_result_pk=script.result.pk %}">{{ script.result.created }}</a> <a href="{% url 'extras:script_result' job_result_pk=script.result.pk %}">{{ script.result.created }}</a>
</td> </td>
{% else %} {% else %}
<td class="text-right text-muted">Never</td> <td class="text-end text-muted">Never</td>
{% endif %} {% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
@ -41,29 +42,33 @@
{% endfor %} {% endfor %}
{% else %} {% else %}
<div class="alert alert-info"> <div class="alert alert-info">
<p><strong>No scripts found.</strong></p> <h4 class="alert-heading">No Scripts Found</h4>
<p>Scripts should be saved to <code>{{ settings.SCRIPTS_ROOT }}</code>. (This path can be changed by setting <code>SCRIPTS_ROOT</code> in NetBox's configuration.)</p> Scripts should be saved to <code>{{ settings.SCRIPTS_ROOT }}</code>.
<hr/>
This path can be changed by setting <code>SCRIPTS_ROOT</code> in NetBox's configuration.
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
{% if scripts %} {% if scripts %}
<div class="panel panel-default"> <div class="card">
{% for module, module_scripts in scripts.items %} <div class="card-body">
<div class="panel-heading"> {% for module, module_scripts in scripts.items %}
<strong>{{ module|bettertitle }}</strong> <h5>{{ module|bettertitle }}</h5>
<div class="small mb-2">
<ul class="list-group list-group-flush">
{% for class_name, script in module_scripts.items %}
<a href="#script.{{ class_name }}" class="list-group-item">
<i class="mdi mdi-file-chart-outline"></i> {{ script.name }}
<div class="float-end">
{% include 'extras/inc/job_label.html' with result=script.result %}
</div>
</a>
{% endfor %}
</ul>
</div> </div>
<ul class="list-group"> {% endfor %}
{% for class_name, script in module_scripts.items %} </div>
<a href="#script.{{ class_name }}" class="list-group-item">
<i class="mdi mdi-file-chart-outline"></i> {{ script.name }}
<div class="pull-right">
{% include 'extras/inc/job_label.html' with result=script.result %}
</div>
</a>
{% endfor %}
</ul>
{% endfor %}
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -206,3 +206,24 @@ menus:
- label: Secret Roles - label: Secret Roles
url: 'secrets:secretrole_list' url: 'secrets:secretrole_list'
disabled: true disabled: true
- label: Other
groups:
- label: Logging
items:
- label: Change Log
url: 'extras:objectchange_list'
disabled: true
- label: Journal Entries
url: 'extras:journalentry_list'
disabled: true
- label: Miscellaneous
items:
- label: Config Contexts
url: 'extras:configcontext_list'
disabled: true
- label: Reports
url: 'extras:report_list'
disabled: true
- label: Scripts
url: 'extras:script_list'
disabled: true