Browse Source

Force success

曹聚阳 4 years ago
parent
commit
df33d1a28e

+ 7 - 0
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js

@@ -236,6 +236,13 @@ const tasksState = {
     color: '#5102ce',
     icoUnicode: 'ans-icon-coin',
     isSpin: false
+  },
+  FORCED_SUCCESS: {
+    id: 13,
+    desc: `${i18n.$t('Forced success')}`,
+    color: '#5102ce',
+    icoUnicode: 'ans-icon-success-solid',
+    isSpin: false
   }
 }
 

+ 3 - 0
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js

@@ -63,6 +63,9 @@ const stateType = [
   }, {
     code: 'DELAY_EXECUTION',
     label: `${i18n.$t('Delay execution')}`
+  }, {
+    code: 'FORCED_SUCCESS',
+    label: `${i18n.$t('Forced success')}`
   }
 ]
 

+ 23 - 0
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskInstance/_source/list.vue

@@ -91,6 +91,16 @@
           <td><span>{{item.duration}}</span></td>
           <td><span>{{item.retryTimes}}</span></td>
           <td>
+            <x-button
+                    v-if="item.state === 'FAILURE' || item.state === 'NEED_FAULT_TOLERANCE' || item.state === 'KILL'"
+                    type="error"
+                    shape="circle"
+                    size="xsmall"
+                    data-toggle="tooltip"
+                    :title="$t('Force success')"
+                    icon="ans-icon-success-solid"
+                    @click="_forceSuccess(item)">
+            </x-button>
             <x-button
                     type="info"
                     shape="circle"
@@ -110,6 +120,7 @@
   import Permissions from '@/module/permissions'
   import mLog from '@/conf/home/pages/dag/_source/formModel/log'
   import { tasksState } from '@/conf/home/pages/dag/_source/config'
+  import { mapActions } from 'vuex'
 
   export default {
     name: 'list',
@@ -126,6 +137,7 @@
       pageSize: Number
     },
     methods: {
+      ...mapActions('dag', ['forceTaskSuccess']),
       _rtState (code) {
         let o = tasksState[code]
         return `<em class="${o.icoUnicode} ${o.isSpin ? 'as as-spin' : ''}" style="color:${o.color}" data-toggle="tooltip" data-container="body" title="${o.desc}"></em>`
@@ -156,6 +168,17 @@
           }
         })
       },
+      _forceSuccess (item) {
+        this.forceTaskSuccess({taskInstanceId: item.id}).then(res => {
+          if (res.code === 0) {
+            this.$message.success(res.msg)
+          } else {
+            this.$message.error(res.msg)
+          }
+        }).catch(e => {
+          this.$message.error(e.msg)
+        })
+      },
       _go (item) {
         this.$router.push({ path: `/projects/instance/list/${item.processInstanceId}` })
       },

+ 12 - 0
dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js

@@ -734,6 +734,18 @@ export default {
       })
     })
   },
+  /**
+   * Force fail/kill/need_fault_tolerance task success
+   */
+  forceTaskSuccess ({ state }, payload) {
+    return new Promise((resolve, reject) => {
+      io.post(`projects/${state.projectName}/task-instance/force-success`, payload, res => {
+        resolve(res)
+      }).catch(e => {
+        reject(e)
+      })
+    })
+  },
   /**
    * Query task record list
    */

+ 2 - 0
dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js

@@ -32,6 +32,7 @@ export default {
   'Current node settings': 'Current node settings',
   'View history': 'View history',
   'View log': 'View log',
+  'Force success': 'Force success',
   'Enter this child node': 'Enter this child node',
   'Node name': 'Node name',
   'Run flag': 'Run flag',
@@ -432,6 +433,7 @@ export default {
   'Timeout must be longer than check interval': 'Timeout must be longer than check interval',
   'Timeout strategy must be selected': 'Timeout strategy must be selected',
   'Timeout must be a positive integer': 'Timeout must be a positive integer',
+  'Forced success': 'Forced success',
   'Add dependency': 'Add dependency',
   and: 'and',
   or: 'or',

+ 1 - 0
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@@ -32,6 +32,7 @@ export default {
   'Current node settings': '当前节点设置',
   'View history': '查看历史',
   'View log': '查看日志',
+  'Force success': '强制成功',
   'Enter this child node': '进入该子节点',
   'Node name': '节点名称',
   'Please enter name (required)': '请输入名称(必填)',