in dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx [49:184]
setup() {
let setIntervalP: number
const uiSettingStore = useUISettingStore()
const logTimer = uiSettingStore.getLogTimer
const { t, variables, getTableData, createColumns } = useTable()
const onUpdatePageSize = () => {
variables.page = 1
getTableData()
}
const onSearch = () => {
variables.page = 1
getTableData()
}
const onClearSearchTaskName = () => {
variables.searchVal = null
onSearch()
}
const onClearSearchWorkFlowName = () => {
variables.workflowDefinitionName = null
onSearch()
}
const onClearSearchExecutorName = () => {
variables.executorName = null
onSearch()
}
const onClearSearchHost = () => {
variables.host = null
onSearch()
}
const onClearSearchStateType = () => {
variables.stateType = null
onSearch()
}
const onClearSearchTime = () => {
variables.datePickerRange = null
onSearch()
}
const onConfirmModal = () => {
variables.showModalRef = false
}
const getLogs = (row: any, logTimer: number) => {
const { state } = useAsyncState(
queryLog({
taskInstanceId: Number(row.id),
limit: variables.limit,
skipLineNum: variables.skipLineNum
}).then((res: any) => {
variables.logRef += res.message || ''
if (res && res.message !== '') {
variables.limit += 1000
variables.skipLineNum += res.lineNum
getLogs(row, logTimer)
} else {
variables.logLoadingRef = false
setTimeout(() => {
variables.logRef = ''
variables.limit = 1000
variables.skipLineNum = 0
variables.logLoadingRef = true
getLogs(row, logTimer)
}, logTimer * 1000)
}
}),
{}
)
return state
}
const refreshLogs = (row: any) => {
variables.logRef = ''
variables.limit = 1000
variables.skipLineNum = 0
getLogs(row, logTimer)
}
const trim = getCurrentInstance()?.appContext.config.globalProperties.trim
onMounted(() => {
createColumns(variables)
getTableData()
setIntervalP = setInterval(() => {
getTableData()
}, 3000)
})
onUnmounted(() => {
clearInterval(setIntervalP)
})
watch(useI18n().locale, () => {
createColumns(variables)
})
watch(
() => variables.showModalRef,
() => {
if (variables.showModalRef) {
getLogs(variables.row, logTimer)
} else {
variables.row = {}
variables.logRef = ''
variables.logLoadingRef = true
variables.skipLineNum = 0
variables.limit = 1000
}
}
)
return {
t,
...toRefs(variables),
getTableData,
onUpdatePageSize,
onSearch,
onClearSearchTaskName,
onClearSearchWorkFlowName,
onClearSearchExecutorName,
onClearSearchHost,
onClearSearchStateType,
onClearSearchTime,
onConfirmModal,
refreshLogs,
trim
}
},