From afcedf1475f0051a25874df0b9ce355e659927dd Mon Sep 17 00:00:00 2001 From: HynoR <20227709+HynoR@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:37:56 +0800 Subject: [PATCH 1/2] feat: Enhance log container with copy mode and improved UI layout - Added a copy mode for logs, allowing users to copy log entries easily. - Improved the layout of the log container with a toolbar and better organization of controls. - Introduced new checkboxes for displaying timestamps and watching logs, with disabled states based on copy mode. - Refactored styles for better responsiveness and usability. --- .../src/components/log/container/index.vue | 181 ++++-- .../src/layout/components/Sidebar/index.vue | 1 - .../src/views/container/compose/index.vue | 522 +++++++++++++----- 3 files changed, 530 insertions(+), 174 deletions(-) diff --git a/frontend/src/components/log/container/index.vue b/frontend/src/components/log/container/index.vue index cb7fb659c0f0..8a466c453be5 100644 --- a/frontend/src/components/log/container/index.vue +++ b/frontend/src/components/log/container/index.vue @@ -1,44 +1,63 @@ @@ -97,6 +116,8 @@ const styleVars = computed(() => ({ const logVisible = ref(false); const logContainer = ref(null); const logs = ref([]); +const isCopyMode = ref(false); +const copyPendingLogs = ref([]); let eventSource: EventSource | null = null; const logSearch = reactive({ isWatch: props.defaultFollow ? true : true, @@ -148,16 +169,42 @@ const stopListening = () => { const handleClose = async () => { stopListening(); + isCopyMode.value = false; + copyPendingLogs.value = []; logVisible.value = false; }; +const flushCopyPendingLogs = () => { + if (copyPendingLogs.value.length === 0) { + return; + } + logs.value.push(...copyPendingLogs.value); + copyPendingLogs.value = []; +}; + +const toggleCopyMode = () => { + if (isCopyMode.value) { + isCopyMode.value = false; + flushCopyPendingLogs(); + nextTick(() => { + if (logContainer.value) { + logContainer.value.scrollTop = logContainer.value.scrollHeight; + } + }); + return; + } + isCopyMode.value = true; +}; + const searchLogs = async () => { if (Number(logSearch.tail) < 0) { MsgError(i18n.global.t('container.linesHelper')); return; } stopListening(); + isCopyMode.value = false; logs.value = []; + copyPendingLogs.value = []; let currentNode = globalStore.currentNode; if (props.node && props.node !== '') { currentNode = props.node; @@ -169,6 +216,10 @@ const searchLogs = async () => { eventSource = new EventSource(url); eventSource.onmessage = (event: MessageEvent) => { const data = event.data; + if (isCopyMode.value) { + copyPendingLogs.value.push(data); + return; + } logs.value.push(data); nextTick(() => { if (logContainer.value) { @@ -290,20 +341,50 @@ onMounted(() => { diff --git a/frontend/src/layout/components/Sidebar/index.vue b/frontend/src/layout/components/Sidebar/index.vue index 71e30f6fc2ba..96e69045ed4c 100644 --- a/frontend/src/layout/components/Sidebar/index.vue +++ b/frontend/src/layout/components/Sidebar/index.vue @@ -16,7 +16,6 @@ :router="true" :collapse="isCollapse" :collapse-transition="false" - :unique-opened="true" @select="handleMenuClick" class="custom-menu" > diff --git a/frontend/src/views/container/compose/index.vue b/frontend/src/views/container/compose/index.vue index 1e40fc878a89..061287ec3fff 100644 --- a/frontend/src/views/container/compose/index.vue +++ b/frontend/src/views/container/compose/index.vue @@ -19,100 +19,206 @@ - + @@ -209,7 +315,7 @@ - + @@ -370,7 +494,7 @@ From b9b0e74e82598f42780238121775f896a998176c Mon Sep 17 00:00:00 2001 From: HynoR <20227709+HynoR@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:51:36 +0800 Subject: [PATCH 2/2] feat: Add icon support to copy mode button in log container - Enhanced the copy mode button with an icon that changes based on the mode (CopyDocument or Close). - Improved user experience by visually indicating the current action of the button. --- frontend/src/components/log/container/index.vue | 6 +++++- frontend/src/views/container/compose/index.vue | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/log/container/index.vue b/frontend/src/components/log/container/index.vue index 8a466c453be5..a49c127ae84c 100644 --- a/frontend/src/components/log/container/index.vue +++ b/frontend/src/components/log/container/index.vue @@ -30,7 +30,11 @@
- + {{ isCopyMode ? $t('commons.button.close') : $t('commons.button.copy') }} diff --git a/frontend/src/views/container/compose/index.vue b/frontend/src/views/container/compose/index.vue index 061287ec3fff..0759003587f5 100644 --- a/frontend/src/views/container/compose/index.vue +++ b/frontend/src/views/container/compose/index.vue @@ -385,7 +385,7 @@ @@ -461,7 +461,7 @@ - +