Skip to content

Fix : Undo Btn Hide, Refresh btn refreshes the grid, empty mappings w…#4108

Merged
Maheshkale447 merged 1 commit into
Releases/Official-Releasefrom
BugFix/WireMock
Feb 17, 2025
Merged

Fix : Undo Btn Hide, Refresh btn refreshes the grid, empty mappings w…#4108
Maheshkale447 merged 1 commit into
Releases/Official-Releasefrom
BugFix/WireMock

Conversation

@AmanPrasad43

@AmanPrasad43 AmanPrasad43 commented Feb 17, 2025

Copy link
Copy Markdown
Contributor

…ill not be downloaded

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

    • Refresh controls are now available on grid views, enabling users to update mapping data on demand.
    • Enhanced download functionality provides dynamic file saving and integrates a dedicated refresh mechanism.
    • An additional configuration for managing undo actions has been introduced (default hidden).
  • Bug Fixes

    • Improved download logic now checks for empty mapping data and displays a clear notification when no mappings are available.
    • Streamlined scrolling behavior contributes to a more consistent user interface.

@coderabbitai

coderabbitai Bot commented Feb 17, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This pull request updates the WireMock pages by modifying grid control properties and enhancing functionality. The user interface now displays refresh and undo options in the grid. New event handlers and methods have been added to refresh the grid data and handle downloads dynamically, including checks for empty mapping lists and improvements in file path construction. Additionally, a new solution context variable is introduced and a user message entry is added to indicate when no mappings are available for download.

Changes

File(s) Change Summary
Ginger/.../WireMockTemplatePage.xaml Changed Ginger:ucGrid property ShowRefresh from Collapsed to Visible; simplified the ScrollViewer by removing the horizontal scrollbar attribute.
Ginger/.../WireMockMappingPage.xaml Added Ginger:ucGrid property ShowUndo with value "Collapsed".
Ginger/.../WireMockTemplatePage.xaml.cs & Ginger/.../WireMockMappingPage.xaml.cs Introduced new refresh functionality (RefreshMappings method) and updated xDownloadMapping_Click to check for empty data and generate dynamic file paths; added a new private variable Solution mSolution in the template page.
GingerCoreCommon/ReporterLib/UserMsgsPool.cs Added new enum value WireMockMappingDownloadEmpty to provide a user message when no WireMock mappings are available for download.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant Controller
    participant Grid
    User->>UI: Click Refresh Button
    UI->>Controller: Invoke RefreshMappings()
    Controller->>Grid: Call SetGridData()
    Grid-->>Controller: Return Updated Data
    Controller-->>UI: Update Grid Display
Loading
sequenceDiagram
    participant User
    participant UI
    participant xDownloadMapping_Click
    participant FileSystem
    User->>UI: Click Download Mapping Button
    UI->>xDownloadMapping_Click: Trigger Download Event
    xDownloadMapping_Click->>xDownloadMapping_Click: Check if Grid Data is Empty
    alt Grid is empty
        xDownloadMapping_Click-->>User: Display "No Mapping Available" Message
    else
        xDownloadMapping_Click->>FileSystem: Create Directory & Construct File Path
        FileSystem-->>xDownloadMapping_Click: Return File Path
        xDownloadMapping_Click-->>User: Process and Save Download
    end
Loading

Suggested Reviewers

  • Maheshkale447

Poem

I’m a rabbit, hopping near and far,
With fresh grids glowing like a star.
Refresh and download, a joyful new tune,
Undo and dynamic paths make my heart swoon!
Happy code hops in every byte – cheers to our PR light!
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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: 1

🔭 Outside diff range comments (1)
Ginger/GingerCoreCommon/ReporterLib/UserMsgsPool.cs (1)

818-829: 🧹 Nitpick (assertive)

Consider standardizing WireMock message formats.

The WireMock-related messages have some inconsistencies in their formatting:

  • Some messages start with a space (lines 819, 820, 821, 822, 823)
  • Some messages have different punctuation patterns

Apply this diff to standardize the message formats:

-                { eUserMsgKey.WireMockConnectionSuccess, new UserMsg(eUserMsgType.INFO, "WireMock Connection Success", " WireMock Connection Successful.", eUserMsgOption.OK, eUserMsgSelection.None) },
-                { eUserMsgKey.WireMockMappingDownload, new UserMsg(eUserMsgType.INFO, "WireMock Mapping Download", " WireMock Mapping downloaded Successful.", eUserMsgOption.OK, eUserMsgSelection.None) },
-                { eUserMsgKey.WireMockMappingDownloadFailed, new UserMsg(eUserMsgType.ERROR, "WireMock Mapping Download", " WireMock Mapping download failed.", eUserMsgOption.OK, eUserMsgSelection.None) },
-                { eUserMsgKey.WireMockMappingEmpty, new UserMsg(eUserMsgType.INFO, "No WireMock Mapping Found", " No WireMock Mapping Available to Show.", eUserMsgOption.OK, eUserMsgSelection.None) },
-                { eUserMsgKey.WireMockMappingDownloadEmpty, new UserMsg(eUserMsgType.INFO, "No WireMock Mapping Found", " No WireMock Mapping Available to Download.", eUserMsgOption.OK, eUserMsgSelection.None) },
+                { eUserMsgKey.WireMockConnectionSuccess, new UserMsg(eUserMsgType.INFO, "WireMock Connection Success", "WireMock Connection Successful.", eUserMsgOption.OK, eUserMsgSelection.None) },
+                { eUserMsgKey.WireMockMappingDownload, new UserMsg(eUserMsgType.INFO, "WireMock Mapping Download", "WireMock Mapping downloaded successfully.", eUserMsgOption.OK, eUserMsgSelection.None) },
+                { eUserMsgKey.WireMockMappingDownloadFailed, new UserMsg(eUserMsgType.ERROR, "WireMock Mapping Download", "WireMock Mapping download failed.", eUserMsgOption.OK, eUserMsgSelection.None) },
+                { eUserMsgKey.WireMockMappingEmpty, new UserMsg(eUserMsgType.INFO, "No WireMock Mapping Found", "No WireMock Mapping available to show.", eUserMsgOption.OK, eUserMsgSelection.None) },
+                { eUserMsgKey.WireMockMappingDownloadEmpty, new UserMsg(eUserMsgType.INFO, "No WireMock Mapping Found", "No WireMock Mapping available to download.", eUserMsgOption.OK, eUserMsgSelection.None) },
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c8d32ac and 9389cb8.

📒 Files selected for processing (5)
  • Ginger/Ginger/ApplicationModelsLib/WireMockAPIModels/WireMockTemplatePage.xaml (1 hunks)
  • Ginger/Ginger/ApplicationModelsLib/WireMockAPIModels/WireMockTemplatePage.xaml.cs (6 hunks)
  • Ginger/Ginger/GeneralWindows/WireMockMappingPage.xaml (1 hunks)
  • Ginger/Ginger/GeneralWindows/WireMockMappingPage.xaml.cs (3 hunks)
  • Ginger/GingerCoreCommon/ReporterLib/UserMsgsPool.cs (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
Ginger/Ginger/ApplicationModelsLib/WireMockAPIModels/WireMockTemplatePage.xaml.cs (1)
Learnt from: AmanPrasad43
PR: Ginger-Automation/Ginger#4100
File: Ginger/Ginger/ApplicationModelsLib/APIModels/APIModelPage.xaml.cs:44-44
Timestamp: 2025-02-13T11:58:42.226Z
Learning: In the APIModelPage class, WireMockMappingController (wmController) should be lazily initialized when needed rather than at construction time, as its usage is limited to specific scenarios.
🔇 Additional comments (11)
Ginger/Ginger/ApplicationModelsLib/WireMockAPIModels/WireMockTemplatePage.xaml (1)

62-63: LGTM! Grid control properties updated correctly.

The changes to the grid control properties align with the PR objectives:

  • ShowRefresh is now Visible to enable grid refresh functionality
  • ShowUndo is explicitly set to Collapsed
Ginger/Ginger/GeneralWindows/WireMockMappingPage.xaml (1)

64-64: LGTM! Grid control properties are consistent.

The grid control properties are consistent with WireMockTemplatePage.xaml and align with the PR objectives.

Ginger/Ginger/GeneralWindows/WireMockMappingPage.xaml.cs (3)

65-65: LGTM! Refresh button handler added correctly.

The refresh button handler is properly set up to enable grid refresh functionality.


85-88: LGTM! RefreshMappings implementation is clean and consistent.

The RefreshMappings method is implemented consistently with WireMockTemplatePage.


164-168: LGTM! Empty data source check improves error handling.

The check for empty data source before attempting download improves user experience by providing appropriate feedback.

Ginger/Ginger/ApplicationModelsLib/WireMockAPIModels/WireMockTemplatePage.xaml.cs (4)

73-77: LGTM! Button handlers are properly configured.

The download and refresh button handlers are correctly set up to enable grid functionality.


94-98: LGTM! RefreshMappings implementation is clean.

The RefreshMappings method is implemented correctly to refresh grid data.


252-256: LGTM! Empty data source check improves error handling.

The check for empty data source before attempting download improves user experience by providing appropriate feedback.


266-280: LGTM! File path construction is robust.

The file path construction:

  • Uses solution folder as base path
  • Creates directory if it doesn't exist
  • Properly handles path separators
Ginger/GingerCoreCommon/ReporterLib/UserMsgsPool.cs (2)

187-187: LGTM! New enum value added for WireMock empty mapping download scenario.

The new enum value WireMockMappingDownloadEmpty is appropriately placed in the WireMock-related section of the enum.


823-823: LGTM! New user message added for WireMock empty mapping download scenario.

The message is well-defined with:

  • Appropriate type: INFO
  • Clear caption: "No WireMock Mapping Found"
  • Descriptive message: "No WireMock Mapping Available to Download"
  • Default button: OK
  • Default selection: None

Comment on lines 30 to +32
public WireMockMappingController wmController;
public ApplicationAPIModel mApplicationAPIModel;
Solution mSolution;

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.

🧹 Nitpick (assertive)

Consider lazy initialization of WireMockMappingController.

Based on previous feedback, WireMockMappingController should be lazily initialized when needed rather than at construction time.

-public WireMockMappingController wmController;
+private WireMockMappingController wmController;
 public ApplicationAPIModel mApplicationAPIModel;
 Solution mSolution;

Then initialize it only when needed:

-wmController = new WireMockMappingController();
+wmController ??= new WireMockMappingController();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public WireMockMappingController wmController;
public ApplicationAPIModel mApplicationAPIModel;
Solution mSolution;
// Field declarations (e.g., around lines 30-32 in WireMockTemplatePage.xaml.cs)
private WireMockMappingController wmController;
public ApplicationAPIModel mApplicationAPIModel;
Solution mSolution;
// Elsewhere in the code where wmController is initialized (e.g., in the constructor):
// Original code:
// wmController = new WireMockMappingController();
// Updated code with lazy initialization:
wmController ??= new WireMockMappingController();

@Maheshkale447
Maheshkale447 merged commit 2def65c into Releases/Official-Release Feb 17, 2025
@Maheshkale447
Maheshkale447 deleted the BugFix/WireMock branch February 17, 2025 17:16
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