Statistics.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <div class="container">
  3. <page-metadata title="Admin | Statistics" />
  4. <div class="columns">
  5. <div
  6. class="
  7. card
  8. column
  9. is-10-desktop is-offset-1-desktop is-12-mobile
  10. "
  11. >
  12. <header class="card-header">
  13. <p class="card-header-title">Average Logs</p>
  14. </header>
  15. <div class="card-content">
  16. <div class="content">
  17. <table class="table">
  18. <thead>
  19. <tr>
  20. <th>Name</th>
  21. <th>Status</th>
  22. <th>Stage</th>
  23. <th>Jobs in queue</th>
  24. <th>Jobs in progress</th>
  25. <th>Jobs paused</th>
  26. <th>Concurrency</th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. <tr
  31. v-for="moduleItem in modules"
  32. :key="moduleItem.name"
  33. >
  34. <td>
  35. <router-link
  36. :to="
  37. '?moduleName=' + moduleItem.name
  38. "
  39. >{{ moduleItem.name }}</router-link
  40. >
  41. </td>
  42. <td>{{ moduleItem.status }}</td>
  43. <td>{{ moduleItem.stage }}</td>
  44. <td>{{ moduleItem.jobsInQueue }}</td>
  45. <td>{{ moduleItem.jobsInProgress }}</td>
  46. <td>{{ moduleItem.jobsPaused }}</td>
  47. <td>{{ moduleItem.concurrency }}</td>
  48. </tr>
  49. </tbody>
  50. </table>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <br />
  56. <div class="columns" v-if="module">
  57. <div
  58. class="
  59. card
  60. column
  61. is-10-desktop is-offset-1-desktop is-12-mobile
  62. "
  63. >
  64. <header class="card-header">
  65. <p class="card-header-title">Running tasks</p>
  66. </header>
  67. <div class="card-content">
  68. <div class="content">
  69. <table class="table">
  70. <thead>
  71. <tr>
  72. <th>Name</th>
  73. <th>Payload</th>
  74. </tr>
  75. </thead>
  76. <tbody>
  77. <tr
  78. v-for="job in module.runningTasks"
  79. :key="JSON.stringify(job)"
  80. >
  81. <td>{{ job.name }}</td>
  82. <td>
  83. {{ JSON.stringify(job.payload) }}
  84. </td>
  85. </tr>
  86. </tbody>
  87. </table>
  88. </div>
  89. </div>
  90. </div>
  91. <div
  92. class="
  93. card
  94. column
  95. is-10-desktop is-offset-1-desktop is-12-mobile
  96. "
  97. >
  98. <header class="card-header">
  99. <p class="card-header-title">Paused tasks</p>
  100. </header>
  101. <div class="card-content">
  102. <div class="content">
  103. <table class="table">
  104. <thead>
  105. <tr>
  106. <th>Name</th>
  107. <th>Payload</th>
  108. </tr>
  109. </thead>
  110. <tbody>
  111. <tr
  112. v-for="job in module.pausedTasks"
  113. :key="JSON.stringify(job)"
  114. >
  115. <td>{{ job.name }}</td>
  116. <td>
  117. {{ JSON.stringify(job.payload) }}
  118. </td>
  119. </tr>
  120. </tbody>
  121. </table>
  122. </div>
  123. </div>
  124. </div>
  125. <div
  126. class="
  127. card
  128. column
  129. is-10-desktop is-offset-1-desktop is-12-mobile
  130. "
  131. >
  132. <header class="card-header">
  133. <p class="card-header-title">Queued tasks</p>
  134. </header>
  135. <div class="card-content">
  136. <div class="content">
  137. <table class="table">
  138. <thead>
  139. <tr>
  140. <th>Name</th>
  141. <th>Payload</th>
  142. </tr>
  143. </thead>
  144. <tbody>
  145. <tr
  146. v-for="job in module.queuedTasks"
  147. :key="JSON.stringify(job)"
  148. >
  149. <td>{{ job.name }}</td>
  150. <td>
  151. {{ JSON.stringify(job.payload) }}
  152. </td>
  153. </tr>
  154. </tbody>
  155. </table>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. <br />
  161. <div class="columns" v-if="module">
  162. <div
  163. class="
  164. card
  165. column
  166. is-10-desktop is-offset-1-desktop is-12-mobile
  167. "
  168. >
  169. <header class="card-header">
  170. <p class="card-header-title">Average Logs</p>
  171. </header>
  172. <div class="card-content">
  173. <div class="content">
  174. <table class="table">
  175. <thead>
  176. <tr>
  177. <th>Job name</th>
  178. <th>Successful</th>
  179. <th>Failed</th>
  180. <th>Total</th>
  181. <th>Average timing</th>
  182. </tr>
  183. </thead>
  184. <tbody>
  185. <tr
  186. v-for="(
  187. job, jobName
  188. ) in module.jobStatistics"
  189. :key="jobName"
  190. >
  191. <td>{{ jobName }}</td>
  192. <td>
  193. {{ job.successful }}
  194. </td>
  195. <td>
  196. {{ job.failed }}
  197. </td>
  198. <td>
  199. {{ job.total }}
  200. </td>
  201. <td>
  202. {{ job.averageTiming }}
  203. </td>
  204. </tr>
  205. </tbody>
  206. </table>
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. </template>
  213. <script>
  214. import { mapGetters } from "vuex";
  215. import ws from "@/ws";
  216. export default {
  217. components: {},
  218. data() {
  219. return {
  220. modules: [],
  221. module: null
  222. };
  223. },
  224. computed: mapGetters({
  225. socket: "websockets/getSocket"
  226. }),
  227. mounted() {
  228. ws.onConnect(this.init);
  229. },
  230. methods: {
  231. init() {
  232. this.socket.dispatch("utils.getModules", res => {
  233. if (res.status === "success") this.modules = res.data.modules;
  234. });
  235. if (this.$route.query.moduleName) {
  236. this.socket.dispatch(
  237. "utils.getModule",
  238. this.$route.query.moduleName,
  239. res => {
  240. if (res.status === "success")
  241. this.module = {
  242. runningJobs: res.data.runningJobs,
  243. jobStatistics: res.data.jobStatistics
  244. };
  245. }
  246. );
  247. }
  248. },
  249. round(number) {
  250. return Math.round(number);
  251. }
  252. }
  253. };
  254. </script>
  255. <style lang="scss" scoped>
  256. .night-mode {
  257. .table {
  258. color: var(--light-grey-2);
  259. background-color: var(--dark-grey-3);
  260. thead tr {
  261. background: var(--dark-grey-3);
  262. td {
  263. color: var(--white);
  264. }
  265. }
  266. tbody tr:hover {
  267. background-color: var(--dark-grey-4) !important;
  268. }
  269. tbody tr:nth-child(even) {
  270. background-color: var(--dark-grey-2);
  271. }
  272. strong {
  273. color: var(--light-grey-2);
  274. }
  275. }
  276. .card {
  277. background-color: var(--dark-grey-3);
  278. p {
  279. color: var(--light-grey-2);
  280. }
  281. }
  282. }
  283. body {
  284. font-family: "Hind", sans-serif;
  285. }
  286. .user-avatar {
  287. display: block;
  288. max-width: 50px;
  289. margin: 0 auto;
  290. }
  291. td {
  292. vertical-align: middle;
  293. }
  294. .is-primary:focus {
  295. background-color: var(--primary-color) !important;
  296. }
  297. </style>