feat(1.5.0)-beta1): 优化日志查询逻辑
This commit is contained in:
parent
3f585a6c78
commit
4935995b4f
@ -1,11 +1,9 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import {
|
import {
|
||||||
NButton,
|
|
||||||
NCard,
|
NCard,
|
||||||
NCollapse,
|
NCollapse,
|
||||||
NCollapseItem,
|
NCollapseItem,
|
||||||
NDivider,
|
NDivider,
|
||||||
NDropdown,
|
|
||||||
NEmpty,
|
NEmpty,
|
||||||
NScrollbar,
|
NScrollbar,
|
||||||
NSpin,
|
NSpin,
|
||||||
@ -118,14 +116,10 @@ watch(
|
|||||||
|
|
||||||
if (((val && props.drawer) || !props.drawer) && props.type && props.taskData) {
|
if (((val && props.drawer) || !props.drawer) && props.type && props.taskData) {
|
||||||
finished.value = false;
|
finished.value = false;
|
||||||
if (props.fetchType === 'ws') {
|
|
||||||
let url: string | null = '';
|
let url: string | null = '';
|
||||||
if (props.type === 'job') {
|
|
||||||
url = initWebSocketUrl('JOB_LOG_SCENE', props.taskData.id);
|
const scene = props.type === 'job' ? 'JOB_LOG_SCENE' : 'RETRY_LOG_SCENE';
|
||||||
}
|
url = initWebSocketUrl(scene, props.taskData.id);
|
||||||
if (props.type === 'retry') {
|
|
||||||
url = initWebSocketUrl('RETRY_LOG_SCENE', props.taskData.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
window.$message?.error('Token 失效');
|
window.$message?.error('Token 失效');
|
||||||
@ -160,10 +154,6 @@ watch(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
getLogListByWs();
|
getLogListByWs();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await getLogList();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
@ -225,37 +215,6 @@ const handleSyncSelect = async (time: number) => {
|
|||||||
await getLogList();
|
await getLogList();
|
||||||
};
|
};
|
||||||
|
|
||||||
const syncOptions = ref([
|
|
||||||
{
|
|
||||||
label: 'Off',
|
|
||||||
key: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Auto(1s)',
|
|
||||||
key: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '5s',
|
|
||||||
key: 5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '10s',
|
|
||||||
key: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '30s',
|
|
||||||
key: 30
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '1m',
|
|
||||||
key: 60
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '5m',
|
|
||||||
key: 300
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
|
|
||||||
const SnailLogComponent = defineComponent({
|
const SnailLogComponent = defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
if (finished.value && logList.value.length === 0) {
|
if (finished.value && logList.value.length === 0) {
|
||||||
@ -433,22 +392,6 @@ const SnailLogComponent = defineComponent({
|
|||||||
<NCard v-else :bordered="false" :title="title" size="small" class="h-full sm:flex-1-hidden card-wrapper">
|
<NCard v-else :bordered="false" :title="title" size="small" class="h-full sm:flex-1-hidden card-wrapper">
|
||||||
<template #header-extra>
|
<template #header-extra>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<NDropdown trigger="hover" :options="syncOptions" width="trigger" @select="handleSyncSelect">
|
|
||||||
<NTooltip placement="right">
|
|
||||||
<template #trigger>
|
|
||||||
<NButton dashed class="mx-12px w-136px" @click="handleSyncSelect(-1)">
|
|
||||||
<template #icon>
|
|
||||||
<div class="flex-center gap-8px">
|
|
||||||
<icon-solar:refresh-outline class="text-18px" />
|
|
||||||
{{ syncOptions.filter(item => item.key === syncTime)[0].label }}
|
|
||||||
<SvgIcon icon="material-symbols:expand-more-rounded" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</NButton>
|
|
||||||
</template>
|
|
||||||
自动刷新频率
|
|
||||||
</NTooltip>
|
|
||||||
</NDropdown>
|
|
||||||
<ButtonIcon
|
<ButtonIcon
|
||||||
size="tiny"
|
size="tiny"
|
||||||
class="mr-12px"
|
class="mr-12px"
|
||||||
|
Loading…
Reference in New Issue
Block a user