Browse Source

Restore constants to variables

pull/3/MERGE
break60 4 years ago
parent
commit
6d1b45c14a
  1. 11
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js
  2. 16
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js
  3. 4
      dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js

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

@ -478,9 +478,9 @@ JSP.prototype.handleEventRemove = function () {
JSP.prototype.removeNodes = function ($id) { JSP.prototype.removeNodes = function ($id) {
// Delete node processing(data-targetarr) // Delete node processing(data-targetarr)
_.map(tasksAll(), v => { _.map(tasksAll(), v => {
const targetarr = v.targetarr.split(',') let targetarr = v.targetarr.split(',')
if (targetarr.length) { if (targetarr.length) {
const newArr = _.filter(targetarr, v1 => v1 !== $id) let newArr = _.filter(targetarr, v1 => v1 !== $id)
$(`#${v.id}`).attr('data-targetarr', newArr.toString()) $(`#${v.id}`).attr('data-targetarr', newArr.toString())
} }
}) })
@ -496,8 +496,7 @@ JSP.prototype.removeNodes = function ($id) {
_.map(this.JspInstance.getConnections(), v => { _.map(this.JspInstance.getConnections(), v => {
connects.push({ connects.push({
endPointSourceId: v.sourceId, endPointSourceId: v.sourceId,
endPointTargetId: v.targetId, endPointTargetId: v.targetId
label: v._jsPlumb.overlays.label.canvas.innerText
}) })
}) })
// Storage line dependence // Storage line dependence
@ -512,8 +511,8 @@ JSP.prototype.removeConnect = function ($connect) {
return return
} }
// Remove connections and remove node and node dependencies // Remove connections and remove node and node dependencies
const targetId = $connect.targetId let targetId = $connect.targetId
const sourceId = $connect.sourceId let sourceId = $connect.sourceId
let targetarr = rtTargetarrArr(targetId) let targetarr = rtTargetarrArr(targetId)
if (targetarr.length) { if (targetarr.length) {
targetarr = _.filter(targetarr, v => v !== sourceId) targetarr = _.filter(targetarr, v => v !== sourceId)

16
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js

@ -23,7 +23,7 @@ import store from '@/conf/home/store'
* Node, to array * Node, to array
*/ */
const rtTargetarrArr = (id) => { const rtTargetarrArr = (id) => {
const ids = $(`#${id}`).attr('data-targetarr') let ids = $(`#${id}`).attr('data-targetarr')
return ids ? ids.split(',') : [] return ids ? ids.split(',') : []
} }
@ -31,8 +31,8 @@ const rtTargetarrArr = (id) => {
* Store node id to targetarr * Store node id to targetarr
*/ */
const saveTargetarr = (valId, domId) => { const saveTargetarr = (valId, domId) => {
const $target = $(`#${domId}`) let $target = $(`#${domId}`)
const targetStr = $target.attr('data-targetarr') ? $target.attr('data-targetarr') + `,${valId}` : `${valId}` let targetStr = $target.attr('data-targetarr') ? $target.attr('data-targetarr') + `,${valId}` : `${valId}`
$target.attr('data-targetarr', targetStr) $target.attr('data-targetarr', targetStr)
} }
@ -66,9 +66,9 @@ const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType, runFlag
* Get all tasks nodes * Get all tasks nodes
*/ */
const tasksAll = () => { const tasksAll = () => {
const a = [] let a = []
$('#canvas .w').each(function (idx, elem) { $('#canvas .w').each(function (idx, elem) {
const e = $(elem) let e = $(elem)
a.push({ a.push({
id: e.attr('id'), id: e.attr('id'),
name: e.find('.name-p').text(), name: e.find('.name-p').text(),
@ -117,10 +117,10 @@ const setSvgColor = (e, color) => {
* Get all node ids * Get all node ids
*/ */
const allNodesId = () => { const allNodesId = () => {
const idArr = [] let idArr = []
$('.w').each((i, o) => { $('.w').each((i, o) => {
const $obj = $(o) let $obj = $(o)
const $span = $obj.find('.name-p').text() let $span = $obj.find('.name-p').text()
if ($span) { if ($span) {
idArr.push({ idArr.push({
id: $obj.attr('id'), id: $obj.attr('id'),

4
dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js

@ -120,7 +120,7 @@ export default {
* object {} * object {}
*/ */
addTasks (state, payload) { addTasks (state, payload) {
const i = _.findIndex(state.tasks, v => v.id === payload.id) let i = _.findIndex(state.tasks, v => v.id === payload.id)
if (i !== -1) { if (i !== -1) {
state.tasks[i] = Object.assign(state.tasks[i], {}, payload) state.tasks[i] = Object.assign(state.tasks[i], {}, payload)
} else { } else {
@ -131,7 +131,7 @@ export default {
} else { } else {
state.cacheTasks[payload.id] = payload state.cacheTasks[payload.id] = payload
} }
const dom = $(`#${payload.id}`) let dom = $(`#${payload.id}`)
state.locations[payload.id] = _.assign(state.locations[payload.id], { state.locations[payload.id] = _.assign(state.locations[payload.id], {
name: dom.find('.name-p').text(), name: dom.find('.name-p').text(),
targetarr: dom.attr('data-targetarr'), targetarr: dom.attr('data-targetarr'),

Loading…
Cancel
Save