enhance(client): improve control panel

This commit is contained in:
syuilo 2022-06-25 23:01:40 +09:00
parent c67c0df762
commit 0248a2a989
7 changed files with 996 additions and 403 deletions

View file

@ -1,14 +1,9 @@
<template>
<MkStickyContainer>
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
<template #header><XHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="800">
<XQueue :connection="connection" domain="inbox">
<template #title>In</template>
</XQueue>
<XQueue :connection="connection" domain="deliver">
<template #title>Out</template>
</XQueue>
<MkButton danger @click="clear()"><i class="fas fa-trash-alt"></i> {{ i18n.ts.clearQueue }}</MkButton>
<XQueue v-if="tab === 'deliver'" domain="deliver"/>
<XQueue v-else-if="tab === 'inbox'" domain="inbox"/>
</MkSpacer>
</MkStickyContainer>
</template>
@ -19,12 +14,11 @@ import XQueue from './queue.chart.vue';
import XHeader from './_header_.vue';
import MkButton from '@/components/ui/button.vue';
import * as os from '@/os';
import { stream } from '@/stream';
import * as config from '@/config';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
const connection = markRaw(stream.useChannel('queueStats'));
let tab = $ref('deliver');
function clear() {
os.confirm({
@ -38,19 +32,6 @@ function clear() {
});
}
onMounted(() => {
nextTick(() => {
connection.send('requestLog', {
id: Math.random().toString().substr(2, 8),
length: 200,
});
});
});
onBeforeUnmount(() => {
connection.dispose();
});
const headerActions = $computed(() => [{
asFullButton: true,
icon: 'fas fa-up-right-from-square',
@ -60,7 +41,13 @@ const headerActions = $computed(() => [{
},
}]);
const headerTabs = $computed(() => []);
const headerTabs = $computed(() => [{
key: 'deliver',
title: 'Deliver',
}, {
key: 'inbox',
title: 'Inbox',
}]);
definePageMetadata({
title: i18n.ts.jobQueue,