enhancementgood first issuehelp wanted
Repository metrics
- Stars
- (284 stars)
- PR merge metrics
- (PR metrics pending)
Description
Add logic for restarting services after package operations
Summary
Implement the missing service restart functionality in the PostSummary modal. Currently, pressing 's' only shows a toast message but doesn't actually restart the systemd services that are pending restart after package operations.
Files to modify
src/events/modals/common.rs(around line 295)
Expected behavior
When users press 's' in the PostSummary modal and there are services pending restart:
- Execute
systemctl restart <service>for each service in theservices_pendinglist - Show appropriate success/error messages for each service restart attempt
- Handle partial failures gracefully (some services might fail while others succeed)
- Update the UI state to reflect that services have been restarted
Testing
-
cargo checkpasses -
cargo clippy --all-targets --all-features -- -D warningspasses -
cargo test -- --test-threads=1passes - Test service restart with mock systemctl commands
- Test error handling when systemctl is not available
- Test partial failure scenarios (some services restart successfully, others fail)
Additional context
The implementation should integrate with systemd service management using the existing run_command infrastructure from src/logic/services/command.rs. Follow the pattern used in src/logic/services/systemd.rs for executing systemctl commands.
Key considerations:
- Use
systemctl restart <service>for each service inservices_pending - Handle both success and failure cases gracefully
- Consider running restarts asynchronously to avoid blocking the UI
- Update the modal state after successful restarts
- Add proper error messages and logging