Skip to content

Fixes #2836 Run (and some other actions) are not disabled in the context menu after a PI was started#2837

Merged
rwmcintosh merged 1 commit intodevelopfrom
2836-run-and-some-other-actions-are-not-disabled-in-the-context-menu-after-a-pi-was-started
Apr 17, 2026
Merged

Fixes #2836 Run (and some other actions) are not disabled in the context menu after a PI was started#2837
rwmcintosh merged 1 commit intodevelopfrom
2836-run-and-some-other-actions-are-not-disabled-in-the-context-menu-after-a-pi-was-started

Conversation

@rwmcintosh
Copy link
Copy Markdown
Member

@rwmcintosh rwmcintosh commented Apr 17, 2026

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 x in the brackets.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires documentation changes (link at least one user or developer documentation issue):
  • Algorithm update - updates algorithm documentation/questions/answers etc.
  • Other (please describe):

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

  • Integration tests
  • Unit tests
  • Manual tests
  • No tests required

Reviewer checklist

Mark everything that needs to be checked before merging the PR.

  • Check if the code is well documented
  • Check if the behavior is what is expected
  • Check if the code is well tested
  • Check if the code is readable and well formatted
  • Additional checks (document below if any)
  • Check if documentation update issue(s) are created if the option This change requires a documentation update above is selected

Screenshots (if appropriate):

Questions (if appropriate):

Summary by CodeRabbit

Bug Fixes

  • Context menu actions (Delete, Rename, Run) are now disabled while a parameter identification is running, preventing accidental interference with ongoing operations.

@rwmcintosh rwmcintosh self-assigned this Apr 17, 2026
@rwmcintosh rwmcintosh added this to V12.3 Apr 17, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

This pull request modifies context menu item builders to accept an isRunning parameter and conditionally disable Delete, Rename, and Run actions via .AsDisabledIf(isRunning). The isRunning state is computed by checking whether a parameter identification exists in the RunningParameterIdentifications collection.

Changes

Cohort / File(s) Summary
Context Menu Enhancements
src/OSPSuite.Presentation/Presenters/ContextMenus/ParameterIdentificationContextMenuItems.cs
Added isRunning parameter to DeleteParameterIdentification, RenameParameterIdentification, and RunParameterIdentification method signatures. Menu items now conditionally disable based on parameter identification running state, computed from IParameterIdentificationRunner.RunningParameterIdentifications.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • msevestre
  • Yuri05

Poem

🐰 A Running PI Must Pause,
No Delete, Rename, or Restart Cause,
The Menu Items Dimly Fade,
While Calculations are Made,
A Gentle Guard with Thoughtful Clause! 🎨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly references issue #2836 and accurately describes the main change: disabling context menu actions when a Parameter Identification is running.
Linked Issues check ✅ Passed The code changes address all three requirements from issue #2836: disabling Run, Rename, and Delete actions by checking if the PI is running and conditionally disabling menu items via isRunning flag.
Out of Scope Changes check ✅ Passed All changes are scoped to ParameterIdentificationContextMenuItems.cs and directly address the context menu disabling requirements outlined in issue #2836.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2836-run-and-some-other-actions-are-not-disabled-in-the-context-menu-after-a-pi-was-started

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 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. Since RunningParameterIdentifications is IEnumerable<ParameterIdentification>, Contains uses 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 future Stop item).

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between b2cf131 and b849937.

📒 Files selected for processing (1)
  • src/OSPSuite.Presentation/Presenters/ContextMenus/ParameterIdentificationContextMenuItems.cs

@rwmcintosh rwmcintosh merged commit 763ddbe into develop Apr 17, 2026
6 checks passed
@rwmcintosh rwmcintosh deleted the 2836-run-and-some-other-actions-are-not-disabled-in-the-context-menu-after-a-pi-was-started branch April 17, 2026 14:34
@github-project-automation github-project-automation bot moved this to Done in V12.3 Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Run (and some other actions) are not disabled in the context menu after a PI was started

2 participants