This commit is contained in:
Bozhidar 2024-09-03 13:15:41 +03:00
parent 427442c142
commit 2cd6780495
4 changed files with 89 additions and 15 deletions

View file

@ -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')

View file

@ -0,0 +1,54 @@
<?php
namespace Modules\Microweber\Jobs;
use App\ShellApi;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use MicroweberPackages\ComposerClient\Client;
use MicroweberPackages\SharedServerScripts\MicroweberDownloader;
use MicroweberPackages\SharedServerScripts\MicroweberModuleConnectorsDownloader;
use MicroweberPackages\SharedServerScripts\MicroweberTemplatesDownloader;
use MicroweberPackages\SharedServerScripts\MicroweberWhitelabelWebsiteApply;
use MicroweberPackages\SharedServerScripts\MicroweberWhitelabelSettingsUpdater;
use Modules\Microweber\App\Models\MicroweberInstallation;
use Modules\Microweber\MicroweberComposerClientHelper;
class UpdateWhitelabelToWebsites implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public static $displayName = 'Update Whitelabel To Websites';
public static $displayDescription = 'Apply whitelabel settings to all websites';
public function handle(): void
{
set_time_limit(0);
$mwInstallations = MicroweberInstallation::all();
if ($mwInstallations->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();
}
}
}

View file

@ -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;
}
}

View file

@ -1,5 +1,7 @@
<div>
@if(auth()->id())
<script>
let hiddenJobQueueNotifications = [];
function hideJobQueueNotification(jobId) {
@ -43,4 +45,6 @@
@endforeach
</div>
@endif
</div>