未验证 提交 afd5c75c 编写于 作者: Z zhukai 提交者: GitHub

Fix the bug #1968. (#1969)

When create a new task or edit an exist task.The task details window will be open.
Then if delete the task node or click the DataSource menu. And the task details window still open.

The task details window should be close.
上级 d7d7e954
...@@ -49,10 +49,16 @@ Dag.prototype.setConfig = function (o) { ...@@ -49,10 +49,16 @@ Dag.prototype.setConfig = function (o) {
* create dag * create dag
*/ */
Dag.prototype.create = function () { Dag.prototype.create = function () {
let self = this
jsPlumb.ready(() => { jsPlumb.ready(() => {
JSP.init({ JSP.init({
dag: this.dag, dag: this.dag,
instance: this.instance instance: this.instance,
options: {
onRemoveNodes ($id) {
self.dag.removeEventModelById($id)
}
}
}) })
// init event // init event
...@@ -282,10 +288,16 @@ Dag.prototype.backfill = function (arg) { ...@@ -282,10 +288,16 @@ Dag.prototype.backfill = function (arg) {
} }
locationsValue = dataObject locationsValue = dataObject
let self = this
jsPlumb.ready(() => { jsPlumb.ready(() => {
JSP.init({ JSP.init({
dag: this.dag, dag: this.dag,
instance: this.instance instance: this.instance,
options: {
onRemoveNodes ($id) {
self.dag.removeEventModelById($id)
}
}
}) })
// Backfill // Backfill
JSP.jspBackfill({ JSP.jspBackfill({
...@@ -298,10 +310,16 @@ Dag.prototype.backfill = function (arg) { ...@@ -298,10 +310,16 @@ Dag.prototype.backfill = function (arg) {
}) })
}) })
} else { } else {
let self = this
jsPlumb.ready(() => { jsPlumb.ready(() => {
JSP.init({ JSP.init({
dag: this.dag, dag: this.dag,
instance: this.instance instance: this.instance,
options: {
onRemoveNodes ($id) {
self.dag.removeEventModelById($id)
}
}
}) })
// Backfill // Backfill
JSP.jspBackfill({ JSP.jspBackfill({
......
...@@ -527,6 +527,11 @@ ...@@ -527,6 +527,11 @@
} }
}) })
}) })
},
removeEventModelById ($id) {
if(eventModel && this.taskId == $id){
eventModel.remove()
}
} }
}, },
watch: { watch: {
...@@ -580,6 +585,9 @@ ...@@ -580,6 +585,9 @@
clearInterval(this.setIntervalP) clearInterval(this.setIntervalP)
}, },
destroyed () { destroyed () {
if (eventModel) {
eventModel.remove()
}
}, },
computed: { computed: {
...mapState('dag', ['tasks', 'locations', 'connects', 'isEditDag', 'name']) ...mapState('dag', ['tasks', 'locations', 'connects', 'isEditDag', 'name'])
......
...@@ -58,11 +58,13 @@ let JSP = function () { ...@@ -58,11 +58,13 @@ let JSP = function () {
/** /**
* dag init * dag init
*/ */
JSP.prototype.init = function ({ dag, instance }) { JSP.prototype.init = function ({ dag, instance, options }) {
// Get the dag component instance // Get the dag component instance
this.dag = dag this.dag = dag
// Get jsplumb instance // Get jsplumb instance
this.JspInstance = instance this.JspInstance = instance
// Get JSP options
this.options = options || {}
// Register jsplumb connection type and configuration // Register jsplumb connection type and configuration
this.JspInstance.registerConnectionType('basic', { this.JspInstance.registerConnectionType('basic', {
anchor: 'Continuous', anchor: 'Continuous',
...@@ -494,6 +496,9 @@ JSP.prototype.removeNodes = function ($id) { ...@@ -494,6 +496,9 @@ JSP.prototype.removeNodes = function ($id) {
// delete dom // delete dom
$(`#${$id}`).remove() $(`#${$id}`).remove()
// callback onRemoveNodes event
this.options&&this.options.onRemoveNodes&&this.options.onRemoveNodes($id)
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册