Browse Source

[Fix][UI Next][V1.0.0-Alpha] Fix the instructions links error in task editor modal. (#8924)

Amy0104 3 years ago
parent
commit
e17c2bb56a

+ 8 - 6
dolphinscheduler-ui-next/src/views/projects/task/components/node/detail-modal.tsx

@@ -36,6 +36,7 @@ import {
   QuestionCircleTwotone
 } from '@vicons/antd'
 import { NIcon } from 'naive-ui'
+import { TASK_TYPES_MAP } from '../../constants/task-type'
 import { Router, useRouter } from 'vue-router'
 import { IWorkflowTaskInstance } from '@/views/projects/workflow/components/dag/types'
 
@@ -103,20 +104,20 @@ const NodeDetailModal = defineComponent({
       }
     }
 
-    const initHeaderLinks = (
-      processInstance: any,
-      taskType: ITaskType | undefined
-    ) => {
+    const initHeaderLinks = (processInstance: any, taskType?: ITaskType) => {
       headerLinks.value = [
         {
           text: t('project.node.instructions'),
-          show: taskType ? true : false,
+          show:
+            taskType && !TASK_TYPES_MAP[taskType]?.helperLinkDisable
+              ? true
+              : false,
           action: () => {
             const helpUrl =
               'https://dolphinscheduler.apache.org/' +
               locale.value.toLowerCase().replace('_', '-') +
               '/docs/latest/user_doc/guide/task/' +
-              taskType?.toLowerCase() +
+              taskType?.toLowerCase().replace('_', '-') +
               '.html'
             window.open(helpUrl)
           },
@@ -147,6 +148,7 @@ const NodeDetailModal = defineComponent({
     const onTaskTypeChange = (taskType: ITaskType) => {
       // eslint-disable-next-line vue/no-mutating-props
       props.data.taskType = taskType
+      initHeaderLinks(props.processInstance, props.data.taskType)
     }
 
     provide(

+ 32 - 9
dolphinscheduler-ui-next/src/views/projects/task/constants/task-type.ts

@@ -14,6 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+export type TaskType =
+  | 'SHELL'
+  | 'SUB_PROCESS'
+  | 'PROCEDURE'
+  | 'SQL'
+  | 'SPARK'
+  | 'FLINK'
+  | 'MR'
+  | 'PYTHON'
+  | 'DEPENDENT'
+  | 'HTTP'
+  | 'DATAX'
+  | 'PIGEON'
+  | 'SQOOP'
+  | 'CONDITIONS'
+  | 'DATA_QUALITY'
+  | 'SWITCH'
+  | 'SEATUNNEL'
+  | 'EMR'
 
 export const TASK_TYPES_MAP = {
   SHELL: {
@@ -23,7 +42,8 @@ export const TASK_TYPES_MAP = {
     alias: 'SUB_PROCESS'
   },
   PROCEDURE: {
-    alias: 'PROCEDURE'
+    alias: 'PROCEDURE',
+    helperLinkDisable: true
   },
   SQL: {
     alias: 'SQL'
@@ -35,7 +55,8 @@ export const TASK_TYPES_MAP = {
     alias: 'FLINK'
   },
   MR: {
-    alias: 'MapReduce'
+    alias: 'MapReduce',
+    helperLinkDisable: true
   },
   PYTHON: {
     alias: 'PYTHON'
@@ -53,23 +74,25 @@ export const TASK_TYPES_MAP = {
     alias: 'PIGEON'
   },
   SQOOP: {
-    alias: 'SQOOP'
+    alias: 'SQOOP',
+    helperLinkDisable: true
   },
   CONDITIONS: {
     alias: 'CONDITIONS'
   },
   DATA_QUALITY: {
-    alias: 'DATA_QUALITY'
+    alias: 'DATA_QUALITY',
+    helperLinkDisable: true
   },
   SWITCH: {
     alias: 'SWITCH'
   },
   SEATUNNEL: {
-    alias: 'WATERDROP'
+    alias: 'WATERDROP',
+    helperLinkDisable: true
   },
   EMR: {
-    alias: 'AmazonEMR'
+    alias: 'AmazonEMR',
+    helperLinkDisable: true
   }
-}
-
-export type TaskType = keyof typeof TASK_TYPES_MAP
+} as { [key in TaskType]: { alias: string; helperLinkDisable?: boolean } }