Also debounce label

Not sure if that really works, I assume `form.trigger("change")` is
what's updating the label on the Node vue instance ?
This commit is contained in:
mvdbeek
2020-11-22 18:44:33 +01:00
parent 3781304830
commit 3c515fa7f0
2 changed files with 9 additions and 1 deletions
@@ -300,6 +300,14 @@ export default {
this.annotation = annotation;
}, 100);
},
setLabel(label) {
if (this.labelTimeout) {
clearTimeout(this.labelTimeout);
}
this.labelTimeout = setTimeout(() => {
this.label = label;
}, 100);
},
setData(data) {
this.config_form = data.config_form;
this.tool_state = data.tool_state;
@@ -133,6 +133,7 @@ function _addLabelAnnotation(self, node) {
help: _l("Add a step label."),
fixed: true,
onchange: function (new_label) {
node.setLabel(new_label);
let duplicate = false;
for (const i in workflow.nodes) {
const n = workflow.nodes[i];
@@ -148,7 +149,6 @@ function _addLabelAnnotation(self, node) {
"error_text",
duplicate && "Duplicate label. Please fix this before saving the workflow."
);
self.form.trigger("change");
},
});
}