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

when adding a field to a graph configuration, the fields value from t… #754

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

M-Wicenec
Copy link
Collaborator

@M-Wicenec M-Wicenec commented Nov 4, 2024

when adding a field to a graph configuration, the field's value from the graph will be set as the initial configured value in the graph configuration. aka when adding a field to the config, it takes its value with it.
additionally i fixed an error when creating a new graph config when there is none added in the first place.

Summary by Sourcery

Enhance the graph configuration process by setting the field's current value as the initial value when adding a field. Fix an error in creating a new graph configuration when none exists by initializing a new GraphConfig.

Bug Fixes:

  • Fix an error when creating a new graph configuration when none exists by initializing a new GraphConfig instead of cloning an active one.

Enhancements:

  • Ensure that when adding a field to a graph configuration, the field's current value is set as the initial configured value.

…he graph will be set as the initial configured value in the graph configuration
Copy link
Contributor

sourcery-ai bot commented Nov 4, 2024

Reviewer's Guide by Sourcery

The PR modifies how fields are added to graph configurations and fixes graph configuration initialization. Instead of simply adding fields, the implementation now preserves the field's current value when adding it to the configuration. Additionally, the creation of new graph configurations has been modified to start fresh rather than cloning an existing configuration.

Sequence diagram for adding a field to graph configuration

sequenceDiagram
    participant User
    participant ParameterTable
    participant GraphConfig

    User->>ParameterTable: Add field to graph configuration
    ParameterTable->>GraphConfig: addValue(nodeId, fieldId, fieldValue)
    GraphConfig-->>ParameterTable: Field added with value
    ParameterTable-->>User: Field added to configuration
Loading

Updated class diagram for ParameterTable and GraphConfig

classDiagram
    class ParameterTable {
        +addValue(nodeId, fieldId, fieldValue)
    }
    class GraphConfig {
        +addValue(nodeId, fieldId, fieldValue)
        +removeField(field)
    }
    ParameterTable --> GraphConfig: uses
    note for ParameterTable "Modified to use addValue instead of addField"
    note for GraphConfig "addValue method added to preserve field value"
Loading

Updated class diagram for Eagle

classDiagram
    class Eagle {
        +newConfig()
    }
    class GraphConfig {
        +setId(id)
    }
    Eagle --> GraphConfig: creates
    note for Eagle "newConfig modified to create a new GraphConfig instead of cloning"
Loading

File-Level Changes

Change Details Files
Modified field addition to graph configurations to include value preservation
  • Replaced addField() call with addValue() to explicitly set field values
  • Now preserves the field's current value when adding it to the configuration
src/ParameterTable.ts
Fixed new graph configuration creation
  • Replaced cloning of active configuration with creation of fresh GraphConfig instance
  • Simplified initialization process while maintaining ID generation
src/Eagle.ts

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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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

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 @M-Wicenec - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please update the PR description to explain the behavior change in newConfig() - it now creates an empty configuration instead of cloning the active one.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 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.

Copy link
Collaborator

@james-strauss-uwa james-strauss-uwa left a comment

Choose a reason for hiding this comment

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

Much better

@M-Wicenec M-Wicenec merged commit ac9a891 into master Nov 4, 2024
1 check passed
@M-Wicenec M-Wicenec deleted the eagle-1332 branch November 4, 2024 07:10
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.

2 participants