diff --git a/frontend/src/components/log/container/index.vue b/frontend/src/components/log/container/index.vue index cb7fb659c0f0..a49c127ae84c 100644 --- a/frontend/src/components/log/container/index.vue +++ b/frontend/src/components/log/container/index.vue @@ -1,44 +1,67 @@ @@ -97,6 +120,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 +173,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 +220,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 +345,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..0759003587f5 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 @@