queue.gohtml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. {{define "queue-get" -}}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>File {{ .info.Name }}</title>
  7. <link rel="stylesheet" href="/assets/styles.css"/>
  8. <link rel="stylesheet" href="/assets/bootstrap.min.css">
  9. </head>
  10. <body>
  11. <main class="container">
  12. <div class="container mt-5">
  13. <nav aria-label="breadcrumb">
  14. <ol class="breadcrumb">
  15. <li class="breadcrumb-item"><a href="/">Home</a></li>
  16. <li class="breadcrumb-item active" aria-current="page">{{ .info.Name }}</li>
  17. </ol>
  18. </nav>
  19. <h1 class="text-3xl font-bold underline">Queue view for {{ .info.Name }}</h1>
  20. {{ template "flashes" .flashes }}
  21. <div class="alert alert-secondary alert-dismissible fade show row">
  22. <div class="col col-2">SQS info latency</div>
  23. <div class="col col-4">{{ .latency.info }}</div>
  24. <div class="col col-2">SQS messages latency</div>
  25. <div class="col col-4">{{ .latency.items }}</div>
  26. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  27. </div>
  28. {{ $timeFormat := "2006-01-02 03:04:05 -0700" }}
  29. <table class="table">
  30. <thead>
  31. </thead>
  32. <tbody>
  33. {{ $attr := .info.Attributes }}
  34. <tr>
  35. <th scope="row">Info</th>
  36. <td>Link: <a href="{{ .info.URL }}">{{ .info.Name }}</a></td>
  37. <td>ARN: {{ $attr.QueueARN }}</td>
  38. </tr>
  39. <tr>
  40. <th scope="row">Times</th>
  41. <td>Created: {{ timestamp $attr.CreatedTimestamp }}</td>
  42. <td>Last modified: {{ timestamp $attr.LastModifiedTimestamp }}</td>
  43. </tr>
  44. <tr>
  45. <th scope="row" rowspan="2">Durations</th>
  46. <td>Queue delay: {{ $attr.DelaySeconds }} seconds</td>
  47. <td>Visibility Timeout: {{ $attr.VisibilityTimeout }} seconds</td>
  48. </tr>
  49. <tr>
  50. <td>Retention period: {{ $attr.MessageRetentionPeriod }} seconds</td>
  51. <td>Receive wait time: {{ $attr.ReceiveMessageWaitTimeSeconds }} seconds</td>
  52. </tr>
  53. <tr>
  54. <th scope="row">Counts</th>
  55. <td>Approx. messages: {{ $attr.ApproximateNumberOfMessages }}</td>
  56. <td>Approx. delayed: {{ $attr.ApproximateNumberOfMessagesDelayed }}</td>
  57. </tr>
  58. <tr>
  59. <th scope="row">Messages</th>
  60. <td>Approx. not visible: {{ $attr.ApproximateNumberOfMessagesNotVisible }}</td>
  61. <td>Max. size: {{ $attr.MaximumMessageSize }}</td>
  62. </tr>
  63. {{ if $attr.RedrivePolicy }}
  64. <tr>
  65. <th scope="row">DeadLetter queue</th>
  66. <td><a href="/queue/{{ nameFromARN $attr.RedrivePolicy.DeadLetterTargetARN }}">{{ $attr.RedrivePolicy.DeadLetterTargetARN }}</a></td>
  67. <td>Max. receive count: {{ $attr.RedrivePolicy.MaxReceiveCount }}</td>
  68. </tr>
  69. {{ end }}
  70. {{ if $attr.RedriveAllowPolicy }}
  71. <tr>
  72. <th scope="row">Source queues for DLQ</th>
  73. <td>Redrive Permission: {{ $attr.RedriveAllowPolicy.RedrivePermission }}</td>
  74. <td>Queues:
  75. <ul>
  76. {{ range $attr.RedriveAllowPolicy.SourceQueueARNs }}
  77. <li><a href="/queue/{{- nameFromARN . -}}">{{ . }}</a></li>
  78. {{ end }}
  79. </ul>
  80. </td>
  81. </tr>
  82. {{ end }}
  83. </tbody>
  84. </table>
  85. </div>
  86. <section class="container mt-5">
  87. <form method="get" id="msg-form" action="/queue/{{ .info.Name }}/confirm">
  88. <div class="d-flex align-items-center justify-content-between">
  89. <h2 class="my-5">Messages</h2>
  90. <button type="submit" form="msg-form" id="redrive" name="redrive" class="btn btn-outline-warning bg-warning text-white" disabled>
  91. Redrive selection
  92. </button>
  93. <button type="submit" form="msg-form" id="delete" name="delete" class="btn btn-outline-danger bg-danger-subtle text-danger" disabled>
  94. Delete selection
  95. </button>
  96. <button type="submit" form="msg-form" id="purge" name="purge" class="btn btn-outline-danger bg-danger text-white">
  97. Purge whole queue
  98. </button>
  99. </div>
  100. <table class="table">
  101. <thead>
  102. <tr>
  103. <th scope="col" class="d-flex align-items-center">
  104. <input id="select-all" class="form-check-input mt-0 me-3" type="checkbox">
  105. <span>Select all</span>
  106. </th>
  107. <th scope="col">ID</th>
  108. <th scope="col">Body</th>
  109. <th scope="col">Attributes</th>
  110. </tr>
  111. </thead>
  112. <tbody>
  113. {{ range $i, $message := .items }}
  114. {{ $row := dict "message" $message "i" $i }}
  115. {{ template "queue-item" $row }}
  116. {{ end }}
  117. </tbody>
  118. </table>
  119. </form>
  120. </section>
  121. </main>
  122. <script src="/assets/bootstrap.js"></script>
  123. <script src="/assets/script.js"></script>
  124. </body>
  125. </html>
  126. {{end}}
  127. {{ define "queue-item" -}}
  128. <tr>
  129. <th scope="row"><input class="form-check-input checkbox" type="checkbox" name="id-{{ .i }}"/>
  130. <input type="hidden" name="rh-{{ .i }}" value="{{ .message.ReceiptHandle }}"/></th>
  131. <input type="hidden" name="mid-{{ .i }}" value="{{ .message.MessageId }}"/></th>
  132. <td>{{ .message.MessageId }}</td>
  133. <td>{{ abbrev 80 .message.Body }}</td>
  134. <td>{{ toJson .message.MessageAttributes | abbrev 80 }}</td>
  135. </tr>
  136. {{ end }}