Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui_template scope does not clean up on configuration change. #1038

Closed
hotNipi opened this issue Jun 28, 2024 · 3 comments · Fixed by #1078
Closed

ui_template scope does not clean up on configuration change. #1038

hotNipi opened this issue Jun 28, 2024 · 3 comments · Fixed by #1078
Assignees
Labels
bug Something isn't working size:XS - 1 Sizing estimation point

Comments

@hotNipi
Copy link
Contributor

hotNipi commented Jun 28, 2024

Current Behavior

User wants to make a template for CSS

1 Drag in the ui_template (default scope "Widget (Group-scoped)")
2 Write or copy/paste the content into
3 Forget to change the template type to "CSS (All Pages)"
4 Deploy
5 Change the template type to "CSS (All Pages)"
6 Deploy

Result:

  • there's no errors in console or any other indicators that something went wrong.
  • the CSS is not applied to the document head, user cant see any of desired changes
  • user can not use this template anymore for CSS (group and page properties are not removed)

Debug panels comparing broken ad correct ui_template for CSS
The broken ui_template "page-back" has values for page and group.

image

Expected Behavior

Changing the scope should be possible in all ways.

Steps To Reproduce

Steps to reproduce described above

Workaround:
Make new ui_template but pay attention to not deploy for wrong scope

1 Drag in the ui_template (and give it a name)
2 Change the template type to "CSS (All Pages)"
3 Write or copy/paste the content into
4 Deploy

Environment

  • Dashboard version: v1.12.2
  • Node-RED version:v4.0.0
  • Node.js version:v20.14.0
  • npm version:
  • Platform/OS: Windows 10
  • Browser: Chrome

Have you provided an initial effort estimate for this issue?

I can not provide an initial effort estimate

@hotNipi hotNipi added bug Something isn't working needs-triage Needs looking at to decide what to do labels Jun 28, 2024
@joepavitt
Copy link
Collaborator

Can see the problem:

if (config.templateScope === 'local') {
config.page = ''
config.ui = ''
} else if (config.templateScope === 'widget:page') {
config.ui = ''
config.group = ''
} else if (config.templateScope === 'widget:ui') {
config.page = ''
config.group = ''

I don't account for the CSS use cases here to clear the unnecessary group and page variables.

@joepavitt joepavitt added the size:XS - 1 Sizing estimation point label Jun 28, 2024
@joepavitt joepavitt self-assigned this Jun 28, 2024
@joepavitt joepavitt removed the needs-triage Needs looking at to decide what to do label Jun 28, 2024
@arturv2000
Copy link
Contributor

@joepavitt Noticed that the template does not generate any error if no (page/UI) selected, only gives error when no group is selected. Should it give some kind of error? Should open a separate issue?

@joepavitt
Copy link
Collaborator

Yeah, I noticed that too, issue would be great. Thanks @arturv2000

arturv2000 added a commit to arturv2000/node-red-dashboard that referenced this issue Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:XS - 1 Sizing estimation point
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants