queue.gohtml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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>
  67. <a href="/queue/{{ nameFromARN $attr.RedrivePolicy.DeadLetterTargetARN }}">{{ $attr.RedrivePolicy.DeadLetterTargetARN }}</a>
  68. </td>
  69. <td>Max. receive count: {{ $attr.RedrivePolicy.MaxReceiveCount }}</td>
  70. </tr>
  71. {{ end }}
  72. {{ if .isDLQ }}
  73. <tr>
  74. <th scope="row">Source queues for DLQ</th>
  75. <td>Redrive Permission: {{ $attr.RedriveAllowPolicy.RedrivePermission }}</td>
  76. <td>Queues:
  77. <ul>
  78. {{ range $attr.RedriveAllowPolicy.SourceQueueARNs }}
  79. <li><a href="/queue/{{- nameFromARN . -}}">{{ . }}</a></li>
  80. {{ end }}
  81. </ul>
  82. </td>
  83. </tr>
  84. {{ end }}
  85. </tbody>
  86. </table>
  87. </div>
  88. <section class="container mt-5">
  89. <form method="get" id="msg-form" action="/queue/{{ .info.Name }}/confirm">
  90. <div class="d-flex align-items-center justify-content-between">
  91. <h2 class="my-5">Messages</h2>
  92. {{ if .isDLQ }}
  93. <button type="submit" form="msg-form" id="redrive" name="redrive"
  94. class="btn btn-outline-warning bg-warning text-white" disabled>
  95. Redrive selection
  96. </button>
  97. {{ end }}
  98. <button type="submit" form="msg-form" id="delete" name="delete"
  99. class="btn btn-outline-danger bg-danger-subtle text-danger" disabled>
  100. Delete selection
  101. </button>
  102. <button type="submit" form="msg-form" id="purge" name="purge"
  103. class="btn btn-outline-danger bg-danger text-white">
  104. Purge whole queue
  105. </button>
  106. </div>
  107. <table class="table">
  108. <thead>
  109. <tr>
  110. <th scope="col" class="d-flex align-items-center">
  111. <input id="select-all" class="form-check-input mt-0 me-3" type="checkbox">
  112. <span>Select all</span>
  113. </th>
  114. <th scope="col">ID</th>
  115. <th scope="col">Body</th>
  116. <th scope="col">Attributes</th>
  117. </tr>
  118. </thead>
  119. <tbody>
  120. {{ range $i, $message := .items }}
  121. {{ $row := dict "message" $message "i" $i }}
  122. {{ template "queue-item" $row }}
  123. {{ end }}
  124. </tbody>
  125. </table>
  126. </form>
  127. </section>
  128. </main>
  129. <script src="/assets/bootstrap.js"></script>
  130. <script src="/assets/script.js"></script>
  131. </body>
  132. </html>
  133. {{end}}
  134. {{ define "queue-item" -}}
  135. <tr>
  136. <th scope="row"><input class="form-check-input checkbox" type="checkbox" name="id-{{ .i }}"/>
  137. <input type="hidden" name="rh-{{ .i }}" value="{{ .message.ReceiptHandle }}"/></th>
  138. <input type="hidden" name="mid-{{ .i }}" value="{{ .message.MessageId }}"/></th>
  139. <td>{{ .message.MessageId }}</td>
  140. <td>{{ abbrev 80 .message.Body }}</td>
  141. <td>{{ toJson .message.MessageAttributes | abbrev 80 }}</td>
  142. </tr>
  143. {{ end }}