script_result.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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="row mb-3">
  39. <div class="col-auto ms-auto d-print-none">
  40. {% if request.user.is_authenticated %}
  41. <div class="table-configure input-group">
  42. <button type="button" data-bs-toggle="modal" title="{% trans "Configure Table" %}" data-bs-target="#ObjectTable_config"
  43. class="btn">
  44. <i class="mdi mdi-cog"></i> {% trans "Configure Table" %}
  45. </button>
  46. </div>
  47. {% endif %}
  48. </div>
  49. </div>
  50. <form method="post" class="form form-horizontal">
  51. {% csrf_token %}
  52. {# "Select all" form #}
  53. {% if table.paginator.num_pages > 1 %}
  54. <div id="select-all-box" class="d-none card d-print-none">
  55. <div class="form col-md-12">
  56. <div class="card-body">
  57. <div class="form-check">
  58. <input type="checkbox" id="select-all" name="_all" class="form-check-input" />
  59. <label for="select-all" class="form-check-label">
  60. {% blocktrans trimmed with count=table.rows|length object_type_plural=table.data.verbose_name_plural %}
  61. Select <strong>all {{ count }} {{ object_type_plural }}</strong> matching query
  62. {% endblocktrans %}
  63. </label>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. {% endif %}
  69. <div class="form form-horizontal">
  70. {% csrf_token %}
  71. <input type="hidden" name="return_url" value="{% if return_url %}{{ return_url }}{% else %}{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}{% endif %}" />
  72. {# Objects table #}
  73. <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 %}>
  74. {% include 'extras/htmx/script_result.html' %}
  75. </div>
  76. {# /Objects table #}
  77. </div>
  78. </form>
  79. </div>
  80. {# /Object list tab #}
  81. {# Filters tab #}
  82. {% if filter_form %}
  83. <div class="tab-pane show" id="filters-form" role="tabpanel" aria-labelledby="filters-form-tab">
  84. {% include 'inc/filter_list.html' %}
  85. </div>
  86. {% endif %}
  87. {# /Filters tab #}
  88. {% endblock content %}
  89. {% block modals %}
  90. {% if job.completed %}
  91. {% table_config_form table table_name="ObjectTable" %}
  92. {% endif %}
  93. {% endblock modals %}