From 376d0a09ae7bce0de0c754001a580054a7cf9586 Mon Sep 17 00:00:00 2001 From: Sheldon <39169452+sketchmind@users.noreply.github.com> Date: Fri, 12 Aug 2022 16:12:39 +0800 Subject: [PATCH] [Improvement-11386][UI] Concise the logic available for task action buttons (#11419) * Remove button instead of disable button * Correct the value of releaseState in the compare statement Co-authored-by: sheldonliu --- .../components/dag/dag-context-menu.tsx | 54 +++++++++---------- .../workflow/components/dag/index.tsx | 25 +++++---- 2 files changed, 37 insertions(+), 42 deletions(-) diff --git a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-context-menu.tsx b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-context-menu.tsx index 87161c3d27..98d4e04706 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-context-menu.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-context-menu.tsx @@ -26,15 +26,11 @@ import { IWorkflowTaskInstance } from './types' import { NButton } from 'naive-ui' const props = { - startButtonDisplay: { - type: Boolean as PropType, - default: true - }, - startReadonly: { + startDisplay: { type: Boolean as PropType, default: false }, - menuReadonly: { + menuDisplay: { type: Boolean as PropType, default: false }, @@ -131,36 +127,36 @@ export default defineComponent({ class={styles['dag-context-menu']} style={{ left: `${this.left}px`, top: `${this.top}px` }} > - {this.startButtonDisplay && ( + {this.startDisplay && ( {t('project.node.start')} ) } - - {t('project.node.edit')} - - - {t('project.node.copy')} - - - {t('project.node.delete')} - + {this.menuDisplay && ( + <> + + {t('project.node.edit')} + + + {t('project.node.copy')} + + + {t('project.node.delete')} + + + )} {this.taskInstance && ( { + const startDisplay = computed(() => { if (props.definition) { return ( route.name === 'workflow-definition-detail' && - props.definition!.processDefinition.releaseState === 'NOT_RELEASE' + props.definition!.processDefinition.releaseState === 'ONLINE' ) } else { return false @@ -131,17 +131,17 @@ export default defineComponent({ }) // other button in the dag node menu - const menuReadonly = computed(() => { + const menuDisplay = computed(() => { if (props.instance) { return ( - props.instance.state !== 'WAITING_THREAD' && - props.instance.state !== 'SUCCESS' && - props.instance.state !== 'PAUSE' && - props.instance.state !== 'FAILURE' && - props.instance.state !== 'STOP' + props.instance.state === 'WAITING_THREAD' || + props.instance.state === 'SUCCESS' || + props.instance.state === 'PAUSE' || + props.instance.state === 'FAILURE' || + props.instance.state === 'STOP' ) } else if (props.definition) { - return props.definition!.processDefinition.releaseState === 'ONLINE' + return props.definition!.processDefinition.releaseState === 'OFFLINE' } else { return false } @@ -337,7 +337,7 @@ export default defineComponent({ /> {!!props.definition && (