Fixes #2836 Run (and some other actions) are not disabled in the context menu after a PI was started#2837
Conversation
…ext menu after a PI was started
📝 WalkthroughWalkthroughThis pull request modifies context menu item builders to accept an Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/OSPSuite.Presentation/Presenters/ContextMenus/ParameterIdentificationContextMenuItems.cs (1)
93-93: Optional: cache the resolved runner / running set.Minor nit:
container.Resolve<IParameterIdentificationRunner>().RunningParameterIdentifications.Contains(parameterIdentification)resolves the runner and enumerates the collection on every menu build. SinceRunningParameterIdentificationsisIEnumerable<ParameterIdentification>,Containsuses LINQ's O(n) scan — fine in practice given the tiny expected size, but you could assign the runner to a local first for readability if you anticipate reusing it (e.g., to wire up a futureStopitem).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/OSPSuite.Presentation/Presenters/ContextMenus/ParameterIdentificationContextMenuItems.cs` at line 93, The code repeatedly resolves the runner and scans RunningParameterIdentifications on each menu build; instead, resolve IParameterIdentificationRunner once into a local variable (e.g., var runner = container.Resolve<IParameterIdentificationRunner>()) and then check runner.RunningParameterIdentifications.Contains(parameterIdentification); this improves readability and avoids multiple Resolve calls and repeated enumeration when you later add additional logic (e.g., wiring a Stop menu item) that reuses the runner.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@src/OSPSuite.Presentation/Presenters/ContextMenus/ParameterIdentificationContextMenuItems.cs`:
- Line 93: The code repeatedly resolves the runner and scans
RunningParameterIdentifications on each menu build; instead, resolve
IParameterIdentificationRunner once into a local variable (e.g., var runner =
container.Resolve<IParameterIdentificationRunner>()) and then check
runner.RunningParameterIdentifications.Contains(parameterIdentification); this
improves readability and avoids multiple Resolve calls and repeated enumeration
when you later add additional logic (e.g., wiring a Stop menu item) that reuses
the runner.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 368ce132-8d83-4f0d-8af8-e36afffffdf7
📒 Files selected for processing (1)
src/OSPSuite.Presentation/Presenters/ContextMenus/ParameterIdentificationContextMenuItems.cs
Fixes #2836 Run (and some other actions) are not disabled in the context menu after a PI was started
Description
It was not checked for running during context menu construction
Type of change
Please mark relevant options with an
xin the brackets.How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Reviewer checklist
Mark everything that needs to be checked before merging the PR.
This change requires a documentation updateabove is selectedScreenshots (if appropriate):
Questions (if appropriate):
Summary by CodeRabbit
Bug Fixes