mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-24 02:59:16 +08:00
feat: 优化日志加载 (#6593)
This commit is contained in:
parent
cb6c58cb5d
commit
1d326afa93
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-loading="isLoading">
|
<div v-loading="firstLoading">
|
||||||
<div v-if="defaultButton">
|
<div v-if="defaultButton">
|
||||||
<el-checkbox border v-model="tailLog" class="float-left" @change="changeTail(false)">
|
<el-checkbox border v-model="tailLog" class="float-left" @change="changeTail(false)">
|
||||||
{{ $t('commons.button.watch') }}
|
{{ $t('commons.button.watch') }}
|
||||||
@ -78,6 +78,7 @@ const minPage = ref(1);
|
|||||||
const maxPage = ref(1);
|
const maxPage = ref(1);
|
||||||
const logs = ref([]);
|
const logs = ref([]);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
const firstLoading = ref(true);
|
||||||
|
|
||||||
const readReq = reactive({
|
const readReq = reactive({
|
||||||
id: 0,
|
id: 0,
|
||||||
@ -129,6 +130,7 @@ const getContent = (pre: boolean) => {
|
|||||||
}
|
}
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
ReadByLine(readReq).then((res) => {
|
ReadByLine(readReq).then((res) => {
|
||||||
|
firstLoading.value = false;
|
||||||
if (!end.value && res.data.end) {
|
if (!end.value && res.data.end) {
|
||||||
lastLogs.value = [...logs.value];
|
lastLogs.value = [...logs.value];
|
||||||
}
|
}
|
||||||
@ -193,7 +195,7 @@ const getContent = (pre: boolean) => {
|
|||||||
maxPage.value = res.data.total;
|
maxPage.value = res.data.total;
|
||||||
minPage.value = res.data.total;
|
minPage.value = res.data.total;
|
||||||
}
|
}
|
||||||
if (logs.value && logs.value.length > 3000) {
|
if (logs.value && logs.value.length > 1000) {
|
||||||
logs.value.splice(0, readReq.pageSize);
|
logs.value.splice(0, readReq.pageSize);
|
||||||
if (minPage.value > 1) {
|
if (minPage.value > 1) {
|
||||||
minPage.value--;
|
minPage.value--;
|
||||||
@ -278,8 +280,6 @@ const init = () => {
|
|||||||
}
|
}
|
||||||
readReq.latest = true;
|
readReq.latest = true;
|
||||||
search();
|
search();
|
||||||
|
|
||||||
nextTick(() => {});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearLog = (): void => {
|
const clearLog = (): void => {
|
||||||
|
Loading…
Reference in New Issue
Block a user