Browse Source

Merge pull request #3472 from break60/1.3.2-release

[fix-3058][ui] Move rtTargetArr to jsPlumbHandle.js
pull/3/MERGE
xingchun-chen 4 years ago committed by GitHub
parent
commit
a48618dd24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js

17
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js

@ -688,12 +688,15 @@ JSP.prototype.saveStore = function () {
JSP.prototype.handleEvent = function () { JSP.prototype.handleEvent = function () {
this.JspInstance.bind('beforeDrop', function (info) { this.JspInstance.bind('beforeDrop', function (info) {
console.log(info) console.log(info)
const rtTargetArr = (id) => {
let ids = $(`#${id}`).attr('data-targetarr')
return ids ? ids.split(',') : []
}
let sourceId = info['sourceId']// 出 let sourceId = info['sourceId']// 出
let targetId = info['targetId']// 入 let targetId = info['targetId']// 入
console.log(sourceId,targetId) console.log(sourceId,targetId)
let rtTargetarr = rtTargetarrArr(targetId) let rtTargetArrs = rtTargetArr(targetId)
let rtSoucearr = rtTargetarrArr(sourceId) let rtSouceArrs = rtTargetArr(sourceId)
console.log(rtTargetarr,rtSoucearr)
/** /**
* When connecting, connection is prohibited when the sourceId and target nodes are empty * When connecting, connection is prohibited when the sourceId and target nodes are empty
*/ */
@ -710,7 +713,7 @@ JSP.prototype.handleEvent = function () {
if (arr[i] === targetId) { if (arr[i] === targetId) {
recursiveVal = targetId recursiveVal = targetId
} else { } else {
let targetArr = rtTargetarrArr(arr[i]) let targetArr = rtTargetArr(arr[i])
recursiveTargetarr(targetArr, targetId) recursiveTargetarr(targetArr, targetId)
} }
} }
@ -718,13 +721,13 @@ JSP.prototype.handleEvent = function () {
} }
// Connection to connected nodes is not allowed // Connection to connected nodes is not allowed
if (_.findIndex(rtTargetarr, v => v === sourceId) !== -1) { if (_.findIndex(rtTargetArrs, v => v === sourceId) !== -1) {
console.log(rtTargetarr,'not allowed') console.log(rtTargetArrs,'not allowed')
return false return false
} }
// Recursive form to find if the target Targetarr has a sourceId // Recursive form to find if the target Targetarr has a sourceId
if (recursiveTargetarr(rtSoucearr, targetId)) { if (recursiveTargetarr(rtSouceArrs, targetId)) {
console.log('has a sourceId') console.log('has a sourceId')
return false return false
} }

Loading…
Cancel
Save