Firstp1ck / Firstp1ck/Pacsea

[FEATURE] Implement Service Restart Logic

Open
#99 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted
Dominant language
Rust
Stars
296
Forks
11
PR merge metrics
No merged PRs in 30d

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:
1. Execute `systemctl restart ` for each service in the `services_pending` list
2. Show appropriate success/error messages for each service restart attempt
3. Handle partial failures gracefully (some services might fail while others succeed)
4. Update the UI state to reflect that services have been restarted

## Testing
- [ ] `cargo check` passes
- [ ] `cargo clippy --all-targets --all-features -- -D warnings` passes
- [ ] `cargo test -- --test-threads=1` passes
- [ ] 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 ` for each service in `services_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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.