mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
feat: 网站日志增加清空功能 (#1134)
This commit is contained in:
parent
aa3e8783ae
commit
b84c983727
@ -16,6 +16,9 @@
|
||||
>
|
||||
{{ $t('file.download') }}
|
||||
</el-button>
|
||||
<el-button style="margin-left: 20px" @click="cleanLog" icon="Delete" :disabled="data.content === ''">
|
||||
{{ $t('commons.button.clean') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
@ -43,6 +46,7 @@ import { oneDark } from '@codemirror/theme-one-dark';
|
||||
import { computed, nextTick, onMounted, onUnmounted, ref, shallowRef } from 'vue';
|
||||
import { OpWebsiteLog } from '@/api/modules/website';
|
||||
import { dateFormatForName } from '@/utils/util';
|
||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
||||
|
||||
const extensions = [javascript(), oneDark];
|
||||
const props = defineProps({
|
||||
@ -124,6 +128,20 @@ const updateEnable = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const cleanLog = async () => {
|
||||
const req = {
|
||||
id: id.value,
|
||||
operate: 'delete',
|
||||
logType: logType.value,
|
||||
};
|
||||
try {
|
||||
await useDeleteData(OpWebsiteLog, req, 'commons.msg.delete');
|
||||
getContent();
|
||||
} catch (error) {
|
||||
} finally {
|
||||
}
|
||||
};
|
||||
|
||||
const onDownload = async () => {
|
||||
const downloadUrl = window.URL.createObjectURL(new Blob([data.value.content]));
|
||||
const a = document.createElement('a');
|
||||
|
Loading…
x
Reference in New Issue
Block a user