Skip to content

Commit 69a3686

Browse files
authored
[Chore] Add missing Filament Forms and Tables imports (alexjustesen#2220)
1 parent 4740bfa commit 69a3686

File tree

7 files changed

+267
-258
lines changed

7 files changed

+267
-258
lines changed

app/Filament/Pages/Settings/DataIntegrationPage.php

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
use App\Jobs\Influxdb\v2\TestConnectionJob;
77
use App\Settings\DataIntegrationSettings;
88
use Filament\Forms;
9+
use Filament\Forms\Components\Actions;
10+
use Filament\Forms\Components\Actions\Action;
11+
use Filament\Forms\Components\Checkbox;
12+
use Filament\Forms\Components\Grid;
13+
use Filament\Forms\Components\Section;
14+
use Filament\Forms\Components\TextInput;
915
use Filament\Forms\Form;
1016
use Filament\Notifications\Notification;
1117
use Filament\Pages\SettingsPage;
@@ -27,63 +33,63 @@ class DataIntegrationPage extends SettingsPage
2733

2834
public static function canAccess(): bool
2935
{
30-
return auth()->user()->is_admin;
36+
return Auth::check() && Auth::user()->is_admin;
3137
}
3238

3339
public static function shouldRegisterNavigation(): bool
3440
{
35-
return auth()->user()->is_admin;
41+
return Auth::check() && Auth::user()->is_admin;
3642
}
3743

3844
public function form(Form $form): Form
3945
{
4046
return $form
4147
->schema([
42-
Forms\Components\Grid::make([
48+
Grid::make([
4349
'default' => 1,
4450
'md' => 3,
4551
])
4652
->schema([
47-
Forms\Components\Section::make('InfluxDB v2')
53+
Section::make('InfluxDB v2')
4854
->description('When enabled, all new Speedtest results will also be sent to InfluxDB.')
4955
->schema([
5056
Forms\Components\Toggle::make('influxdb_v2_enabled')
5157
->label('Enable')
5258
->reactive()
5359
->columnSpanFull(),
54-
Forms\Components\Grid::make(['default' => 1, 'md' => 3])
60+
Grid::make(['default' => 1, 'md' => 3])
5561
->hidden(fn (Forms\Get $get) => $get('influxdb_v2_enabled') !== true)
5662
->schema([
57-
Forms\Components\TextInput::make('influxdb_v2_url')
63+
TextInput::make('influxdb_v2_url')
5864
->label('URL')
5965
->placeholder('http://your-influxdb-instance')
6066
->maxLength(255)
6167
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
6268
->columnSpan(['md' => 1]),
63-
Forms\Components\TextInput::make('influxdb_v2_org')
69+
TextInput::make('influxdb_v2_org')
6470
->label('Org')
6571
->maxLength(255)
6672
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
6773
->columnSpan(['md' => 1]),
68-
Forms\Components\TextInput::make('influxdb_v2_bucket')
74+
TextInput::make('influxdb_v2_bucket')
6975
->placeholder('speedtest-tracker')
7076
->label('Bucket')
7177
->maxLength(255)
7278
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
7379
->columnSpan(['md' => 2]),
74-
Forms\Components\TextInput::make('influxdb_v2_token')
80+
TextInput::make('influxdb_v2_token')
7581
->label('Token')
7682
->maxLength(255)
7783
->password()
7884
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
7985
->disableAutocomplete()
8086
->columnSpan(['md' => 2]),
81-
Forms\Components\Checkbox::make('influxdb_v2_verify_ssl')
87+
Checkbox::make('influxdb_v2_verify_ssl')
8288
->label('Verify SSL')
8389
->columnSpanFull(),
8490
// Button to send old data to InfluxDB
85-
Forms\Components\Actions::make([
86-
Forms\Components\Actions\Action::make('Export current results')
91+
Actions::make([
92+
Action::make('Export current results')
8793
->label('Export current results')
8894
->action(function () {
8995
Notification::make()
@@ -98,8 +104,8 @@ public function form(Form $form): Form
98104
->visible(fn (): bool => app(DataIntegrationSettings::class)->influxdb_v2_enabled),
99105
]),
100106
// Button to test InfluxDB connection
101-
Forms\Components\Actions::make([
102-
Forms\Components\Actions\Action::make('Test connection')
107+
Actions::make([
108+
Action::make('Test connection')
103109
->label('Test connection')
104110
->action(function () {
105111
Notification::make()

0 commit comments

Comments
 (0)