-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
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 7dfcbc62bb..20f5187048 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
@@ -50,8 +50,8 @@
{{$t('Run flag')}}
- {{$t('Normal')}}
- {{$t('Prohibition execution')}}
+ {{$t('Normal')}}
+ {{$t('Prohibition execution')}}
@@ -259,11 +259,12 @@
:pre-node="nodeData.preNode">
-
+
@@ -276,7 +277,7 @@
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/log.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/log.vue
index 81d59d8b95..4a0cf69e3e 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/log.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/log.vue
@@ -79,6 +79,7 @@
store,
router,
isLog: false,
+ // TODO
stateId: $(`#${this.item.id}`).attr('data-state-id') || null,
isScreen: false,
loadingIndex: 0,
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sub_process.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sub_process.vue
index 71fce10813..189f92f493 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sub_process.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sub_process.vue
@@ -30,7 +30,7 @@
v-for="city in processDefinitionList"
:key="city.code"
:value="city.id"
- :label="city.code">
+ :label="city.name">
@@ -74,14 +74,14 @@
/**
* The selected process defines the upper component name padding
*/
- _handleWdiChanged (o) {
- this.$emit('on-set-process-name', this._handleName(o))
+ _handleWdiChanged (id) {
+ this.$emit('on-set-process-name', this._handleName(id))
},
/**
* Return the name according to the process definition id
*/
_handleName (id) {
- return _.filter(this.processDefinitionList, v => id === v.id)[0].code
+ return _.filter(this.processDefinitionList, v => id === v.id)[0].name
}
},
watch: {
@@ -93,22 +93,20 @@
},
created () {
let processListS = _.cloneDeep(this.store.state.dag.processListS)
- let id = null
+ let code = null
if (this.router.history.current.name === 'projects-instance-details') {
- id = this.router.history.current.query.id || null
+ code = this.router.history.current.query.code || null
} else {
- id = this.router.history.current.params.id || null
+ code = this.router.history.current.params.code || null
}
- this.processDefinitionList = (() => {
- let a = _.map(processListS, v => {
- return {
- id: v.id,
- code: v.name,
- disabled: false
- }
- })
- return _.filter(a, v => +v.id !== +id)
- })()
+ this.processDefinitionList = processListS.map(v => {
+ return {
+ id: v.processDefinition.id,
+ code: v.processDefinition.code,
+ name: v.processDefinition.name,
+ disabled: false
+ }
+ }).filter(a => (a.code + '') !== code)
let o = this.backfillItem
// Non-null objects represent backfill
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-close.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-close.png
new file mode 100755
index 0000000000..316fff7a86
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-close.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-close_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-close_hover.png
new file mode 100755
index 0000000000..5ad88040f9
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-close_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-open.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-open.png
new file mode 100755
index 0000000000..2443cc7d00
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-open.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-open_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-open_hover.png
new file mode 100755
index 0000000000..d33ba6734e
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/full-screen-open_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/graph-format.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/graph-format.png
new file mode 100755
index 0000000000..ce0ca79686
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/graph-format.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/graph-format_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/graph-format_hover.png
new file mode 100755
index 0000000000..97d359aa0c
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/graph-format_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/startup-params.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/startup-params.png
new file mode 100755
index 0000000000..987e1f9085
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/startup-params.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/startup-params_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/startup-params_hover.png
new file mode 100755
index 0000000000..83b9a829e1
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/startup-params_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/conditions.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/conditions.png
new file mode 100755
index 0000000000..0849964310
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/conditions.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/conditions_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/conditions_hover.png
new file mode 100755
index 0000000000..a0c4551be3
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/conditions_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/datax.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/datax.png
new file mode 100755
index 0000000000..22519a98ec
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/datax.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/datax_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/datax_hover.png
new file mode 100755
index 0000000000..986470d993
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/datax_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/dependent.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/dependent.png
new file mode 100755
index 0000000000..3f0b732c40
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/dependent.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/dependent_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/dependent_hover.png
new file mode 100755
index 0000000000..4b4b8669f9
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/dependent_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/flink.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/flink.png
new file mode 100755
index 0000000000..568efbef22
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/flink.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/flink_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/flink_hover.png
new file mode 100755
index 0000000000..7c8e521553
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/flink_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/http.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/http.png
new file mode 100755
index 0000000000..1d80cd08d0
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/http.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/http_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/http_hover.png
new file mode 100755
index 0000000000..31403be5e5
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/http_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/mr.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/mr.png
new file mode 100755
index 0000000000..59d082f98e
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/mr.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/mr_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/mr_hover.png
new file mode 100755
index 0000000000..e4cfd96972
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/mr_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/procedure.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/procedure.png
new file mode 100755
index 0000000000..e681c288d8
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/procedure.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/procedure_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/procedure_hover.png
new file mode 100755
index 0000000000..82ad43d08b
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/procedure_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/python.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/python.png
new file mode 100755
index 0000000000..8bc4d516aa
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/python.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/python_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/python_hover.png
new file mode 100755
index 0000000000..f94a4f7c64
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/python_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/shell.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/shell.png
new file mode 100755
index 0000000000..4e40b6eb20
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/shell.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/shell_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/shell_hover.png
new file mode 100755
index 0000000000..b615f5532e
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/shell_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/spark.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/spark.png
new file mode 100755
index 0000000000..e9ff012d4d
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/spark.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/spark_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/spark_hover.png
new file mode 100755
index 0000000000..b0fbc56050
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/spark_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sql.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sql.png
new file mode 100755
index 0000000000..34154861d5
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sql.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sql_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sql_hover.png
new file mode 100755
index 0000000000..fabce22545
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sql_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sqoop.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sqoop.png
new file mode 100755
index 0000000000..2c754d365f
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sqoop.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sqoop_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sqoop_hover.png
new file mode 100755
index 0000000000..dd64890207
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sqoop_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sub_process.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sub_process.png
new file mode 100755
index 0000000000..fb12061507
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sub_process.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sub_process_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sub_process_hover.png
new file mode 100755
index 0000000000..d6b4abc2cd
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/sub_process_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/waterdrop.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/waterdrop.png
new file mode 100755
index 0000000000..bf2f83e206
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/waterdrop.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/waterdrop_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/waterdrop_hover.png
new file mode 100755
index 0000000000..e6affd6ff1
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/task-icos/waterdrop_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/view-variables.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/view-variables.png
new file mode 100755
index 0000000000..44cbc907e8
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/view-variables.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/view-variables_hover.png b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/view-variables_hover.png
new file mode 100755
index 0000000000..7f8e08cce4
Binary files /dev/null and b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/images/view-variables_hover.png differ
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js
deleted file mode 100644
index 1c851a175f..0000000000
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.
- */
-
-import _ from 'lodash'
-import canvg from 'canvg'
-import { tasksAll } from './util'
-import html2canvas from 'html2canvas'
-import { findComponentDownward } from '@/module/util/'
-
-const DownChart = function () {
- this.dag = {}
-}
-
-/**
- * Get interception location information
- */
-DownChart.prototype.maxVal = function () {
- return new Promise((resolve, reject) => {
- // All nodes
- const tasksAllList = tasksAll()
- const dom = $('.dag-container')
- const y = parseInt(_.maxBy(tasksAllList, 'y').y + 60)
- const x = parseInt(_.maxBy(tasksAllList, 'x').x + 100)
-
- resolve({
- width: (x > 600 ? x : dom.width()) + 100,
- height: (y > 500 ? y : dom.height()) + 100
- })
- })
-}
-
-/**
- * Download to image
- */
-DownChart.prototype.download = function ({ dagThis }) {
- this.dag = dagThis
-
- this.maxVal().then(({ width, height }) => {
- // Dom to save
- const copyDom = $('#canvas')
- // gain
- const scale = 1
- // divReport is the id of the dom that needs to be intercepted into a picture
- const svgElem = copyDom.find('svg')
- svgElem.each((index, node) => {
- // svg handle
- const nodesToRecover = []
- const nodesToRemove = []
- const parentNode = node.parentNode
- const svg = node.outerHTML.trim()
- const canvas = document.createElement('canvas')
- canvg(canvas, svg)
- if (node.style.position) {
- canvas.style.position += node.style.position
- canvas.style.left += node.style.left
- canvas.style.top += node.style.top
- }
- nodesToRecover.push({
- parent: parentNode,
- child: node
- })
- parentNode.removeChild(node)
- nodesToRemove.push({
- parent: parentNode,
- child: canvas
- })
- parentNode.appendChild(canvas)
- })
-
- const canvas = document.createElement('canvas')
- // canvas width
- canvas.width = width * scale
- // canvas height
- canvas.height = height * scale
-
- const content = canvas.getContext('2d')
- content.scale(scale, scale)
- // Get the offset of the element relative to the inspection
- const rect = copyDom.get(0).getBoundingClientRect()
- // Set the context position, the value is a negative value relative to the window offset, let the picture reset
- content.translate(-rect.left, -rect.top)
-
- html2canvas(copyDom[0], {
- dpi: window.devicePixelRatio * 2,
- scale: scale,
- width: width,
- canvas: canvas,
- heigth: height,
- useCORS: true // Enable cross-domain configuration
- }).then((canvas) => {
- const name = `${this.dag.name}.png`
- const url = canvas.toDataURL('image/png', 1)
- setTimeout(() => {
- const triggerDownload = $('').attr('href', url).attr('download', name).appendTo('body')
- triggerDownload[0].click()
- triggerDownload.remove()
- }, 100)
-
- // To refresh the dag instance, otherwise you can't re-plot
- setTimeout(() => {
- // Refresh current dag
- findComponentDownward(this.dag.$root, `${this.dag.type}-details`).init()
- }, 500)
- })
- })
-}
-
-export default new DownChart()
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js
deleted file mode 100755
index fbc00b0746..0000000000
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js
+++ /dev/null
@@ -1,814 +0,0 @@
-/*
- * 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.
- */
-import 'jquery-ui/ui/widgets/draggable'
-import 'jquery-ui/ui/widgets/droppable'
-import 'jquery-ui/ui/widgets/resizable'
-import _ from 'lodash'
-import i18n from '@/module/i18n'
-import { jsPlumb } from 'jsplumb'
-import DragZoom from './dragZoom'
-import store from '@/conf/home/store'
-import router from '@/conf/home/router'
-import { uuid, findComponentDownward } from '@/module/util/'
-
-import {
- tasksAll,
- rtTasksTpl,
- setSvgColor,
- saveTargetarr,
- rtTargetarrArr,
- computeScale
-} from './util'
-import multiDrag from './multiDrag'
-
-const JSP = function () {
- this.dag = {}
- this.selectedElement = {}
-
- this.config = {
- // Whether to drag
- isDrag: true,
- // Whether to allow connection
- isAttachment: false,
- // Whether to drag a new node
- isNewNodes: true,
- // Whether to support double-click node events
- isDblclick: true,
- // Whether to support right-click menu events
- isContextmenu: true,
- // Whether to allow click events
- isClick: false
- }
-}
-/**
- * dag init
- */
-JSP.prototype.init = function ({ dag, instance, options }) {
- // Get the dag component instance
- this.dag = dag
- // Get jsplumb instance
- this.JspInstance = instance
- // Get JSP options
- this.options = options || {}
- // Register jsplumb connection type and configuration
- this.JspInstance.registerConnectionType('basic', {
- anchor: 'Continuous',
- connector: 'Bezier' // Line type
- })
-
- // Initial configuration
- this.setConfig({
- isDrag: !store.state.dag.isDetails,
- isAttachment: false,
- isNewNodes: !store.state.dag.isDetails, // Permissions.getAuth() === false ? false : !store.state.dag.isDetails,
- isDblclick: true,
- isContextmenu: true,
- isClick: false
- })
-
- // Monitor line click
- this.JspInstance.bind('click', e => {
- // Untie event
- if (this.config.isClick) {
- this.connectClick(e)
- } else {
- findComponentDownward(this.dag.$root, 'dag-chart')._createLineLabel({ id: e._jsPlumb.overlays.label.canvas.id, sourceId: e.sourceId, targetId: e.targetId })
- }
- })
-
- // Drag and drop
- if (this.config.isNewNodes) {
- DragZoom.init()
- }
-
- // support multi drag
- multiDrag()
-}
-
-/**
- * set config attribute
- */
-JSP.prototype.setConfig = function (o) {
- this.config = Object.assign(this.config, {}, o)
-}
-
-/**
- * Node binding event
- */
-JSP.prototype.tasksEvent = function (selfId) {
- const tasks = $(`#${selfId}`)
- // Bind right event
- tasks.on('contextmenu', e => {
- this.tasksContextmenu(e)
- return false
- })
-
- // Binding double click event
- tasks.find('.icos').bind('dblclick', e => {
- this.tasksDblclick(e)
- })
-
- // Binding click event
- tasks.on('click', e => {
- this.tasksClick(e)
- })
-}
-
-/**
- * Dag node drag and drop processing
- */
-JSP.prototype.draggable = function () {
- if (this.config.isNewNodes) {
- let selfId
- const self = this
- $('.toolbar-btn .roundedRect').draggable({
- scope: 'plant',
- helper: 'clone',
- containment: $('.dag-model'),
- stop: function (e, ui) {
- },
- drag: function () {
- $('body').find('.tooltip.fade.top.in').remove()
- }
- })
-
- $('#canvas').droppable({
- scope: 'plant',
- drop: function (ev, ui) {
- let id = 'tasks-' + Math.ceil(Math.random() * 100000) // eslint-disable-line
-
- let scale = computeScale($(this))
- scale = scale || 1
-
- // Get mouse coordinates and after scale coordinate
- const left = parseInt(ui.offset.left - $(this).offset().left) / scale
- const top = parseInt(ui.offset.top - $(this).offset().top) / scale
- // Generate template node
- $('#canvas').append(rtTasksTpl({
- id: id,
- name: id,
- x: left,
- y: top,
- isAttachment: self.config.isAttachment,
- taskType: findComponentDownward(self.dag.$root, 'dag-chart').dagBarId
- }))
-
- // Get the generated node
- const thisDom = jsPlumb.getSelector('.statemachine-demo .w')
-
- // Generating a connection node
- self.JspInstance.batch(() => {
- self.initNode(thisDom[thisDom.length - 1])
- })
- selfId = id
-
- self.tasksEvent(selfId)
-
- // Dom structure is not generated without pop-up form form
- if ($(`#${selfId}`).html()) {
- // dag event
- findComponentDownward(self.dag.$root, 'dag-chart')._createNodes({
- id: selfId
- })
- }
- }
- })
- }
-}
-
-/**
- * Echo json processing and old data structure processing
- */
-JSP.prototype.jsonHandle = function ({ largeJson, locations }) {
- _.map(largeJson, v => {
- // Generate template
- $('#canvas').append(rtTasksTpl({
- id: v.id,
- name: v.name,
- x: locations[v.id].x,
- y: locations[v.id].y,
- targetarr: locations[v.id].targetarr,
- isAttachment: this.config.isAttachment,
- taskType: v.type,
- runFlag: v.runFlag,
- nodenumber: locations[v.id].nodenumber,
- successNode: v.conditionResult === undefined ? '' : v.conditionResult.successNode[0],
- failedNode: v.conditionResult === undefined ? '' : v.conditionResult.failedNode[0]
- }))
-
- // contextmenu event
- $(`#${v.id}`).on('contextmenu', e => {
- this.tasksContextmenu(e)
- return false
- })
-
- // dblclick event
- $(`#${v.id}`).find('.icos').bind('dblclick', e => {
- this.tasksDblclick(e)
- })
-
- // click event
- $(`#${v.id}`).bind('click', e => {
- this.tasksClick(e)
- })
- })
-}
-
-/**
- * Initialize a single node
- */
-JSP.prototype.initNode = function (el) {
- // Whether to drag
- if (this.config.isDrag) {
- this.JspInstance.draggable(el, {
- containment: 'dag-container'
- })
- }
-
- // Node attribute configuration
- this.JspInstance.makeSource(el, {
- filter: '.ep',
- anchor: 'Continuous',
- connectorStyle: {
- stroke: '#2d8cf0',
- strokeWidth: 2,
- outlineStroke: 'transparent',
- outlineWidth: 4
- },
- // This place is leaking
- // connectionType: "basic",
- extract: {
- action: 'the-action'
- },
- maxConnections: -1
- })
-
- // Node connection property configuration
- this.JspInstance.makeTarget(el, {
- dropOptions: { hoverClass: 'dragHover' },
- anchor: 'Continuous',
- allowLoopback: false // Forbid yourself to connect yourself
- })
- this.JspInstance.fire('jsPlumbDemoNodeAdded', el)
-}
-
-/**
- * Node right click menu
- */
-JSP.prototype.tasksContextmenu = function (event) {
- if (this.config.isContextmenu) {
- const routerName = router.history.current.name
- // state
- const isOne = routerName === 'projects-definition-details' && this.dag.releaseState !== 'NOT_RELEASE'
- // hide
- const isTwo = store.state.dag.isDetails
-
- const html = [
- `${i18n.$t('Start')}`,
- `${i18n.$t('Edit')}`,
- `${i18n.$t('Copy')}`,
- `${i18n.$t('Delete')}`
- ]
-
- const operationHtml = () => {
- return html.splice(',')
- }
-
- const e = event
- const $id = e.currentTarget.id
- const $contextmenu = $('#contextmenu')
- const $name = $(`#${$id}`).find('.name-p').text()
- const $left = e.pageX + document.body.scrollLeft - 5
- const $top = e.pageY + document.body.scrollTop - 5
- $contextmenu.css({
- left: $left,
- top: $top,
- visibility: 'visible'
- })
- // Action bar
- $contextmenu.html('').append(operationHtml)
-
- if (isOne) {
- // start run
- $('#startRunning').on('click', () => {
- const name = store.state.dag.name
- const id = router.history.current.params.id
- store.dispatch('dag/getStartCheck', { processDefinitionId: id }).then(res => {
- this.dag.startRunning({ id: id, name: name }, $name, 'contextmenu')
- })
- })
- }
- if (!isTwo) {
- // edit node
- $('#editNodes').click(ev => {
- findComponentDownward(this.dag.$root, 'dag-chart')._createNodes({
- id: $id,
- type: $(`#${$id}`).attr('data-tasks-type')
- })
- })
- // delete node
- $('#removeNodes').click(ev => {
- this.removeNodes($id)
- })
-
- // copy node
- $('#copyNodes').click(res => {
- this.copyNodes($id)
- })
- }
- }
-}
-
-/**
- * Node double click event
- */
-JSP.prototype.tasksDblclick = function (e) {
- // Untie event
- if (this.config.isDblclick) {
- const id = $(e.currentTarget.offsetParent).attr('id')
- findComponentDownward(this.dag.$root, 'dag-chart')._createNodes({
- id: id,
- type: $(`#${id}`).attr('data-tasks-type')
- })
- }
-}
-
-/**
- * Node click event
- */
-JSP.prototype.tasksClick = function (e) {
- let $id
- const self = this
- const $body = $('body')
- if (this.config.isClick) {
- const $connect = this.selectedElement.connect
- $('.w').removeClass('jtk-tasks-active')
- $(e.currentTarget).addClass('jtk-tasks-active')
- if ($connect) {
- setSvgColor($connect, '#2d8cf0')
- this.selectedElement.connect = null
- }
- this.selectedElement.id = $(e.currentTarget).attr('id')
-
- // Unbind copy and paste events
- $body.unbind('copy').unbind('paste')
- // Copy binding id
- $id = self.selectedElement.id
-
- $body.bind({
- copy: function () {
- $id = self.selectedElement.id
- },
- paste: function () {
- $id && self.copyNodes($id)
- }
- })
- }
-}
-
-/**
- * Remove binding events
- * paste
- */
-JSP.prototype.removePaste = function () {
- const $body = $('body')
- // Unbind copy and paste events
- $body.unbind('copy').unbind('paste')
- // Remove selected node parameters
- this.selectedElement.id = null
- // Remove node selection effect
- $('.w').removeClass('jtk-tasks-active')
-}
-
-/**
- * Line click event
- */
-JSP.prototype.connectClick = function (e) {
- // Set svg color
- setSvgColor(e, '#0097e0')
- const $id = this.selectedElement.id
- if ($id) {
- $(`#${$id}`).removeClass('jtk-tasks-active')
- this.selectedElement.id = null
- }
- this.selectedElement.connect = e
-}
-
-/**
- * toolbarEvent
- * @param {Pointer}
- */
-JSP.prototype.handleEventPointer = function (is) {
- this.setConfig({
- isClick: is,
- isAttachment: false
- })
-}
-
-/**
- * toolbarEvent
- * @param {Line}
- */
-JSP.prototype.handleEventLine = function (is) {
- const wDom = $('.w')
- this.setConfig({
- isAttachment: is
- })
- is ? wDom.addClass('jtk-ep') : wDom.removeClass('jtk-ep')
-}
-
-/**
- * toolbarEvent
- * @param {Remove}
- */
-JSP.prototype.handleEventRemove = function () {
- const $id = this.selectedElement.id || null
- const $connect = this.selectedElement.connect || null
- if ($id) {
- this.removeNodes(this.selectedElement.id)
- } else {
- this.removeConnect($connect)
- }
-
- // Monitor whether to edit DAG
- store.commit('dag/setIsEditDag', true)
-}
-
-/**
- * Delete node
- */
-JSP.prototype.removeNodes = function ($id) {
- // Delete node processing(data-targetarr)
- _.map(tasksAll(), v => {
- const targetarr = v.targetarr.split(',')
- if (targetarr.length) {
- const newArr = _.filter(targetarr, v1 => v1 !== $id)
- $(`#${v.id}`).attr('data-targetarr', newArr.toString())
- }
- })
- // delete node
- this.JspInstance.remove($id)
-
- // delete dom
- $(`#${$id}`).remove()
-
- // callback onRemoveNodes event
- this.options && this.options.onRemoveNodes && this.options.onRemoveNodes($id)
- const connects = []
- _.map(this.JspInstance.getConnections(), v => {
- connects.push({
- endPointSourceId: v.sourceId,
- endPointTargetId: v.targetId,
- label: v._jsPlumb.overlays.label.canvas.innerText
- })
- })
- // Storage line dependence
- store.commit('dag/setConnects', connects)
-}
-
-/**
- * Delete connection
- */
-JSP.prototype.removeConnect = function ($connect) {
- if (!$connect) {
- return
- }
- // Remove connections and remove node and node dependencies
- const targetId = $connect.targetId
- const sourceId = $connect.sourceId
- let targetarr = rtTargetarrArr(targetId)
- if (targetarr.length) {
- targetarr = _.filter(targetarr, v => v !== sourceId)
- $(`#${targetId}`).attr('data-targetarr', targetarr.toString())
- }
- if ($(`#${sourceId}`).attr('data-tasks-type') === 'CONDITIONS') {
- $(`#${sourceId}`).attr('data-nodenumber', Number($(`#${sourceId}`).attr('data-nodenumber')) - 1)
- }
- this.JspInstance.deleteConnection($connect)
-
- this.selectedElement = {}
-}
-
-/**
- * Copy node
- */
-JSP.prototype.copyNodes = function ($id) {
- let newNodeInfo = _.cloneDeep(_.find(store.state.dag.tasks, v => v.id === $id))
- const newNodePors = store.state.dag.locations[$id]
- // Unstored nodes do not allow replication
- if (!newNodePors) {
- return
- }
- // Generate random id
- const newUuId = `${uuid() + uuid()}`
- const id = newNodeInfo.id.length > 8 ? newNodeInfo.id.substr(0, 7) : newNodeInfo.id
- const name = newNodeInfo.name.length > 8 ? newNodeInfo.name.substr(0, 7) : newNodeInfo.name
-
- // new id
- const newId = `${id || ''}-${newUuId}`
- // new name
- const newName = `${name || ''}-${newUuId}`
- // coordinate x
- const newX = newNodePors.x + 100
- // coordinate y
- const newY = newNodePors.y + 40
-
- // Generate template node
- $('#canvas').append(rtTasksTpl({
- id: newId,
- name: newName,
- x: newX,
- y: newY,
- isAttachment: this.config.isAttachment,
- taskType: newNodeInfo.type
- }))
-
- // Get the generated node
- const thisDom = jsPlumb.getSelector('.statemachine-demo .w')
-
- // Copy node information
- newNodeInfo = Object.assign(newNodeInfo, {
- id: newId,
- name: newName
- })
-
- // Add new node
- store.commit('dag/addTasks', newNodeInfo)
- // Add node location information
- store.commit('dag/addLocations', {
- [newId]: {
- name: newName,
- targetarr: '',
- nodenumber: 0,
- x: newX,
- y: newY
- }
- })
-
- // Generating a connection node
- this.JspInstance.batch(() => {
- this.initNode(thisDom[thisDom.length - 1])
- // Add events to nodes
- this.tasksEvent(newId)
- })
-}
-/**
- * toolbarEvent
- * @param {Screen}
- */
-JSP.prototype.handleEventScreen = function ({ item, is }) {
- let screenOpen = true
- if (is) {
- item.icon = 'el-icon-aim'
- screenOpen = true
- } else {
- item.icon = 'el-icon-full-screen'
- screenOpen = false
- }
- const $mainLayoutModel = $('.main-layout-model')
- if (screenOpen) {
- $mainLayoutModel.addClass('dag-screen')
- } else {
- $mainLayoutModel.removeClass('dag-screen')
- }
-}
-/**
- * save task
- * @param tasks
- * @param locations
- * @param connects
- */
-JSP.prototype.saveStore = function () {
- return new Promise((resolve, reject) => {
- const connects = []
- const locations = {}
- const tasks = []
-
- const is = (id) => {
- return !!_.filter(tasksAll(), v => v.id === id).length
- }
-
- // task
- _.map(_.cloneDeep(store.state.dag.tasks), v => {
- if (is(v.id)) {
- const preTasks = []
- const id = $(`#${v.id}`)
- const tar = id.attr('data-targetarr')
- const idDep = tar ? id.attr('data-targetarr').split(',') : []
- if (idDep.length) {
- _.map(idDep, v1 => {
- preTasks.push($(`#${v1}`).find('.name-p').text())
- })
- }
-
- let tasksParam = _.assign(v, {
- preTasks: preTasks,
- depList: null
- })
-
- // Sub-workflow has no retries and interval
- if (v.type === 'SUB_PROCESS') {
- tasksParam = _.omit(tasksParam, ['maxRetryTimes', 'retryInterval'])
- }
-
- tasks.push(tasksParam)
- }
- })
-
- if (store.state.dag.connects.length === this.JspInstance.getConnections().length) {
- _.map(store.state.dag.connects, u => {
- connects.push({
- endPointSourceId: u.endPointSourceId,
- endPointTargetId: u.endPointTargetId,
- label: u.label
- })
- })
- } else if (store.state.dag.connects.length > 0 && store.state.dag.connects.length < this.JspInstance.getConnections().length) {
- _.map(this.JspInstance.getConnections(), v => {
- connects.push({
- endPointSourceId: v.sourceId,
- endPointTargetId: v.targetId,
- label: v._jsPlumb.overlays.label.canvas.innerText
- })
- })
- _.map(store.state.dag.connects, u => {
- _.map(connects, v => {
- if (u.label && u.endPointSourceId === v.endPointSourceId && u.endPointTargetId === v.endPointTargetId) {
- v.label = u.label
- }
- })
- })
- } else if (store.state.dag.connects.length === 0) {
- _.map(this.JspInstance.getConnections(), v => {
- connects.push({
- endPointSourceId: v.sourceId,
- endPointTargetId: v.targetId,
- label: v._jsPlumb.overlays.label.canvas.innerText
- })
- })
- } else if (store.state.dag.connects.length > this.JspInstance.getConnections().length) {
- _.map(this.JspInstance.getConnections(), v => {
- connects.push({
- endPointSourceId: v.sourceId,
- endPointTargetId: v.targetId,
- label: v._jsPlumb.overlays.label.canvas.innerText
- })
- })
- }
-
- _.map(tasksAll(), v => {
- locations[v.id] = {
- name: v.name,
- targetarr: v.targetarr,
- nodenumber: v.nodenumber,
- x: v.x,
- y: v.y
- }
- })
-
- // Storage node
- store.commit('dag/setTasks', tasks)
- // Store coordinate information
- store.commit('dag/setLocations', locations)
- // Storage line dependence
- store.commit('dag/setConnects', connects)
-
- resolve({
- connects: connects,
- tasks: tasks,
- locations: locations
- })
- })
-}
-/**
- * Event processing
- */
-
-JSP.prototype.handleEvent = function () {
- this.JspInstance.bind('beforeDrop', function (info) {
- const sourceId = info.sourceId// 出
- const targetId = info.targetId// 入
- /**
- * Recursive search for nodes
- */
- let recursiveVal
- const recursiveTargetarr = (arr, targetId) => {
- for (const i in arr) {
- if (arr[i] === targetId) {
- recursiveVal = targetId
- } else {
- recursiveTargetarr(rtTargetarrArr(arr[i]), targetId)
- }
- }
- return recursiveVal
- }
-
- // Connection to connected nodes is not allowed
- if (_.findIndex(rtTargetarrArr(targetId), v => v === sourceId) !== -1) {
- return false
- }
-
- // Recursive form to find if the target Targetarr has a sourceId
- if (recursiveTargetarr(rtTargetarrArr(sourceId), targetId)) {
- return false
- }
-
- if ($(`#${sourceId}`).attr('data-tasks-type') === 'CONDITIONS' && $(`#${sourceId}`).attr('data-nodenumber') === 2) {
- return false
- } else {
- $(`#${sourceId}`).attr('data-nodenumber', Number($(`#${sourceId}`).attr('data-nodenumber')) + 1)
- }
-
- // Storage node dependency information
- saveTargetarr(sourceId, targetId)
-
- // Monitor whether to edit DAG
- store.commit('dag/setIsEditDag', true)
-
- return true
- })
-}
-/**
- * Backfill data processing
- */
-JSP.prototype.jspBackfill = function ({ connects, locations, largeJson }) {
- // Backfill nodes
- this.jsonHandle({
- largeJson: largeJson,
- locations: locations
- })
-
- const wNodes = jsPlumb.getSelector('.statemachine-demo .w')
-
- // Backfill line
- this.JspInstance.batch(() => {
- for (let i = 0; i < wNodes.length; i++) {
- this.initNode(wNodes[i])
- }
- _.map(connects, v => {
- let sourceId = v.endPointSourceId.split('-')
- let targetId = v.endPointTargetId.split('-')
- const labels = v.label
- if (sourceId.length === 4 && targetId.length === 4) {
- sourceId = `${sourceId[0]}-${sourceId[1]}-${sourceId[2]}`
- targetId = `${targetId[0]}-${targetId[1]}-${targetId[2]}`
- } else {
- sourceId = v.endPointSourceId
- targetId = v.endPointTargetId
- }
-
- if ($(`#${sourceId}`).attr('data-tasks-type') === 'CONDITIONS' && $(`#${sourceId}`).attr('data-successnode') === $(`#${targetId}`).find('.name-p').text()) {
- this.JspInstance.connect({
- source: sourceId,
- target: targetId,
- type: 'basic',
- paintStyle: { strokeWidth: 2, stroke: '#4caf50' },
- HoverPaintStyle: { stroke: '#ccc', strokeWidth: 3 },
- overlays: [['Label', { label: labels }]]
- })
- } else if ($(`#${sourceId}`).attr('data-tasks-type') === 'CONDITIONS' && $(`#${sourceId}`).attr('data-failednode') === $(`#${targetId}`).find('.name-p').text()) {
- this.JspInstance.connect({
- source: sourceId,
- target: targetId,
- type: 'basic',
- paintStyle: { strokeWidth: 2, stroke: '#252d39' },
- HoverPaintStyle: { stroke: '#ccc', strokeWidth: 3 },
- overlays: [['Label', { label: labels }]]
- })
- } else {
- this.JspInstance.connect({
- source: sourceId,
- target: targetId,
- type: 'basic',
- paintStyle: { strokeWidth: 2, stroke: '#2d8cf0' },
- HoverPaintStyle: { stroke: '#ccc', strokeWidth: 3 },
- overlays: [['Label', { label: labels }]]
- })
- }
- })
- })
-
- jsPlumb.fire('jsPlumbDemoLoaded', this.JspInstance)
-
- // Connection monitoring
- this.handleEvent()
-
- // Drag and drop new nodes
- this.draggable()
-}
-
-export default new JSP()
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/multiDrag.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/multiDrag.js
deleted file mode 100644
index a68c529374..0000000000
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/multiDrag.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.
- */
-import JSP from './jsPlumbHandle'
-/**
- * when and only ctrl or meta key pressing, we can select one or more dags to drag
- */
-export default function () {
- // init
- let selectableObjects = []
- JSP.JspInstance.clearDragSelection()
- let ctrlPress = false
-
- let nodes = null
- const $window = $(window)
-
- $window.bind('keydown', function (event) {
- if (event.ctrlKey || event.metaKey) {
- if (nodes) {
- nodes.unbind('mousedown', select)
- }
- nodes = $('.jtk-draggable')
- nodes.bind('mousedown', select)
- ctrlPress = true
- }
- })
- $window.bind('keyup', function (event) {
- clear()
- })
-
- function select (event) {
- if (ctrlPress && event.button === 0) {
- let index = null
- if ((index = selectableObjects.indexOf(this)) !== -1) {
- selectableObjects.splice(index, 1)
- JSP.JspInstance.removeFromDragSelection(this)
- $(this).css('border-color', '')
- } else {
- selectableObjects.push(this)
- JSP.JspInstance.addToDragSelection(this)
- $(this).css('border-color', '#4af')
- }
- }
- }
-
- function clear () {
- ctrlPress = false
- selectableObjects.map(item => {
- $(item).css('border-color', '')
- })
- selectableObjects = []
- JSP.JspInstance.clearDragSelection()
- }
-}
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js
deleted file mode 100755
index 34a23e8d2c..0000000000
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.
- */
-
-import _ from 'lodash'
-import i18n from '@/module/i18n'
-import store from '@/conf/home/store'
-
-/**
- * Node, to array
- */
-const rtTargetarrArr = (id) => {
- const ids = $(`#${id}`).attr('data-targetarr')
- return ids ? ids.split(',') : []
-}
-
-/**
- * Store node id to targetarr
- */
-const saveTargetarr = (valId, domId) => {
- const $target = $(`#${domId}`)
- const targetStr = $target.attr('data-targetarr') ? $target.attr('data-targetarr') + `,${valId}` : `${valId}`
- $target.attr('data-targetarr', targetStr)
-}
-
-const rtBantpl = () => {
- return ``
-}
-
-/**
- * return node html
- */
-const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType, runFlag, nodenumber, successNode, failedNode }) => {
- let tpl = ''
- tpl += ``
- tpl += '
'
- tpl += '
'
- tpl += `
`
- tpl += `
${name}`
- tpl += '
'
- tpl += '
'
- tpl += '
'
- if (runFlag === 'FORBIDDEN') {
- tpl += rtBantpl()
- }
- tpl += '
'
- tpl += '
'
-
- return tpl
-}
-
-/**
- * Get all tasks nodes
- */
-const tasksAll = () => {
- const a = []
- $('#canvas .w').each(function (idx, elem) {
- const e = $(elem)
- a.push({
- id: e.attr('id'),
- name: e.find('.name-p').text(),
- targetarr: e.attr('data-targetarr') || '',
- nodenumber: e.attr('data-nodenumber'),
- x: parseInt(e.css('left'), 10),
- y: parseInt(e.css('top'), 10)
- })
- })
- return a
-}
-
-/**
- * Determine if name is in the current dag map
- * rely dom / backfill
- */
-const isNameExDag = (name, rely) => {
- if (rely === 'dom') {
- return _.findIndex(tasksAll(), v => v.name === name) !== -1
- } else {
- return _.findIndex(store.state.dag.tasks, v => v.name === name) !== -1
- }
-}
-
-/**
- * Change svg line color
- */
-const setSvgColor = (e, color) => {
- // Traverse clear all colors
- $('.jtk-connector').each((i, o) => {
- _.map($(o)[0].childNodes, v => {
- if ($(v).attr('fill') === '#ccc') {
- $(v).attr('fill', '#2d8cf0')
- }
- if ($(v).attr('fill') === '#4caf50') {
- $(v).attr('fill', '#4caf50').attr('stroke', '#4caf50').attr('stroke-width', 2)
- $(v).prev().attr('stroke', '#4caf50').attr('stroke-width', 2)
- } else if ($(v).attr('fill') === '#252d39') {
- $(v).attr('stroke', '#252d39').attr('stroke-width', 2)
- $(v).prev().attr('stroke', '#252d39').attr('stroke-width', 2)
- } else {
- $(v).attr('stroke', '#2d8cf0').attr('stroke-width', 2)
- }
- })
- })
-
- // Add color to the selection
- _.map($(e.canvas)[0].childNodes, (v, i) => {
- if ($(v).attr('fill') === '#2d8cf0') {
- $(v).attr('fill', '#ccc')
- }
- $(v).attr('stroke', '#ccc')
- if ($(v).attr('class')) {
- $(v).attr('stroke-width', 2)
- }
- })
-}
-
-/**
- * Get all node ids
- */
-const allNodesId = () => {
- const idArr = []
- $('.w').each((i, o) => {
- const $obj = $(o)
- const $span = $obj.find('.name-p').text()
- if ($span) {
- idArr.push({
- id: $obj.attr('id'),
- name: $span
- })
- }
- })
- return idArr
-}
-/**
- * compute scale,because it cant get from jquery directly
- * @param el element
- * @returns {boolean|number}
- */
-const computeScale = function (el) {
- const matrix = el.css('transform')
- if (!matrix || matrix === 'none') {
- return false
- }
- const values = matrix.split('(')[1].split(')')[0].split(',')
- return Math.sqrt(values[0] * values[0] + values[1] * values[1])
-}
-
-export {
- rtTargetarrArr,
- saveTargetarr,
- rtTasksTpl,
- tasksAll,
- isNameExDag,
- setSvgColor,
- allNodesId,
- rtBantpl,
- computeScale
-}
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/_source/selectTenant.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/_source/selectTenant.vue
index e3611ba6a0..0a491f9aa5 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/_source/selectTenant.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/_source/selectTenant.vue
@@ -61,8 +61,11 @@
}
},
methods: {
- _onChange (o) {
- this.$emit('tenantSelectEvent', o)
+ _onChange (id) {
+ const tenant = this.itemList.find(item => item.id === id)
+ if (tenant) {
+ this.$emit('tenantSelectEvent', tenant.tenantCode)
+ }
}
},
watch: {
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue
index 9196e9670b..2d5af386b7 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/udp/udp.vue
@@ -42,7 +42,7 @@
{{$t('select tenant')}}
-
+
{{$t('warning of timeout')}}
@@ -117,8 +117,8 @@
syncDefine: true,
// Timeout alarm
timeout: 0,
-
- tenantId: -1,
+ // tenant code
+ tenantCode: 'default',
// checked Timeout alarm
checkedTimeout: true
}
@@ -150,7 +150,7 @@
this.store.commit('dag/setName', _.cloneDeep(this.name))
this.store.commit('dag/setTimeout', _.cloneDeep(this.timeout))
- this.store.commit('dag/setTenantId', _.cloneDeep(this.tenantId))
+ this.store.commit('dag/setTenantCode', _.cloneDeep(this.tenantCode))
this.store.commit('dag/setDesc', _.cloneDeep(this.description))
this.store.commit('dag/setSyncDefine', this.syncDefine)
this.store.commit('dag/setReleaseState', this.releaseState)
@@ -257,10 +257,10 @@
this.timeout = dag.timeout || 0
this.checkedTimeout = this.timeout !== 0
this.$nextTick(() => {
- if (dag.tenantId > -1) {
- this.tenantId = dag.tenantId
- } else if (this.store.state.user.userInfo.tenantId) {
- this.tenantId = this.store.state.user.userInfo.tenantId
+ if (dag.tenantCode) {
+ this.tenantCode = dag.tenantCode
+ } else {
+ this.tenantCode = this.store.state.user.userInfo.tenantCode || 'default'
}
})
},
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue
index 65510bf69b..1a5cc63043 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue
@@ -53,7 +53,7 @@
// Promise Get node needs data
Promise.all([
// Node details
- this.getProcessDetails(this.$route.params.id),
+ this.getProcessDetails(this.$route.params.code),
// get process definition
this.getProcessList(),
// get project
@@ -69,8 +69,8 @@
this.getTenantList()
]).then((data) => {
let item = data[0]
- this.setIsDetails(item.releaseState === 'ONLINE')
- this.releaseState = item.releaseState
+ this.setIsDetails(item.processDefinition.releaseState === 'ONLINE')
+ this.releaseState = item.processDefinition.releaseState
this.isLoading = false
// Whether to pop up the box?
Affirm.init(this.$root)
@@ -82,7 +82,7 @@
* Redraw (refresh operation)
*/
_reset () {
- this.getProcessDetails(this.$route.params.id).then(res => {
+ this.getProcessDetails(this.$route.params.code).then(res => {
let item = res
this.setIsDetails(item.releaseState === 'ONLINE')
this.releaseState = item.releaseState
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue
index bf4eefd794..fe55531ac2 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue
@@ -25,7 +25,7 @@
{{ scope.row.name }}
-
+
{{scope.row.name}}
@@ -256,7 +256,7 @@
}
// remove one
this.deleteDefinition({
- processDefinitionId: item.id
+ code: item.code
}).then(res => {
this._onUpdate()
this.$message.success(res.msg)
@@ -268,14 +268,14 @@
* edit
*/
_edit (item) {
- this.$router.push({ path: `/projects/${this.projectId}/definition/list/${item.id}` })
+ this.$router.push({ path: `/projects/${this.projectCode}/definition/list/${item.code}` })
},
/**
* Offline
*/
_downline (item) {
this._upProcessState({
- processId: item.id,
+ ...item,
releaseState: 'OFFLINE'
})
},
@@ -284,7 +284,7 @@
*/
_poponline (item) {
this._upProcessState({
- processId: item.id,
+ ...item,
releaseState: 'ONLINE'
})
},
@@ -520,7 +520,7 @@
mounted () {
},
computed: {
- ...mapState('dag', ['projectId'])
+ ...mapState('dag', ['projectId', 'projectCode'])
},
components: { mVersions, mStart, mTiming, mRelatedItems }
}
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue
index 982a15664b..04548681c0 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue
@@ -265,7 +265,7 @@
}
}
let param = {
- processDefinitionId: this.startData.id,
+ processDefinitionCode: this.startData.code,
scheduleTime: this.scheduleTime.length && this.scheduleTime.join(',') || '',
failureStrategy: this.failureStrategy,
warningType: this.warningType,
@@ -319,7 +319,7 @@
}
},
_getGlobalParams () {
- this.store.dispatch('dag/getProcessDetails', this.startData.id).then(res => {
+ this.store.dispatch('dag/getProcessDetails', this.startData.code).then(res => {
this.definitionGlobalParams = _.cloneDeep(this.store.state.dag.globalParams)
this.udpList = _.cloneDeep(this.store.state.dag.globalParams)
})
diff --git a/dolphinscheduler-ui/src/js/conf/home/router/index.js b/dolphinscheduler-ui/src/js/conf/home/router/index.js
index f73dba2abb..a0f7ce4b37 100644
--- a/dolphinscheduler-ui/src/js/conf/home/router/index.js
+++ b/dolphinscheduler-ui/src/js/conf/home/router/index.js
@@ -92,7 +92,7 @@ const router = new Router({
}
},
{
- path: '/projects/:projectId/kinship',
+ path: '/projects/:projectCode/kinship',
name: 'projects-kinship',
component: resolve => require(['../pages/projects/pages/kinship/index'], resolve),
meta: {
@@ -101,7 +101,7 @@ const router = new Router({
}
},
{
- path: '/projects/:projectId/definition',
+ path: '/projects/:projectCode/definition',
name: 'definition',
component: resolve => require(['../pages/projects/pages/definition/index'], resolve),
meta: {
@@ -113,7 +113,7 @@ const router = new Router({
},
children: [
{
- path: '/projects/:projectId/definition/list',
+ path: '/projects/:projectCode/definition/list',
name: 'projects-definition-list',
component: resolve => require(['../pages/projects/pages/definition/pages/list/index'], resolve),
meta: {
@@ -122,7 +122,7 @@ const router = new Router({
}
},
{
- path: '/projects/:projectId/definition/list/:id',
+ path: '/projects/:projectCode/definition/list/:code',
name: 'projects-definition-details',
component: resolve => require(['../pages/projects/pages/definition/pages/details/index'], resolve),
meta: {
@@ -131,7 +131,7 @@ const router = new Router({
}
},
{
- path: '/projects/:projectId/definition/create',
+ path: '/projects/:projectCode/definition/create',
name: 'definition-create',
component: resolve => require(['../pages/projects/pages/definition/pages/create/index'], resolve),
meta: {
@@ -139,7 +139,7 @@ const router = new Router({
}
},
{
- path: '/projects/:projectId/definition/tree/:id',
+ path: '/projects/:projectCode/definition/tree/:id',
name: 'definition-tree-view-index',
component: resolve => require(['../pages/projects/pages/definition/pages/tree/index'], resolve),
meta: {
@@ -148,7 +148,7 @@ const router = new Router({
}
},
{
- path: '/projects/:projectId/definition/list/timing/:code',
+ path: '/projects/:projectCode/definition/list/timing/:code',
name: 'definition-timing-details',
component: resolve => require(['../pages/projects/pages/definition/timing/index'], resolve),
meta: {
@@ -159,7 +159,7 @@ const router = new Router({
]
},
{
- path: '/projects/:projectId/instance',
+ path: '/projects/:projectCode/instance',
name: 'instance',
component: resolve => require(['../pages/projects/pages/instance/index'], resolve),
meta: {
@@ -170,7 +170,7 @@ const router = new Router({
},
children: [
{
- path: '/projects/:projectId/instance/list',
+ path: '/projects/:projectCode/instance/list',
name: 'projects-instance-list',
component: resolve => require(['../pages/projects/pages/instance/pages/list/index'], resolve),
meta: {
@@ -179,7 +179,7 @@ const router = new Router({
}
},
{
- path: '/projects/:projectId/instance/list/:id',
+ path: '/projects/:projectCode/instance/list/:id',
name: 'projects-instance-details',
component: resolve => require(['../pages/projects/pages/instance/pages/details/index'], resolve),
meta: {
@@ -188,7 +188,7 @@ const router = new Router({
}
},
{
- path: '/projects/:projectId/instance/gantt/:id',
+ path: '/projects/:projectCode/instance/gantt/:id',
name: 'instance-gantt-index',
component: resolve => require(['../pages/projects/pages/instance/pages/gantt/index'], resolve),
meta: {
@@ -199,7 +199,7 @@ const router = new Router({
]
},
{
- path: '/projects/:projectId/task-instance',
+ path: '/projects/:projectCode/task-instance',
name: 'task-instance',
component: resolve => require(['../pages/projects/pages/taskInstance'], resolve),
meta: {
@@ -209,7 +209,7 @@ const router = new Router({
},
{
- path: '/projects/:projectId/task-record',
+ path: '/projects/:projectCode/task-record',
name: 'task-record',
component: resolve => require(['../pages/projects/pages/taskRecord'], resolve),
meta: {
@@ -218,7 +218,7 @@ const router = new Router({
}
},
{
- path: '/projects/:projectId/history-task-record',
+ path: '/projects/:projectCode/history-task-record',
name: 'history-task-record',
component: resolve => require(['../pages/projects/pages/historyTaskRecord'], resolve),
meta: {
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 63bce501d2..9ac787d521 100644
--- a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js
+++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js
@@ -19,32 +19,13 @@ import _ from 'lodash'
import io from '@/module/io'
import { tasksState } from '@/conf/home/pages/dag/_source/config'
-// delete 'definitionList' from tasks
-const deleteDefinitionList = (tasks) => {
- const newTasks = []
- tasks.forEach(item => {
- const newItem = Object.assign({}, item)
- if (newItem.dependence && newItem.dependence.dependTaskList) {
- newItem.dependence.dependTaskList.forEach(dependTaskItem => {
- if (dependTaskItem.dependItemList) {
- dependTaskItem.dependItemList.forEach(dependItem => {
- Reflect.deleteProperty(dependItem, 'definitionList')
- })
- }
- })
- }
- newTasks.push(newItem)
- })
- return newTasks
-}
-
export default {
/**
* Task status acquisition
*/
getTaskState ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/instance/task-list-by-process-id`, {
+ io.get(`projects/${state.projectCode}/instance/task-list-by-process-id`, {
processInstanceId: payload
}, res => {
const arr = _.map(res.data.taskList, v => {
@@ -69,8 +50,9 @@ export default {
*/
editProcessState ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.post(`projects/${state.projectName}/process/release`, {
- processId: payload.processId,
+ io.post(`projects/${state.projectCode}/process/release`, {
+ code: payload.code,
+ name: payload.name,
releaseState: payload.releaseState
}, res => {
resolve(res)
@@ -85,7 +67,7 @@ export default {
*/
getProcessDefinitionVersionsPage ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/versions`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/versions`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@@ -98,7 +80,7 @@ export default {
*/
switchProcessDefinitionVersion ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/version/switch`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/version/switch`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@@ -111,7 +93,7 @@ export default {
*/
deleteProcessDefinitionVersion ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/version/delete`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/version/delete`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@@ -139,7 +121,7 @@ export default {
*/
verifDAGName ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/verify-name`, {
+ io.get(`projects/${state.projectCode}/process/verify-name`, {
name: payload
}, res => {
state.name = payload
@@ -155,36 +137,45 @@ export default {
*/
getProcessDetails ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/select-by-id`, {
- processId: payload
+ io.get(`projects/${state.projectCode}/process/select-by-code`, {
+ code: payload
}, res => {
// process definition code
- state.code = res.data.code
+ state.code = res.data.processDefinition.code
// version
- state.version = res.data.version
+ state.version = res.data.processDefinition.version
// name
- state.name = res.data.name
+ state.name = res.data.processDefinition.name
// description
- state.description = res.data.description
- // connects
- state.connects = JSON.parse(res.data.connects)
+ state.description = res.data.processDefinition.description
+ // taskRelationJson
+ state.connects = res.data.processTaskRelationList
// locations
- state.locations = JSON.parse(res.data.locations)
- // Process definition
- const processDefinitionJson = JSON.parse(res.data.processDefinitionJson)
- // tasks info
- state.tasks = processDefinitionJson.tasks
- // tasks cache
- state.cacheTasks = {}
- processDefinitionJson.tasks.forEach(v => {
- state.cacheTasks[v.id] = v
- })
+ state.locations = JSON.parse(res.data.processDefinition.locations)
// global params
- state.globalParams = processDefinitionJson.globalParams
+ state.globalParams = res.data.processDefinition.globalParamList
// timeout
- state.timeout = processDefinitionJson.timeout
-
- state.tenantId = processDefinitionJson.tenantId
+ state.timeout = res.data.processDefinition.timeout
+ // tenantId
+ state.tenantCode = res.data.processDefinition.tenantCode
+ // tasks info
+ state.tasks = res.data.taskDefinitionList.map(task => _.pick(task, [
+ 'code',
+ 'name',
+ 'version',
+ 'description',
+ 'delayTime',
+ 'taskType',
+ 'taskParams',
+ 'flag',
+ 'taskPriority',
+ 'workerGroup',
+ 'failRetryTimes',
+ 'failRetryInterval',
+ 'timeoutFlag',
+ 'timeoutNotifyStrategy',
+ 'timeout'
+ ]))
resolve(res.data)
}).catch(res => {
reject(res)
@@ -197,7 +188,7 @@ export default {
*/
copyProcess ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.post(`projects/${state.projectName}/process/copy`, {
+ io.post(`projects/${state.projectCode}/process/copy`, {
processDefinitionIds: payload.processDefinitionIds,
targetProjectId: payload.targetProjectId
}, res => {
@@ -213,7 +204,7 @@ export default {
*/
moveProcess ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.post(`projects/${state.projectName}/process/move`, {
+ io.post(`projects/${state.project}/process/move`, {
processDefinitionIds: payload.processDefinitionIds,
targetProjectId: payload.targetProjectId
}, res => {
@@ -242,37 +233,46 @@ export default {
*/
getInstancedetail ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/instance/select-by-id`, {
+ io.get(`projects/${state.projectCode}/instance/select-by-id`, {
processInstanceId: payload
}, res => {
+ const { processDefinition, processTaskRelationList, taskDefinitionList } = res.data.dagData
// code
- state.code = res.data.processDefinitionCode
+ state.code = processDefinition.code
// version
- state.version = res.data.processDefinitionVersion
+ state.version = processDefinition.version
// name
state.name = res.data.name
// desc
- state.description = res.data.description
+ state.description = processDefinition.description
// connects
- state.connects = JSON.parse(res.data.connects)
+ state.connects = processTaskRelationList
// locations
- state.locations = JSON.parse(res.data.locations)
- // process instance
- const processInstanceJson = JSON.parse(res.data.processInstanceJson)
- // tasks info
- state.tasks = processInstanceJson.tasks
- // tasks cache
- state.cacheTasks = {}
- processInstanceJson.tasks.forEach(v => {
- state.cacheTasks[v.id] = v
- })
+ state.locations = JSON.parse(processDefinition.locations)
// global params
- state.globalParams = processInstanceJson.globalParams
+ state.globalParams = processDefinition.globalParamList
// timeout
- state.timeout = processInstanceJson.timeout
-
- state.tenantId = processInstanceJson.tenantId
-
+ state.timeout = processDefinition.timeout
+ // tenantCode
+ state.tenantCode = res.data.tenantCode
+ // tasks info
+ state.tasks = taskDefinitionList.map(task => _.pick(task, [
+ 'code',
+ 'name',
+ 'version',
+ 'description',
+ 'delayTime',
+ 'taskType',
+ 'taskParams',
+ 'flag',
+ 'taskPriority',
+ 'workerGroup',
+ 'failRetryTimes',
+ 'failRetryInterval',
+ 'timeoutFlag',
+ 'timeoutNotifyStrategy',
+ 'timeout'
+ ]))
// startup parameters
state.startup = _.assign(state.startup, _.pick(res.data, ['commandType', 'failureStrategy', 'processInstancePriority', 'workerGroup', 'warningType', 'warningGroupId', 'receivers', 'receiversCc']))
state.startup.commandParam = JSON.parse(res.data.commandParam)
@@ -288,18 +288,15 @@ export default {
*/
saveDAGchart ({ state }, payload) {
return new Promise((resolve, reject) => {
- const data = {
- globalParams: state.globalParams,
- tasks: deleteDefinitionList(state.tasks),
- tenantId: state.tenantId,
- timeout: state.timeout
- }
- io.post(`projects/${state.projectName}/process/save`, {
- processDefinitionJson: JSON.stringify(data),
+ io.post(`projects/${state.projectCode}/process/save`, {
+ locations: JSON.stringify(state.locations),
name: _.trim(state.name),
+ taskDefinitionJson: JSON.stringify(state.tasks),
+ taskRelationJson: JSON.stringify(state.connects),
+ tenantCode: state.tenantCode,
description: _.trim(state.description),
- locations: JSON.stringify(state.locations),
- connects: JSON.stringify(state.connects)
+ globalParams: JSON.stringify(state.globalParams),
+ timeout: state.timeout
}, res => {
resolve(res)
}).catch(e => {
@@ -312,20 +309,17 @@ export default {
*/
updateDefinition ({ state }, payload) {
return new Promise((resolve, reject) => {
- const data = {
- globalParams: state.globalParams,
- tasks: deleteDefinitionList(state.tasks),
- tenantId: state.tenantId,
- timeout: state.timeout
- }
- io.post(`projects/${state.projectName}/process/update`, {
- processDefinitionJson: JSON.stringify(data),
+ io.post(`projects/${state.projectCode}/process/update`, {
locations: JSON.stringify(state.locations),
- connects: JSON.stringify(state.connects),
name: _.trim(state.name),
+ taskDefinitionJson: JSON.stringify(state.tasks),
+ taskRelationJson: JSON.stringify(state.connects),
+ tenantCode: state.tenantCode,
description: _.trim(state.description),
- id: payload,
- releaseState: state.releaseState
+ globalParams: JSON.stringify(state.globalParams),
+ timeout: state.timeout,
+ releaseState: state.releaseState,
+ code: payload
}, res => {
resolve(res)
state.isEditDag = false
@@ -345,7 +339,7 @@ export default {
tenantId: state.tenantId,
timeout: state.timeout
}
- io.post(`projects/${state.projectName}/instance/update`, {
+ io.post(`projects/${state.projectCode}/instance/update`, {
processInstanceJson: JSON.stringify(data),
locations: JSON.stringify(state.locations),
connects: JSON.stringify(state.connects),
@@ -368,7 +362,7 @@ export default {
resolve()
return
}
- io.get(`projects/${state.projectName}/process/list`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/list`, payload, res => {
state.processListS = res.data
resolve(res.data)
}).catch(res => {
@@ -381,7 +375,7 @@ export default {
*/
getProcessListP ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/list-paging`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/list-paging`, payload, res => {
resolve(res.data)
}).catch(res => {
reject(res)
@@ -410,7 +404,7 @@ export default {
*/
getProcessByProjectId ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/queryProcessDefinitionAllByProjectId`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/queryProcessDefinitionAllByProjectId`, payload, res => {
resolve(res.data)
}).catch(res => {
reject(res)
@@ -474,7 +468,7 @@ export default {
*/
getProcessInstance ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/instance/list-paging`, payload, res => {
+ io.get(`projects/${state.projectCode}/instance/list-paging`, payload, res => {
state.instanceListS = res.data.totalList
resolve(res.data)
}).catch(res => {
@@ -531,7 +525,7 @@ export default {
*/
getSubProcessId ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/instance/select-sub-process`, payload, res => {
+ io.get(`projects/${state.projectCode}/instance/select-sub-process`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@@ -628,7 +622,7 @@ export default {
*/
deleteInstance ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/instance/delete`, payload, res => {
+ io.get(`projects/${state.projectCode}/instance/delete`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@@ -640,7 +634,7 @@ export default {
*/
batchDeleteInstance ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/instance/batch-delete`, payload, res => {
+ io.get(`projects/${state.projectCode}/instance/batch-delete`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@@ -652,7 +646,7 @@ export default {
*/
deleteDefinition ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/delete`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/delete`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@@ -664,7 +658,7 @@ export default {
*/
batchDeleteDefinition ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/batch-delete`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/batch-delete`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@@ -696,7 +690,7 @@ export default {
}
}
- io.get(`projects/${state.projectName}/process/export`, { processDefinitionIds: payload.processDefinitionIds }, res => {
+ io.get(`projects/${state.projectCode}/process/export`, { processDefinitionIds: payload.processDefinitionIds }, res => {
downloadBlob(res, payload.fileName)
}, e => {
@@ -710,7 +704,7 @@ export default {
*/
getViewvariables ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/instance/view-variables`, payload, res => {
+ io.get(`projects/${state.projectCode}/instance/view-variables`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@@ -734,7 +728,7 @@ export default {
*/
getTaskInstanceList ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/task-instance/list-paging`, payload, res => {
+ io.get(`projects/${state.projectCode}/task-instance/list-paging`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@@ -746,7 +740,7 @@ export default {
*/
forceTaskSuccess ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.post(`projects/${state.projectName}/task-instance/force-success`, payload, res => {
+ io.post(`projects/${state.projectCode}/task-instance/force-success`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@@ -782,7 +776,7 @@ export default {
*/
getViewTree ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/view-tree`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/view-tree`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@@ -794,7 +788,7 @@ export default {
*/
getViewGantt ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/instance/view-gantt`, payload, res => {
+ io.get(`projects/${state.projectCode}/instance/view-gantt`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@@ -806,7 +800,7 @@ export default {
*/
getProcessTasksList ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/gen-task-list`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/gen-task-list`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@@ -815,7 +809,7 @@ export default {
},
getTaskListDefIdAll ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.get(`projects/${state.projectName}/process/get-task-list`, payload, res => {
+ io.get(`projects/${state.projectCode}/process/get-task-list`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@@ -842,5 +836,14 @@ export default {
reject(e)
})
})
+ },
+ genTaskCodeList ({ state }, payload) {
+ return new Promise((resolve, reject) => {
+ io.get(`projects/${state.projectCode}/task/gen-task-code-list`, payload, res => {
+ resolve(res.data)
+ }).catch(e => {
+ reject(e)
+ })
+ })
}
}
diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js
index 010a860347..b974fed118 100755
--- a/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js
+++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js
@@ -64,10 +64,10 @@ export default {
state.timeout = payload
},
/**
- * set tenantId
+ * set tenantCode
*/
- setTenantId (state, payload) {
- state.tenantId = payload
+ setTenantCode (state, payload) {
+ state.tenantCode = payload
},
/**
* set global params
@@ -108,13 +108,12 @@ export default {
* reset params
*/
resetParams (state, payload) {
- $('#canvas').html('')
state.globalParams = (payload && payload.globalParams) || []
state.tasks = (payload && payload.tasks) || []
state.name = (payload && payload.name) || ''
state.description = (payload && payload.description) || ''
state.timeout = (payload && payload.timeout) || 0
- state.tenantId = (payload && payload.tenantId) || -1
+ state.tenantCode = (payload && payload.tenantCode) || ''
state.processListS = (payload && payload.processListS) || []
state.resourcesListS = (payload && payload.resourcesListS) || []
state.resourcesListJar = (payload && payload.resourcesListJar) || []
@@ -126,48 +125,23 @@ export default {
},
/**
* add task
- * object {}
+ * @param {Task} task
*/
- addTasks (state, payload) {
- const i = _.findIndex(state.tasks, v => v.id === payload.id)
+ addTask (state, task) {
+ const i = _.findIndex(state.tasks, v => v.code === task.code)
if (i !== -1) {
- state.tasks[i] = Object.assign(state.tasks[i], {}, payload)
+ state.tasks[i] = Object.assign(state.tasks[i], {}, task)
} else {
- state.tasks.push(payload)
+ state.tasks.push(task)
}
- if (state.cacheTasks[payload.id]) {
- state.cacheTasks[payload.id] = Object.assign(state.cacheTasks[payload.id], {}, payload)
- } else {
- state.cacheTasks[payload.id] = payload
- }
- const dom = $(`#${payload.id}`)
- state.locations[payload.id] = _.assign(state.locations[payload.id], {
- name: dom.find('.name-p').text(),
- targetarr: dom.attr('data-targetarr'),
- nodenumber: dom.attr('data-nodenumber'),
- x: parseInt(dom.css('left'), 10),
- y: parseInt(dom.css('top'), 10)
- })
- },
- addConnects (state, payload) {
- state.connects = _.map(state.connects, v => {
- if (v.endPointSourceId === payload.sourceId && v.endPointTargetId === payload.targetId) {
- v.label = payload.labelName
- }
- return v
- })
},
/**
- * Cache the input
- * @param state
- * @param payload
+ * remove task
+ * @param {object} state
+ * @param {string} code
*/
- cacheTasks (state, payload) {
- if (state.cacheTasks[payload.id]) {
- state.cacheTasks[payload.id] = Object.assign(state.cacheTasks[payload.id], {}, payload)
- } else {
- state.cacheTasks[payload.id] = payload
- }
+ removeTask (state, code) {
+ state.tasks = state.tasks.filter(task => task.code !== code)
},
resetLocalParam (state, payload) {
const tasks = state.tasks
diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js
index 4843ad97e3..b04c54f4c5 100644
--- a/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js
+++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js
@@ -39,11 +39,11 @@ export default {
cacheTasks: {},
// Timeout alarm
timeout: 0,
- // tenant id
- tenantId: -1,
+ // tenant code
+ tenantCode: '',
// Node location information
locations: {},
- // Node-to-node connection
+ // Node relations
connects: [],
// Running sign
runFlag: '',