format muhahaha

This commit is contained in:
Andras Bacsai
2023-08-11 20:48:52 +02:00
parent c762195c8a
commit 82a01b4483
109 changed files with 295 additions and 244 deletions

View File

@@ -54,18 +54,13 @@ class BackupEdit extends Component
} catch (\Exception $e) {
$this->emit('error', $e->getMessage());
}
}
private function custom_validate()
{
// if ($this->backup->save_s3) {
// if (!is_numeric($this->selected_storage_id)) {
// throw new \Exception('Invalid S3 Storage');
// } else {
// $this->backup->s3_storage_id = $this->selected_storage_id;
// }
// }
if (!is_numeric($this->backup->s3_storage_id)) {
$this->backup->s3_storage_id = null;
}
$isValid = validate_cron_expression($this->backup->frequency);
if (!$isValid) {
throw new \Exception('Invalid Cron / Human expression');

View File

@@ -11,7 +11,6 @@ class BackupExecution extends Component
public function download()
{
}
public function delete(): void

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Http\Livewire\Project\Database;
use App\Jobs\DatabaseBackupJob;
use Livewire\Component;
class BackupNow extends Component
{
public $backup;
public function backup_now()
{
dispatch(new DatabaseBackupJob(
backup: $this->backup
));
$this->emit('success', 'Backup queued. It will be available in a few minutes');
}
}

View File

@@ -42,7 +42,7 @@ class General extends Component
public function save_init_script($script)
{
$this->database->init_scripts = filter($this->database->init_scripts, fn($s) => $s['filename'] !== $script['filename']);
$this->database->init_scripts = filter($this->database->init_scripts, fn ($s) => $s['filename'] !== $script['filename']);
$this->database->init_scripts = array_merge($this->database->init_scripts, [$script]);
$this->database->save();
$this->emit('success', 'Init script saved successfully.');
@@ -53,8 +53,8 @@ class General extends Component
$collection = collect($this->database->init_scripts);
$found = $collection->firstWhere('filename', $script['filename']);
if ($found) {
ray($collection->filter(fn($s) => $s['filename'] !== $script['filename'])->toArray());
$this->database->init_scripts = $collection->filter(fn($s) => $s['filename'] !== $script['filename'])->toArray();
ray($collection->filter(fn ($s) => $s['filename'] !== $script['filename'])->toArray());
$this->database->init_scripts = $collection->filter(fn ($s) => $s['filename'] !== $script['filename'])->toArray();
$this->database->save();
$this->refresh();
$this->emit('success', 'Init script deleted successfully.');