in seatunnel-ui/src/components/log-modal/index.tsx [71:159]
setup(props, ctx) {
const { t } = i18n.global
const logInstRef = ref()
const variables = reactive({
isFullscreen: false
})
const change = () => {
variables.isFullscreen = screenfull.isFullscreen
}
const renderIcon = (icon: any) => {
return () => h(NIcon, null, { default: () => h(icon) })
}
const confirmModal = () => {
variables.isFullscreen = false
ctx.emit('confirmModal', props.showModalRef)
}
const refreshLogs = () => {
ctx.emit('refreshLogs', props.row)
}
const handleFullScreen = () => {
screenfull.toggle(document.querySelectorAll('.logModalRef')[0])
}
const downloadLogs = () => {
ctx.emit('downloadLogs', props.row)
}
const setLogPosition = (position: 'top' | 'bottom') => {
logInstRef.value?.scrollTo({ position, slient: false })
}
onMounted(() => {
screenfull.on('change', change)
watchEffect(() => {
if (props.logRef) {
nextTick(() => {
logInstRef.value?.scrollTo({ position: 'bottom', slient: true })
})
}
})
})
onUnmounted(() => {
screenfull.on('change', change)
})
const headerLinks:any = ref([
{
text: t('project.workflow.download_log'),
show: props.showDownloadLog,
action: downloadLogs,
icon: renderIcon(DownloadOutlined)
},
{
text: t('project.task.refresh'),
show: true,
action: refreshLogs,
icon: renderIcon(SyncOutlined)
},
{
text: variables.isFullscreen
? t('project.task.cancel_full_screen')
: t('project.task.enter_full_screen'),
show: true,
action: handleFullScreen,
icon: variables.isFullscreen
? renderIcon(FullscreenExitOutlined)
: renderIcon(FullscreenOutlined)
}
])
return {
t,
renderIcon,
confirmModal,
refreshLogs,
downloadLogs,
handleFullScreen,
...toRefs(variables),
logInstRef,
setLogPosition,
headerLinks
}
},