Skip to content

Fix artifact name#3704

Merged
Maheshkale447 merged 7 commits into
masterfrom
fix_artifact_name
Jun 7, 2024
Merged

Fix artifact name#3704
Maheshkale447 merged 7 commits into
masterfrom
fix_artifact_name

Conversation

@sudarshan0212

@sudarshan0212 sudarshan0212 commented May 15, 2024

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

    • Enhanced image handling functionality by allowing specification of width and height for static images.
    • Improved artifact file naming by including the artifact name along with the file name.
  • Updates

    • Updated stylesheet links and script sources for the Ginger Web Client reports.
    • Modified artifact handling in reports to streamline data mapping and improve performance.

@coderabbitai

coderabbitai Bot commented May 15, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The recent changes primarily involve updates to the ImageMakerControl class to support custom image dimensions, adjustments to CSS and JavaScript references in the Ginger Web Client, and enhancements to the ArtifactFileName property in the UCArtifact class. Additionally, there were improvements in handling artifact paths within the MapActionEndData method, removing redundant dictionary usage.

Changes

File(s) Change Summary
.../ImageMakerLib/ImageMakerControl.xaml.cs Modified SetAsStaticImage method to include width and height parameters.
GingerCoreNET.csproj Added JavaScript and CSS files for the Ginger Web Client reports.
.../Reports/Ginger-Web-Client/index.html Updated stylesheet links and script sources.
.../UserControls/UCArtifact.xaml.cs Enhanced ArtifactFileName property to include ArtifactName along with the file name.
.../RunListenerLib/CenteralizedExecutionLogger/AccountReportEntitiesDataMapping.cs Removed newArtifactList dictionary and updated artifact handling directly within the loop.

Poem

In code so fine, we made our mark,
With images sized, and paths to spark.
Artifacts named with grace and flair,
Web Client scripts now light the air.
A rabbit's joy in lines of lore,
Our Ginger shines forevermore. 🌟🐇


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between cf2ee81 and 5136326.
Files selected for processing (3)
  • Ginger/Ginger/Actions/UserControls/UCArtifact.xaml.cs (1 hunks)
  • Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs (2 hunks)
  • Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportEntitiesDataMapping.cs (2 hunks)
Additional comments not posted (3)
Ginger/Ginger/Actions/UserControls/UCArtifact.xaml.cs (1)

65-65: Ensure the new ArtifactFileName format is handled correctly in all UI components where it is displayed.

Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportEntitiesDataMapping.cs (1)

Line range hint 82-117: Refactor in MapActionEndData simplifies artifact handling. Verify that all artifacts are correctly processed and appear in reports as expected.

Verification successful

The refactor in MapActionEndData simplifies artifact handling and ensures that artifacts are correctly processed and sent to the central database.

  • AccountReportExecutionLogger.cs calls MapActionEndData and sends artifacts to the central database.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that artifacts are processed correctly in the `MapActionEndData` method.

# Test: Search for method usage and check artifact processing. Expect: Correct processing and appearance in reports.
rg --type csharp 'MapActionEndData'

Length of output: 480



Script:

#!/bin/bash
# Description: Extract the usage of `MapActionEndData` in `AccountReportExecutionLogger.cs` to verify artifact processing.

# Extract the relevant code snippet from `AccountReportExecutionLogger.cs`.
rg --type csharp --context 10 'MapActionEndData' Ginger/GingerCoreNET/Run/RunListenerLib/CenteralizedExecutionLogger/AccountReportExecutionLogger.cs

Length of output: 1131

Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs (1)

1210-1220: The enhancements to SetAsStaticImage method to support width and height parameters are well-implemented and maintain backward compatibility.

@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: CHILL

Commits

Files that changed from the base of the PR and between 5136326 and aa15e6e.

Files selected for processing (3)
  • Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs (2 hunks)
  • Ginger/GingerCoreNET/GingerCoreNET.csproj (3 hunks)
  • Ginger/GingerCoreNET/Reports/Ginger-Web-Client/index.html (1 hunks)
Files skipped from review due to trivial changes (2)
  • Ginger/GingerCoreNET/GingerCoreNET.csproj
  • Ginger/GingerCoreNET/Reports/Ginger-Web-Client/index.html

Comment on lines +1228 to +1238
private void SetAsStaticImage(string imageName = "", BitmapImage imageBitMap = null, double Width = 0, double Height = 0)
{
xStaticImage.Visibility = Visibility.Visible;
if(Width > 0)
{
xStaticImage.Width = Width;
}
if(Height > 0)
{
xStaticImage.Height = Height;
}

@coderabbitai coderabbitai Bot Jun 5, 2024

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.

Ensure proper handling of zero or negative values for Width and Height.

The method SetAsStaticImage now includes parameters for Width and Height. It's important to ensure that these values are handled correctly, especially considering zero or negative values which might not be intended. Consider adding validation to ensure that the width and height are positive before applying them.

+ if (Width <= 0 || Height <= 0) throw new ArgumentException("Width and Height must be positive numbers.");

Committable suggestion was skipped due to low confidence.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The idea of default width=0 / Height=0 is to apply only if user specified the width / height explicilty. So here im checking if its default value and then ignoring it.

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.

@sudarshan0212, thank you for clarifying the intended behavior for the default values of Width and Height. It makes sense to apply these dimensions only when explicitly specified by the user. This approach ensures flexibility while using the SetAsStaticImage method. If there's anything else you need, feel free to ask!

Comment on lines +751 to +757
SetAsStaticImage("xml.png" , null, 50);
break;
case eImageType.FileJSON:
SetAsStaticImage("json.png");
SetAsStaticImage("json.png", null, 50);
break;
case eImageType.FileJavascript:
SetAsStaticImage("javascript.png");
SetAsStaticImage("javascript.png", null, 50);

@coderabbitai coderabbitai Bot Jun 5, 2024

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.

Tip

Codebase Verification

The search results indicate that the SetAsStaticImage method is called multiple times with different parameters, but only the calls for XML, JSON, and JavaScript images include a hardcoded width of 50. Other calls do not specify a width, implying they use the default value of 0.

  • Locations with hardcoded width of 50:
    • Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs:751
    • Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs:754
    • Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs:757

Given this inconsistency, it might be beneficial to review whether the hardcoded width of 50 is appropriate for all use cases or if it should be configurable.

Analysis chain

Verify the hardcoded width for image types.

The method calls for SetAsStaticImage with XML, JSON, and JavaScript types now include a hardcoded width of 50. Ensure this width is appropriate for all use cases or consider making it configurable if needed.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Search for all usages of SetAsStaticImage to verify if hardcoded width is consistent.
rg --type cs "SetAsStaticImage" Ginger/UserControlsLib/ImageMakerLib

Length of output: 145



Script:

#!/bin/bash
# Locate the correct path for ImageMakerControl.xaml.cs
fd ImageMakerControl.xaml.cs

# Search for all usages of SetAsStaticImage to verify if hardcoded width is consistent
rg --type cs "SetAsStaticImage"

Length of output: 3875

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The idea of default width=0 / Height=0 is to apply only if user specified the width / height explicilty. So here im checking if its default value and then ignoring it.

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.

@sudarshan0212, thank you for the clarification. It makes sense to use default values as a condition to check if specific dimensions were explicitly set by the user. This approach provides the necessary flexibility for different use cases. If there's anything else you need to discuss or adjust regarding this implementation, feel free to let me know!

@Maheshkale447 Maheshkale447 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.

Please also check codacy issues

if(!string.IsNullOrEmpty(ArtifactPath))
{
FileName = System.IO.Path.GetFileName(ArtifactPath);
FileName = ArtifactName + " (" + System.IO.Path.GetFileName(ArtifactPath) +")";

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.

Please use string interpolation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aa15e6e and 50ee7e6.

Files selected for processing (1)
  • Ginger/Ginger/Actions/UserControls/UCArtifact.xaml.cs (1 hunks)
Additional comments not posted (1)
Ginger/Ginger/Actions/UserControls/UCArtifact.xaml.cs (1)

64-65: The updated ArtifactFileName property now includes the ArtifactName, which enhances clarity and usefulness of the filename. Good use of string interpolation as suggested.

@Maheshkale447
Maheshkale447 merged commit 8544837 into master Jun 7, 2024
@Maheshkale447
Maheshkale447 deleted the fix_artifact_name branch June 7, 2024 10:18
@coderabbitai coderabbitai Bot mentioned this pull request Sep 9, 2024
15 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Oct 16, 2024
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