sumitshinde-84 / node-red-dashboard-2-ui-webcam

The ui-webcam node for Node-RED Dashboard 2.0 enables users to integrate webcam functionality into Node-RED Dashboard 2.0. It allows users to capture images, select different cameras, and control webcam features through an intuitive user interface within the Node-RED Dashboard.
https://flows.nodered.org/node/@sumit_shinde_84/node-red-dashboard-2-ui-webcam
Apache License 2.0
0 stars 3 forks source link

msg from the previous node passing through ui-webcam. #11

Closed sumitshinde-84 closed 9 months ago

sumitshinde-84 commented 9 months ago

I have submitted #10 to add passthrou: { value: false } in ui-webcam.html default object. I have tested that locally; however, the message from the previous node is still passing through ui-webcam.

https://github.com/sumitshinde-84/node-red-dashboard-2-ui-webcam/assets/110285294/fc6e7a3e-ae64-422c-8dcc-a211e97900d5

sumitshinde-84 commented 9 months ago

Hi @joepavitt, could you please share your thoughts on this issue?

joepavitt commented 9 months ago

This is the same problem you had before with width and height, you need to nest the property inside the defaults object inside the ui-webcam.html

sumitshinde-84 commented 9 months ago

I have already added that property in the defaults object. , see https://github.com/sumitshinde-84/node-red-dashboard-2-ui-webcam/blob/e6bea7fcd8cabb54037fc818809d8638d561db48/nodes/ui-webcam.html#L20C8-L20C36

joepavitt commented 9 months ago

That isn't in the defaults object, that's in the higher Node config. The defaults object is: https://github.com/sumitshinde-84/node-red-dashboard-2-ui-webcam/blob/e6bea7fcd8cabb54037fc818809d8638d561db48/nodes/ui-webcam.html#L6-L16

sumitshinde-84 commented 9 months ago

Yes, I have also tried moving the passthrough between the width and group properties (in defaults obj).

https://github.com/sumitshinde-84/node-red-dashboard-2-ui-webcam/assets/110285294/60e4fac9-a6c3-4fa0-b9f0-5b63a513133e

joepavitt commented 9 months ago

Okay, so 2 things:

  1. You've not added it as an option in the Node Editor's options, e.g. from ui-dropdown.html in Dashboard 2.0:
<div class="form-row">
    <label style="width:auto" for="node-input-passthru"><i class="fa fa-arrow-right"></i> If <code>msg</code> arrives on input, pass through to output: </label>
    <input type="checkbox" checked id="node-input-passthru" style="display:inline-block; width:auto; vertical-align:top;">
</div>

This isn't the breaking problem, but worth noting nonetheless.

  1. You've also defined your own onInput event function in ui-webcam.js, which overrides the default behaviour we have in Dashboard 2.0, and which include the check for passthru. So you have two options here, remove your custom onInput, as you're not doing anything bespoke that the default handler doesn't already do, or implement the passthru logic yourself in your onInput function. I recommend removing your custom onInput.

I do appreciate though, this isn't an intuitive step given that you have to specify true for onAction, and it's not mentioned in the ui-example project that the onInput is overriding a default behaviour. I'll get the example improved.

sumitshinde-84 commented 9 months ago

Thanks, @joepavitt , for your suggestions. I will try to resolve the issue based on your suggestions. Also, I am pretty sure that the second suggestion which about onInput will work.