diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-context-menu.tsx b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-context-menu.tsx index 944a64034b..439d1d5b32 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-context-menu.tsx +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-context-menu.tsx @@ -35,6 +35,10 @@ const props = { type: Object as PropType, require: true }, + taskList: { + type: Array as PropType>, + default: [] + }, visible: { type: Boolean as PropType, default: true @@ -81,7 +85,13 @@ export default defineComponent({ } const handleViewLog = () => { - ctx.emit('viewLog') + const taskCode = Number(props.cell?.id) + const taskInstance = props.taskList.find( + (task: any) => task.taskCode === taskCode + ) + if (taskInstance) { + ctx.emit('viewLog', taskInstance.id, taskInstance.taskType) + } } const handleCopy = () => { @@ -161,9 +171,11 @@ export default defineComponent({ > {t('project.node.delete')} -
- {t('project.node.view_log')} -
+ {this.taskList.length > 0 && ( +
+ {t('project.node.view_log')} +
+ )} ) ) diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/index.tsx b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/index.tsx index ca69b8de21..ea5cff824e 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/index.tsx +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/index.tsx @@ -115,6 +115,8 @@ export default defineComponent({ menuVisible, startModalShow, logModalShow, + logViewTaskId, + logViewTaskType, menuHide, menuStart, viewLog, @@ -124,7 +126,7 @@ export default defineComponent({ }) const statusTimerRef = ref() - const { refreshTaskStatus } = useNodeStatus({ graph }) + const { taskList, refreshTaskStatus } = useNodeStatus({ graph }) const { onDragStart, onDrop } = useDagDragAndDrop({ graph, @@ -183,7 +185,7 @@ export default defineComponent({ () => { if (props.instance) { refreshTaskStatus() - statusTimerRef.value = setInterval(() => refreshTaskStatus(), 9000) + statusTimerRef.value = setInterval(() => refreshTaskStatus(), 90000) } } ) @@ -238,6 +240,7 @@ export default defineComponent({ onCancel={taskCancel} /> )} diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-menu.ts b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-menu.ts index 61f011bfb3..ff2d97019f 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-menu.ts +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-menu.ts @@ -30,6 +30,8 @@ export function useNodeMenu(options: Options) { const { graph } = options const startModalShow = ref(false) const logModalShow = ref(false) + const logViewTaskId = ref() + const logViewTaskType = ref() const menuVisible = ref(false) const pageX = ref() const pageY = ref() @@ -46,7 +48,9 @@ export function useNodeMenu(options: Options) { startModalShow.value = true } - const viewLog = () => { + const viewLog = (taskId: number, taskType: string) => { + logViewTaskId.value = taskId + logViewTaskType.value = taskType logModalShow.value = true } @@ -77,6 +81,8 @@ export function useNodeMenu(options: Options) { pageY, startModalShow, logModalShow, + logViewTaskId, + logViewTaskType, menuVisible, menuCell, menuHide, diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-status.ts b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-status.ts index 6d322dcddf..2cef274337 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-status.ts +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-node-status.ts @@ -16,7 +16,7 @@ */ import type { Ref } from 'vue' -import { render, h } from 'vue' +import { render, h, ref } from 'vue' import { useRoute } from 'vue-router' import { useI18n } from 'vue-i18n' import type { Graph } from '@antv/x6' @@ -35,6 +35,7 @@ interface Options { export function useNodeStatus(options: Options) { const { graph } = options const route = useRoute() + const taskList = ref>([]) const { t } = useI18n() @@ -66,9 +67,9 @@ export function useNodeStatus(options: Options) { queryTaskListByProcessId(instanceId, projectCode).then((res: any) => { window.$message.success(t('project.workflow.refresh_status_succeeded')) - const { taskList } = res - if (taskList) { - taskList.forEach((taskInstance: any) => { + taskList.value = res.taskList + if (taskList.value) { + taskList.value.forEach((taskInstance: any) => { setNodeStatus(taskInstance.taskCode, taskInstance.state, taskInstance) }) } @@ -76,6 +77,7 @@ export function useNodeStatus(options: Options) { } return { + taskList, refreshTaskStatus } } diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/instance/components/log-modal.tsx b/dolphinscheduler-ui-next/src/views/projects/workflow/instance/components/log-modal.tsx index e28cfb1e98..2416df2a73 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/instance/components/log-modal.tsx +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/instance/components/log-modal.tsx @@ -28,7 +28,7 @@ import { renderSlot } from 'vue' import { useI18n } from 'vue-i18n' -import { NButton, NIcon, NTooltip } from 'naive-ui' +import { dateEnGB, NButton, NIcon, NTooltip } from 'naive-ui' import { queryLog } from '@/service/modules/log' import { DownloadOutlined, @@ -68,6 +68,7 @@ export default defineComponent({ const textareaHeight = computed(() => logContentBox.value ? logContentBox.value.clientHeight : 0 ) + const contentRef = ref() const boxRef = reactive({ width: '', @@ -113,10 +114,13 @@ export default defineComponent({ setTimeout(() => { window.$message.warning(t('project.workflow.no_more_log')) }, 1000) - textareaLog.value.innerHTML = t('project.workflow.no_log') + textareaLog.value.innerHTML = + contentRef.value || t('project.workflow.no_log') } else { isDataRef.value = true - textareaLog.value.innerHTML = res || t('project.workflow.no_log') + contentRef.value = res + textareaLog.value.innerHTML = + contentRef.value || t('project.workflow.no_log') setTimeout(() => { textareaLog.value.scrollTop = 2 }, 800) @@ -178,30 +182,28 @@ export default defineComponent({ /** * up */ - const onUp = _.debounce( + const onUp = _.throttle( function () { loadingIndex.value = loadingIndex.value - 1 showLog() }, 1000, { - leading: false, - trailing: true + trailing: false } ) /** * down */ - const onDown = _.debounce( + const onDown = _.throttle( function () { loadingIndex.value = loadingIndex.value + 1 showLog() }, 1000, { - leading: false, - trailing: true + trailing: false } )