Skip to content

EAGLE-1429: Fields on Construct component should not be ports #851

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

Merged
merged 4 commits into from
Apr 15, 2025

Conversation

james-strauss-uwa
Copy link
Collaborator

@james-strauss-uwa james-strauss-uwa commented Apr 11, 2025

checkGraph() function already picked up this issue. Construct nodes have a maximum of zero ports. But the issue was only detected when the graph was re-checked, which wasn't happening.

So I added a call to eagle.checkGraph() inside the existing fieldUsageChanged() event handler to re-check graph after change to field usage.

Also update the options data-bind in the UI for the "usage" column in the ParameterTable. If the node is a construct, then only the "NoPort" option appears in the usage drop-down.

Summary by Sourcery

Modify field usage handling for Construct nodes to prevent port creation and ensure graph consistency

Bug Fixes:

  • Prevent fields on Construct nodes from being set as ports by restricting usage options
  • Automatically re-check graph integrity when field usage changes

Enhancements:

  • Add dynamic usage options computation for nodes based on their category type
  • Improve field usage change handling to maintain graph validity

Tests:

  • Update page model test selectors to match new class names for field usage dropdown

…event handler
…ruct nodes. Minor spelling mistakes.
Copy link
Contributor

sourcery-ai bot commented Apr 11, 2025

Reviewer's Guide by Sourcery

This pull request ensures that fields on Construct components cannot be ports. It achieves this by limiting the available usage options in the UI and re-checking the graph after changes to field usage. The UI was updated to use the correct class name for the 'use as' dropdown.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Added a computed observable to the Node class to determine the available usage options for fields based on the node's category type.
  • Added a usageOptions computed observable.
  • If the node is a Construct, the only available usage option is NoPort.
  • Otherwise, all FieldUsage values are available.
src/Node.ts
Updated the data-bind for the 'usage' column in the ParameterTable to use the new usageOptions computed observable.
  • Modified the options binding of the select element to use eagle.selectedNode().usageOptions.
  • This ensures that only valid usage options are displayed for Construct nodes.
templates/node_parameter_table.html
Added a call to eagle.checkGraph() inside the fieldUsageChanged() event handler to re-check the graph after a change to field usage.
  • Added eagle.checkGraph() call to the end of the fieldUsageChanged function.
src/ParameterTable.ts
Updated test selectors to use the correct class name for the 'use as' dropdown.
  • Changed .tbaleFieldUseAs to .tableFieldUseAs in the test selectors.
tests/page-model.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@james-strauss-uwa james-strauss-uwa self-assigned this Apr 11, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @james-strauss-uwa - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider debouncing the call to eagle.checkGraph() in fieldUsageChanged() to avoid excessive graph checks.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

… selectedNode() is not an Application
@james-strauss-uwa
Copy link
Collaborator Author

@M-Wicenec rightly pointed out that it doesn't make much sense for the "Use As" dropdown to contain only one option for Construct nodes. Every field on a construct node must have "Use As" set to "No Port".

So, I've now hidden that column when a Construct is selected.

This follows the same pattern as the "Encoding" column, which is hidden unless the selectedNode is an Application.

I've also hidden those two columns in the "columns visibility" drop down, in the cases where the selectedNode doesn't allow that column to be displayed anyway.

This is ready to re-test and review.

Copy link
Collaborator

@M-Wicenec M-Wicenec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, looks good!

@james-strauss-uwa james-strauss-uwa merged commit 0e650d0 into master Apr 15, 2025
1 check passed
@james-strauss-uwa james-strauss-uwa deleted the eagle-1429 branch April 15, 2025 04:59
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.

None yet

2 participants