This commit is contained in:
Bozhidar 2024-05-16 12:04:36 +03:00
parent 909ed5ba70
commit f1aeeba229
2 changed files with 47 additions and 1 deletions

View file

@ -6,6 +6,7 @@ use App\Filament\Resources\BackupResource;
use App\Jobs\RestoreBackup;
use Filament\Actions;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Form;
use Filament\Pages\Concerns\ExposesTableToWidgets;
use Filament\Resources\Components\Tab;
@ -28,6 +29,7 @@ class ManageBackups extends ManageRecords
return [
Actions\Action::make('restore')
->hidden($restoringBackup)
->icon('heroicon-o-cloud-arrow-up')
@ -52,6 +54,43 @@ class ManageBackups extends ManageRecords
Actions\CreateAction::make()
->icon('heroicon-o-clock')
->slideOver(),
Actions\Action::make('settings')
->icon('heroicon-o-cog')
->slideOver()
->modalHeading('Backup Settings')
->form(function () {
return [
Select::make('backup_frequency')
->options([
'daily' => 'Daily',
'weekly' => 'Weekly',
'monthly' => 'Monthly',
])
->default('daily')
->required()
->columnSpanFull(),
Select::make('backup_retention_days')
->options([
'1' => '1 Day',
'7' => '1 Week',
'30' => '1 Month',
'90' => '3 Months',
'180' => '6 Months',
'365' => '1 Year',
])
->default('7')
->required()
->columnSpanFull(),
];
})->afterFormValidated(function (array $data) {
// Update backup settings
setting($data);
}),
];
}

View file

@ -2,6 +2,7 @@
namespace App\Providers;
use App\Backup\BackupManager;
use App\BackupStorage;
use App\Events\ModelDomainCreated;
use App\Events\ModelDomainDeleting;
@ -18,6 +19,7 @@ use App\Livewire\JobQueueNotifications;
use App\Models\Domain;
use App\Models\HostingSubscription;
use App\Policies\CustomerPolicy;
use App\VirtualHosts\ApacheVirtualHostManager;
use BladeUI\Icons\Factory;
use Filament\Facades\Filament;
use Illuminate\Filesystem\Filesystem;
@ -47,8 +49,13 @@ class AppServiceProvider extends ServiceProvider
});
App::singleton('virtualHostManager', function () {
return new \App\VirtualHosts\ApacheVirtualHostManager();
return new ApacheVirtualHostManager();
});
App::singleton('backupManager', function () {
return new BackupManager();
});
}
/**