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

Enhancing Section Input Flexibility #153

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

suprajamannava17
Copy link
Collaborator

Fixes #140

What was changed?

  • Improved Preview Modal behavior to close when pressing the Escape key and display API error messages.
  • Enhanced Section Input Handling to support non-sequential inputs (e.g., 1,3,5) and correctly interpret range formats (e.g., 1-5).

Why was it changed?

  • Modal Usability Issues: Previously, the preview modal did not close with the Escape key, forcing users to click manually. Additionally, API error messages were not displayed, making troubleshooting difficult.
  • Section Input Limitations: The system only handled sequential inputs, making it inconvenient for users who wanted to specify non-sequential sections or use range-based inputs.

How was it changed?

  1. file_search_operations.py
  • Extracts section numbers correctly, even for non-sequential and range inputs.
  • Ensures valid sections are processed by checking against the total number of sections (if section_number > len(specify_lines): continue).
  • Handles missing section numbers gracefully by verifying start_line before using it.
  1. OrcaDashboardComponent.js
  • Added a keydown event listener inside useEffect to close the preview modal when Escape is pressed.
  • The function handleNumSectionsBlur was modified to parse non-sequential section inputs and expand range inputs (e.g., 1-5 to 1,2,3,4,5). Uses Set() to store unique values and avoid duplicates. Splits input by ,, processes ranges (x-y), and converts valid numbers into an array. Finally, sorts the parsed values and updates the state.

.split(",")
.map((val) => val.trim())
.filter((val) => val !== "");
const input = e.target.value;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see you had written a clean code for range (1-3) to work but Some edge cases is being missed make sure to check it once

@@ -257,14 +274,26 @@ const OrcaDashboardComponent = () => {
});
};

useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Code is clean and effective

start_line = term_line_num[i] if i < len(term_line_num) else None
term_line_num = term_line_nums.get(term, [])

for section_number in sections:
Copy link
Collaborator

Choose a reason for hiding this comment

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

cleaver usage of logic and optimal lines of code really good

Copy link
Collaborator

@bhumulanandinireddy bhumulanandinireddy left a comment

Choose a reason for hiding this comment

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

@suprajamannava17 please check escape key , on entering the range functionality for no of sections ex : 1-3 is not working and could not able to display any error messages on failure.

Copy link
Collaborator

@bhumulanandinireddy bhumulanandinireddy left a comment

Choose a reason for hiding this comment

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

Changes looks good to me ! - everything is working fine

@bhumulanandinireddy bhumulanandinireddy merged commit 0b7a98a into main Mar 19, 2025
3 checks passed
@bhumulanandinireddy bhumulanandinireddy deleted the 140-api-error-messages-extract-sections branch March 19, 2025 19:51
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.

API Error Messages in Preview Modal & Section Input Handling
2 participants