-
-
Notifications
You must be signed in to change notification settings - Fork 254
Only disable "delete backup" when backup hasn't failed #1686
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
Conversation
📝 WalkthroughWalkthroughUpdated the DeleteAction disabled condition in BackupResource::defaultTable: previously disabled when a backup was is_locked; now disabled only when is_locked and status is not Failed. This permits deleting locked backups with Failed status. No public API signatures changed. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Table as BackupResource Table
participant Delete as DeleteAction
participant Guard as Disabled Condition
User->>Table: Open Backups list
User->>Delete: Attempt Delete on a backup
Delete->>Guard: Evaluate (is_locked && status != Failed)?
alt Guard returns true (disabled)
Delete-->>User: Delete unavailable
else Guard returns false (enabled)
Delete->>Table: Proceed with delete flow
Table-->>User: Deletion executed
end
note over Guard: New logic allows delete when is_locked && status == Failed
Pre-merge checks (3 passed)✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/Filament/Server/Resources/Backups/BackupResource.php (2)
90-90: Nit: fix class casing to match import (Textarea)Avoid case-mismatch with the imported Filament component.
Apply:
- TextArea::make('ignored') + Textarea::make('ignored')
251-254: Use status enum for the 'failed' activity property for consistencyKeeps telemetry aligned with the UI’s status-based logic and prevents drift if failure semantics evolve.
- Activity::event('server:backup.delete') - ->subject($backup) - ->property(['name' => $backup->name, 'failed' => !$backup->is_successful]) + Activity::event('server:backup.delete') + ->subject($backup) + ->property(['name' => $backup->name, 'failed' => $backup->status === BackupStatus::Failed]) ->log();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/Filament/Server/Resources/Backups/BackupResource.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/Filament/Server/Resources/Backups/BackupResource.php (1)
app/Models/Backup.php (1)
Backup(36-107)
🔇 Additional comments (2)
app/Filament/Server/Resources/Backups/BackupResource.php (2)
230-230: Condition change LGTM — enables deleting locked failed backups as intendedThis precisely matches the PR goal: deletion is disabled only when locked and not Failed; still hidden during InProgress.
233-255: Service allows deletion of failed locked backups
Verified that inDeleteBackupService::handle(), theBackupLockedExceptionis only thrown when$backup->is_locked && $backup->is_successful && $backup->completed_atare true, so failed backups (whereis_successfulis false) can still be deleted even if locked.
Currently, if a failed backup is locked there is no way to unlock or delete it. This makes a failed backup deletable, even if it's locked.