Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved the hide call on the new-rule-dialog to the end of the valid/su… #2

Merged
merged 1 commit into from
May 20, 2024

Conversation

2lambda123
Copy link
Owner

@2lambda123 2lambda123 commented May 20, 2024

…ccess path

Thank you for submitting a contribution to Apache NiFi.

Please provide a short description of the PR here:

Description of PR

Enables X functionality; fixes bug NIFI-YYYY.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically master)?

  • Is your initial contribution a single, squashed commit? Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not squash or use --force when pushing to allow for clean monitoring of changes.

For code changes:

  • Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
  • Have you written or updated unit tests to verify your changes?
  • Have you verified that the full build is successful on both JDK 8 and JDK 11?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
  • If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
  • If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.

Summary by CodeRabbit

  • Bug Fixes
    • Improved dialog handling to ensure it closes only under specific conditions, enhancing user experience and preventing unintended closures.

Copy link

Unable to locate .performanceTestingBot config file

Copy link

cr-gpt bot commented May 20, 2024

Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information

Copy link

Processing PR updates...

Copy link

git-greetings bot commented May 20, 2024

Thanks @2lambda123 for opening this PR!

For COLLABORATOR only :

  • To add labels, comment on the issue
    /label add label1,label2,label3

  • To remove labels, comment on the issue
    /label remove label1,label2,label3

Copy link

@gitginie gitginie bot left a comment

Choose a reason for hiding this comment

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

@2lambda123
Thank you for your contribution to this repository! We appreciate your effort in opening pull request.
Happy coding!

Copy link

quine-bot bot commented May 20, 2024

👋 Figuring out if a PR is useful is hard, hopefully this will help.

  • @2lambda123 has been on GitHub since 2019 and in that time has had 2218 public PRs merged
  • Don't you recognize them? They've been here before 🎉
  • Here's a good example of their work: HeyGenClone
  • From looking at their profile, they seem to be good with Shell and Makefile.

Their most recently public accepted PR is: #1

Copy link

sweep-ai bot commented May 20, 2024

Sweep: PR Review

nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js

The change ensures that the 'new-rule-dialog' is only closed after the new rule has been successfully added and the rule filter has been re-applied.

Potential Issues

Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.


Copy link

git-greetings bot commented May 20, 2024

PR Details of @2lambda123 in NorthropGrumman-nifi :

OPEN CLOSED TOTAL
1 1 2

@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label May 20, 2024
@labels-and-badges labels-and-badges bot added the PR:size/XS Denotes a Pull Request that changes 0-9 lines. label May 20, 2024
Copy link

coderabbitai bot commented May 20, 2024

Walkthrough

The recent update to the nifi-update-attribute-ui module's application.js file refines the logic for closing dialogs. The code responsible for this action has been moved inside a specific condition block to ensure dialogs are only closed when the appropriate conditions are met, enhancing the user interface's responsiveness and reliability.

Changes

File Path Change Summary
nifi-nar-bundles/.../nifi-update-attribute-ui/src/main/webapp/js/application.js Moved dialog-closing code into a specific condition block to ensure it executes only under certain conditions.

In lines of code, a change so slight,
Dialogs now close just right.
Conditions met, they disappear,
Enhancing user flow, it's clear.
🐇✨ In code we trust, improvements near,
A smoother path, we now revere.


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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

Copy link

codeautopilot bot commented May 20, 2024

undefined

Disclaimer: This comment was entirely generated using AI. Be aware that the information provided may be incorrect.

Current plan usage: 87.20%

Have feedback or need help?
Discord
Documentation
support@codeautopilot.com

@2lambda123 2lambda123 merged commit bbd007a into master May 20, 2024
10 of 21 checks passed
Copy link

@gitginie gitginie bot left a comment

Choose a reason for hiding this comment

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

@2lambda123
Thank you for your contribution to this repository! We appreciate your effort in closing pull request.
Happy coding!

@trafico-bot trafico-bot bot added the ✨ Merged Pull Request has been merged successfully label May 20, 2024
@quine-bot quine-bot bot mentioned this pull request May 20, 2024
12 tasks
@trafico-bot trafico-bot bot removed 🔍 Ready for Review Pull Request is not reviewed yet ✨ Merged Pull Request has been merged successfully labels May 20, 2024
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @2lambda123 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines +400 to +401
// close the dialog
$('#new-rule-dialog').modal('hide');
Copy link

Choose a reason for hiding this comment

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

issue: Duplicate code for closing the dialog

The code for closing the dialog is duplicated. Consider moving it outside the success and error callbacks to avoid redundancy and ensure the dialog is always closed regardless of the outcome.

@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label May 20, 2024
Comment on lines 404 to 405
$('#ok-dialog-content').text(error);
$('#ok-dialog').modal('setHeaderText', 'Configuration Error').modal('show');

Choose a reason for hiding this comment

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

The error handling mechanism directly displays the error message to the user without any sanitization or formatting. This approach can potentially expose sensitive information about the underlying system or lead to cross-site scripting (XSS) vulnerabilities if the error message contains user-controllable input. It's recommended to sanitize and format error messages before displaying them to the user to avoid revealing sensitive information or creating security vulnerabilities.

Choose a reason for hiding this comment

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

Micro-Learning Topic: Cross-site scripting (Detected by phrase)

Matched on "cross-site scripting"

What is this? (2min video)

Cross-site scripting vulnerabilities occur when unescaped input is rendered into a page displayed to the user. When HTML or script is included in the input, it will be processed by a user's browser as HTML or script and can alter the appearance of the page or execute malicious scripts in their user context.

Try a challenge in Secure Code Warrior

Helpful references

@@ -396,13 +396,15 @@ var ua = {
// re-apply the rule filter
ua.applyRuleFilter();
}

// close the dialog
$('#new-rule-dialog').modal('hide');

Choose a reason for hiding this comment

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

The code directly manipulates the DOM to close a modal dialog, which is tightly coupling the JavaScript logic with the UI structure. This approach can lead to maintenance issues if the UI changes, as the JavaScript code will also need to be updated. It's recommended to abstract UI manipulations into separate functions or use a framework that provides more declarative ways to handle UI changes, improving the maintainability and modularity of the code.

@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed 🔍 Ready for Review Pull Request is not reviewed yet labels May 20, 2024
Copy link

codesyncapp bot commented May 20, 2024

Check out the playback for this Pull Request here.

Copy link

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

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 7106aa2 and 67fa33f.
Files selected for processing (1)
  • nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js (1 hunks)
Additional comments not posted (1)
nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js (1)

401-401: Move dialog hide call to ensure it only executes on successful rule creation.

This change aligns with the PR's objective to ensure the dialog only closes upon successful validation, enhancing user experience by preventing the dialog from disappearing during an error state.

@trafico-bot trafico-bot bot added 🔍 Ready for Review Pull Request is not reviewed yet and removed ✨ Merged Pull Request has been merged successfully labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR:size/XS Denotes a Pull Request that changes 0-9 lines. 🔍 Ready for Review Pull Request is not reviewed yet size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant