-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat(todo): enhance todo functionality and error handling #198
Conversation
- Refactored the JavaScript code for creating and displaying todo items to use a template-based approach. - Improved error handling and user feedback for adding, deleting, and updating todo items. - Updated API endpoints and views to include better validation and error messages. - Enhanced the UI with new icons and required fields for better user experience. - Added a hidden template for todo items to streamline the creation of new items dynamically.
…t validation - Refactored JavaScript code to use const instead of var for variable declarations. - Updated event handlers to use async functions for better handling of asynchronous operations. - Improved input validation in the HTML form for adding todos, including setting minimum and maximum lengths and allowed character patterns. - Enhanced error handling and user feedback for adding, deleting, and updating todo items. - Added detailed docstrings to Python view functions for better code documentation and readability. - Introduced logging for JSON decode errors in the Python views.
- Simplified the button click handling logic in todo.js by removing redundant code and improving readability. - Enhanced the user interface feedback for important task toggling and deletion confirmation. - Added autocomplete="on" to the task input field in index.html for better user experience. - Removed redundant class addition in the todo item creation process.
…nality - Refactored todo.js to modularize event listeners into separate functions. - Enhanced search functionality to save and load search terms from local storage. - Updated the UI to include a clear search button and improved button styling for task actions. - Adjusted HTML and CSS to support the new search and action button features.
…crollbar instances - Removed redundant variable assignments for PerfectScrollbar instances in the populateTodofunction. - Added a missing semicolon in the importantBtnListener function.
- Corrected the function name from populateTodofunction to populateTodo. - Added a new listener function addTaskPopupListener to handle task popups. - Renamed addActionsBtnListener to actionsBtnListener and added a call to searchFunction within it. - Introduced a new property is_important for tasks and updated the template to conditionally display the important badge. - Enhanced the search functionality to apply the current filter after searching. - Added a new function applyCurrentFilter to filter tasks based on their status (Todo, Done, Important).
Reviewer's Guide by SourceryThis pull request enhances the todo functionality and error handling in the recon_note app. It introduces a template-based approach for creating and displaying todo items, improves error handling and user feedback, updates API endpoints with better validation, and enhances the UI with new icons and required fields. The changes span across JavaScript, Python, and HTML files, focusing on improving the overall user experience and code quality. File-Level Changes
Tips
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @psyray - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider optimizing the
updateBadgeCounts()
function to reduce potential performance impact, especially if it's called frequently. - Ensure that server-side validation is in place to complement the client-side validation for todo title and description.
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
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
}; | ||
|
||
// Updated search function | ||
const searchFunction = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (performance): Optimize search function for performance
The searchFunction might be called frequently. Consider optimizing it, perhaps by debouncing the input or using more efficient DOM manipulation techniques.
const searchFunction = _.debounce(function() {
const searchTerm = $('.input-search').val();
const rex = new RegExp(searchTerm, 'i');
// ... rest of the function
}, 300);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested. A general but important suggestion though: please change it to 'to-do'. 'Todo' isn't a word at all.
- Updated key names in todo.js to ensure consistency with backend expectations.
- Adjusted CSS styles in todolist.css for better alignment and spacing.
- Updated various HTML templates and JavaScript files to standardize the terminology from "Todo" to "to-do".
… placeholder - Updated test cases to include content_type='application/json' in POST requests. - Modified error messages in AddReconNote view to remove checks for scan_history_id and subdomain_id. - Corrected the placeholder text in the HTML input field for adding a to-do.
…x elements - Simplified the logic for updating badge notifications in the todo list by consolidating repeated code into a single function. - Removed unused checkbox elements from the todo item template and related HTML.
- Added a "Close" button to the modal footer in the note index template. - Implemented functionality to hide the modal when the "Close" button is clicked.
Fixes #197
Preview
Summary by Sourcery
Enhance the todo functionality by adopting a template-based approach for item creation, improving error handling, and refining the UI with new icons and required fields. Refactor JavaScript code for better organization and introduce detailed docstrings in the views for improved documentation.
New Features:
Bug Fixes:
Enhancements:
Documentation: