ICRAR / EAGLE

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

Eagle 1320 #752

Closed M-Wicenec closed 1 week ago

M-Wicenec commented 2 weeks ago

graph configs are much more open to user changes now i have removed the restrictions stopping users from editing existing configs the active graph config is now not a separate entity, we keep an id for the active graph config. editing and adding of configs is all done directly into the logical graph, meaning there is also no longer a need to save graph configs before saving the graph

Summary by Sourcery

Enhance the graph configuration system by allowing direct editing and addition of configurations into the logical graph, eliminating the need for separate saving. Track the active graph configuration using an ID instead of a separate entity.

Enhancements:

sourcery-ai[bot] commented 2 weeks ago

Reviewer's Guide by Sourcery

This PR significantly refactors the graph configuration system by removing restrictions on editing existing configs and simplifying the active config management. The changes eliminate the need to save graph configs separately from the graph itself, as configurations are now directly integrated into the logical graph structure.

Updated class diagram for GraphConfig and related classes

classDiagram
    class GraphConfig {
        -id: ko.Observable<GraphConfig.Id>
        -name: ko.Observable<string>
        -description: ko.Observable<string>
        -nodes: ko.ObservableArray<GraphConfigNode>
        +clone(): GraphConfig
        +setId(id: GraphConfig.Id): void
        +getId(): GraphConfig.Id
        +setName(name: string): void
        +getName(): string
        +getNodes(): GraphConfigNode[]
    }

    class GraphConfigNode {
        -id: ko.Observable<NodeId>
        -fields: ko.ObservableArray<GraphConfigField>
        +clone(): GraphConfigNode
        +setId(id: NodeId): GraphConfigNode
        +getId(): NodeId
        +addField(id: FieldId): GraphConfigField
        +findFieldById(id: FieldId): GraphConfigField
        +removeFieldById(id: string): GraphConfigNode
        +getFields(): GraphConfigField[]
    }

    class GraphConfigField {
        -id: ko.Observable<FieldId>
        -value: ko.Observable<string>
        -comment: ko.Observable<string>
        +clone(): GraphConfigField
        +setId(id: FieldId): GraphConfigField
        +getId(): string
        +setValue(value: string): GraphConfigField
        +getValue(): string
        +setComment(comment: string): GraphConfigField
        +getComment(): string
    }

    GraphConfig --> GraphConfigNode : contains
    GraphConfigNode --> GraphConfigField : contains

Updated class diagram for LogicalGraph

classDiagram
    class LogicalGraph {
        -nodes: ko.ObservableArray<Node>
        -edges: ko.ObservableArray<Edge>
        -graphConfigs: ko.ObservableArray<GraphConfig>
        -activeGraphConfigId: ko.Observable<GraphConfig.Id>
        +getGraphConfigs(): GraphConfig[]
        +getGraphConfigById(requestedConifgId: GraphConfig.Id): GraphConfig
        +addGraphConfig(config: GraphConfig): void
        +duplicateGraphConfig(config: GraphConfig): void
        +removeGraphConfig(config: GraphConfig): void
        +getActiveGraphConfig(): GraphConfig
        +setActiveGraphConfig(configId: GraphConfig.Id): void
    }

    LogicalGraph --> GraphConfig : manages

File-Level Changes

Change Details Files
Removed the concept of modified/unmodified graph configurations
  • Removed isModified flag from GraphConfig class
  • Eliminated separate save functionality for graph configs
  • Removed restrictions preventing editing of existing configs
  • Removed isFavorite flag and related functionality
src/GraphConfig.ts
src/Eagle.ts
Changed how active graph configuration is managed
  • Replaced activeGraphConfig object with activeGraphConfigId reference
  • Updated all references to active config to use ID-based lookup
  • Added activeGraphConfigId to graph JSON serialization
  • Modified graph config selection logic to work with IDs
src/LogicalGraph.ts
src/Eagle.ts
Simplified the UI for managing graph configurations
  • Removed save config button and related UI elements
  • Updated configuration table to show active config status
  • Added file modification indicator to the UI
  • Simplified configuration creation and editing workflow
templates/graph_configurations_table.html
templates/parameter_table.html
templates/navbar.html
Improved change tracking and undo functionality
  • Added file modification tracking for graph config changes
  • Added undo snapshots for config-related operations
  • Updated edge and node modification tracking
src/Eagle.ts
src/GraphRenderer.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).