Statistics.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <script setup lang="ts">
  2. import { ref, onMounted } from "vue";
  3. import { useRoute } from "vue-router";
  4. import { useWebsocketsStore } from "@/stores/websockets";
  5. const route = useRoute();
  6. const { socket } = useWebsocketsStore();
  7. const modules = ref([]);
  8. const activeModule = ref();
  9. onMounted(() => {
  10. socket.onConnect(() => {
  11. socket.dispatch("utils.getModules", res => {
  12. if (res.status === "success") modules.value = res.data.modules;
  13. });
  14. if (route.query.moduleName) {
  15. socket.dispatch("utils.getModule", route.query.moduleName, res => {
  16. if (res.status === "success")
  17. activeModule.value = {
  18. runningTasks: res.data.runningTasks,
  19. queuedTasks: res.data.queuedTasks,
  20. pausedTasks: res.data.pausedTasks,
  21. jobStatistics: res.data.jobStatistics
  22. };
  23. });
  24. }
  25. });
  26. });
  27. </script>
  28. <template>
  29. <div class="admin-tab container">
  30. <page-metadata title="Admin | Statistics" />
  31. <div class="card tab-info">
  32. <div class="info-row">
  33. <h1>Statistics</h1>
  34. <p>Analyze backend server job statistics</p>
  35. </div>
  36. </div>
  37. <div class="card">
  38. <h4>Average Logs</h4>
  39. <hr class="section-horizontal-rule" />
  40. <div class="card-content">
  41. <table class="table">
  42. <thead>
  43. <tr>
  44. <th>Name</th>
  45. <th>Status</th>
  46. <th>Stage</th>
  47. <th>Jobs in queue</th>
  48. <th>Jobs in progress</th>
  49. <th>Jobs paused</th>
  50. <th>Concurrency</th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. <tr
  55. v-for="moduleItem in modules"
  56. :key="moduleItem.name"
  57. >
  58. <td>
  59. <router-link
  60. :to="'?moduleName=' + moduleItem.name"
  61. >{{ moduleItem.name }}</router-link
  62. >
  63. </td>
  64. <td>{{ moduleItem.status }}</td>
  65. <td>{{ moduleItem.stage }}</td>
  66. <td>{{ moduleItem.jobsInQueue }}</td>
  67. <td>{{ moduleItem.jobsInProgress }}</td>
  68. <td>{{ moduleItem.jobsPaused }}</td>
  69. <td>{{ moduleItem.concurrency }}</td>
  70. </tr>
  71. </tbody>
  72. </table>
  73. </div>
  74. </div>
  75. <div v-if="activeModule" class="card">
  76. <h4>Running Tasks</h4>
  77. <hr class="section-horizontal-rule" />
  78. <div class="card-content">
  79. <table class="table">
  80. <thead>
  81. <tr>
  82. <th>Name</th>
  83. <th>UUID</th>
  84. <th>Status</th>
  85. <th>Priority</th>
  86. <th>Parent UUID</th>
  87. <th>Parent name</th>
  88. </tr>
  89. </thead>
  90. <tbody>
  91. <tr
  92. v-for="job in activeModule.runningTasks"
  93. :key="JSON.stringify(job)"
  94. >
  95. <td>{{ job.name }}</td>
  96. <td>{{ job.uniqueId }}</td>
  97. <td>{{ job.status }}</td>
  98. <td>{{ job.priority }}</td>
  99. <td>{{ job.parentUniqueId }}</td>
  100. <td>{{ job.parentName }}</td>
  101. </tr>
  102. </tbody>
  103. </table>
  104. </div>
  105. </div>
  106. <div v-if="activeModule" class="card">
  107. <h4>Paused Tasks</h4>
  108. <hr class="section-horizontal-rule" />
  109. <div class="card-content">
  110. <table class="table">
  111. <thead>
  112. <tr>
  113. <th>Name</th>
  114. <th>UUID</th>
  115. <th>Status</th>
  116. <th>Priority</th>
  117. <th>Parent UUID</th>
  118. <th>Parent name</th>
  119. </tr>
  120. </thead>
  121. <tbody>
  122. <tr
  123. v-for="job in activeModule.pausedTasks"
  124. :key="JSON.stringify(job)"
  125. >
  126. <td>{{ job.name }}</td>
  127. <td>{{ job.uniqueId }}</td>
  128. <td>{{ job.status }}</td>
  129. <td>{{ job.priority }}</td>
  130. <td>{{ job.parentUniqueId }}</td>
  131. <td>{{ job.parentName }}</td>
  132. </tr>
  133. </tbody>
  134. </table>
  135. </div>
  136. </div>
  137. <div v-if="activeModule" class="card">
  138. <h4>Queued Tasks</h4>
  139. <hr class="section-horizontal-rule" />
  140. <div class="card-content">
  141. <table class="table">
  142. <thead>
  143. <tr>
  144. <th>Name</th>
  145. <th>UUID</th>
  146. <th>Status</th>
  147. <th>Priority</th>
  148. <th>Parent UUID</th>
  149. <th>Parent name</th>
  150. </tr>
  151. </thead>
  152. <tbody>
  153. <tr
  154. v-for="job in activeModule.queuedTasks"
  155. :key="JSON.stringify(job)"
  156. >
  157. <td>{{ job.name }}</td>
  158. <td>{{ job.uniqueId }}</td>
  159. <td>{{ job.status }}</td>
  160. <td>{{ job.priority }}</td>
  161. <td>{{ job.parentUniqueId }}</td>
  162. <td>{{ job.parentName }}</td>
  163. </tr>
  164. </tbody>
  165. </table>
  166. </div>
  167. </div>
  168. <div v-if="activeModule">
  169. <div class="card">
  170. <h4>Average Logs</h4>
  171. <hr class="section-horizontal-rule" />
  172. <div class="card-content">
  173. <table class="table">
  174. <thead>
  175. <tr>
  176. <th>Job name</th>
  177. <th>Successful</th>
  178. <th>Failed</th>
  179. <th>Total</th>
  180. <th>Average timing</th>
  181. </tr>
  182. </thead>
  183. <tbody>
  184. <tr
  185. v-for="(
  186. job, jobName
  187. ) in activeModule.jobStatistics"
  188. :key="jobName"
  189. >
  190. <td>{{ jobName }}</td>
  191. <td>
  192. {{ job.successful }}
  193. </td>
  194. <td>
  195. {{ job.failed }}
  196. </td>
  197. <td>
  198. {{ job.total }}
  199. </td>
  200. <td>
  201. {{ job.averageTiming }}
  202. </td>
  203. </tr>
  204. </tbody>
  205. </table>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. </template>
  211. <style lang="less" scoped>
  212. .night-mode {
  213. .table {
  214. color: var(--light-grey-2);
  215. background-color: var(--dark-grey-3);
  216. thead tr {
  217. background: var(--dark-grey-3);
  218. td {
  219. color: var(--white);
  220. }
  221. }
  222. tbody tr:hover {
  223. background-color: var(--dark-grey-4) !important;
  224. }
  225. tbody tr:nth-child(even) {
  226. background-color: var(--dark-grey-2);
  227. }
  228. strong {
  229. color: var(--light-grey-2);
  230. }
  231. }
  232. }
  233. td {
  234. vertical-align: middle;
  235. }
  236. </style>