Skip to content

Commit 377533d

Browse files
authored
Remove deprecation notices (alexjustesen#2312)
Co-authored-by: Alex Justesen <[email protected]>
1 parent a1fd29d commit 377533d

File tree

5 files changed

+552
-597
lines changed

5 files changed

+552
-597
lines changed

app/Filament/Pages/Settings/DataIntegrationPage.php

Lines changed: 79 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Filament\Forms\Form;
1616
use Filament\Notifications\Notification;
1717
use Filament\Pages\SettingsPage;
18+
use Filament\Support\Enums\MaxWidth;
1819
use Illuminate\Support\Facades\Auth;
1920

2021
class DataIntegrationPage extends SettingsPage
@@ -41,92 +42,95 @@ public static function shouldRegisterNavigation(): bool
4142
return Auth::check() && Auth::user()->is_admin;
4243
}
4344

45+
public function getMaxContentWidth(): MaxWidth
46+
{
47+
return MaxWidth::ThreeExtraLarge;
48+
}
49+
4450
public function form(Form $form): Form
4551
{
4652
return $form
4753
->schema([
48-
Grid::make([
49-
'default' => 1,
50-
'md' => 3,
51-
])
54+
Section::make('InfluxDB v2')
55+
->description('When enabled, all new Speedtest results will also be sent to InfluxDB.')
5256
->schema([
53-
Section::make('InfluxDB v2')
54-
->description('When enabled, all new Speedtest results will also be sent to InfluxDB.')
57+
Forms\Components\Toggle::make('influxdb_v2_enabled')
58+
->label('Enable')
59+
->reactive()
60+
->columnSpanFull(),
61+
62+
Grid::make(['default' => 1, 'md' => 2])
63+
->hidden(fn (Forms\Get $get) => $get('influxdb_v2_enabled') !== true)
5564
->schema([
56-
Forms\Components\Toggle::make('influxdb_v2_enabled')
57-
->label('Enable')
58-
->reactive()
65+
TextInput::make('influxdb_v2_url')
66+
->label('URL')
67+
->placeholder('http://your-influxdb-instance')
68+
->maxLength(255)
69+
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
70+
->columnSpan(['md' => 1]),
71+
TextInput::make('influxdb_v2_org')
72+
->label('Org')
73+
->maxLength(255)
74+
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
75+
->columnSpan(['md' => 1]),
76+
TextInput::make('influxdb_v2_bucket')
77+
->placeholder('speedtest-tracker')
78+
->label('Bucket')
79+
->maxLength(255)
80+
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
81+
->columnSpan(['md' => 2]),
82+
TextInput::make('influxdb_v2_token')
83+
->label('Token')
84+
->maxLength(255)
85+
->password()
86+
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
87+
->autocomplete(false)
88+
->columnSpan(['md' => 2]),
89+
Checkbox::make('influxdb_v2_verify_ssl')
90+
->label('Verify SSL')
5991
->columnSpanFull(),
60-
Grid::make(['default' => 1, 'md' => 3])
61-
->hidden(fn (Forms\Get $get) => $get('influxdb_v2_enabled') !== true)
62-
->schema([
63-
TextInput::make('influxdb_v2_url')
64-
->label('URL')
65-
->placeholder('http://your-influxdb-instance')
66-
->maxLength(255)
67-
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
68-
->columnSpan(['md' => 1]),
69-
TextInput::make('influxdb_v2_org')
70-
->label('Org')
71-
->maxLength(255)
72-
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
73-
->columnSpan(['md' => 1]),
74-
TextInput::make('influxdb_v2_bucket')
75-
->placeholder('speedtest-tracker')
76-
->label('Bucket')
77-
->maxLength(255)
78-
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
79-
->columnSpan(['md' => 2]),
80-
TextInput::make('influxdb_v2_token')
81-
->label('Token')
82-
->maxLength(255)
83-
->password()
84-
->required(fn (Forms\Get $get) => $get('influxdb_v2_enabled') === true)
85-
->disableAutocomplete()
86-
->columnSpan(['md' => 2]),
87-
Checkbox::make('influxdb_v2_verify_ssl')
88-
->label('Verify SSL')
89-
->columnSpanFull(),
90-
// Button to send old data to InfluxDB
91-
Actions::make([
92-
Action::make('Export current results')
93-
->label('Export current results')
94-
->action(function () {
95-
Notification::make()
96-
->title('Starting bulk data write to Influxdb')
97-
->info()
98-
->send();
92+
// Button to send old data to InfluxDB
93+
Actions::make([
94+
Action::make('Export current results')
95+
->label('Export current results')
96+
->action(function () {
97+
Notification::make()
98+
->title('Starting bulk data write to Influxdb')
99+
->info()
100+
->send();
99101

100-
BulkWriteResults::dispatch(Auth::user());
101-
})
102-
->color('primary')
103-
->icon('heroicon-o-cloud-arrow-up')
104-
->visible(fn (): bool => app(DataIntegrationSettings::class)->influxdb_v2_enabled),
105-
]),
106-
// Button to test InfluxDB connection
107-
Actions::make([
108-
Action::make('Test connection')
109-
->label('Test connection')
110-
->action(function () {
111-
Notification::make()
112-
->title('Sending test data to Influxdb')
113-
->info()
114-
->send();
102+
BulkWriteResults::dispatch(Auth::user());
103+
})
104+
->color('primary')
105+
->icon('heroicon-o-cloud-arrow-up')
106+
->visible(fn (): bool => app(DataIntegrationSettings::class)->influxdb_v2_enabled),
107+
]),
108+
// Button to test InfluxDB connection
109+
Actions::make([
110+
Action::make('Test connection')
111+
->label('Test connection')
112+
->action(function () {
113+
Notification::make()
114+
->title('Sending test data to Influxdb')
115+
->info()
116+
->send();
115117

116-
TestConnectionJob::dispatch(Auth::user());
117-
})
118-
->color('primary')
119-
->icon('heroicon-o-check-circle')
120-
->visible(fn (): bool => app(DataIntegrationSettings::class)->influxdb_v2_enabled),
121-
]),
122-
]),
123-
])
124-
->compact()
125-
->columns([
126-
'default' => 1,
127-
'md' => 2,
118+
TestConnectionJob::dispatch(Auth::user());
119+
})
120+
->color('primary')
121+
->icon('heroicon-o-check-circle')
122+
->visible(fn (): bool => app(DataIntegrationSettings::class)->influxdb_v2_enabled),
123+
]),
128124
]),
125+
])
126+
->compact()
127+
->columns([
128+
'default' => 1,
129+
'md' => 2,
129130
]),
131+
])
132+
->columns([
133+
'default' => 1,
130134
]);
131135
}
132136
}

0 commit comments

Comments
 (0)