diff --git a/frontend/src/components/backup/index.vue b/frontend/src/components/backup/index.vue
index 8f858825d..c24892cef 100644
--- a/frontend/src/components/backup/index.vue
+++ b/frontend/src/components/backup/index.vue
@@ -119,7 +119,7 @@ import i18n from '@/lang';
import { Backup } from '@/api/interface/backup';
import router from '@/routers';
import { MsgSuccess } from '@/utils/message';
-import TaskLog from '@/components/task-log/index.vue';
+import TaskLog from '@/components/log/task/index.vue';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
diff --git a/frontend/src/components/log-dialog/index.vue b/frontend/src/components/log-dialog/index.vue
deleted file mode 100644
index c2b7e9e2e..000000000
--- a/frontend/src/components/log-dialog/index.vue
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/frontend/src/components/compose-log/index.vue b/frontend/src/components/log/compose/index.vue
similarity index 96%
rename from frontend/src/components/compose-log/index.vue
rename to frontend/src/components/log/compose/index.vue
index 1a7c4b907..3d5c4a484 100644
--- a/frontend/src/components/compose-log/index.vue
+++ b/frontend/src/components/log/compose/index.vue
@@ -22,7 +22,7 @@ import i18n from '@/lang';
import { computed, onBeforeUnmount, ref, watch } from 'vue';
import { GlobalStore } from '@/store';
import screenfull from 'screenfull';
-import ContainerLog from '@/components/container-log/index.vue';
+import ContainerLog from '@/components/log/container/index.vue';
const open = ref(false);
const resource = ref('');
diff --git a/frontend/src/views/container/container/log/index.vue b/frontend/src/components/log/container-drawer/index.vue
similarity index 97%
rename from frontend/src/views/container/container/log/index.vue
rename to frontend/src/components/log/container-drawer/index.vue
index fb0e6b78c..706b8429f 100644
--- a/frontend/src/views/container/container/log/index.vue
+++ b/frontend/src/components/log/container-drawer/index.vue
@@ -27,6 +27,7 @@ import i18n from '@/lang';
import { computed, onBeforeUnmount, reactive, ref, watch } from 'vue';
import screenfull from 'screenfull';
import { GlobalStore } from '@/store';
+import ContainerLog from '@/components/log/container/index.vue';
const logVisible = ref(false);
const mobile = computed(() => {
diff --git a/frontend/src/components/container-log/index.vue b/frontend/src/components/log/container/index.vue
similarity index 86%
rename from frontend/src/components/container-log/index.vue
rename to frontend/src/components/log/container/index.vue
index 1edd45d92..71e018d21 100644
--- a/frontend/src/components/container-log/index.vue
+++ b/frontend/src/components/log/container/index.vue
@@ -24,16 +24,6 @@
{{ $t('commons.button.clean') }}
-
-
logs.value.length);
const totalHeight = computed(() => logHeight * logCount.value);
const startIndex = ref(0);
const containerHeight = ref(500);
-const visibleCount = computed(() => Math.ceil(containerHeight.value / logHeight));
+const visibleCount = computed(() => Math.ceil(containerHeight.value / logHeight) + 2);
const visibleLogs = computed(() => {
- return logs.value.slice(startIndex.value, startIndex.value + visibleCount.value);
+ const start = Math.max(0, startIndex.value - 1);
+ const end = startIndex.value + visibleCount.value + 1;
+ return logs.value.slice(start, end);
});
const timeOptions = ref([
@@ -185,10 +177,22 @@ const onClean = async () => {
});
};
+const handleScroll = () => {
+ if (logContainer.value) {
+ const scrollTop = logContainer.value.scrollTop;
+ startIndex.value = Math.max(0, Math.floor(scrollTop / logHeight) - 1);
+ }
+};
+
onUnmounted(() => {
handleClose();
+ if (logContainer.value) {
+ logContainer.value.removeEventListener('scroll', handleScroll);
+ }
});
+const resizeObserver = ref(null);
+
onMounted(() => {
logSearch.container = props.container;
logSearch.compose = props.compose;
@@ -200,8 +204,12 @@ onMounted(() => {
nextTick(() => {
if (logContainer.value) {
- logContainer.value.scrollTop = totalHeight.value;
- containerHeight.value = logContainer.value.getBoundingClientRect().height;
+ containerHeight.value = logContainer.value.clientHeight;
+ logContainer.value.addEventListener('scroll', handleScroll);
+ resizeObserver.value = new ResizeObserver((entries) => {
+ containerHeight.value = entries[0].contentRect.height;
+ });
+ resizeObserver.value.observe(logContainer.value);
}
});
@@ -227,7 +235,7 @@ onMounted(() => {
}
.log-container {
- height: calc(100vh - 405px);
+ height: calc(100vh - 320px);
overflow-y: auto;
overflow-x: auto;
position: relative;
diff --git a/frontend/src/components/hightlight/index.vue b/frontend/src/components/log/custom-hightlight/index.vue
similarity index 100%
rename from frontend/src/components/hightlight/index.vue
rename to frontend/src/components/log/custom-hightlight/index.vue
diff --git a/frontend/src/components/log/drawer/index.vue b/frontend/src/components/log/drawer/index.vue
new file mode 100644
index 000000000..8d2bcbb2d
--- /dev/null
+++ b/frontend/src/components/log/drawer/index.vue
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/components/log-file/index.vue b/frontend/src/components/log/file/index.vue
similarity index 97%
rename from frontend/src/components/log-file/index.vue
rename to frontend/src/components/log/file/index.vue
index 3cf1d563f..df8f4e802 100644
--- a/frontend/src/components/log-file/index.vue
+++ b/frontend/src/components/log/file/index.vue
@@ -17,7 +17,7 @@
-
+
{
await getContent(false);
};
+const containerStyle = computed(() => ({
+ height: `calc(100vh - ${props.heightDiff}px)`,
+}));
+
onMounted(async () => {
firstLoading.value = true;
await init();
@@ -330,7 +334,6 @@ defineExpose({ changeTail, onDownload, clearLog });