account_audit_log.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. {% extends "base.html" %}
  2. {% set active_page = "accounts" %}
  3. {% block title %} Account {{ account.name }} actions history {% endblock %}
  4. {% block divs %}
  5. <div class="container-fluid">
  6. <div class="row">
  7. <div class="sensors-asset card">
  8. <h3>History of actions for account <a href="/accounts/{{ account.id }}">{{ account.name }}</a></h3>
  9. <div class="table-responsive">
  10. <table id="account_audit_log" class="table table-striped paginate nav-on-click">
  11. <thead>
  12. <tr>
  13. <th style="display:none;">Event Timestamp</th><!-- Hidden UTC Timestamp column for sorting, Keep at position zero -->
  14. <th>Event Datetime</th>
  15. <th>Event Name</th>
  16. <th>Active user id</th>
  17. </tr>
  18. </thead>
  19. <tbody>
  20. {% for audit_log in audit_logs: %}
  21. <tr>
  22. <td style="display:none;">
  23. {{ audit_log.event_datetime | to_utc_timestamp }} <!-- Hidden UTC Timestamp column for sorting, Keep at position zero -->
  24. </td>
  25. <td>
  26. {{ audit_log.event_datetime }}
  27. </td>
  28. <td>
  29. {{ audit_log.event }}
  30. </td>
  31. <td>
  32. {{ audit_log.active_user_id }}
  33. </td>
  34. </tr>
  35. {% endfor %}
  36. </tbody>
  37. </table>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <script>
  43. $(document).ready(function() {
  44. $('#account_audit_log').DataTable({
  45. "order": [[ 0, "desc" ]], //Default sort by "Event Datetime" column
  46. "columnDefs": [
  47. {
  48. "targets": 1, // Target the visible "Event Datetime" column
  49. "orderData": 0 // Use data from the first column (UTC Timestamp) for sorting
  50. }
  51. ]
  52. });
  53. });
  54. </script>
  55. {% endblock %}