[ANNOUNCE] node-red-contrib-ui-contextmenu - typedinputs

Hi folks,

In another discussion we had an agreement to send a msg.event property on some of the UI nodes. So I also implemented that change in version 2.0.0 of the SVG node, which is not on NPM yet (which will be released this week)!

However the ContextMenu node searched its coordinates in the msg.position (hardcoded), instead of in ``msg.event`. To avoid that everybody needs to add Change nodes all over the place (to move the message fields), version 2.0.0 of the ContextMenu node has following changes:

  • It is possible to specify the X and Y coordinate values separately, as fixed coordinate value or as a specified input message field:

    image

  • The menu can now also be delivered in any specified input message field:

    image

    Or fixed as before:

    image

  • The readme file contains more examples and flows. I have also added the demo from @Paul-Reed to the readme, because it demonstrates nicely how the node can be used without the SVG node. Thanks Paul!

  • The example flows are now available via the flow editor "Import" menu:

    image

  • The input messages are now validated on the server side, which allows me to show some validation errors in the debug panel.

Would be nice if somebody could install this new version from Github, and test it:

npm install bartbutenaers/node-red-contrib-ui-contextmenu

I have added migration logic, so 'normally' the old hardcoded message fields should be automatically filled in into the typedinputs.

As soon as this node is on NPM, I will publish the SVG node.

Thanks!!!
Bart

2 Likes

Still works fine here, using contextmenu for a menu system (not using SVG).

1 Like

Works for me also. (as a new install)

I tried the context_menu_for_button example and - please remember that I am new to all this and lacking in understanding bunches of stuff - the help says that the output msg.sourceMsg will contain the original input message but the output I get is the x & y position from the input position object and _ui_cm_already_seen: true which is definitely not what I see as the source msg.

Would it be possible to explain how this should be used. (The basic outputs are obvious even to me :smiley:)

Thanks for the confirmation Paul!

Hi Jef (@Buckskin),
Thanks for testing!!! It is lately difficult to find testers, so all help is welcome ...
Seems you found a bug, which had sneaked into this version.
It is now fixed on Github:

image

Thank you, yep that fixed it. The only other issue I have (and it may not be related) when I installed the node I got this from the log. Any idea on what node-gyp is and why there should be all these warnings. The contextmenu node is working fine. If it makes any difference the instance of Node-Red I am using for this is running on Ubuntu 16.04 in a VMWare box on Windows 10

> pi@HomeAutomation:~/.node-red$ npm install bartbutenaers/node-red-contrib-ui-contextmenu
> 
> mdns@2.5.1 install /home/pi/.node-red/node_modules/mdns
> node-gyp rebuild
> 
> make: Entering directory '/home/pi/.node-red/node_modules/mdns/build'
>   CXX(target) Release/obj.target/dns_sd_bindings/src/dns_sd.o
> In file included from ../src/dns_sd.cpp:1:0:
> ../src/mdns.hpp:32:20: fatal error: dns_sd.h: No such file or directory
> compilation terminated.
> dns_sd_bindings.target.mk:168: recipe for target 'Release/obj.target/dns_sd_bindings/src/dns_sd.o' failed
> make: *** [Release/obj.target/dns_sd_bindings/src/dns_sd.o] Error 1
> make: Leaving directory '/home/pi/.node-red/node_modules/mdns/build'
> gyp ERR! build error
> gyp ERR! stack Error: `make` failed with exit code: 2
> gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:191:23)
> gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
> gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
> gyp ERR! System Linux 4.4.0-185-generic
> gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
> gyp ERR! cwd /home/pi/.node-red/node_modules/mdns
> gyp ERR! node -v v10.21.0
> gyp ERR! node-gyp -v v5.1.0
> gyp ERR! not ok
> npm WARN node-red-contrib-ui-led@0.3.1 requires a peer of node-red-dashboard@2.14.x but none is installed. You must install peer dependencies yourself.
> npm WARN node-red-project@0.0.1 No repository field.
> npm WARN node-red-project@0.0.1 No license field.
> npm WARN optional SKIPPING OPTIONAL DEPENDENCY: mdns@2.5.1 (node_modules/mdns):
> npm WARN optional SKIPPING OPTIONAL DEPENDENCY: mdns@2.5.1 install: `node-gyp rebuild`
> npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
> 
> + node-red-contrib-ui-contextmenu@2.0.0
> updated 1 package and audited 1043 packages in 36.708s
> 
> 18 packages are looking for funding
>   run `npm fund` for details
> 
> found 2 low severity vulnerabilities
>   run `npm audit fix` to fix them, or `npm audit` for details

Post edited by Moderator to format printout correctly. See How to share code or flow json

That I don't know.

The contextmenu node has no dependencies, as you can see in my package.json file.

That mdns package is about multicasting. I see here that e.g. node-red-contrib-googlehome uses it.

But if you want to solve that, please open another discussion. Otherwise my original question (to get testers) will vanish soon ...

1 Like

As of now it is available on NPM:

image

This topic was automatically closed after 60 days. New replies are no longer allowed.