Refactor backup execution and cleanup functionality
This commit is contained in:
parent
a6669ed876
commit
051a1405e7
@ -10,7 +10,8 @@ class Execution extends Component
|
|||||||
public $backup;
|
public $backup;
|
||||||
public $executions;
|
public $executions;
|
||||||
public $s3s;
|
public $s3s;
|
||||||
public function mount() {
|
public function mount()
|
||||||
|
{
|
||||||
$backup_uuid = request()->route('backup_uuid');
|
$backup_uuid = request()->route('backup_uuid');
|
||||||
$project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
$project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
||||||
if (!$project) {
|
if (!$project) {
|
||||||
@ -34,6 +35,11 @@ class Execution extends Component
|
|||||||
$this->executions = $executions;
|
$this->executions = $executions;
|
||||||
$this->s3s = currentTeam()->s3s;
|
$this->s3s = currentTeam()->s3s;
|
||||||
}
|
}
|
||||||
|
public function cleanupFailed()
|
||||||
|
{
|
||||||
|
$this->backup->executions()->where('status', 'failed')->delete();
|
||||||
|
$this->dispatch('refreshBackupExecutions');
|
||||||
|
}
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('livewire.project.database.backup.execution');
|
return view('livewire.project.database.backup.execution');
|
||||||
|
@ -34,7 +34,7 @@ class BackupExecutions extends Component
|
|||||||
}
|
}
|
||||||
$execution->delete();
|
$execution->delete();
|
||||||
$this->dispatch('success', 'Backup deleted.');
|
$this->dispatch('success', 'Backup deleted.');
|
||||||
$this->dispatch('refreshBackupExecutions');
|
$this->refreshBackupExecutions();
|
||||||
}
|
}
|
||||||
public function download($exeuctionId)
|
public function download($exeuctionId)
|
||||||
{
|
{
|
||||||
@ -65,6 +65,6 @@ class BackupExecutions extends Component
|
|||||||
}
|
}
|
||||||
public function refreshBackupExecutions(): void
|
public function refreshBackupExecutions(): void
|
||||||
{
|
{
|
||||||
$this->executions = data_get($this->backup, 'executions', []);
|
$this->executions = $this->backup->executions()->get()->sortByDesc('created_at');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,10 @@
|
|||||||
</x-modal>
|
</x-modal>
|
||||||
<div class="pt-6">
|
<div class="pt-6">
|
||||||
<livewire:project.database.backup-edit :backup="$backup" :s3s="$s3s" :status="data_get($database, 'status')" />
|
<livewire:project.database.backup-edit :backup="$backup" :s3s="$s3s" :status="data_get($database, 'status')" />
|
||||||
<h3 class="py-4">Executions</h3>
|
<div class="flex items-center gap-2">
|
||||||
|
<h3 class="py-4">Executions</h3>
|
||||||
|
<x-forms.button wire:click='cleanupFailed'>Cleanup Failed Backups</x-forms.button>
|
||||||
|
</div>
|
||||||
<livewire:project.database.backup-executions :backup="$backup" :executions="$executions" />
|
<livewire:project.database.backup-executions :backup="$backup" :executions="$executions" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user