Skip to content

Commit

Permalink
[Improvement][UI] Task instance log details should always stay at the…
Browse files Browse the repository at this point in the history
… bottom
  • Loading branch information
imizao committed Jan 7, 2025
1 parent 7495642 commit 77ae091
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions dolphinscheduler-ui/src/components/log-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ import {
reactive,
toRefs,
onMounted,
onUnmounted
onUnmounted,
nextTick,
watchEffect
} from 'vue'
import { useI18n } from 'vue-i18n'
import { NIcon, NLog } from 'naive-ui'
import type { LogInst } from 'naive-ui'
import Modal from '../modal'
import {
DownloadOutlined,
Expand Down Expand Up @@ -69,6 +72,9 @@ export default defineComponent({
const variables = reactive({
isFullscreen: false
})

const logInstRef = ref<LogInst | null>(null)


const change = () => {
variables.isFullscreen = screenfull.isFullscreen
Expand All @@ -95,12 +101,21 @@ export default defineComponent({
ctx.emit('downloadLogs', props.row)
}

// Listen for changes in logRef and scroll to the bottom
watchEffect(() => {
if (props.logRef) {
nextTick(() => {
logInstRef.value?.scrollTo({ position: 'bottom', slient: true })
})
}
})

onMounted(() => {
screenfull.on('change', change)
})

onUnmounted(() => {
screenfull.on('change', change)
screenfull.off('change', change)
})

return {
Expand All @@ -110,6 +125,7 @@ export default defineComponent({
refreshLogs,
downloadLogs,
handleFullScreen,
logInstRef,
...toRefs(variables)
}
},
Expand Down Expand Up @@ -157,6 +173,7 @@ export default defineComponent({
])}
>
<NLog
ref="logInstRef"
rows={30}
log={this.logRef}
loading={this.logLoadingRef}
Expand Down

0 comments on commit 77ae091

Please sign in to comment.