Skip to content

dropdown disabled while loading the data#4236

Merged
Maheshkale447 merged 3 commits into
Releases/Betafrom
BugFix/BulkUpdate
Jun 20, 2025
Merged

dropdown disabled while loading the data#4236
Maheshkale447 merged 3 commits into
Releases/Betafrom
BugFix/BulkUpdate

Conversation

@AmanPrasad43

@AmanPrasad43 AmanPrasad43 commented Jun 20, 2025

Copy link
Copy Markdown
Contributor

Thank you for your contribution.
Before submitting this PR, please make sure:

  • PR description and commit message should describe the changes done in this PR
  • Verify the PR is pointing to correct branch i.e. Release or Beta branch if the code fix is for specific release , else point it to master
  • Latest Code from master or specific release branch is merged to your branch
  • No unwanted\commented\junk code is included
  • No new warning upon build solution
  • Code Summary\Comments are added to my code which explains what my code is doing
  • Existing unit test cases are passed
  • New Unit tests are added for your development
  • Sanity Tests are successfully executed for New and Existing Functionality
  • Verify that changes are compatible with all relevant browsers and platforms.
  • After creating pull request there should not be any conflicts
  • Resolve all Codacy comments
  • Builds and checks are passed before PR is sent for review
  • Resolve code review comments
  • Update the Help Library document to match any feature changes

Summary by CodeRabbit

  • New Features

    • Added a loading state to the Find and Replace page that temporarily disables certain dropdown menus during search operations for improved user experience.
  • Style

    • Improved formatting and cleaned up unused imports.

@coderabbitai

coderabbitai Bot commented Jun 20, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

A private backing field and a public property, IsLoading, were added to the FindAndReplacePage class to manage a loading state. This property controls the enabled state of two ComboBoxes during asynchronous operations. Unused using directives were removed, and minor formatting improvements were made.

Changes

File(s) Change Summary
Ginger/.../FindAndReplacePage.xaml.cs Added IsLoading property with private backing field; controls ComboBox enabled state during async operations. Removed unused using directives and improved formatting.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FindAndReplacePage
    participant ComboBoxes

    User->>FindAndReplacePage: Initiate FindItemsAsync_item
    FindAndReplacePage->>FindAndReplacePage: Set IsLoading = true
    FindAndReplacePage->>ComboBoxes: Disable xMainItemListCB, xAttributeNameComboBox
    FindAndReplacePage->>FindAndReplacePage: Perform find operation (async)
    FindAndReplacePage->>FindAndReplacePage: finally { Set IsLoading = false }
    FindAndReplacePage->>ComboBoxes: Enable xMainItemListCB, xAttributeNameComboBox
Loading

Suggested reviewers

  • Maheshkale447

Poem

In code we hop, with fields anew,
A loading flag now guides us through.
ComboBoxes pause, then spring to play,
As async tasks just hop away.
Clean imports trimmed, the code feels light—
A bunny’s touch brings functions right! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 122007d and 5cc0d0d.

📒 Files selected for processing (1)
  • Ginger/Ginger/Functionalities/FindAndReplacePage.xaml.cs (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
Ginger/Ginger/Functionalities/FindAndReplacePage.xaml.cs (5)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.059Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it provides access to the `ObservableList<>` class which is used throughout the file for collections of RunSetConfig, AnalyzerItemBase, and ApplicationPOMModel objects.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.059Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it imports the ObservableList<> class which is used throughout the file.
Learnt from: prashelke
PR: Ginger-Automation/Ginger#4232
File: Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/VRTAnalyzer.cs:19-22
Timestamp: 2025-06-16T10:37:13.024Z
Learning: In Ginger codebase, both `using amdocs.ginger.GingerCoreNET;` and `using Amdocs.Ginger.CoreNET;` are valid and serve different purposes. The first (lowercase) contains the WorkSpace class and related workspace functionality, while the second (proper case) contains drivers like GenericAppiumDriver and other core functionality. Both may be required in files that use types from both namespaces.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:30.816Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:33.780Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
🔇 Additional comments (3)
Ginger/Ginger/Functionalities/FindAndReplacePage.xaml.cs (3)

479-479: Minor formatting adjustment.

The method signature formatting change is acceptable but not essential.


1719-1719: Good implementation of loading state management.

Setting IsLoading = true at the start of the async operation correctly initiates the loading state to disable UI controls.


1740-1740: Proper cleanup in finally block.

Setting IsLoading = false in the finally block ensures the loading state is cleared regardless of success or failure.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch BugFix/BulkUpdate

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2bf2f10 and 122007d.

📒 Files selected for processing (2)
  • Ginger/Ginger/Functionalities/FindAndReplacePage.xaml (1 hunks)
  • Ginger/Ginger/Functionalities/FindAndReplacePage.xaml.cs (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
Ginger/Ginger/Functionalities/FindAndReplacePage.xaml.cs (5)
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.059Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it provides access to the `ObservableList<>` class which is used throughout the file for collections of RunSetConfig, AnalyzerItemBase, and ApplicationPOMModel objects.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4188
File: Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs:22-23
Timestamp: 2025-04-25T13:29:45.059Z
Learning: The `using Amdocs.Ginger.Repository;` statement in Ginger/GingerCoreNET/RunLib/CLILib/DoOptionsHanlder.cs is necessary as it imports the ObservableList<> class which is used throughout the file.
Learnt from: prashelke
PR: Ginger-Automation/Ginger#4232
File: Ginger/GingerCoreNET/ActionsLib/UI/VisualTesting/VRTAnalyzer.cs:19-22
Timestamp: 2025-06-16T10:37:13.024Z
Learning: In Ginger codebase, both `using amdocs.ginger.GingerCoreNET;` and `using Amdocs.Ginger.CoreNET;` are valid and serve different purposes. The first (lowercase) contains the WorkSpace class and related workspace functionality, while the second (proper case) contains drivers like GenericAppiumDriver and other core functionality. Both may be required in files that use types from both namespaces.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:30.816Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
Learnt from: GokulBothe99
PR: Ginger-Automation/Ginger#4137
File: Ginger/Ginger/SourceControl/SourceControlProjectsPage.xaml.cs:21-21
Timestamp: 2025-03-20T11:10:33.780Z
Learning: The `Amdocs.Ginger.Common.SourceControlLib` namespace is required in files that reference the `GingerSolution` class for source control operations in the Ginger automation framework.
🔇 Additional comments (2)
Ginger/Ginger/Functionalities/FindAndReplacePage.xaml (1)

104-104: Verify data binding setup for IsEnabled bindings.

The XAML uses standard WPF data binding syntax {Binding IsNotLoading}, but this requires the DataContext to be set to an object that implements INotifyPropertyChanged and raises PropertyChanged events. The code-behind directly sets IsEnabled properties instead, making these bindings ineffective.

#!/bin/bash
# Verify if the page implements INotifyPropertyChanged or sets DataContext
ast-grep --pattern 'class FindAndReplacePage : Page, INotifyPropertyChanged'
ast-grep --pattern 'DataContext = this'
ast-grep --pattern 'PropertyChanged?.Invoke'

Also applies to: 110-110

Ginger/Ginger/Functionalities/FindAndReplacePage.xaml.cs (1)

1721-1721: Loading state management implementation looks correct.

The IsLoading property is properly set to true at the start of the async operation and reset to false in the finally block, ensuring proper cleanup even if exceptions occur.

Also applies to: 1742-1742

Comment thread Ginger/Ginger/Functionalities/FindAndReplacePage.xaml.cs Outdated
Comment on lines +1801 to +1813
private bool _isLoading;
public bool IsLoading
{
get => _isLoading;
set
{
_isLoading = value;

xMainItemListCB.IsEnabled = !value;
xAttributeNameComboBox.IsEnabled = !value;
}
}
public bool IsNotLoading => !IsLoading;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Refactor to use consistent binding approach and remove redundancy.

The current implementation has several issues:

  1. Redundant mechanisms: Both direct property setting (lines 1809-1810) and XAML data binding are used
  2. Ineffective bindings: The XAML bindings won't work without INotifyPropertyChanged implementation
  3. Inconsistent approach: The codebase uses GingerCore.GeneralLib.BindingHandler.ObjFieldBinding for other bindings (line 359)

Choose one approach and implement it consistently:

Option 1: Use direct property setting only (simpler)

+private bool _isLoading;
+public bool IsLoading
+{
+    get => _isLoading;
+    set
+    {
+        _isLoading = value;
+        xMainItemListCB.IsEnabled = !value;
+        xAttributeNameComboBox.IsEnabled = !value;
+    }
+}

Remove the XAML bindings and the IsNotLoading property.

Option 2: Use the existing binding mechanism

+private bool _isLoading;
+public bool IsLoading
+{
+    get => _isLoading;
+    set => _isLoading = value;
+}

Then use GingerCore.GeneralLib.BindingHandler.ObjFieldBinding in the initialization method to bind the IsEnabled properties.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In Ginger/Ginger/Functionalities/FindAndReplacePage.xaml.cs around lines 1801 to
1813, the IsLoading property setter directly sets UI element states while the
XAML uses bindings that require INotifyPropertyChanged, causing redundancy and
ineffective bindings. To fix this, choose either to remove the XAML bindings and
the IsNotLoading property and keep direct property setting only, or implement
INotifyPropertyChanged and replace direct UI updates with
GingerCore.GeneralLib.BindingHandler.ObjFieldBinding calls in the initialization
method to bind IsEnabled properties consistently.

@Maheshkale447
Maheshkale447 merged commit f44e62a into Releases/Beta Jun 20, 2025
4 of 5 checks passed
@Maheshkale447
Maheshkale447 deleted the BugFix/BulkUpdate branch June 20, 2025 10:34
@coderabbitai coderabbitai Bot mentioned this pull request Jun 22, 2025
15 tasks
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