Messaggio errore che esce dall'entry point
parent
d712a65326
commit
db86642364
|
|
@ -73,6 +73,9 @@
|
|||
var label = "";
|
||||
if (rule) {
|
||||
label = rule.v;
|
||||
if (label == "") {
|
||||
return "(empty)";
|
||||
}
|
||||
return label;
|
||||
}
|
||||
},
|
||||
|
|
@ -182,7 +185,7 @@
|
|||
selectField.change();
|
||||
|
||||
var currentOutputs = JSON.parse(outputCount.val() || "{}");
|
||||
currentOutputs[opt.hasOwnProperty('i') ? opt.i : opt._i] = i + 1;
|
||||
currentOutputs[opt.hasOwnProperty('i') ? opt.i : opt._i] = i;
|
||||
outputCount.val(JSON.stringify(currentOutputs));
|
||||
},
|
||||
removeItem: function (opt) {
|
||||
|
|
@ -196,7 +199,7 @@
|
|||
rules.each(function (i) {
|
||||
$(this).find(".node-input-rule-index").html(i + 1);
|
||||
var data = $(this).data('data');
|
||||
currentOutputs[data.hasOwnProperty('i') ? data.i : data._i] = i + 1;
|
||||
currentOutputs[data.hasOwnProperty('i') ? data.i : data._i] = i;
|
||||
});
|
||||
outputCount.val(JSON.stringify(currentOutputs));
|
||||
},
|
||||
|
|
@ -263,7 +266,7 @@
|
|||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-help_text"><i class="fa fa-ellipsis-h"></i> Help text:</label>
|
||||
<input type="text" id="node-input-property" style="width: 70%"/>
|
||||
<input type="text" id="node-input-help_text" style="width: 70%"/>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
|
@ -279,7 +282,7 @@
|
|||
help_text: {value: ""}
|
||||
},
|
||||
inputs: 1,
|
||||
outputs: 1,
|
||||
outputs: 2,
|
||||
label: function() {
|
||||
return this.name || "parser entry point";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ module.exports = function (RED) {
|
|||
function ParserEntryPoint(n) {
|
||||
RED.nodes.createNode(this, n);
|
||||
this.property = n.property;
|
||||
this.help_message = n.help_message;
|
||||
this.help_text = n.help_text;
|
||||
this.on("input", msg => {
|
||||
RED.util.evaluateNodeProperty(this.property, "msg", this, msg,
|
||||
(err, value) => {
|
||||
|
|
@ -16,9 +16,13 @@ module.exports = function (RED) {
|
|||
msg.token_parser = {
|
||||
new_tokens: tokens,
|
||||
consumed_tokens: [],
|
||||
help_message: this.help_message
|
||||
help_message: this.help_text,
|
||||
on_error: (maybe_error) => {
|
||||
let err = maybe_error ? maybe_error : this.help_text;
|
||||
this.send([undefined, err]);
|
||||
}
|
||||
};
|
||||
this.send(msg);
|
||||
this.send([msg, undefined]);
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
@ -56,7 +60,9 @@ module.exports = function (RED) {
|
|||
out.push(undefined);
|
||||
}
|
||||
}
|
||||
//out.push(n_matches == 0 ? msg : undefined);
|
||||
if (n_matches == 0) {
|
||||
msg.token_parser.on_error();
|
||||
}
|
||||
this.send(out);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue