diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/referenceFromTask.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/referenceFromTask.vue
index ef1489cb85..be631908ba 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/referenceFromTask.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/referenceFromTask.vue
@@ -81,7 +81,7 @@
document.removeEventListener('click', this.outsideClick)
},
methods: {
- ...mapActions('dag', ['getTaskDefinitions']),
+ ...mapActions('dag', ['getTaskDefinitionList']),
outsideClick (e) {
const elem = this.$refs.copyFrom
if (!elem.contains(e.target) && this.dropdownVisible) {
@@ -99,7 +99,7 @@
}
if (this.noMore) return
this.loading = true
- this.getTaskDefinitions({
+ this.getTaskDefinitionsList({
pageNo: this.pageNo,
pageSize: this.pageSize,
searchVal: this.searchVal,
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
index fcafefc268..c5107d3836 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
@@ -46,7 +46,6 @@
-
@@ -61,12 +60,34 @@
:disabled="isDetails"
:placeholder="$t('Please enter name (required)')"
maxlength="100"
- @blur="_verifName()"
>
+
+ {{ $t("Task Type") }}
+
+
+
+
+
+
+
+
{{ $t("Run flag") }}
@@ -353,13 +374,14 @@
:backfill-item="backfillItem"
>
-
-
+
+
@@ -415,7 +437,7 @@
:loading="spinnerLoading"
@click="ok()"
:disabled="isDetails"
- >{{ spinnerLoading ? $t("Loading...") : $t("Confirm add") }}
+ >{{ spinnerLoading ? $t("Loading...") : $t("Confirm") }}
@@ -453,6 +475,7 @@
import disabledState from '@/module/mixin/disabledState'
import mPriority from '@/module/components/priority/priority'
import { findComponentDownward } from '@/module/util/'
+ import { tasksType } from '@/conf/home/pages/dag/_source/config.js'
// import ReferenceFromTask from './_source/referenceFromTask.vue'
export default {
@@ -524,7 +547,8 @@
// refresh part of the formModel, after set backfillItem outside
backfillRefresh: true,
// whether this is a new Task
- isNewCreate: true
+ isNewCreate: true,
+ tasksTypeList: Object.keys(tasksType)
}
},
provide () {
@@ -542,7 +566,8 @@
type: {
type: String,
default: ''
- }
+ },
+ taskDefinition: Object
},
inject: ['dagChart'],
methods: {
@@ -723,6 +748,16 @@
}
return true
},
+ _verifTaskType () {
+ if (!this.fromTaskDefinition) return true
+ if (!this.nodeData.taskType) {
+ this.$message.warning(
+ `${i18n.$t('Please select a task type (required)')}`
+ )
+ return false
+ }
+ return true
+ },
/**
* Global verification procedure
*/
@@ -731,6 +766,12 @@
if (!this._verifName()) {
return
}
+
+ // Verify task type
+ if (!this._verifTaskType()) {
+ return
+ }
+
// verif workGroup
if (!this._verifWorkGroup()) {
return
@@ -777,14 +818,11 @@
timeoutNotifyStrategy: this.timeout.strategy,
timeout: this.timeout.interval || 0,
delayTime: this.delayTime,
- environmentCode: this.environmentCode || -1,
- status: this.status,
- branch: this.branch
+ environmentCode: this.environmentCode || -1
},
fromThis: this
})
- // set run flag
- this._setRunFlag()
+
// set edge label
this._setEdgeLabel()
},
@@ -795,10 +833,8 @@
this.name = name
},
/**
- * set run flag
- * TODO
+ * set edge label by successBranch && failedBranch
*/
- _setRunFlag () {},
_setEdgeLabel () {
if (this.successBranch || this.failedBranch) {
const canvas = findComponentDownward(this.dagChart, 'dag-canvas')
@@ -892,7 +928,8 @@
} else {
this.workerGroup = o.workerGroup
}
- this.environmentCode = o.environmentCode === -1 ? '' : o.environmentCode
+ this.environmentCode =
+ o.environmentCode === -1 ? '' : o.environmentCode
this.params = o.params || {}
this.dependence = o.dependence || {}
this.cacheDependence = o.dependence || {}
@@ -901,23 +938,37 @@
}
this.cacheBackfillItem = JSON.parse(JSON.stringify(o))
this.isContentBox = true
+ },
+ changeTaskType (value) {
+ this.$emit('changeTaskType', value)
}
},
created () {
// Backfill data
- let taskList = this.store.state.dag.tasks
let o = {}
- if (taskList.length) {
- taskList.forEach((task) => {
- if (task.code === this.nodeData.id) {
- const backfillItem = this.taskToBackfillItem(task)
- o = backfillItem
- this.backfillItem = backfillItem
- this.isNewCreate = false
- }
- })
- }
this.code = this.nodeData.id
+
+ if (this.fromTaskDefinition) {
+ if (this.taskDefinition) {
+ const backfillItem = this.taskToBackfillItem(this.taskDefinition)
+ o = backfillItem
+ this.backfillItem = backfillItem
+ this.isNewCreate = false
+ }
+ } else {
+ let taskList = this.store.state.dag.tasks
+ if (taskList.length) {
+ taskList.forEach((task) => {
+ if (task.code === this.nodeData.id) {
+ const backfillItem = this.taskToBackfillItem(task)
+ o = backfillItem
+ this.backfillItem = backfillItem
+ this.isNewCreate = false
+ }
+ })
+ }
+ }
+
this.backfill(o)
if (this.dagChart) {
@@ -958,6 +1009,12 @@
)
}
return null
+ },
+ /**
+ * Open the modal from task definition
+ */
+ fromTaskDefinition () {
+ return this.type === 'task-definition'
}
},
components: {
@@ -986,7 +1043,7 @@
mWorkerGroups,
mRelatedEnvironment,
mPreTasks
- // ReferenceFromTask
+ // ReferenceFromTask
}
}
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskDefinition/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskDefinition/_source/list.vue
new file mode 100644
index 0000000000..bca4b47134
--- /dev/null
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskDefinition/_source/list.vue
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+