-
-
{{$t('Cancel')}}
-
{{spinnerLoading ? $t('Loading...') : $t('Confirm add')}}
+
+
+ {{ $t("Cancel") }}
+
+ {{ spinnerLoading ? $t("Loading...") : $t("Confirm add") }}
+
@@ -318,6 +442,7 @@
import disabledState from '@/module/mixin/disabledState'
import mPriority from '@/module/components/priority/priority'
import { findComponentDownward } from '@/module/util/'
+ import CopyFromTask from './_source/copyFromTask.vue'
export default {
name: 'form-model',
@@ -384,7 +509,14 @@
],
// for CONDITIONS
postTasks: [],
- prevTasks: []
+ prevTasks: [],
+ // refresh part of the formModel, after set backfillItem outside
+ backfillRefresh: true
+ }
+ },
+ provide () {
+ return {
+ formModel: this
}
},
/**
@@ -408,7 +540,11 @@
id: task.id,
maxRetryTimes: task.failRetryTimes,
name: task.name,
- params: _.omit(task.taskParams, ['conditionResult', 'dependence']),
+ params: _.omit(task.taskParams, [
+ 'conditionResult',
+ 'dependence',
+ 'waitStartTimeout'
+ ]),
retryInterval: task.failRetryInterval,
runFlag: task.flag,
taskInstancePriority: task.taskPriority,
@@ -448,13 +584,17 @@
*/
_onDependentTimeout (o) {
this.timeout = Object.assign(this.timeout, {}, o.waitCompleteTimeout)
- this.waitStartTimeout = Object.assign(this.waitStartTimeout, {}, o.waitStartTimeout)
+ this.waitStartTimeout = Object.assign(
+ this.waitStartTimeout,
+ {},
+ o.waitStartTimeout
+ )
},
/**
* Click external to close the current component
*/
_handleClose () {
- // this.close()
+ // this.close()
},
/**
* Jump to task instance
@@ -468,25 +608,39 @@
*/
_goSubProcess () {
if (_.isEmpty(this.backfillItem)) {
- this.$message.warning(`${i18n.$t('The newly created sub-Process has not yet been executed and cannot enter the sub-Process')}`)
+ this.$message.warning(
+ `${i18n.$t(
+ 'The newly created sub-Process has not yet been executed and cannot enter the sub-Process'
+ )}`
+ )
return
}
if (this.router.history.current.name === 'projects-instance-details') {
if (!this.taskInstance) {
- this.$message.warning(`${i18n.$t('The task has not been executed and cannot enter the sub-Process')}`)
+ this.$message.warning(
+ `${i18n.$t(
+ 'The task has not been executed and cannot enter the sub-Process'
+ )}`
+ )
return
}
- this.store.dispatch('dag/getSubProcessId', { taskId: this.taskInstance.id }).then(res => {
- this.$emit('onSubProcess', {
- subProcessId: res.data.subProcessInstanceId,
- fromThis: this
+ this.store
+ .dispatch('dag/getSubProcessId', { taskId: this.taskInstance.id })
+ .then((res) => {
+ this.$emit('onSubProcess', {
+ subProcessId: res.data.subProcessInstanceId,
+ fromThis: this
+ })
+ })
+ .catch((e) => {
+ this.$message.error(e.msg || '')
})
- }).catch(e => {
- this.$message.error(e.msg || '')
- })
} else {
- const processDefinitionId = this.backfillItem.params.processDefinitionId
- const process = this.processListS.find(process => process.processDefinition.id === processDefinitionId)
+ const processDefinitionId =
+ this.backfillItem.params.processDefinitionId
+ const process = this.processListS.find(
+ (process) => process.processDefinition.id === processDefinitionId
+ )
this.$emit('onSubProcess', {
subProcessCode: process.processDefinition.code,
fromThis: this
@@ -519,8 +673,16 @@
this.$message.warning(`${i18n.$t('Please enter name (required)')}`)
return false
}
- if (this.successBranch !== '' && this.successBranch !== null && this.successBranch === this.failedBranch) {
- this.$message.warning(`${i18n.$t('Cannot select the same node for successful branch flow and failed branch flow')}`)
+ if (
+ this.successBranch !== '' &&
+ this.successBranch !== null &&
+ this.successBranch === this.failedBranch
+ ) {
+ this.$message.warning(
+ `${i18n.$t(
+ 'Cannot select the same node for successful branch flow and failed branch flow'
+ )}`
+ )
return false
}
if (this.name === this.backfillItem.name) {
@@ -528,7 +690,7 @@
}
// Name repeat depends on dom backfill dependent store
const tasks = this.store.state.dag.tasks
- const task = tasks.find(t => t.name === 'this.name')
+ const task = tasks.find((t) => t.name === 'this.name')
if (task) {
this.$message.warning(`${i18n.$t('Name already exists')}`)
return false
@@ -536,11 +698,15 @@
return true
},
_verifWorkGroup () {
- let item = this.store.state.security.workerGroupsListAll.find(item => {
+ let item = this.store.state.security.workerGroupsListAll.find((item) => {
return item.id === this.workerGroup
})
if (item === undefined) {
- this.$message.warning(`${i18n.$t('The Worker group no longer exists, please select the correct Worker group!')}`)
+ this.$message.warning(
+ `${i18n.$t(
+ 'The Worker group no longer exists, please select the correct Worker group!'
+ )}`
+ )
return false
}
return true
@@ -619,20 +785,29 @@
* set run flag
* TODO
*/
- _setRunFlag () {
-
- },
- /**
- *
- */
+ _setRunFlag () {},
_setEdgeLabel () {
if (this.successBranch || this.failedBranch) {
const canvas = findComponentDownward(this.dagChart, 'dag-canvas')
const edges = canvas.getEdges()
- const successTask = this.postTasks.find(t => t.name === this.successBranch)
- const failedTask = this.postTasks.find(t => t.name === this.failedBranch)
- const sEdge = edges.find(edge => successTask && edge.sourceId === this.code && edge.targetId === successTask.code)
- const fEdge = edges.find(edge => failedTask && edge.sourceId === this.code && edge.targetId === failedTask.code)
+ const successTask = this.postTasks.find(
+ (t) => t.name === this.successBranch
+ )
+ const failedTask = this.postTasks.find(
+ (t) => t.name === this.failedBranch
+ )
+ const sEdge = edges.find(
+ (edge) =>
+ successTask &&
+ edge.sourceId === this.code &&
+ edge.targetId === successTask.code
+ )
+ const fEdge = edges.find(
+ (edge) =>
+ failedTask &&
+ edge.sourceId === this.code &&
+ edge.targetId === failedTask.code
+ )
sEdge && canvas.setEdgeLabel(sEdge.id, this.$t('Success'))
fEdge && canvas.setEdgeLabel(fEdge.id, this.$t('Failed'))
}
@@ -659,6 +834,57 @@
flag: flag,
fromThis: this
})
+ },
+ backfill (backfillItem, copyFromTask) {
+ const o = backfillItem
+ // Non-null objects represent backfill
+ if (!_.isEmpty(o)) {
+ this.code = o.code
+ !copyFromTask && (this.name = o.name)
+ this.taskInstancePriority = o.taskInstancePriority
+ this.runFlag = o.runFlag || 'YES'
+ this.desc = o.desc
+ this.maxRetryTimes = o.maxRetryTimes
+ this.retryInterval = o.retryInterval
+ this.delayTime = o.delayTime
+ if (o.conditionResult) {
+ this.successBranch = o.conditionResult.successNode[0]
+ this.failedBranch = o.conditionResult.failedNode[0]
+ }
+ // If the workergroup has been deleted, set the default workergroup
+ for (
+ let i = 0;
+ i < this.store.state.security.workerGroupsListAll.length;
+ i++
+ ) {
+ let workerGroup = this.store.state.security.workerGroupsListAll[i].id
+ if (o.workerGroup === workerGroup) {
+ break
+ }
+ }
+ if (o.workerGroup === undefined) {
+ this.store
+ .dispatch('dag/getTaskInstanceList', {
+ pageSize: 10,
+ pageNo: 1,
+ processInstanceId: this.nodeData.instanceId,
+ name: o.name
+ })
+ .then((res) => {
+ this.workerGroup = res.totalList[0].workerGroup
+ })
+ } else {
+ this.workerGroup = o.workerGroup
+ }
+ this.environmentCode = o.environmentCode
+ this.params = o.params || {}
+ this.dependence = o.dependence || {}
+ this.cacheDependence = o.dependence || {}
+ } else {
+ this.workerGroup = this.store.state.security.workerGroupsListAll[0].id
+ }
+ this.cacheBackfillItem = JSON.parse(JSON.stringify(o))
+ this.isContentBox = true
}
},
created () {
@@ -666,7 +892,7 @@
let taskList = this.store.state.dag.tasks
let o = {}
if (taskList.length) {
- taskList.forEach(task => {
+ taskList.forEach((task) => {
if (task.code === this.nodeData.id) {
const backfillItem = this.taskToBackfillItem(task)
o = backfillItem
@@ -675,46 +901,7 @@
})
}
this.code = this.nodeData.id
- // Non-null objects represent backfill
- if (!_.isEmpty(o)) {
- this.code = o.code
- this.name = o.name
- this.taskInstancePriority = o.taskInstancePriority
- this.runFlag = o.runFlag || 'YES'
- this.desc = o.desc
- this.maxRetryTimes = o.maxRetryTimes
- this.retryInterval = o.retryInterval
- this.delayTime = o.delayTime
- if (o.conditionResult) {
- this.successBranch = o.conditionResult.successNode[0]
- this.failedBranch = o.conditionResult.failedNode[0]
- }
- // If the workergroup has been deleted, set the default workergroup
- for (let i = 0; i < this.store.state.security.workerGroupsListAll.length; i++) {
- let workerGroup = this.store.state.security.workerGroupsListAll[i].id
- if (o.workerGroup === workerGroup) {
- break
- }
- }
-
- if (o.workerGroup === undefined) {
- this.store.dispatch('dag/getTaskInstanceList', {
- pageSize: 10, pageNo: 1, processInstanceId: this.nodeData.instanceId, name: o.name
- }).then(res => {
- this.workerGroup = res.totalList[0].workerGroup
- })
- } else {
- this.workerGroup = o.workerGroup
- }
- this.environmentCode = o.environmentCode
- this.params = o.params || {}
- this.dependence = o.dependence || {}
- this.cacheDependence = o.dependence || {}
- } else {
- this.workerGroup = this.store.state.security.workerGroupsListAll[0].id
- }
- this.cacheBackfillItem = JSON.parse(JSON.stringify(o))
- this.isContentBox = true
+ this.backfill(o)
if (this.dagChart) {
const canvas = findComponentDownward(this.dagChart, 'dag-canvas')
@@ -736,17 +923,11 @@
self.close()
})
},
- updated () {
- },
- beforeDestroy () {
- },
- destroyed () {
- },
+ updated () {},
+ beforeDestroy () {},
+ destroyed () {},
computed: {
- ...mapState('dag', [
- 'processListS',
- 'taskInstances'
- ]),
+ ...mapState('dag', ['processListS', 'taskInstances']),
/**
* Child workflow entry show/hide
*/
@@ -786,16 +967,17 @@
mPriority,
mWorkerGroups,
mRelatedEnvironment,
- mPreTasks
+ mPreTasks,
+ CopyFromTask
}
}
diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js
index d1dabb4ed8..3459502af4 100644
--- a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js
+++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js
@@ -829,5 +829,14 @@ export default {
reject(e)
})
})
+ },
+ getTaskDefinitions ({ state }, payload) {
+ return new Promise((resolve, reject) => {
+ io.get(`projects/${state.projectCode}/task-definition`, payload, res => {
+ resolve(res.data)
+ }).catch(e => {
+ reject(e)
+ })
+ })
}
}
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
index 99164b722d..e72a1d0dd0 100755
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
@@ -706,5 +706,7 @@ export default {
'Please enter environment desc': 'Please enter environment desc',
'Please select worker groups': 'Please select worker groups',
condition: 'condition',
- 'The condition content cannot be empty': 'The condition content cannot be empty'
+ 'The condition content cannot be empty': 'The condition content cannot be empty',
+ 'Copy from': 'Copy from',
+ 'No more...': 'No more...'
}
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
index f84d5ffac7..03935341f6 100644
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
@@ -705,5 +705,7 @@ export default {
'Please enter environment desc': '请输入详细描述',
'Please select worker groups': '请选择Worker分组',
condition: '条件',
- 'The condition content cannot be empty': '条件内容不能为空'
+ 'The condition content cannot be empty': '条件内容不能为空',
+ 'Copy from': '从任务复制',
+ 'No more...': '没有更多了...'
}