script_result.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {% extends 'generic/_base.html' %}
  2. {% load helpers %}
  3. {% load buttons %}
  4. {% load perms %}
  5. {% load i18n %}
  6. {% block title %}{{ script }}{% endblock %}
  7. {% block subtitle %}
  8. {{ script.Meta.description|markdown }}
  9. {% endblock %}
  10. {% block page-header %}
  11. <div class="container-fluid mt-2">
  12. <nav class="breadcrumb-container" aria-label="breadcrumb">
  13. <ol class="breadcrumb">
  14. <li class="breadcrumb-item"><a href="{% url 'extras:script_list' %}">{% trans "Scripts" %}</a></li>
  15. <li class="breadcrumb-item"><a href="{% url 'extras:script_list' %}#module.{{ script.module }}">{{ script.module|bettertitle }}</a></li>
  16. <li class="breadcrumb-item"><a href="{{ script.get_absolute_url }}">{{ script }}</a></li>
  17. <li class="breadcrumb-item">{{ job.created|isodatetime }}</li>
  18. </ol>
  19. </nav>
  20. </div>
  21. {% endblock page-header %}
  22. {% block controls %}
  23. {% if request.user|can_delete:job %}
  24. {% delete_button job %}
  25. {% endif %}
  26. {% endblock controls %}
  27. {% block tabs %}
  28. <ul class="nav nav-tabs" role="tablist">
  29. <li class="nav-item" role="presentation">
  30. <a href="#results" role="tab" data-bs-toggle="tab" class="nav-link active">{% trans "Results" %}</a>
  31. </li>
  32. </ul>
  33. {% endblock %}
  34. {% block content %}
  35. {# Object list tab #}
  36. <div class="tab-pane show active" id="results" role="tabpanel" aria-labelledby="results-tab">
  37. {# Object table controls #}
  38. <div class="d-flex align-items-center mb-3">
  39. <div>{% trans "Log threshold" %}</div>
  40. <div class="px-2 d-print-none">
  41. <div class="dropdown">
  42. <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
  43. {{ log_levels|get_key:log_threshold }}
  44. </button>
  45. <div class="dropdown-menu">
  46. {% for level, name in log_levels.items %}
  47. <a class="dropdown-item d-flex justify-content-between" href="{% url 'extras:script_result' job_pk=job.pk %}?log_threshold={{ level }}">
  48. {{ name }}{% if forloop.first %} ({% trans "All" %}){% endif %}
  49. {% if level == log_threshold %}<span class="badge bg-green ms-auto"></span>{% endif %}
  50. </a>
  51. {% endfor %}
  52. </div>
  53. </div>
  54. </div>
  55. <div class="ms-auto d-print-none">
  56. {% if request.user.is_authenticated and job.completed %}
  57. <div class="table-configure input-group">
  58. <button type="button" data-bs-toggle="modal" title="{% trans "Configure Table" %}" data-bs-target="#ObjectTable_config"
  59. class="btn">
  60. <i class="mdi mdi-cog"></i> {% trans "Configure Table" %}
  61. </button>
  62. </div>
  63. {% endif %}
  64. </div>
  65. </div>
  66. <form method="post" class="form form-horizontal">
  67. {% csrf_token %}
  68. {# "Select all" form #}
  69. {% if table.paginator.num_pages > 1 %}
  70. <div id="select-all-box" class="d-none card d-print-none">
  71. <div class="form col-md-12">
  72. <div class="card-body">
  73. <div class="form-check">
  74. <input type="checkbox" id="select-all" name="_all" class="form-check-input" />
  75. <label for="select-all" class="form-check-label">
  76. {% blocktrans trimmed with count=table.rows|length object_type_plural=table.data.verbose_name_plural %}
  77. Select <strong>all {{ count }} {{ object_type_plural }}</strong> matching query
  78. {% endblocktrans %}
  79. </label>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. {% endif %}
  85. <div class="form form-horizontal">
  86. {% csrf_token %}
  87. <input type="hidden" name="return_url" value="{% if return_url %}{{ return_url }}{% else %}{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}{% endif %}" />
  88. {# Objects table #}
  89. <div class="col col-md-12"{% if not job.completed %} hx-get="{% url 'extras:script_result' job_pk=job.pk %}" hx-trigger="load delay:0.5s, every 5s"{% endif %}>
  90. {% include 'extras/htmx/script_result.html' %}
  91. </div>
  92. {# /Objects table #}
  93. </div>
  94. </form>
  95. </div>
  96. {# /Object list tab #}
  97. {% endblock content %}
  98. {% block modals %}
  99. {% if job.completed %}
  100. {% table_config_form table table_name="ObjectTable" %}
  101. {% endif %}
  102. {% endblock modals %}