script_list.html 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {% extends 'layout.html' %}
  2. {% load helpers %}
  3. {% block title %}Scripts{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col col-md-9">
  7. {% if scripts %}
  8. {% for module, module_scripts in scripts.items %}
  9. <h3><a name="module.{{ module }}"></a>{{ module|bettertitle }}</h3>
  10. <table class="table table-hover table-headings reports">
  11. <thead>
  12. <tr>
  13. <th>Name</th>
  14. <th>Status</th>
  15. <th>Description</th>
  16. <th class="text-end">Last Run</th>
  17. </tr>
  18. </thead>
  19. <tbody>
  20. {% for class_name, script in module_scripts.items %}
  21. <tr>
  22. <td>
  23. <a href="{% url 'extras:script' module=script.module name=class_name %}" name="script.{{ class_name }}"><strong>{{ script }}</strong></a>
  24. </td>
  25. <td>
  26. {% include 'extras/inc/job_label.html' with result=script.result %}
  27. </td>
  28. <td>{{ script.Meta.description|render_markdown }}</td>
  29. {% if script.result %}
  30. <td class="text-end">
  31. <a href="{% url 'extras:script_result' job_result_pk=script.result.pk %}">{{ script.result.created }}</a>
  32. </td>
  33. {% else %}
  34. <td class="text-end text-muted">Never</td>
  35. {% endif %}
  36. </tr>
  37. {% endfor %}
  38. </tbody>
  39. </table>
  40. {% endfor %}
  41. {% else %}
  42. <div class="alert alert-info">
  43. <h4 class="alert-heading">No Scripts Found</h4>
  44. Scripts should be saved to <code>{{ settings.SCRIPTS_ROOT }}</code>.
  45. <hr/>
  46. This path can be changed by setting <code>SCRIPTS_ROOT</code> in NetBox's configuration.
  47. </div>
  48. {% endif %}
  49. </div>
  50. <div class="col col-md-3">
  51. {% if scripts %}
  52. <div class="card">
  53. <div class="card-body">
  54. {% for module, module_scripts in scripts.items %}
  55. <h5>{{ module|bettertitle }}</h5>
  56. <div class="small mb-2">
  57. <ul class="list-group list-group-flush">
  58. {% for class_name, script in module_scripts.items %}
  59. <a href="#script.{{ class_name }}" class="list-group-item">
  60. <i class="mdi mdi-file-chart-outline"></i> {{ script.name }}
  61. <div class="float-end">
  62. {% include 'extras/inc/job_label.html' with result=script.result %}
  63. </div>
  64. </a>
  65. {% endfor %}
  66. </ul>
  67. </div>
  68. {% endfor %}
  69. </div>
  70. </div>
  71. {% endif %}
  72. </div>
  73. </div>
  74. {% endblock %}