From 2cd6780495455517f259fa1e6a3e554bea018eaf Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Tue, 3 Sep 2024 13:15:41 +0300 Subject: [PATCH] update --- .../Clusters/Microweber/Pages/Whitelabel.php | 35 ++++++++---- .../Jobs/UpdateWhitelabelToWebsites.php | 54 +++++++++++++++++++ .../Providers/Filament/AdminPanelProvider.php | 11 ++-- .../job-queue-notifications.blade.php | 4 ++ 4 files changed, 89 insertions(+), 15 deletions(-) create mode 100644 web/Modules/Microweber/Jobs/UpdateWhitelabelToWebsites.php diff --git a/web/Modules/Microweber/Filament/Clusters/Microweber/Pages/Whitelabel.php b/web/Modules/Microweber/Filament/Clusters/Microweber/Pages/Whitelabel.php index be061ae..8982e26 100644 --- a/web/Modules/Microweber/Filament/Clusters/Microweber/Pages/Whitelabel.php +++ b/web/Modules/Microweber/Filament/Clusters/Microweber/Pages/Whitelabel.php @@ -8,6 +8,8 @@ use Filament\Forms\Components\Textarea; use Filament\Forms\Components\TextInput; use MicroweberPackages\ComposerClient\Client; use Modules\Microweber\Filament\Clusters\MicroweberCluster; +use Modules\Microweber\Jobs\DownloadMicroweber; +use Modules\Microweber\Jobs\UpdateWhitelabelToWebsites; use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings; class Whitelabel extends BaseSettings @@ -32,6 +34,15 @@ class Whitelabel extends BaseSettings return self::$navigationLabel; } + public function save() : void + { + parent::save(); + + UpdateWhitelabelToWebsites::dispatch(); + + $this->redirect('/admin/microweber/whitelabel'); + } + public function schema(): array { @@ -52,37 +63,43 @@ class Whitelabel extends BaseSettings TextInput::make('microweber.whitelabel.brand_favicon') ->label('Brand Favicon'), - TextInput::make('microweber.whitelabel.admin_login_white_label_url') + TextInput::make('microweber.whitelabel.admin_logo_login_link') ->label('Admin login - White Label URL?'), Checkbox::make('microweber.whitelabel.enable_support_links') ->label('Enable support links?'), - TextInput::make('microweber.whitelabel.enable_support_links') - ->label('Enable support links'), + TextInput::make('microweber.whitelabel.custom_support_url') + ->label('Custom support URL'), Textarea::make('microweber.whitelabel.powered_by_text') ->label('Enter "Powered by" text'), - Checkbox::make('microweber.whitelabel.hide_powered_by_link') + Checkbox::make('microweber.whitelabel.powered_by_link') ->label('Hide "Powered by" link'), - TextInput::make('microweber.whitelabel.logo_admin_panel') + Checkbox::make('microweber.whitelabel.enable_service_links') + ->label('Enable service links'), + + TextInput::make('microweber.whitelabel.logo_admin') ->label('Logo for Admin panel (size: 180x35px)'), - TextInput::make('microweber.whitelabel.logo_live_edit_toolbar') + TextInput::make('microweber.whitelabel.logo_live_edit') ->label('Logo for Live-Edit toolbar (size: 50x50px)'), - TextInput::make('microweber.whitelabel.logo_login_screen') + TextInput::make('microweber.whitelabel.logo_login') ->label('Logo for Login screen (max width: 290px)'), - Checkbox::make('microweber.whitelabel.disable_microweber_marketplace') + Checkbox::make('microweber.whitelabel.disable_marketplace') ->label('Disable Microweber Marketplace'), + Checkbox::make('microweber.whitelabel.disable_powered_by_link') + ->label('Disable Powered by link'), + TextInput::make('microweber.whitelabel.external_login_server_button_text') ->label('External Login Server Button Text'), - Checkbox::make('microweber.whitelabel.enable_external_login_server') + Checkbox::make('microweber.whitelabel.external_login_server_enable') ->label('Enable External Login Server'), Checkbox::make('microweber.whitelabel.enable_microweber_service_links') diff --git a/web/Modules/Microweber/Jobs/UpdateWhitelabelToWebsites.php b/web/Modules/Microweber/Jobs/UpdateWhitelabelToWebsites.php new file mode 100644 index 0000000..f42ae61 --- /dev/null +++ b/web/Modules/Microweber/Jobs/UpdateWhitelabelToWebsites.php @@ -0,0 +1,54 @@ +isEmpty()) { + return; + } + + $sharedAppPath = config('microweber.sharedPaths.app'); + $whitelabelSettings = setting('microweber.whitelabel'); + + $whitelabel = new MicroweberWhitelabelSettingsUpdater(); + $whitelabel->setPath($sharedAppPath); + $whitelabel->apply($whitelabelSettings); + + foreach ($mwInstallations as $mwInstallation) { + + $whitelabelApply = new MicroweberWhitelabelWebsiteApply(); + $whitelabelApply->setWebPath($mwInstallation->installation_path); + $whitelabelApply->setSharedPath($sharedAppPath); + $whitelabelApply->apply(); + + } + + } + +} diff --git a/web/app/Providers/Filament/AdminPanelProvider.php b/web/app/Providers/Filament/AdminPanelProvider.php index d4c11bf..8039f4c 100644 --- a/web/app/Providers/Filament/AdminPanelProvider.php +++ b/web/app/Providers/Filament/AdminPanelProvider.php @@ -35,12 +35,6 @@ class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { - if (auth()->check()) { - $panel->renderHook( - name: PanelsRenderHook::BODY_START, - hook: fn (): string => Blade::render('@livewire(\'jobs-queue-notifications\')') - ); - } $panel->default() ->darkMode(true) @@ -137,6 +131,11 @@ class AdminPanelProvider extends PanelProvider 'primary'=>$defaultColor, ]); + $panel->renderHook( + name: PanelsRenderHook::BODY_START, + hook: fn (): string => Blade::render('@livewire(\'jobs-queue-notifications\')') + ); + return $panel; } } diff --git a/web/resources/views/filament/job-queue-notifications.blade.php b/web/resources/views/filament/job-queue-notifications.blade.php index d77e67f..2f622de 100644 --- a/web/resources/views/filament/job-queue-notifications.blade.php +++ b/web/resources/views/filament/job-queue-notifications.blade.php @@ -1,5 +1,7 @@
+ @if(auth()->id()) +