fix: allow deleting previewed restore runs

Treat previewed as deletable for hygiene; keeps partial deletable too.
This commit is contained in:
Ahmed Darrazi 2025-12-25 03:25:27 +01:00
parent 0a6e1f7751
commit d718a127c5
2 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,7 @@ public function backupSet(): BelongsTo
public function scopeDeletable($query) public function scopeDeletable($query)
{ {
return $query->whereIn('status', ['completed', 'failed', 'aborted', 'completed_with_errors', 'partial']); return $query->whereIn('status', ['completed', 'failed', 'aborted', 'completed_with_errors', 'partial', 'previewed']);
} }
public function isDeletable(): bool public function isDeletable(): bool
@ -44,6 +44,6 @@ public function isDeletable(): bool
$status = strtolower(trim((string) $this->status)); $status = strtolower(trim((string) $this->status));
$status = str_replace([' ', '-'], '_', $status); $status = str_replace([' ', '-'], '_', $status);
return in_array($status, ['completed', 'failed', 'aborted', 'completed_with_errors', 'partial'], true); return in_array($status, ['completed', 'failed', 'aborted', 'completed_with_errors', 'partial', 'previewed'], true);
} }
} }

View File

@ -24,6 +24,7 @@
'aborted', 'aborted',
'completed_with_errors', 'completed_with_errors',
'partial', 'partial',
'previewed',
'running', 'running',
'pending', 'pending',
]; ];
@ -52,6 +53,7 @@
'completed_with_errors', 'completed_with_errors',
'failed', 'failed',
'partial', 'partial',
'previewed',
]); ]);
}); });