ICRAR / EAGLE

Editor for the Astronomical Graph Language Environment
GNU Lesser General Public License v3.0
0 stars 1 forks source link

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

Closed M-Wicenec closed 1 week ago

M-Wicenec commented 1 week ago

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:

Enhancements:

sourcery-ai[bot] commented 1 week ago

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

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"

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"

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](https://app.sourcery.ai) 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 - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).