in dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx [48:203]
setup() {
const uiSettingStore = useUISettingStore()
const logTimer = uiSettingStore.getLogTimer
const { t, variables, getTableData, createColumns } = useTable()
const requestTableData = () => {
getTableData({
pageSize: variables.pageSize,
pageNo: variables.page,
searchVal: variables.searchVal,
taskCode: variables.taskCode,
workflowInstanceId: variables.workflowInstanceId,
host: variables.host,
stateType: variables.stateType,
datePickerRange: variables.datePickerRange,
executorName: variables.executorName,
workflowInstanceName: variables.workflowInstanceName
})
}
const onUpdatePageSize = () => {
variables.page = 1
requestTableData()
}
const onSearch = () => {
variables.page = 1
requestTableData()
}
const onClearSearchTaskCode = () => {
variables.taskCode = null
onSearch()
}
const onClearSearchTaskName = () => {
variables.searchVal = ''
onSearch()
}
const onClearSearchWorkflowInstanceName = () => {
variables.workflowInstanceName = 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
}
let getLogsID: number
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
if (logTimer !== 0) {
if (typeof getLogsID === 'number') {
clearTimeout(getLogsID)
}
getLogsID = 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)
requestTableData()
})
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),
requestTableData,
onUpdatePageSize,
onSearch,
onClearSearchTaskCode,
onClearSearchTaskName,
onClearSearchWorkflowInstanceName,
onClearSearchExecutorName,
onClearSearchHost,
onClearSearchStateType,
onClearSearchTime,
onConfirmModal,
refreshLogs,
trim
}
},