mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
fix: 修复日志文件下载不全的问题 (#2313)
This commit is contained in:
parent
4e7350aaae
commit
a3bf4513e1
@ -42,6 +42,7 @@ type WebsiteLog struct {
|
||||
Enable bool `json:"enable"`
|
||||
Content string `json:"content"`
|
||||
End bool `json:"end"`
|
||||
Path string `json:"path"`
|
||||
}
|
||||
|
||||
type PHPConfig struct {
|
||||
|
@ -941,6 +941,7 @@ func (w WebsiteService) OpWebsiteLog(req request.WebsiteLogReq) (*response.Websi
|
||||
return nil, err
|
||||
}
|
||||
res.End = end
|
||||
res.Path = filePath
|
||||
res.Content = strings.Join(lines, "\n")
|
||||
return res, nil
|
||||
case constant.DisableLog:
|
||||
|
@ -90,6 +90,7 @@ export namespace Website {
|
||||
enable: boolean;
|
||||
content: string;
|
||||
end: boolean;
|
||||
path: string;
|
||||
}
|
||||
|
||||
export interface Domain {
|
||||
|
@ -4,19 +4,14 @@
|
||||
<el-form-item :label="$t('website.enable')">
|
||||
<el-switch v-model="data.enable" @change="updateEnable"></el-switch>
|
||||
</el-form-item>
|
||||
<div style="margin-top: 10px">
|
||||
<el-checkbox border v-model="tailLog" style="float: left" @change="changeTail">
|
||||
<div class="mt-2.5">
|
||||
<el-checkbox border v-model="tailLog" class="float-left" @change="changeTail">
|
||||
{{ $t('commons.button.watch') }}
|
||||
</el-checkbox>
|
||||
<el-button
|
||||
style="margin-left: 20px"
|
||||
@click="onDownload"
|
||||
icon="Download"
|
||||
:disabled="data.content === ''"
|
||||
>
|
||||
<el-button class="ml-5" @click="onDownload" icon="Download" :disabled="data.content === ''">
|
||||
{{ $t('file.download') }}
|
||||
</el-button>
|
||||
<el-button style="margin-left: 20px" @click="cleanLog" icon="Delete" :disabled="data.content === ''">
|
||||
<el-button class="ml-5" @click="cleanLog" icon="Delete" :disabled="data.content === ''">
|
||||
{{ $t('commons.button.clean') }}
|
||||
</el-button>
|
||||
</div>
|
||||
@ -46,8 +41,8 @@ import { javascript } from '@codemirror/lang-javascript';
|
||||
import { oneDark } from '@codemirror/theme-one-dark';
|
||||
import { computed, nextTick, onMounted, onUnmounted, reactive, ref, shallowRef } from 'vue';
|
||||
import { OpWebsiteLog } from '@/api/modules/website';
|
||||
import { dateFormatForName, downloadWithContent } from '@/utils/util';
|
||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
||||
import { downloadFile } from '@/utils/util';
|
||||
|
||||
const extensions = [javascript(), oneDark];
|
||||
const props = defineProps({
|
||||
@ -70,6 +65,7 @@ const loading = ref(false);
|
||||
const data = ref({
|
||||
enable: false,
|
||||
content: '',
|
||||
path: '',
|
||||
});
|
||||
const tailLog = ref(false);
|
||||
let timer: NodeJS.Timer | null = null;
|
||||
@ -165,7 +161,7 @@ const cleanLog = async () => {
|
||||
};
|
||||
|
||||
const onDownload = async () => {
|
||||
downloadWithContent(data.value.content, logType.value + '-' + dateFormatForName(new Date()) + '.log');
|
||||
downloadFile(data.value.path);
|
||||
};
|
||||
|
||||
const onCloseLog = async () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user