node-red-dashboard icon indicating copy to clipboard operation
node-red-dashboard copied to clipboard

Can't save changes in layout editor

Open mworion opened this issue 1 year ago • 7 comments

Current Behavior

Using the layout editor works nicely, but when save the changes I get an 400 Error

Image

Expected Behavior

Can save the changes

Steps To Reproduce

Open a layout page in edit mode, make some changes and try to save them

Environment

  • Dashboard version: 1.22
  • Node-RED version: 4.05
  • Node.js version:
  • npm version:
  • Platform/OS: RPi
  • Browser: Chrome / Safari

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

mworion avatar Jan 23 '25 19:01 mworion

Hi @mworion

Did a quick test, but for me the problem doesn't occur. Perhaps you can share some more detailed info so people can assist you better.

  • Any errors in your browser console log?
  • Any errors in your Node-RED log on your RPi?
  • Does it also happen when you create a new page with very few content?
  • Other stuff that might help?

bartbutenaers avatar Jan 24 '25 21:01 bartbutenaers

Many thanks for the hints,

attached the error message in the browser console log:

Image

No errors seen on the node-red-log. It is only a test page with one group.

Hope this helps. Michel

mworion avatar Jan 25 '25 13:01 mworion

Thanks for the info!

No errors seen on the node-red-log

I had hoped that the endpoint (which processes the request on the Node-RED server side) would log a bit of information about what is wrong in the request. If anybody knows which endpoint that is, please share it here! Otherwise I need to start searching myself. Hopefully it is a dashboard specific endpoint, so we can enhance it a bit. Imho the endpoint:

  • should log what (he assumes) is wrong in the request.
  • should be fixed because all stuff you put in the request should be correct content, since you have composed the request automatically by simply drawing a layout using the editor.

It is only a test page with one group.

Yes but I see multiple widgets in that group. I am wondering when the error happens. Do you get the error immediately for a group containing only a single widget? If not it would be helpful for the developers in this repo to know when the error starts occuring, for example as soon as you add a dropdown to your group. That would really be helpful in troubleshooting why the request content is generated incorrectly.

I am not familiar with the layout editor, so hopefully I am not telling nononsense here...

bartbutenaers avatar Jan 26 '25 06:01 bartbutenaers

@mworion,

Beside the questions from my last post, I have another question.

In the endpoint code (which is responsible for saving your page on the server-side), there seems to be a lot of error handling code available. For lots of those errors, a http status 400 is being returned to the browser, and extra information is included in the response. That might us also provide some more information...

Could you:

  1. Open the developer tools of your browser.
  2. Open the "Network" tabsheet of the developer tools.
  3. Click the save button in the dashboard editor.
  4. The (failed) http request should now appear in the Network tabsheet.
  5. Click on that failed request, and go to the "Response" sub-tabsheet.
  6. Share a screenshot of that response.

For example in my case it always succeeds, and it seems that then a revision number is being returned:

Image

Hopefully that gives us a clue...

bartbutenaers avatar Jan 27 '25 19:01 bartbutenaers

I have the same bug. In the response I have : {"error":"Widget not found","code":"WIDGET_NOT_FOUND"} or same message with Group not found.

gewy avatar Jan 28 '25 20:01 gewy

Hi @gewy,

Thanks for the feedback!! It might be that it is a different problem as the one from @mworion, because the endpoint can respond with all kind of errors.

If you know a way how I can reproduce that problem (i.e. some list of steps I can follow), I will try to have a look at it.

bartbutenaers avatar Jan 28 '25 20:01 bartbutenaers

Hi, The problem is linked to the use of ui node in subflow. With dashboard v1 I could have a subflow with ui node and I was abled to add several time the same subflow. Each subflow was added on the same page and everything was working at one condition, to create the page and group from the subflow. With dashboard v2 when I create the page/group from a subflow I can't open the Layout Editor, I have the message "Unable to begin layout editor". If the page/group, created outside the subflow, is used in a subflow I have the 400 error when I want to save the changes from the Layout Editor. So I am very confused about all of this. For my special use, the option to have ui-nodes in a subflow is very useful. Thanks.

gewy avatar Jan 28 '25 22:01 gewy