You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

167 lines
7.8 KiB

  1. @* Generator: Template TypeVisibility: Internal GeneratePrettyNames: True *@
  2. @using System
  3. @using DotNetCore.CAP.Dashboard
  4. @using DotNetCore.CAP.Dashboard.Pages
  5. @using DotNetCore.CAP.Dashboard.Resources
  6. @using DotNetCore.CAP.Messages
  7. @using DotNetCore.CAP.Monitoring
  8. @inherits DotNetCore.CAP.Dashboard.RazorPage
  9. @{
  10. Layout = new LayoutPage(Strings.ReceivedMessagesPage_Title);
  11. int from, perPage;
  12. int.TryParse(Query("from"), out from);
  13. int.TryParse(Query("count"), out perPage);
  14. var group = Query("group");
  15. var name = Query("name");
  16. var content = Query("content");
  17. var monitor = Storage.GetMonitoringApi();
  18. var pager = new Pager(from, perPage, GetTotal(monitor));
  19. var queryDto = new MessageQueryDto
  20. {
  21. MessageType = MessageType.Subscribe,
  22. Group = group,
  23. Name = name,
  24. Content = content,
  25. StatusName = StatusName,
  26. CurrentPage = pager.CurrentPage - 1,
  27. PageSize = pager.RecordsPerPage
  28. };
  29. var succeededMessages = monitor.Messages(queryDto);
  30. }
  31. <div class="row">
  32. <div class="col-md-3">
  33. @Html.MessagesSidebar(MessageType.Subscribe)
  34. </div>
  35. <div class="col-md-9">
  36. <h1 class="page-header">@Strings.ReceivedPage_Title</h1>
  37. @if (succeededMessages.Count == 0)
  38. {
  39. <div class="alert alert-info">
  40. @Strings.MessagesPage_NoMessages
  41. </div>
  42. }
  43. else
  44. {
  45. <div class="js-jobs-list">
  46. <div class="btn-toolbar btn-toolbar-top">
  47. <form class="row">
  48. <div class="col-md-2">
  49. <input type="text" class="form-control" name="group" value="@Query("group")" placeholder="@Strings.MessagesPage_Query_MessageGroup"/>
  50. </div>
  51. <div class="col-md-3">
  52. <input type="text" class="form-control" name="name" value="@Query("name")" placeholder="@Strings.MessagesPage_Query_MessageName"/>
  53. </div>
  54. <div class="col-md-5">
  55. <div class="input-group">
  56. <input type="text" class="form-control" name="content" value="@Query("content")" placeholder="@Strings.MessagesPage_Query_MessageBody"/>
  57. <span class="input-group-btn">
  58. <button class="btn btn-info">@Strings.MessagesPage_Query_Button</button>
  59. </span>
  60. </div>
  61. </div>
  62. </form>
  63. </div>
  64. <div class="btn-toolbar btn-toolbar-top">
  65. <button class="js-jobs-list-command btn btn-sm btn-primary"
  66. data-url="@Url.To("/received/requeue")"
  67. data-loading-text="@Strings.Common_Enqueueing"
  68. disabled="disabled">
  69. <span class="glyphicon glyphicon-repeat"></span>
  70. @Strings.Common_ReConsume
  71. </button>
  72. @Html.PerPageSelector(pager)
  73. </div>
  74. <div class="table-responsive">
  75. <table class="table">
  76. <thead>
  77. <tr>
  78. <th style="width: 30px;">
  79. <input type="checkbox" class="js-jobs-list-select-all"/>
  80. </th>
  81. <th style="width: 175px">@Strings.Common_Id</th>
  82. <th>@Strings.Common_Version</th>
  83. <th>@Strings.MessagesPage_Table_Group</th>
  84. <th>@Strings.MessagesPage_Table_Name</th>
  85. <th class="min-width">@Strings.MessagesPage_Table_Retries</th>
  86. @if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase))
  87. {
  88. <th>@Strings.MessagesPage_Table_State</th>
  89. }
  90. <th style="width: 75px;" class="align-right">@Strings.MessagesPage_Table_ExpiresAt</th>
  91. </tr>
  92. </thead>
  93. <tbody>
  94. @foreach (var message in succeededMessages)
  95. {
  96. <tr class="js-jobs-list-row hover">
  97. <td>
  98. <input type="checkbox" class="js-jobs-list-checkbox" name="messages[]" value="@message.Id"/>
  99. </td>
  100. <td class="word-break">
  101. <a href="javascript:;" data-url='@(Url.To("/received/message/") + message.Id)' class="openModal">#@message.Id</a>
  102. </td>
  103. <td>
  104. @message.Version
  105. </td>
  106. <td class="word-break">
  107. @message.Group
  108. </td>
  109. <td>
  110. @message.Name
  111. </td>
  112. <td>
  113. @message.Retries
  114. </td>
  115. @if (string.Equals(StatusName, "Processing", StringComparison.CurrentCultureIgnoreCase))
  116. {
  117. <td>
  118. @message.StatusName
  119. </td>
  120. }
  121. <td class="align-right">
  122. @if (message.ExpiresAt.HasValue)
  123. {
  124. @Html.RelativeTime(message.ExpiresAt.Value)
  125. }
  126. </td>
  127. </tr>
  128. }
  129. </tbody>
  130. </table>
  131. </div>
  132. @Html.Paginator(pager)
  133. </div>
  134. <div>
  135. <div class="modal fade" tabindex="-1" role="dialog">
  136. <div class="modal-dialog" role="document">
  137. <div class="modal-content">
  138. <div class="modal-header">
  139. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  140. <span aria-hidden="true">&times;</span>
  141. </button>
  142. <h4 class="modal-title">Message Content</h4>
  143. </div>
  144. <div id="jsonContent" style="max-height: 500px; overflow-y: auto;" class="modal-body">
  145. </div>
  146. <div class="modal-footer">
  147. <button type="button" class="btn btn-sm btn-primary" id="formatBtn" onclick="">@Strings.MessagesPage_Modal_Format</button>
  148. <button type="button" class="btn btn-sm btn-primary" id="rawBtn" onclick="">@Strings.MessagesPage_Modal_Raw</button>
  149. <button type="button" class="btn btn-sm btn-primary" id="expandBtn" onclick="">@Strings.MessagesPage_Modal_Expand</button>
  150. <button type="button" class="btn btn-sm btn-primary" id="collapseBtn" onclick="">@Strings.MessagesPage_Model_Collaspse</button>
  151. </div>
  152. </div><!-- /.modal-content -->
  153. </div><!-- /.modal-dialog -->
  154. </div><!-- /.modal -->
  155. </div>
  156. }
  157. </div>
  158. </div>