bartbutenaers / node-red-contrib-ui-svg

A Node-RED widget node to show interactive SVG (vector graphics) in the dashboard
Apache License 2.0
94 stars 27 forks source link

Source "None of the specified bindings fields..." unclear #102

Closed EvertDekker closed 2 years ago

EvertDekker commented 2 years ago

Hi Bart, Thanks again for you amazing NR nodes.

When reloading a SVG page I get (sometimes) 1 or more error's None of the specified bindings fields (in the config screen or data-bind-text or data-bind-values) are available in this message. I understand what the error means, but during reloading of the svg page there are send 20+ message's to the svg node to refresh everything. Then is not clear to me what messages will give the error.

Request: Can you add some more info to the error, for example what message or binding field give the error?

bartbutenaers commented 2 years ago

Hi @EvertDekker, Hmmm not sure what kind of data to log.

  1. I cannot simply log the entire message, because some people inject large messages.
  2. I could log the message id, but that might not be enough info for you.
  3. I could add a checkbox to "log input entire input "message at the client". Which you can turn on temporarily to troubleshoot your faulty messages.
  4. Others?

Bart

EvertDekker commented 2 years ago

Hi Bart, Thanks for your reply.

  1. Your right that some people send all in one messages, that can be a problem.
  2. Message ID, i'm not sure if that help. Have to look if there's a way to trace back the message then.
  3. Can be a option, but same problem as no.1
  4. I'm not a really good Javascript programmer, more Vb, C, C++ . But what do you think about something like this changing at line >350. No idea if this is possible, just a thought.

`var counter = 0;

                                node.bindings.forEach(function (binding, index) {
                                    if (getNestedProperty(msg, binding.bindSource) !== undefined) {
                                        counter++;
                                    }
                                   else {
                                    node.error(binding.bindSource +  " is a unspecified binding Source.")
                                   }
                                });
                                node.attributeBasedBindings.forEach(function (binding, index) {
                                    if (getNestedProperty(msg, binding) !== undefined) {
                                        counter++;
                                    }
                                  else {
                                    node.error(binding +  " is a unspecified binding.")
                                   }
                                });

                                if (counter === 0) {
                                    node.error("None of the specified bindings fields (in the config screen or data-bind-text or data-bind-values) are available in this message.");
                                    msg.payload = null;
                                }`
bartbutenaers commented 2 years ago
  1. Message ID, i'm not sure if that help. Have to look if there's a way to trace back the message then.

In that case you need to add (temporarily) a debug message, to display your SVG node's input messages:

image

When I log those message id's, you can look in your debug sidebar panel, to see about which message the error log is talking.

  1. Can be a option, but same problem as no.1

Yes but in this case it is optionally available. You only activate it when you want to troubleshoot something, like you are trying to do currently...

  1. No idea if this is possible, just a thought.

The node.error wouldn't work because that is server-side available only. But I get your point. However in this case you could get a LOT of useless logging. Suppose e.g. you have 10 bindings, and an input message contains one of those binding fields. But in that case you would get 10 - 1 = 9 log lines for all bindings which don't correspond to a field in the input msg...

EvertDekker commented 2 years ago

Hi Bart, Clear, thanks for the explanation of all pros and cons. Then I think that option 2, message Id is the most logic solution.

regards, evert

bartbutenaers commented 2 years ago

@EvertDekker, Can you please install the node from Github, and let me know if option is enough to troubleshoot your issue? From within your .node-red folder:

npm install bartbutenaers/node-red-contrib-ui-svg
bartbutenaers commented 2 years ago

Evert, The option with the message id's in the error messages has been published as version 2.3.1. See point 5 of the troubleshooting section for an example. Please reopen this issue when this is not sufficient to solve your problem.

EvertDekker commented 2 years ago

Bart,

Sorry, missed your previous post. Thanks for adding the request to your Nr node.

bartbutenaers commented 2 years ago

Hi Evert, No problem. Don't hesitate to reopen if this solution is not sufficient!