You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/08/12 02:08:32 UTC

[GitHub] [dolphinscheduler] Amy0104 commented on a diff in pull request #11419: [Improvement-11386][UI] Concise the logic available for task action buttons

Amy0104 commented on code in PR #11419:
URL: https://github.com/apache/dolphinscheduler/pull/11419#discussion_r944063039


##########
dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx:
##########
@@ -119,29 +119,29 @@ export default defineComponent({
     })
 
     // start button in the dag node menu
-    const startReadonly = computed(() => {
+    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
       }
     })
 
     // 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'

Review Comment:
   The strict equality is better here.



##########
dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag-context-menu.tsx:
##########
@@ -131,36 +127,37 @@ export default defineComponent({
           class={styles['dag-context-menu']}
           style={{ left: `${this.left}px`, top: `${this.top}px` }}
         >
-          {this.startButtonDisplay && (
+          {this.startDisplay && (
             <NButton
               class={`${styles['menu-item']}`}
-              disabled={this.startReadonly}
               onClick={this.startRunning}
             >
               {t('project.node.start')}
             </NButton>)
           }
-          <NButton
-            class={`${styles['menu-item']}`}
-            disabled={this.menuReadonly}
-            onClick={this.handleEdit}
-          >
-            {t('project.node.edit')}
-          </NButton>
-          <NButton
-            class={`${styles['menu-item']}`}
-            disabled={this.menuReadonly}
-            onClick={this.handleCopy}
-          >
-            {t('project.node.copy')}
-          </NButton>
-          <NButton
-            class={`${styles['menu-item']}`}
-            disabled={this.menuReadonly}
-            onClick={this.handleDelete}
-          >
-            {t('project.node.delete')}
-          </NButton>
+          {this.menuDisplay && (
+            <div
+            >
+              <NButton
+                class={`${styles['menu-item']}`}
+                onClick={this.handleEdit}
+              >
+                {t('project.node.edit')}
+              </NButton>
+              <NButton
+                class={`${styles['menu-item']}`}
+                onClick={this.handleCopy}
+              >
+                {t('project.node.copy')}
+              </NButton>
+              <NButton
+                class={`${styles['menu-item']}`}
+                onClick={this.handleDelete}
+              >
+                {t('project.node.delete')}
+              </NButton>
+            </div>
+          )}

Review Comment:
   The fragment element is better than div here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org