From f1aeeba22956e92cfd3f6d2692ebbef5da6adab0 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Thu, 16 May 2024 12:04:36 +0300 Subject: [PATCH] update --- .../BackupResource/Pages/ManageBackups.php | 39 +++++++++++++++++++ web/app/Providers/AppServiceProvider.php | 9 ++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/web/app/Filament/Resources/BackupResource/Pages/ManageBackups.php b/web/app/Filament/Resources/BackupResource/Pages/ManageBackups.php index 75594f9..535b976 100644 --- a/web/app/Filament/Resources/BackupResource/Pages/ManageBackups.php +++ b/web/app/Filament/Resources/BackupResource/Pages/ManageBackups.php @@ -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); + + }), ]; } diff --git a/web/app/Providers/AppServiceProvider.php b/web/app/Providers/AppServiceProvider.php index a48695f..e00581a 100644 --- a/web/app/Providers/AppServiceProvider.php +++ b/web/app/Providers/AppServiceProvider.php @@ -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(); + }); + } /**