1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

fix: 解决网站日志清空页面没有刷新的问题 (#3645)

This commit is contained in:
zhengkunwang 2024-01-18 17:05:22 +08:00 committed by GitHub
parent 5152e7b8d5
commit f5bf111203
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -247,6 +247,10 @@ const init = () => {
});
};
const clearLog = (): void => {
content.value = '';
};
onUnmounted(() => {
onCloseLog();
});
@ -255,5 +259,5 @@ onMounted(() => {
init();
});
defineExpose({ changeTail, onDownload });
defineExpose({ changeTail, onDownload, clearLog });
</script>

View File

@ -5,7 +5,7 @@
<el-switch v-model="data.enable" @change="updateEnable"></el-switch>
</el-form-item>
</div>
<LogFile :config="{ id: id, type: 'website', name: logType }" :style="style">
<LogFile :config="{ id: id, type: 'website', name: logType }" :style="style" ref="logRef">
<template #button>
<el-button @click="cleanLog" icon="Delete">
{{ $t('commons.button.clean') }}
@ -13,7 +13,7 @@
</template>
</LogFile>
</div>
<OpDialog ref="opRef" />
<OpDialog ref="opRef" @search="clearLog" />
</template>
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue';
@ -46,6 +46,7 @@ const data = ref({
path: '',
});
const opRef = ref();
const logRef = ref();
const updateEnable = () => {
const operate = data.value.enable ? 'enable' : 'disable';
@ -64,6 +65,10 @@ const updateEnable = () => {
});
};
const clearLog = () => {
logRef.value.clearLog();
};
const cleanLog = async () => {
let log = logType.value === 'access.log' ? i18n.global.t('website.accessLog') : i18n.global.t('website.errLog');
opRef.value.acceptParams({