script_list.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. {% extends 'base/layout.html' %}
  2. {% load helpers %}
  3. {% block title %}Scripts{% endblock %}
  4. {% block tabs %}
  5. <ul class="nav nav-tabs px-3">
  6. <li class="nav-item" role="presentation">
  7. <a class="nav-link active" role="tab">Scripts</a>
  8. </li>
  9. </ul>
  10. {% endblock tabs %}
  11. {% block content-wrapper %}
  12. <div class="tab-content">
  13. {% if scripts %}
  14. {% for module, module_scripts in scripts.items %}
  15. <div class="card">
  16. <h5 class="card-header">
  17. <a name="module.{{ module }}"></a>
  18. <i class="mdi mdi-file-document-outline"></i> {{ module|bettertitle }}
  19. </h5>
  20. <div class="card-body">
  21. <table class="table table-hover table-headings reports">
  22. <thead>
  23. <tr>
  24. <th width="250">Name</th>
  25. <th width="110">Status</th>
  26. <th>Description</th>
  27. <th class="text-end">Last Run</th>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. {% for class_name, script in module_scripts.items %}
  32. <tr>
  33. <td>
  34. <a href="{% url 'extras:script' module=script.root_module name=class_name %}" name="script.{{ class_name }}">{{ script.name }}</a>
  35. </td>
  36. <td>
  37. {% include 'extras/inc/job_label.html' with result=script.result %}
  38. </td>
  39. <td>
  40. {{ script.Meta.description|markdown|placeholder }}
  41. </td>
  42. {% if script.result %}
  43. <td class="text-end">
  44. <a href="{% url 'extras:script_result' job_result_pk=script.result.pk %}">{{ script.result.created|annotated_date }}</a>
  45. </td>
  46. {% else %}
  47. <td class="text-end text-muted">Never</td>
  48. {% endif %}
  49. </tr>
  50. {% endfor %}
  51. </tbody>
  52. </table>
  53. </div>
  54. </div>
  55. {% endfor %}
  56. {% else %}
  57. <div class="alert alert-info">
  58. <h4 class="alert-heading">No Scripts Found</h4>
  59. Scripts should be saved to <code>{{ settings.SCRIPTS_ROOT }}</code>.
  60. <hr/>
  61. This path can be changed by setting <code>SCRIPTS_ROOT</code> in NetBox's configuration.
  62. </div>
  63. {% endif %}
  64. </div>
  65. {% endblock content-wrapper %}