Closed bartbutenaers closed 10 months ago
It would be nice if the new timeout defaults to 0 instead of empty when editing an existing block
I added some debugging and added in a test for undefined and that seems to cure it but there's probably better way of handing it
Otherwise - it's OK with me :)
Weird, the other 2 conditions in that if statement worked fine in my setup (to show timeout 0
for existing nodes).
Anyway I have copied your fix.
Version 2.2.0 is now available in the palette.
Thanks again!!
Having issues editing on my WIn11 NR instance - all OK if I switch back to 2.0.1
Editing is being ignored and sometimes no code visible at all and NR tab locked up - having to use F5 to recover :(
Will test more tomorrow and see if I can narrow it down
And you did not have these issues with the version (2.1.0) from yesterday?
Any errors in the browser console log?
I don't have any issues on my Windows 10 portable.
I've created a new instance with just Blockly node added and getting editing issues starting with 2.1.0
Node can be edited fine using 2.0.1
[{"id":"5cb6b1a1023f9c2e","type":"inject","z":"154e449d05b9191e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":440,"y":80,"wires":[["bf4da0b4b23e3698"]]},{"id":"6bfa5aa353a86acb","type":"debug","z":"154e449d05b9191e","name":"debug 142","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":80,"wires":[]},{"id":"bf4da0b4b23e3698","type":"Blockly","z":"154e449d05b9191e","func":"var data, temp;\n\nfunction convertValueToByte(value) {\n if (isNaN(value)) {\n return value.charCodeAt(0);\n } else {\n if (Buffer.isBuffer(value)) {\n return value[0];\n } else {\n if (value == \" \") {\n return value.charCodeAt(0);\n } else {\n return Math.min(Math.max(value, 0),255);\n }\n }\n }\n}\n\n// Describe this function...\nfunction reverseBuffer(data) {\n temp = (Buffer.alloc(4));\n temp[1 - 1] = convertValueToByte((data[4 - 1]));\n temp[2 - 1] = convertValueToByte((data[3 - 1]));\n temp[3 - 1] = convertValueToByte((data[2 - 1]));\n temp[4 - 1] = convertValueToByte((data[1 - 1]));\n return temp;\n}\n\n\nmsg['payload'] = (Buffer.from('DEC0DA6E', \"hex\"));\nnode.send([msg]);\n","workspaceXml":"<xml xmlns=\"https://developers.google.com/blockly/xml\">\n <variables>\n <variable id=\"]Xmxdbb9Gpc^=Gfbgabt\">data</variable>\n <variable id=\"SMNv-YVEMih?#X%bsrl7\">temp</variable>\n </variables>\n <block type=\"node_object_set\" id=\"@t}1mR:f!pbTXf[w/cGx\" x=\"-1262\" y=\"-1113\">\n <value name=\"object_field\">\n <shadow type=\"node_msg\" id=\"QaE2~Wa;2F2n/Q5!fAm-\"></shadow>\n </value>\n <value name=\"field_name\">\n <shadow type=\"text\" id=\"!w3niL}b)d[oqe,kbl3J\">\n <field name=\"TEXT\">payload</field>\n </shadow>\n </value>\n <value name=\"value_field\">\n <shadow type=\"text\" id=\"A0uSBlAlea]Ae2d!O7{a\">\n <field name=\"TEXT\"></field>\n </shadow>\n <block type=\"procedures_callreturn\" id=\"vr5^x~d{2i}_9d0wYJd9\">\n <mutation name=\"reverseBuffer\">\n <arg name=\"data\"></arg>\n </mutation>\n <value name=\"ARG0\">\n <block type=\"buffer_from_string\" id=\"X09_%qL:BCzr%;*u,Z^,\">\n <field name=\"ENCODING\">hex</field>\n <value name=\"STRING_INPUT\">\n <shadow type=\"text\" id=\"o0Yb{lGuO5EPgX~j{QjZ\">\n <field name=\"TEXT\">DEC0DA6E</field>\n </shadow>\n </value>\n </block>\n </value>\n </block>\n </value>\n <next>\n <block type=\"node_send\" id=\"}UrRTd}W57`CEhOm3AG:\">\n <field name=\"OUTPUT_NR\">1</field>\n <value name=\"MESSAGE_INPUT\">\n <shadow type=\"node_msg\" id=\"dD%*|;);{q`Ca/g@#aAu\"></shadow>\n </value>\n </block>\n </next>\n </block>\n <block type=\"procedures_defreturn\" id=\"),Gf$gra`t4zxC4al_9d\" x=\"-1262\" y=\"-763\">\n <mutation>\n <arg name=\"data\" varid=\"]Xmxdbb9Gpc^=Gfbgabt\"></arg>\n </mutation>\n <field name=\"NAME\">reverseBuffer</field>\n <comment pinned=\"false\" h=\"80\" w=\"160\">Describe this function...</comment>\n <statement name=\"STACK\">\n <block type=\"variables_set\" id=\"(.i5QKmVJH1.gRTw}8bI\">\n <field name=\"VAR\" id=\"SMNv-YVEMih?#X%bsrl7\">temp</field>\n <value name=\"VALUE\">\n <block type=\"buffer_alloc\" id=\"e_CaCTUkaUXsvf(dGWN=\">\n <value name=\"LENGTH\">\n <shadow type=\"math_number\" id=\"g:j{IlW5qCm@_xR`/Kmr\">\n <field name=\"NUM\">4</field>\n </shadow>\n </value>\n </block>\n </value>\n <next>\n <block type=\"buffer_set_index\" id=\"_=HAV=_bP(x=JI-AAE4d\">\n <value name=\"INDEX\">\n <shadow type=\"math_number\" id=\"`6sN8CLlivYRP@.!zIT*\">\n <field name=\"NUM\">1</field>\n </shadow>\n </value>\n <value name=\"BUFFER\">\n <shadow type=\"buffer_empty\" id=\"ZuGkWhrVOuQu[Gp1qz%l\"></shadow>\n <block type=\"variables_get\" id=\"QElNWA#Kc~knAh)yD]D@\">\n <field name=\"VAR\" id=\"SMNv-YVEMih?#X%bsrl7\">temp</field>\n </block>\n </value>\n <value name=\"VALUE\">\n <shadow type=\"buffer_byte\" id=\"gU1rD=25N8jvPfO!nJBE\">\n <field name=\"BYTE_VALUE\">0</field>\n </shadow>\n <block type=\"buffer_get_index\" id=\"S[@T/|94FC)86OjV7Dc,\">\n <value name=\"INDEX\">\n <shadow type=\"math_number\" id=\"`BV-g:+kKslH~Y}M4QT8\">\n <field name=\"NUM\">4</field>\n </shadow>\n </value>\n <value name=\"BUFFER\">\n <shadow type=\"buffer_empty\" id=\"LXCb]E?PfZ~`Z?0i3AtT\"></shadow>\n <block type=\"variables_get\" id=\"XhG6yBs8q,+#jla-sW!?\">\n <field name=\"VAR\" id=\"]Xmxdbb9Gpc^=Gfbgabt\">data</field>\n </block>\n </value>\n </block>\n </value>\n <next>\n <block type=\"buffer_set_index\" id=\"=FYovK={@%L%ypVNv[96\">\n <value name=\"INDEX\">\n <shadow type=\"math_number\" id=\"6m2bPaiB421?qZRbV$RT\">\n <field name=\"NUM\">2</field>\n </shadow>\n </value>\n <value name=\"BUFFER\">\n <shadow type=\"buffer_empty\"></shadow>\n <block type=\"variables_get\" id=\"~bp-.D3ZF@nP/72j~]RQ\">\n <field name=\"VAR\" id=\"SMNv-YVEMih?#X%bsrl7\">temp</field>\n </block>\n </value>\n <value name=\"VALUE\">\n <shadow type=\"buffer_byte\">\n <field name=\"BYTE_VALUE\">0</field>\n </shadow>\n <block type=\"buffer_get_index\" id=\"/M6JJ*.//8py4`owZhoN\">\n <value name=\"INDEX\">\n <shadow type=\"math_number\" id=\"iNCOv9EIy:2uMct:W#5i\">\n <field name=\"NUM\">3</field>\n </shadow>\n </value>\n <value name=\"BUFFER\">\n <shadow type=\"buffer_empty\"></shadow>\n <block type=\"variables_get\" id=\"^uHg{v_RaRz}(`tFA$bh\">\n <field name=\"VAR\" id=\"]Xmxdbb9Gpc^=Gfbgabt\">data</field>\n </block>\n </value>\n </block>\n </value>\n <next>\n <block type=\"buffer_set_index\" id=\"wp_q_(j_#CQS7WLs:7?J\">\n <value name=\"INDEX\">\n <shadow type=\"math_number\" id=\"-|lHn#E^E+-a*q$~1lbv\">\n <field name=\"NUM\">3</field>\n </shadow>\n </value>\n <value name=\"BUFFER\">\n <shadow type=\"buffer_empty\"></shadow>\n <block type=\"variables_get\" id=\"siS($WKXv+},%LUYD3]!\">\n <field name=\"VAR\" id=\"SMNv-YVEMih?#X%bsrl7\">temp</field>\n </block>\n </value>\n <value name=\"VALUE\">\n <shadow type=\"buffer_byte\">\n <field name=\"BYTE_VALUE\">0</field>\n </shadow>\n <block type=\"buffer_get_index\" id=\"UZGO7_t$Gz=I=dWaNNd3\">\n <value name=\"INDEX\">\n <shadow type=\"math_number\" id=\"kKjg9eDdX!yuW1CQ,E:~\">\n <field name=\"NUM\">2</field>\n </shadow>\n </value>\n <value name=\"BUFFER\">\n <shadow type=\"buffer_empty\"></shadow>\n <block type=\"variables_get\" id=\"1Fpq0nnR}iWc2j2yoBNS\">\n <field name=\"VAR\" id=\"]Xmxdbb9Gpc^=Gfbgabt\">data</field>\n </block>\n </value>\n </block>\n </value>\n <next>\n <block type=\"buffer_set_index\" id=\"*l7m?y^8d;rCR|K-+}C}\">\n <value name=\"INDEX\">\n <shadow type=\"math_number\" id=\"T+G|OF$[)xyx0c{0SS-Z\">\n <field name=\"NUM\">4</field>\n </shadow>\n </value>\n <value name=\"BUFFER\">\n <shadow type=\"buffer_empty\"></shadow>\n <block type=\"variables_get\" id=\"7;LV}#!:~DNc!I0Z8/}6\">\n <field name=\"VAR\" id=\"SMNv-YVEMih?#X%bsrl7\">temp</field>\n </block>\n </value>\n <value name=\"VALUE\">\n <shadow type=\"buffer_byte\">\n <field name=\"BYTE_VALUE\">0</field>\n </shadow>\n <block type=\"buffer_get_index\" id=\"3cHEOw$n1$=Sw{n`WHn6\">\n <value name=\"INDEX\">\n <shadow type=\"math_number\" id=\"Z$bVv(lzcB-P]^NA-4F[\">\n <field name=\"NUM\">1</field>\n </shadow>\n </value>\n <value name=\"BUFFER\">\n <shadow type=\"buffer_empty\"></shadow>\n <block type=\"variables_get\" id=\"{dN]PjLes{HtpYqg?jfw\">\n <field name=\"VAR\" id=\"]Xmxdbb9Gpc^=Gfbgabt\">data</field>\n </block>\n </value>\n </block>\n </value>\n </block>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n </statement>\n <value name=\"RETURN\">\n <block type=\"variables_get\" id=\"@mw+c%D-N./$_$yc34tf\">\n <field name=\"VAR\" id=\"SMNv-YVEMih?#X%bsrl7\">temp</field>\n </block>\n </value>\n </block>\n</xml>","outputs":1,"blocklyConfig":"a6722b13cc9e29c1","backpackContents":[],"noerr":0,"name":"","x":580,"y":80,"wires":[["6bfa5aa353a86acb"]]},{"id":"a6722b13cc9e29c1","type":"blockly-config","language":"en","showTrashcan":true,"allowComments":true,"showZoomControl":true,"enableBackPack":false,"backpackContents":[],"toolboxPosition":"left","renderer":"geras","categories":[{"name":"Node-RED","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/nodered/nodeRedBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/nodered/nodeRedBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/nodered/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Objects","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/json/objectBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/json/objectBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/json/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Buffer","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/buffer/bufferBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/buffer/bufferBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/buffer/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Date/time","files":["blockly-contrib/npm/@blockly%2Ffield-date/dist/date_compressed.js","blockly-contrib/npm/node-red-contrib-blockly/lib/datetime/dateTimeBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/datetime/dateTimeBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/datetime/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Timer","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/timer/timerBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/timer/timerBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/timer/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Blockly extension","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/extra/extraBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/extra/extraBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/extra/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Blockly standard","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/basic/toolbox.xml"]}],"customizeToolbox":false,"name":""}]
If I edit the blocks without expanding - then my changes are not saved either :(
Sometimes - the browser tab itself is closing :(
Existing nodes/flows are all working
FYI I was attempting to answer this question https://discourse.nodered.org/t/connect-to-a-tcp-server-with-special-packet-order/82162/3
I think it might simply be any code with a function in it e.g.
Yep any node with a function in it exhibits same problem - all other types of nodes seem fine
Hi @cymplecy,
Thanks for the analysis!! Now at least I was able to reproduce the problem easily.
To be honest I have no clue at the moment what could cause this. It seems somehow related to an icon or something alike:
It is a bit too long ago that I learned Blockly in depth, and meanwhile a lot has changed. As a result a lot of my Blockly knowledge has evaporated...
So I have asked help on their forum. However there was recently a huge amount of spam content on their google group, so now they have to approve manually every post (until they have moved away their forum from google groups). I will share the link with you as soon as my question is approved.
No problem
On Thu, 19 Oct 2023, 19:33 bartbutenaers, @.***> wrote:
Hi @cymplecy https://github.com/cymplecy,
Thanks for the analysis!! Now at least I was able to reproduce the problem easily.
To be honest I have no clue at the moment what could cause this. It seems somehow related to an icon or something alike:
[image: image] https://user-images.githubusercontent.com/14224149/276714547-7cea54db-57ea-45a8-9542-f4e5728d827b.png
It is a bit too long ago that I learned Blockly in depth, and meanwhile a lot has changed. As a result a lot of my Blockly knowledge has evaporated...
So I have asked help on their forum. However there was recently a huge amount of spam content on their google group, so now they have to approve manually every post (until they have moved away their forum from google groups). I will share the link with you as soon as my question is approved.
— Reply to this email directly, view it on GitHub https://github.com/bartbutenaers/node-red-contrib-blockly/issues/104#issuecomment-1771512874, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR7RNAQQQOINEHJOAJGJODYAFW6DAVCNFSM6AAAAAA6EPMN5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZRGUYTEOBXGQ . You are receiving this because you were mentioned.Message ID: @.***>
My question is approved on the blockly forum (see here).
Meanwhile I tried to regenerate the toolbox.xml file, but there were no changes in the standard blocks offered by the Blockly team. So that was no solution for this issue...
I had forgotten about this, but the "Functions" category contains blocks that are generated by standard Blockly code. No idea why that generates faulthy blocks for us. Hopefully someone from the Blockly team knows how to solve it...
@cymplecy, I did some further debugging, but I can't find the root case. Seems there is somehow a mutator active for the procedure blocks, so it can't find a comment icon as a result.
Maribeth from the Blockly team has been so kind to offer to help debugging during a Zoom session. Afterwards I will keep you updated...
Hi @cymplecy,
I have merged the pull-request from the Blockly team, and for me the problem seems to be fixed.
They changed some code that might have impact on the following existing functionality:
In the new workspace we should still see the change (from step 1) even if that wasn't deployed yet. But to me unsaved changes seem to still remembered, even if you select another config node or if you switch to fullscreen or back, ...
Would be nice if you could also do some tests, so I can send some feedback to the Blockly folks (if the problem is solved or not). Thanks!!
Our comments passsed each other - as said on other thread - basic problem is fixed for me :)
Will check out your other comments tomorrow - I'm off to bed - night night :)
Sweet dreams :-)
TBH - I've never felt the need for more than one config
I had a play round creating another one - didn't seem to encounter any unexpected behaviour
@cymplecy
Ok thanks for testing!
Does this mean we can publish a release this evening?
We are good to go AFAIC :)
But will convert my main instance to it now and just make sure all is good during the rest of today
I'm having great fun using Blockly to deal with MQTT TCP packets! :)
Have played all day - we are still good to go :)
Thanks a lot Simon!!
Hi @cymplecy,
Since the backend part of this node (i.e. the blockly.js file) is based on the core Node-RED function node, I try to keep both nodes in sync at every release of our node. I forgot to do that for version 2.1.0 which was released tonight.
So I quickly have compared both nodes now, and seems there are two differences which I have tried to solve in version 2.1.1:
The blockly node now has a timeout field:
Although I have the impression that this is not fully implemented into the core function node: loops and timers are NOT interrupted after the timeout (in seconds). I.e. it will only stop actions that take too long. So our node also doesn't stop those...
Since Node-RED 3.1.0 it is possible to get the path of the node via
node.path
which returns (sub)flowId/nodeId". I have supported this now:Here is an example flow:
It would be nice if you could test this. You can install the branch like this:
P.S. I still need to translate the new option in french/japanese/russian
Thanks! Bart