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

Refactor adding of ui nodes to ensure valid configuration #1428

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

Steve-Mcl
Copy link
Contributor

closes #1401

Description

Refactor adding of ui nodes to ensure valid configuration.

This was achieved by encapsulating the logic of adding and assigning of "things" into helper functions that "do the right thing"

This fixes:

  • Default adding of base/theme/1st group when a node is dragged onto empty workspace
    • Applies default base AND updates the bases user array
  • Adding Links
    • Applies default base
    • Ensures base nodes users are updated
  • Adding Pages
    • Applies default base and theme
    • Ensures base nodes users are updated
  • Adding Groups via the "Add Group" button
  • Ensures the pages users array is updated
  • Applies unique names to pages to avoid the dreaded "same page path" issue
  • Adds links to the end (like pages are)
  • Increments Page and Link names while ensuring they dont clash with existing page/link names

Before (Existing behaviour in V1.18.1)

Demonstrates:

  • links added with name "Link" everytime - making it difficult to decern
  • links added without a base set
  • links added to top of list instead of bottom
  • page name/path clashes when next page already exists
  • new page base not set
  • new theme base not set

chrome_9ECyrsMGVL

After

Reduced friction when adding links and pages

chrome_s45I7tXbiw

No "unused configs" toast in node-red when adding 1st node

chrome_S3sa37659K

Related Issue(s)

#1401

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Includes a DB migration? -> add the area:migration label

@joepavitt
Copy link
Collaborator

This is all great @Steve-Mcl - am still seeing an Unused Config Node message for "UI Link" nodes though? I think it's because it's being used by only other config nodes? It's never linked back to the "normal" nodes?

@Steve-Mcl
Copy link
Contributor Author

This is all great @Steve-Mcl - am still seeing an Unused Config Node message for "UI Link" nodes though? I think it's because it's being used by only other config nodes? It's never linked back to the "normal" nodes?

Bah!

Could you tell me the steps to make this happen please - i will fix it.

@joepavitt
Copy link
Collaborator

Could you tell me the steps to make this happen please - i will fix it.

Click "+ Link" in the sidebar, and any link added gets 0 "users"

@Steve-Mcl
Copy link
Contributor Author

Could you tell me the steps to make this happen please - i will fix it.

Click "+ Link" in the sidebar, and any link added gets 0 "users"

Ah man, must have been a last minute refactor! ok, thanks Joe. will get this sorted.

@Steve-Mcl Steve-Mcl mentioned this pull request Oct 31, 2024
12 tasks
@Steve-Mcl
Copy link
Contributor Author

Could you tell me the steps to make this happen please - i will fix it.

Click "+ Link" in the sidebar, and any link added gets 0 "users"

Ah man, must have been a last minute refactor! ok, thanks Joe. will get this sorted.

Sorted

chrome_JJiF3q7EkY

@joepavitt joepavitt merged commit ab26bb1 into main Nov 1, 2024
2 checks passed
@joepavitt joepavitt deleted the 1401-fix-unregistered branch November 1, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drag in first node creates phantom "unused config nodes" issue
2 participants