Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

use Spatie\LaravelSettings\Migrations\SettingsMigration;

return new class extends SettingsMigration
{
/**
* Run the migrations.
*/
public function up(): void
{
rescue(fn () => $this->migrator->add('app.enable_external_dependencies', true));
}
};
2 changes: 2 additions & 0 deletions resources/lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
'show_timezone' => 'Show Timezone',
'show_dashboard_link' => 'Show Dashboard Link',
'display_graphs' => 'Display Graphs',
'enable_external_dependencies' => 'Enable External Dependencies',
'only_show_disrupted_days' => 'Only Show Disrupted Days',
'recent_incidents_only' => 'Show Recent Incidents Only',
'recent_incidents_days' => 'Number of Days to Show Recent Incidents',
],
'display_settings_title' => 'Display Settings',
],
'manage_customization' => [
'header_label' => 'Custom Header HTML',
Expand Down
10 changes: 9 additions & 1 deletion src/CachetDashboardServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Cachet\Filament\Pages\EditProfile;
use Cachet\Http\Middleware\SetAppLocale;
use Cachet\Settings\AppSettings;
use Filament\FontProviders\LocalFontProvider;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
Expand All @@ -25,9 +27,15 @@ class CachetDashboardServiceProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
$appSettings = app(AppSettings::class);

return $panel
->id('cachet')
->font('switzer', 'https://fonts.cdnfonts.com/css/switzer')
->when(
! app()->runningInConsole() && $appSettings->enable_external_dependencies,
fn ($panel) => $panel->font('switzer', 'https://fonts.cdnfonts.com/css/switzer'),
fn ($panel) => $panel->font('ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" ', provider: LocalFontProvider::class),
)
->default()
->login()
->passwordReset()
Expand Down
17 changes: 10 additions & 7 deletions src/Filament/Pages/Settings/ManageCachet.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Filament\Forms\Form;
use Filament\Forms\Get;
use Illuminate\Support\Str;
use function __;

class ManageCachet extends SettingsPage
{
Expand Down Expand Up @@ -71,13 +72,6 @@ public function form(Form $form): Form
->step(1)
->suffix(__('cachet::settings.manage_cachet.refresh_rate_label_input_suffix_seconds')),

Forms\Components\Grid::make(2)
->schema([
Forms\Components\Toggle::make('show_support')
->label(__('cachet::settings.manage_cachet.toggles.support_cachet')),
Forms\Components\Toggle::make('display_graphs')
->label(__('cachet::settings.manage_cachet.toggles.display_graphs')),
]),
Forms\Components\Toggle::make('show_timezone')
->label(__('cachet::settings.manage_cachet.toggles.show_timezone')),
Forms\Components\Toggle::make('only_disrupted_days')
Expand All @@ -99,6 +93,15 @@ public function form(Form $form): Form
->hidden(fn (Get $get) => $get('recent_incidents_only') !== true),
]),
]),
Forms\Components\Section::make(__('cachet::settings.manage_cachet.display_settings_title'))
->schema([
Forms\Components\Toggle::make('show_support')
->label(__('cachet::settings.manage_cachet.toggles.support_cachet')),
Forms\Components\Toggle::make('display_graphs')
->label(__('cachet::settings.manage_cachet.toggles.display_graphs')),
Forms\Components\Toggle::make('enable_external_dependencies')
->label(__('cachet::settings.manage_cachet.toggles.enable_external_dependencies')),
]),
]);
}
}
2 changes: 2 additions & 0 deletions src/Settings/AppSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class AppSettings extends Settings

public bool $display_graphs = true;

public bool $enable_external_dependencies = true;

public static function group(): string
{
return 'app';
Expand Down
Loading