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(FE): prevent saving view with empty label #6446

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

Conversation

Aarif5435
Copy link

@Aarif5435 Aarif5435 commented Nov 15, 2024

PR Title:

[FE]: Prevent Saving View with Empty or Whitespace-Only Label

PR Description:

Issue:
Currently, the application allows users to save views with an empty or whitespace-only label, leading to confusion and inconsistent naming in the UI.

Fix:
This PR introduces a validation check for the "Label" field in the "Save this view" dialog to ensure that the label contains non-whitespace characters before allowing the view to be saved. If the label is empty or only contains spaces, an error message will prompt the user to enter a valid label.

Changes:

  • Added a validation check for the label field before submission.
  • Displayed an error message if the label is empty or contains only whitespace.
  • Prevented the form submission if the validation fails.

Screenshots

Screenshot 2024-11-15 at 6 41 38 AM Screenshot 2024-11-15 at 6 43 49 AM

How to test:

  1. Open the "Save this view" dialog.
  2. Leave the "Label" field empty or enter only spaces.
  3. Click the "Save this view" button.
  4. Verify that an error message appears prompting the user to enter a valid label.
  5. Ensure the view is not saved unless the label is valid (non-empty and non-whitespace).

Additional Context:

This fix addresses the UX issue where users could save views with invalid labels, making it difficult to manage views later. With the validation in place, users are required to enter a meaningful label before proceeding.


Important

Adds validation in ExplorerOptions.tsx to prevent saving views with empty or whitespace-only labels, displaying an error message if invalid.

  • Behavior:
    • Adds validation in onSaveHandler in ExplorerOptions.tsx to prevent saving views with empty or whitespace-only labels.
    • Displays error message if label is invalid.
    • Blocks form submission if validation fails.

This description was created by Ellipsis for 152c91a. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 152c91a in 33 seconds

More details
  • Looked at 17 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/container/ExplorerOptions/ExplorerOptions.tsx:423
  • Draft comment:
    Consider making the error message more specific by mentioning that the label cannot be empty or contain only whitespace.
 message: 'Label cannot be empty or contain only whitespace. Please enter a valid label name to save this view.'
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The validation logic for the label field is correct, but the error message could be more specific about the whitespace issue.

Workflow ID: wflow_sl3avOuAcEMcBbzj


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -418,6 +418,12 @@ function ExplorerOptions({
});

const onSaveHandler = (): void => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using inline styles. Move styles like dropdownStyle to an external stylesheet or use styled components. This applies to other inline styles in the file as well.

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.

1 participant