diff --git a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-view/index.vue b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-view/index.vue index 6a3d4c15..f77fb3bf 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-view/index.vue +++ b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-view/index.vue @@ -23,14 +23,11 @@ @@ -41,6 +38,7 @@ import { RunHistory } from "../../type"; import PiStatusShow from "/@/views/certd/pipeline/pipeline/component/status-show.vue"; import { usePreferences } from "/@/vben/preferences"; import { useSettingStore } from "/@/store/settings/index"; +import { notification } from "ant-design-vue"; export default { name: "PiTaskView", components: { PiStatusShow }, @@ -56,6 +54,22 @@ export default { onAiChat() { onAiChat(); }, + onDownloadLogs() { + const logs = currentHistory.value?.logs[activeKey.value]; + if (!logs || logs.length === 0) { + notification.warning({ + message: "没有日志", + }); + return; + } + const logText = logs.join(""); + const blob = new Blob([logText], { type: "text/plain;charset=utf-8" }); + const a = document.createElement("a"); + a.href = URL.createObjectURL(blob); + a.download = "certd-task-log.txt"; + a.click(); + URL.revokeObjectURL(a.href); + }, cancelText: "关闭", }); const { isMobile } = usePreferences();