123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- <template>
- <div class="container">
- <metadata title="Admin | Statistics" />
- <div class="columns">
- <div
- class="card column is-10-desktop is-offset-1-desktop is-12-mobile"
- >
- <header class="card-header">
- <p class="card-header-title">Average Logs</p>
- </header>
- <div class="card-content">
- <div class="content">
- <table class="table">
- <thead>
- <tr>
- <th>Name</th>
- <th>Status</th>
- <th>Stage</th>
- <th>Jobs in queue</th>
- <th>Jobs in progress</th>
- <th>Jobs paused</th>
- <th>Concurrency</th>
- </tr>
- </thead>
- <tbody>
- <tr
- v-for="moduleItem in modules"
- :key="moduleItem.name"
- >
- <td>
- <router-link
- :to="
- '?moduleName=' + moduleItem.name
- "
- >{{ moduleItem.name }}</router-link
- >
- </td>
- <td>{{ moduleItem.status }}</td>
- <td>{{ moduleItem.stage }}</td>
- <td>{{ moduleItem.jobsInQueue }}</td>
- <td>{{ moduleItem.jobsInProgress }}</td>
- <td>{{ moduleItem.jobsPaused }}</td>
- <td>{{ moduleItem.concurrency }}</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <br />
- <div class="columns" v-if="module">
- <div
- class="card column is-10-desktop is-offset-1-desktop is-12-mobile"
- >
- <header class="card-header">
- <p class="card-header-title">Running tasks</p>
- </header>
- <div class="card-content">
- <div class="content">
- <table class="table">
- <thead>
- <tr>
- <th>Name</th>
- <th>Payload</th>
- </tr>
- </thead>
- <tbody>
- <tr
- v-for="job in module.runningTasks"
- :key="JSON.stringify(job)"
- >
- <td>{{ job.name }}</td>
- <td>
- {{ JSON.stringify(job.payload) }}
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <div
- class="card column is-10-desktop is-offset-1-desktop is-12-mobile"
- >
- <header class="card-header">
- <p class="card-header-title">Paused tasks</p>
- </header>
- <div class="card-content">
- <div class="content">
- <table class="table">
- <thead>
- <tr>
- <th>Name</th>
- <th>Payload</th>
- </tr>
- </thead>
- <tbody>
- <tr
- v-for="job in module.pausedTasks"
- :key="JSON.stringify(job)"
- >
- <td>{{ job.name }}</td>
- <td>
- {{ JSON.stringify(job.payload) }}
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <div
- class="card column is-10-desktop is-offset-1-desktop is-12-mobile"
- >
- <header class="card-header">
- <p class="card-header-title">Queued tasks</p>
- </header>
- <div class="card-content">
- <div class="content">
- <table class="table">
- <thead>
- <tr>
- <th>Name</th>
- <th>Payload</th>
- </tr>
- </thead>
- <tbody>
- <tr
- v-for="job in module.queuedTasks"
- :key="JSON.stringify(job)"
- >
- <td>{{ job.name }}</td>
- <td>
- {{ JSON.stringify(job.payload) }}
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <br />
- <div class="columns" v-if="module">
- <div
- class="card column is-10-desktop is-offset-1-desktop is-12-mobile"
- >
- <header class="card-header">
- <p class="card-header-title">Average Logs</p>
- </header>
- <div class="card-content">
- <div class="content">
- <table class="table">
- <thead>
- <tr>
- <th>Job name</th>
- <th>Successful</th>
- <th>Failed</th>
- <th>Total</th>
- <th>Average timing</th>
- </tr>
- </thead>
- <tbody>
- <tr
- v-for="(job,
- jobName) in module.jobStatistics"
- :key="jobName"
- >
- <td>{{ jobName }}</td>
- <td>
- {{ job.successful }}
- </td>
- <td>
- {{ job.failed }}
- </td>
- <td>
- {{ job.total }}
- </td>
- <td>
- {{ job.averageTiming }}
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import io from "../../../io";
- export default {
- components: {},
- data() {
- return {
- modules: [],
- module: null
- };
- },
- mounted() {
- io.getSocket(socket => {
- this.socket = socket;
- if (this.socket.readyState === 1) this.init();
- io.onConnect(() => this.init());
- });
- },
- methods: {
- init() {
- this.socket.dispatch("utils.getModules", data => {
- console.log(data);
- if (data.status === "success") {
- this.modules = data.modules;
- }
- });
- if (this.$route.query.moduleName) {
- this.socket.dispatch(
- "utils.getModule",
- this.$route.query.moduleName,
- data => {
- console.log(data);
- if (data.status === "success") {
- this.module = {
- runningJobs: data.runningJobs,
- jobStatistics: data.jobStatistics
- };
- }
- }
- );
- }
- },
- round(number) {
- return Math.round(number);
- }
- }
- };
- </script>
- //
- <style lang="scss" scoped>
- .night-mode {
- .table {
- color: var(--light-grey-2);
- background-color: var(--dark-grey-3);
- thead tr {
- background: var(--dark-grey-3);
- td {
- color: var(--white);
- }
- }
- tbody tr:hover {
- background-color: var(--dark-grey-4) !important;
- }
- tbody tr:nth-child(even) {
- background-color: var(--dark-grey-2);
- }
- strong {
- color: var(--light-grey-2);
- }
- }
- .card {
- background-color: var(--dark-grey-3);
- p {
- color: var(--light-grey-2);
- }
- }
- }
- body {
- font-family: "Hind", sans-serif;
- }
- .user-avatar {
- display: block;
- max-width: 50px;
- margin: 0 auto;
- }
- td {
- vertical-align: middle;
- }
- .is-primary:focus {
- background-color: var(--primary-color) !important;
- }
- </style>
|