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
7 changes: 7 additions & 0 deletions app/Filament/Pages/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public function render(): View
->layout(static::$layout, $this->getLayoutData());
}

protected function getMaxContentWidth(): string
{
$settings = new GeneralSettings();

return $settings->content_width;
}

protected function getActions(): array
{
return [
Expand Down
12 changes: 12 additions & 0 deletions app/Filament/Pages/Settings/GeneralPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ class GeneralPage extends SettingsPage

protected static string $settings = GeneralSettings::class;

protected function getMaxContentWidth(): string
{
$settings = new GeneralSettings();

return $settings->content_width;
}

protected function getFormSchema(): array
{
return [
Expand Down Expand Up @@ -53,6 +60,11 @@ protected function getFormSchema(): array
->placeholder('M j, Y G:i:s')
->maxLength(25)
->required(),
Select::make('content_width')
->options([
'7xl' => 'Default width',
'full' => 'Full width',
]),
])
->compact()
->columns([
Expand Down
8 changes: 8 additions & 0 deletions app/Filament/Pages/Settings/InfluxDbPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Filament\Pages\Settings;

use App\Settings\GeneralSettings;
use App\Settings\InfluxDbSettings;
use Closure;
use Filament\Forms\Components\Grid;
Expand All @@ -24,6 +25,13 @@ class InfluxDbPage extends SettingsPage

protected static string $settings = InfluxDbSettings::class;

protected function getMaxContentWidth(): string
{
$settings = new GeneralSettings();

return $settings->content_width;
}

protected function getFormSchema(): array
{
return [
Expand Down
8 changes: 8 additions & 0 deletions app/Filament/Pages/Settings/NotificationPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Forms\Components\TestMailNotification;
use App\Forms\Components\TestTelegramNotification;
use App\Mail\Test;
use App\Settings\GeneralSettings;
use App\Settings\NotificationSettings;
use App\Telegram\TelegramNotification;
use Closure;
Expand Down Expand Up @@ -35,6 +36,13 @@ class NotificationPage extends SettingsPage

protected static string $settings = NotificationSettings::class;

protected function getMaxContentWidth(): string
{
$settings = new GeneralSettings();

return $settings->content_width;
}

protected function getFormSchema(): array
{
return [
Expand Down
7 changes: 7 additions & 0 deletions app/Filament/Pages/Settings/ThresholdsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class ThresholdsPage extends SettingsPage

protected static string $settings = ThresholdSettings::class;

protected function getMaxContentWidth(): string
{
$settings = new GeneralSettings();

return $settings->content_width;
}

protected function getFormSchema(): array
{
return [
Expand Down
8 changes: 8 additions & 0 deletions app/Filament/Resources/ResultResource/Pages/ListResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Filament\Resources\ResultResource\Pages;

use App\Filament\Resources\ResultResource;
use App\Settings\GeneralSettings;
use Filament\Resources\Pages\ListRecords;

class ListResults extends ListRecords
Expand All @@ -14,6 +15,13 @@ protected function getTablePollingInterval(): ?string
return '5s';
}

protected function getMaxContentWidth(): string
{
$settings = new GeneralSettings();

return $settings->content_width;
}

protected function getHeaderWidgets(): array
{
return ResultResource::getWidgets();
Expand Down
8 changes: 8 additions & 0 deletions app/Filament/Resources/UserResource/Pages/CreateUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
namespace App\Filament\Resources\UserResource\Pages;

use App\Filament\Resources\UserResource;
use App\Settings\GeneralSettings;
use Filament\Resources\Pages\CreateRecord;

class CreateUser extends CreateRecord
{
protected static string $resource = UserResource::class;

protected function getMaxContentWidth(): string
{
$settings = new GeneralSettings();

return $settings->content_width;
}
}
8 changes: 8 additions & 0 deletions app/Filament/Resources/UserResource/Pages/EditUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Filament\Resources\UserResource\Pages;

use App\Filament\Resources\UserResource;
use App\Settings\GeneralSettings;
use Filament\Pages\Actions;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Support\Facades\Hash;
Expand All @@ -11,6 +12,13 @@ class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;

protected function getMaxContentWidth(): string
{
$settings = new GeneralSettings();

return $settings->content_width;
}

protected function getActions(): array
{
return [
Expand Down
8 changes: 8 additions & 0 deletions app/Filament/Resources/UserResource/Pages/ListUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
namespace App\Filament\Resources\UserResource\Pages;

use App\Filament\Resources\UserResource;
use App\Settings\GeneralSettings;
use Filament\Pages\Actions;
use Filament\Resources\Pages\ListRecords;

class ListUsers extends ListRecords
{
protected static string $resource = UserResource::class;

protected function getMaxContentWidth(): string
{
$settings = new GeneralSettings();

return $settings->content_width;
}

protected function getActions(): array
{
return [
Expand Down
2 changes: 2 additions & 0 deletions app/Settings/GeneralSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class GeneralSettings extends Settings
{
public bool $auth_enabled;

public string $content_width;

public ?string $speedtest_schedule;

/** @var string[] */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
*/
public function up()
{
$settings = new GeneralSettings();
try {
$settings = new GeneralSettings();

$settings->speedtest_server = [$settings->speedtest_server];
$settings->save();
$settings->speedtest_server = [$settings->speedtest_server];
$settings->save();
} catch (\Throwable $th) {
// This code is short lived as it'll be replaced with a jobs table...
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

use Spatie\LaravelSettings\Migrations\SettingsMigration;

return new class extends SettingsMigration
{
public function up(): void
{
$this->migrator->add('general.content_width', '7xl');
}
};