This commit is contained in:
Bozhidar 2024-05-16 11:39:40 +03:00
parent 479fcfc236
commit 19044ca3f5
2 changed files with 16 additions and 1 deletions

View file

@ -41,7 +41,7 @@ enum BackupStatus: string implements HasColor, HasIcon, HasLabel
return match ($this) {
self::Pending => 'heroicon-m-sparkles',
self::Processing => 'heroicon-m-arrow-path',
self::Cancelled => 'heroicon-m-truck',
self::Cancelled => 'heroicon-o-x-mark',
self::Completed => 'heroicon-m-check-badge',
self::Failed => 'heroicon-m-x-circle',
};

View file

@ -103,6 +103,21 @@ class BackupResource extends Resource
//
])
->actions([
Tables\Actions\Action::make('cancel')
->icon('heroicon-o-x-mark')
->hidden(function (Backup $backup) {
return $backup->status !== BackupStatus::Processing;
})
->action(function (Backup $backup) {
shell_exec('kill -9 ' . $backup->process_id);
$backup->update([
'status' => BackupStatus::Cancelled,
]);
}),
Tables\Actions\Action::make('download')
->icon('heroicon-o-arrow-down-tray')
->hidden(function (Backup $backup) {