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

fix: bug run button not disabled in response pane #36864

Open
wants to merge 1 commit into
base: release
Choose a base branch
from

Conversation

prasad-madine
Copy link
Contributor

@prasad-madine prasad-madine commented Oct 14, 2024

Description:

When no query is added in the query input box, the run button on the top query page is getting disabled. But the same behaviour is not maintained for the run button in the response pane.

I have raised this PR to fix the bug run button not disabled in response pane when there is no query input

Issue Link

Screenshots:

Before resoving bug:

image

After resoving bug:

image

Summary by CodeRabbit

  • New Features

    • Introduced a check to disable the run button when the query is empty, enhancing user experience in the Query Response Tab.
  • Bug Fixes

    • Improved testing capabilities for the Query Response Tab to ensure the run button behaves correctly based on query state.

Copy link
Contributor

coderabbitai bot commented Oct 14, 2024

Walkthrough

The pull request introduces updates to the QueryResponseTab component's testing suite and logic. A new test case ensures the run button is disabled when the query is empty. Additionally, a boolean variable isQueryEmpty is added to enhance the condition for disabling the run button, which now considers both execution permissions and the query's content. These changes aim to improve the component's behavior and testing accuracy without altering any public entity declarations.

Changes

File Path Change Summary
app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx Added import statements and a new test case to check if the run button is disabled when the query is empty.
app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx Introduced isQueryEmpty variable to modify the condition for disabling the run button in the NoResponse component.

Possibly related issues

Possibly related PRs

Suggested labels

Bug, ok-to-test

Suggested reviewers

  • AmanAgarwal041
  • hetunandu

Poem

In the land of queries, a button so bright,
Now knows when to pause, when to take flight.
With tests that ensure it’s ready to play,
The run button waits for a query to say.
So here’s to the changes, both clever and neat,
Making our editor feel truly complete! 🎉


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 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 anywhere in the PR title to generate the title automatically.

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
Contributor

@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

🧹 Outside diff range and nitpick comments (1)
app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx (1)

198-223: A gold star for adding this crucial test case!

I'm thrilled to see you've added a test to check if the run button is disabled when the query is empty. This is an important edge case that needed coverage. Your setup of the test props and rendering of the component is spot on!

However, I have a small suggestion to make this test even better:

Instead of using screen.getByRole('button'), which might be ambiguous if there are multiple buttons, let's be more specific. Consider using a test ID or a more specific role+name combination. For example:

const runButton = screen.getByRole('button', { name: /run/i });

or

const runButton = screen.getByTestId('run-query-btn');

This will ensure we're always testing the correct button, even if the component structure changes in the future.

Keep up the excellent work in improving our test coverage!

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f572d6d and c85a592.

📒 Files selected for processing (2)
  • app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx (2 hunks)
  • app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx (2 hunks)
🧰 Additional context used
🔇 Additional comments (4)
app/client/src/pages/Editor/QueryEditor/QueryResponseTab.test.tsx (1)

2-3: Excellent addition of testing utilities, class!

I'm pleased to see you've imported screen from @testing-library/react and included @testing-library/jest-dom/extend-expect. These are valuable tools in our testing toolkit!

The screen object will allow you to query rendered components more idiomatically, making your tests easier to read and write. The jest-dom extension adds custom matchers that will make your assertions on DOM elements more expressive.

Keep up the good work in enhancing our testing capabilities!

app/client/src/pages/Editor/QueryEditor/QueryResponseTab.tsx (3)

99-99: Well done, class! Let's examine this new variable.

The addition of isQueryEmpty is a smart move. It's like checking if a student has written anything on their test paper before they submit it. This variable will help us determine if there's actually a query to run.


349-349: Excellent modification! Let's break it down for the class.

This change is like adding an extra check before allowing a student to submit their test. Not only do we make sure they have permission to take the test (isExecutePermitted), but we also ensure they've actually written something (!isQueryEmpty). This will prevent students... I mean, users, from submitting empty queries.


99-99: Class, let's summarize today's lesson!

These changes work together like a well-oiled machine to solve our run button problem. By introducing isQueryEmpty and using it in the isRunDisabled condition, we've ensured that our query "test paper" can't be submitted if it's blank. This is a textbook example of how small, focused changes can have a significant impact on user experience.

Remember, children, in the world of coding, it's not just about writing code, but writing code that prevents users from making mistakes. You've all done very well today!

Also applies to: 349-349

Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Oct 21, 2024
@prasad-madine
Copy link
Contributor Author

Hello @sagar-qa007 @rohan-arthur Could you please review this PR.

@github-actions github-actions bot removed the Stale label Oct 22, 2024
Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Oct 29, 2024
@prasad-madine
Copy link
Contributor Author

Hello @sagar-qa007 , Please review this PR.

@github-actions github-actions bot removed the Stale label Oct 30, 2024
Copy link

github-actions bot commented Nov 7, 2024

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Nov 7, 2024
@prasad-madine
Copy link
Contributor Author

Hello @sagar-qa007 , Please review this PR.

@github-actions github-actions bot removed the Stale label Nov 8, 2024
Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Nov 17, 2024
@prasad-madine
Copy link
Contributor Author

Hello @sagar-qa007 , Please review this PR.

@sagar-qa007
Copy link
Contributor

sagar-qa007 commented Nov 18, 2024

@rahulbarwal FYI. Please check this.

@PrasadMadine Please resolved the conflict.

@github-actions github-actions bot removed the Stale label Jan 11, 2025
Copy link

github-actions bot commented Feb 1, 2025

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants