2019-02-05 23:24:59 -07:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<ui-card>
|
2019-03-14 22:48:17 -06:00
|
|
|
<template #title><fa :icon="faChartBar"/> {{ $t('title') }}</template>
|
2019-03-12 02:11:06 -06:00
|
|
|
<section class="wptihjuy">
|
2019-03-12 02:20:40 -06:00
|
|
|
<header><fa :icon="faPaperPlane"/> Deliver</header>
|
2019-05-27 02:23:05 -06:00
|
|
|
<x-chart v-if="connection" :connection="connection" :limit="chartLimit" type="deliver"/>
|
2019-03-07 21:03:38 -07:00
|
|
|
</section>
|
2019-03-12 02:11:06 -06:00
|
|
|
<section class="wptihjuy">
|
2019-03-12 02:20:40 -06:00
|
|
|
<header><fa :icon="faInbox"/> Inbox</header>
|
2019-05-27 02:23:05 -06:00
|
|
|
<x-chart v-if="connection" :connection="connection" :limit="chartLimit" type="inbox"/>
|
2019-03-07 21:03:38 -07:00
|
|
|
</section>
|
2019-02-05 23:24:59 -07:00
|
|
|
<section>
|
|
|
|
<ui-button @click="removeAllJobs">{{ $t('remove-all-jobs') }}</ui-button>
|
|
|
|
</section>
|
|
|
|
</ui-card>
|
2019-03-14 22:48:17 -06:00
|
|
|
|
|
|
|
<ui-card>
|
|
|
|
<template #title><fa :icon="faTasks"/> {{ $t('jobs') }}</template>
|
|
|
|
<section class="fit-top">
|
|
|
|
<ui-horizon-group inputs>
|
|
|
|
<ui-select v-model="domain">
|
|
|
|
<template #label>{{ $t('queue') }}</template>
|
|
|
|
<option value="deliver">{{ $t('domains.deliver') }}</option>
|
|
|
|
<option value="inbox">{{ $t('domains.inbox') }}</option>
|
|
|
|
</ui-select>
|
|
|
|
<ui-select v-model="state">
|
|
|
|
<template #label>{{ $t('state') }}</template>
|
|
|
|
<option value="delayed">{{ $t('states.delayed') }}</option>
|
|
|
|
</ui-select>
|
|
|
|
</ui-horizon-group>
|
|
|
|
<sequential-entrance animation="entranceFromTop" delay="25">
|
|
|
|
<div class="xvvuvgsv" v-for="job in jobs">
|
|
|
|
<b>{{ job.id }}</b>
|
|
|
|
<template v-if="domain === 'deliver'">
|
|
|
|
<span>{{ job.data.to }}</span>
|
|
|
|
</template>
|
|
|
|
<template v-if="domain === 'inbox'">
|
|
|
|
<span>{{ job.activity.id }}</span>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</sequential-entrance>
|
|
|
|
<ui-info v-if="jobs.length == jobsLimit">{{ $t('result-is-truncated', { n: jobsLimit }) }}</ui-info>
|
|
|
|
</section>
|
|
|
|
</ui-card>
|
2019-02-05 23:24:59 -07:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2019-05-27 02:23:05 -06:00
|
|
|
import { faTasks, faInbox } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import { faPaperPlane, faChartBar } from '@fortawesome/free-regular-svg-icons';
|
2019-02-05 23:24:59 -07:00
|
|
|
import i18n from '../../i18n';
|
2019-05-27 02:23:05 -06:00
|
|
|
import XChart from './queue.chart.vue';
|
2019-03-13 08:27:11 -06:00
|
|
|
|
2019-02-05 23:24:59 -07:00
|
|
|
export default Vue.extend({
|
|
|
|
i18n: i18n('admin/views/queue.vue'),
|
|
|
|
|
2019-05-27 02:23:05 -06:00
|
|
|
components: {
|
|
|
|
XChart
|
|
|
|
},
|
|
|
|
|
2019-02-05 23:24:59 -07:00
|
|
|
data() {
|
|
|
|
return {
|
2019-05-27 02:23:05 -06:00
|
|
|
connection: null,
|
|
|
|
chartLimit: 200,
|
2019-03-14 22:48:17 -06:00
|
|
|
jobs: [],
|
|
|
|
jobsLimit: 50,
|
|
|
|
domain: 'deliver',
|
|
|
|
state: 'delayed',
|
2019-05-27 02:23:05 -06:00
|
|
|
faTasks, faPaperPlane, faInbox, faChartBar
|
2019-02-05 23:24:59 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2019-03-12 02:11:06 -06:00
|
|
|
watch: {
|
2019-03-14 22:48:17 -06:00
|
|
|
domain() {
|
|
|
|
this.jobs = [];
|
|
|
|
this.fetchJobs();
|
|
|
|
},
|
|
|
|
|
|
|
|
state() {
|
|
|
|
this.jobs = [];
|
|
|
|
this.fetchJobs();
|
|
|
|
},
|
2019-03-12 02:11:06 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2019-03-14 22:48:17 -06:00
|
|
|
this.fetchJobs();
|
|
|
|
|
2019-05-27 02:23:05 -06:00
|
|
|
this.connection = this.$root.stream.useSharedConnection('queueStats');
|
|
|
|
this.connection.send('requestLog', {
|
2019-03-12 02:11:06 -06:00
|
|
|
id: Math.random().toString().substr(2, 8),
|
2019-05-27 02:23:05 -06:00
|
|
|
length: this.chartLimit
|
2019-03-12 02:11:06 -06:00
|
|
|
});
|
2019-03-07 21:10:38 -07:00
|
|
|
|
|
|
|
this.$once('hook:beforeDestroy', () => {
|
2019-05-27 02:23:05 -06:00
|
|
|
this.connection.dispose();
|
2019-03-07 21:03:38 -07:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2019-02-05 23:24:59 -07:00
|
|
|
methods: {
|
|
|
|
async removeAllJobs() {
|
|
|
|
const process = async () => {
|
|
|
|
await this.$root.api('admin/queue/clear');
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'success',
|
|
|
|
splash: true
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
await process().catch(e => {
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'error',
|
|
|
|
text: e.toString()
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
2019-03-12 02:11:06 -06:00
|
|
|
|
2019-03-14 22:48:17 -06:00
|
|
|
fetchJobs() {
|
|
|
|
this.$root.api('admin/queue/jobs', {
|
|
|
|
domain: this.domain,
|
|
|
|
state: this.state,
|
|
|
|
limit: this.jobsLimit
|
|
|
|
}).then(jobs => {
|
|
|
|
this.jobs = jobs;
|
|
|
|
});
|
|
|
|
},
|
2019-02-05 23:24:59 -07:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2019-03-12 02:11:06 -06:00
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2019-03-14 22:48:17 -06:00
|
|
|
.xvvuvgsv
|
|
|
|
> b
|
|
|
|
margin-right 16px
|
|
|
|
|
2019-03-12 02:11:06 -06:00
|
|
|
</style>
|