Commit graph

29 commits

Author SHA1 Message Date
phg
dcf28211d8 Refactor imports across multiple files: remove unused imports to clean up code and improve readability. 2025-08-18 14:48:11 +02:00
phg
9b2288dfa6 Restrict DNS resolution actions to edit mode: prevent DNS resolution in read-only mode and provide user feedback. 2025-08-18 14:20:20 +02:00
phg
90935e67a6 Implement radio set for entry type selection in edit mode: add IP and DNS options, manage field visibility, and enhance form population logic. 2025-08-18 13:43:16 +02:00
phg
f8b235ab24 Refactor DNS resolution: remove background service components, simplify manual resolution, and update configuration and tests accordingly. 2025-08-18 11:06:02 +02:00
phg
1c8396f020 Add comprehensive tests for filtering and import/export functionality
- Created `test_filters.py` to test the EntryFilter and FilterOptions classes, covering default values, custom values, filtering by status, DNS type, resolution status, and search functionality.
- Implemented tests for combined filters and edge cases in filtering.
- Added `test_import_export.py` to test the ImportExportService class, including exporting to hosts, JSON, and CSV formats, as well as importing from these formats.
- Included tests for handling invalid formats, missing required columns, and warnings during import.
- Updated `uv.lock` to include `pytest-asyncio` as a dependency for asynchronous testing.
2025-08-18 10:32:52 +02:00
phg
e6f3e9f3d4 Refactor tests for HostsManagerApp: update status verification to use footer instead of subtitle for improved accuracy and clarity. 2025-08-17 21:37:06 +02:00
phg
bc0f8b99e8 Implement command pattern for undo/redo functionality in HostsManager
- Added command classes: ToggleEntryCommand, MoveEntryCommand, AddEntryCommand, DeleteEntryCommand, UpdateEntryCommand.
- Integrated UndoRedoHistory to manage command execution and history.
- Updated HostsManager to use command-based methods for editing entries with undo/redo support.
- Enhanced HostsManagerApp to display undo/redo status and handle undo/redo actions via keyboard shortcuts.
- Refactored navigation handler to utilize command-based methods for toggling and moving entries.
- Created comprehensive tests for command classes and integration with HostsManager.
2025-08-17 21:30:01 +02:00
phg
77d4a2e955 Enhance entry addition process: implement immediate file save after adding an entry and handle save failure by removing the entry for improved reliability. 2025-08-17 19:26:30 +02:00
phg
de5acd4dad Refactor entry details display: replace DataTable with disabled input widgets for improved clarity and user experience. 2025-08-17 18:45:54 +02:00
phg
8d3d1e7c11 Refactor hosts TUI application: replace Footer with CustomFooter, implement footer setup and status updates, and enhance styling for improved user experience 2025-08-16 20:58:41 +02:00
phg
50628d78b7 Refactor hosts TUI application: remove HelpModal, update help action, and clean up related code 2025-08-16 17:57:35 +02:00
phg
07e7e4f70f Add entry and delete entry functionality with modals in TUI application
- Implemented add_entry method in HostsManager for adding new entries.
- Created AddEntryModal for user input when adding entries.
- Implemented delete_entry method in HostsManager for removing entries.
- Created DeleteConfirmationModal for user confirmation before deletion.
- Integrated modals into HostsManagerApp for adding and deleting entries.
- Added search functionality with SearchModal for finding entries by hostname or IP address.
- Updated keybindings to include shortcuts for adding and deleting entries.
- Added HelpModal to provide keyboard shortcuts and usage information.
2025-08-14 19:47:09 +02:00
phg
8b8c02c6da Improve error handling in entry edit mode and update sudo request tests for clarity and accuracy 2025-08-14 18:01:20 +02:00
phg
1fddff91c8 Refactor tests for PermissionManager, HostsManager, HostEntry, HostsFile, and HostsParser
- Updated test cases in test_manager.py to improve readability and consistency.
- Simplified assertions and mock setups in tests for PermissionManager.
- Enhanced test coverage for HostsManager, including edit mode and entry manipulation tests.
- Improved test structure in test_models.py for HostEntry and HostsFile, ensuring clarity in test cases.
- Refined test cases in test_parser.py for better organization and readability.
- Adjusted test_save_confirmation_modal.py to maintain consistency in mocking and assertions.
2025-08-14 17:32:02 +02:00
phg
25001042e5 Enhance status display and entry details in HostsManagerApp
- Updated header title to "/etc/hosts Manager" and modified subtitle format.
- Implemented a dedicated overlay status bar for error messages, ensuring no layout shifts.
- Refactored entry details display to use DataTable with labeled rows for improved consistency.
- Added CSS styles for the new status bar and DataTable.
- Created tests for status bar visibility and DataTable functionality, ensuring all tests pass.
2025-07-31 09:47:09 +02:00
phg
cd6820179f Refactor test error handling and status updates in HostsManagerApp tests 2025-07-31 08:48:02 +02:00
phg
4dbf200c5f Add TUI components for hosts management
- Implement DetailsHandler for managing entry details display and edit forms.
- Create EditHandler to handle edit mode operations, including validation and saving of entry changes.
- Introduce NavigationHandler for entry movement and action operations.
- Define key bindings for various application actions in keybindings.py.
- Add TableHandler for managing the data table, including sorting and filtering of entries.
- Establish CSS styles for consistent theming across the application.
- Update tests to reflect changes in module structure and ensure proper functionality.
2025-07-30 16:08:25 +02:00
phg
8b1c01c894 Refactor test imports: remove unused imports across configuration and modal test files 2025-07-30 15:26:39 +02:00
phg
1dd54b0cb5 Refine modal focus handling: update tab navigation logic and simplify focus setting in SaveConfirmationModal tests 2025-07-30 14:58:43 +02:00
phg
77d8e647f2 Enhance save confirmation modal: adjust button focus behavior and update tests for new functionality 2025-07-30 14:38:39 +02:00
phg
f7671db43e Add save confirmation modal and integrate with entry editing
- Implemented SaveConfirmationModal to prompt users for saving changes when exiting edit mode.
- Integrated modal into HostsManagerApp to handle unsaved changes.
- Added methods to validate and save entry changes, restoring original values if discarded.
- Created unit tests for SaveConfirmationModal and its integration with the main application.
- Refactored entry editing logic to track changes and confirm before exiting edit mode.
2025-07-30 13:36:25 +02:00
phg
d477328bea Enhance status messages and layout in HostsManagerApp; improve error handling and testing for status updates 2025-07-30 00:18:48 +02:00
phg
0ee720c5ef Add management header to hosts files and enhance serialization formatting; update tests to reflect changes. 2025-07-30 00:00:53 +02:00
phg
5a2e0d2623 Enhance hosts file serialization and entry formatting for proper tab alignment; update tests to reflect changes. 2025-07-29 23:31:30 +02:00
phg
3084650c27 Enhance HostsManager to prevent modification and movement of default system entries; add is_default_entry method to HostEntry and update sorting methods to prioritize default entries. 2025-07-29 23:04:29 +02:00
phg
1b57be2cbf Implement HostsManager for managing hosts file edits with permission handling
- Added PermissionManager class for managing sudo permissions.
- Introduced HostsManager class for high-level operations on hosts file.
- Implemented methods for entering/exiting edit mode, toggling entries, moving entries, updating entries, saving the hosts file, and restoring backups.
- Integrated permission validation and backup creation during edit operations.
- Enhanced main application to support edit mode and associated actions.
- Added tests for PermissionManager and HostsManager to ensure functionality and error handling.
2025-07-29 22:43:01 +02:00
phg
0051932014 Add comprehensive tests for configuration management and main TUI components 2025-07-29 21:14:29 +02:00
phg
c57267213f Remove compiled Python cache files from the repository 2025-07-29 15:07:01 +02:00
phg
2decad8047 Add unit tests for HostEntry and HostsFile models, and implement HostsParser tests
- Created comprehensive unit tests for HostEntry class, covering creation, validation, and conversion to/from hosts file lines.
- Developed unit tests for HostsFile class, including entry management, sorting, and retrieval of active/inactive entries.
- Implemented tests for HostsParser class, validating parsing and serialization of hosts files, handling comments, and file operations.
- Ensured coverage for edge cases such as empty files, invalid entries, and file permission checks.
2025-07-29 14:52:31 +02:00