-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace config.yml with settings UI (#58)
- Loading branch information
1 parent
195142c
commit 58c160e
Showing
20 changed files
with
1,166 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
/public/storage | ||
/storage/*.key | ||
/vendor | ||
config.yml | ||
|
||
.env | ||
.env.backup | ||
.phpunit.result.cache | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
namespace App\Filament\Pages\Settings; | ||
|
||
use App\Settings\GeneralSettings; | ||
use Filament\Forms\Components\Card; | ||
use Filament\Forms\Components\Grid; | ||
use Filament\Forms\Components\Section; | ||
use Filament\Forms\Components\Select; | ||
use Filament\Forms\Components\TextInput; | ||
use Filament\Forms\Components\Toggle; | ||
use Filament\Pages\SettingsPage; | ||
use Squire\Models\Timezone; | ||
|
||
class General extends SettingsPage | ||
{ | ||
protected static ?string $navigationIcon = 'heroicon-o-cog'; | ||
|
||
protected static ?string $navigationGroup = 'Settings'; | ||
|
||
protected static ?int $navigationSort = 1; | ||
|
||
protected static string $settings = GeneralSettings::class; | ||
|
||
protected function getFormSchema(): array | ||
{ | ||
return [ | ||
Grid::make([ | ||
'default' => 1, | ||
'md' => 3, | ||
]) | ||
->schema([ | ||
Grid::make([ | ||
'default' => 1, | ||
]) | ||
->schema([ | ||
Section::make('Site Settings') | ||
->collapsible() | ||
->schema([ | ||
TextInput::make('site_name') | ||
->maxLength(50) | ||
->required() | ||
->columnSpan(['md' => 2]), | ||
Select::make('timezone') | ||
->options(Timezone::all()->pluck('code', 'code')) | ||
->searchable() | ||
->required() | ||
->columnSpan(1), | ||
]) | ||
->columns([ | ||
'default' => 1, | ||
'md' => 2, | ||
]), | ||
|
||
Section::make('Speedtest Settings') | ||
->collapsible() | ||
->schema([ | ||
TextInput::make('speedtest_schedule') | ||
->helperText('Leave empty to disable the schedule. You can also use the cron expression generator [HERE](https://crontab.cronhub.io/) to help you make schedules.') | ||
->nullable() | ||
->columnSpan(1), | ||
TextInput::make('speedtest_server') | ||
->helperText('Leave empty to let the system pick the best server.') | ||
->nullable() | ||
->columnSpan(1), | ||
]) | ||
->columns([ | ||
'default' => 1, | ||
'md' => 2, | ||
]), | ||
]) | ||
->columnSpan([ | ||
'md' => 2, | ||
]), | ||
|
||
Card::make() | ||
->schema([ | ||
Toggle::make('auth_enabled') | ||
->label('Authentication enabled') | ||
->helperText("NOTE: Authentication is currently required. It's on the roadmap to be able to disabled it though.") | ||
->disabled(), | ||
]) | ||
->columnSpan([ | ||
'md' => 1, | ||
]), | ||
]), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
namespace App\Filament\Pages\Settings; | ||
|
||
use App\Settings\InfluxDbSettings; | ||
use Filament\Forms\Components\Card; | ||
use Filament\Forms\Components\Grid; | ||
use Filament\Forms\Components\Section; | ||
use Filament\Forms\Components\TextInput; | ||
use Filament\Forms\Components\Toggle; | ||
use Filament\Pages\SettingsPage; | ||
|
||
class InfluxDb extends SettingsPage | ||
{ | ||
protected static ?string $navigationIcon = 'heroicon-o-database'; | ||
|
||
protected static ?string $navigationLabel = 'InfluxDB'; | ||
|
||
protected static ?string $navigationGroup = 'Settings'; | ||
|
||
protected static ?int $navigationSort = 2; | ||
|
||
protected static string $settings = InfluxDbSettings::class; | ||
|
||
protected function getFormSchema(): array | ||
{ | ||
return [ | ||
Grid::make([ | ||
'default' => 1, | ||
'md' => 3, | ||
]) | ||
->schema([ | ||
Grid::make([ | ||
'default' => 1, | ||
]) | ||
->schema([ | ||
Section::make('InfluxDB v2 Settings') | ||
->collapsible() | ||
->schema([ | ||
TextInput::make('v2_url') | ||
->label('URL') | ||
->placeholder('http://your-influxdb-instance') | ||
->maxLength(255) | ||
->columnSpan(['md' => 2]), | ||
TextInput::make('v2_org') | ||
->label('Org') | ||
->maxLength(255) | ||
->columnSpan(1), | ||
TextInput::make('v2_bucket') | ||
->placeholder('speedtest-tracker') | ||
->label('Bucket') | ||
->maxLength(255) | ||
->columnSpan(1), | ||
TextInput::make('v2_token') | ||
->label('Token') | ||
->maxLength(255) | ||
->password() | ||
->disableAutocomplete() | ||
->columnSpan(['md' => 2]), | ||
]) | ||
->columns([ | ||
'default' => 1, | ||
'md' => 2, | ||
]), | ||
]) | ||
->columnSpan([ | ||
'md' => 2, | ||
]), | ||
|
||
Card::make() | ||
->schema([ | ||
Toggle::make('v2_enabled') | ||
->label('v2 enabled') | ||
->helperText('NOTE: At this time only InfluxDB v2 is supported'), | ||
]) | ||
->columnSpan([ | ||
'md' => 1, | ||
]), | ||
]), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.