hippofish/packages/frontend/src/pages/admin/queue.vue

76 lines
1.8 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkStickyContainer>
2022-06-25 16:01:40 +02:00
<template #header><XHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
2023-05-19 13:52:15 +02:00
<MkSpacer :contentMax="800">
2022-06-25 16:01:40 +02:00
<XQueue v-if="tab === 'deliver'" domain="deliver"/>
<XQueue v-else-if="tab === 'inbox'" domain="inbox"/>
<br>
<MkButton @click="promoteAllQueues"><i class="ti ti-reload"></i> {{ i18n.ts.retryAllQueuesNow }}</MkButton>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue';
import XQueue from './queue.chart.vue';
import XHeader from './_header_.vue';
2023-09-19 09:37:43 +02:00
import * as os from '@/os.js';
import * as config from '@/config.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkButton from '@/components/MkButton.vue';
const tab = ref('deliver');
function clear() {
os.confirm({
type: 'warning',
title: i18n.ts.clearQueueConfirmTitle,
text: i18n.ts.clearQueueConfirmText,
}).then(({ canceled }) => {
if (canceled) return;
os.apiWithDialog('admin/queue/clear');
});
}
function promoteAllQueues() {
os.confirm({
type: 'warning',
title: i18n.ts.retryAllQueuesConfirmTitle,
text: i18n.ts.retryAllQueuesConfirmText,
}).then(({ canceled }) => {
if (canceled) return;
os.apiWithDialog('admin/queue/promote', { type: tab.value });
});
}
const headerActions = computed(() => [{
asFullButton: true,
2022-12-20 07:24:31 +01:00
icon: 'ti ti-external-link',
text: i18n.ts.dashboard,
handler: () => {
window.open(config.url + '/queue', '_blank');
},
}]);
const headerTabs = computed(() => [{
2022-06-25 16:01:40 +02:00
key: 'deliver',
title: 'Deliver',
}, {
key: 'inbox',
title: 'Inbox',
}]);
definePageMetadata({
title: i18n.ts.jobQueue,
2022-12-20 07:15:34 +01:00
icon: 'ti ti-clock-play',
});
</script>