Skip to content

Commit 03bfb6f

Browse files
authored
[Feature] Polling config for dashboard and results (alexjustesen#625)
1 parent b8579c5 commit 03bfb6f

File tree

6 files changed

+28
-1
lines changed

6 files changed

+28
-1
lines changed

app/Filament/Resources/ResultResource/Pages/ListResults.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ListResults extends ListRecords
1212

1313
protected function getTablePollingInterval(): ?string
1414
{
15-
return '5s';
15+
return config('speedtest.results_polling');
1616
}
1717

1818
protected function getMaxContentWidth(): string

app/Filament/Widgets/RecentJitterChart.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ class RecentJitterChart extends LineChartWidget
1414

1515
public ?string $filter = '24h';
1616

17+
protected function getPollingInterval(): ?string
18+
{
19+
return config('speedtest.dashboard_polling');
20+
}
21+
1722
protected function getHeading(): string
1823
{
1924
return 'Jitter';

app/Filament/Widgets/RecentPingChart.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ class RecentPingChart extends LineChartWidget
1414

1515
public ?string $filter = '24h';
1616

17+
protected function getPollingInterval(): ?string
18+
{
19+
return config('speedtest.dashboard_polling');
20+
}
21+
1722
protected function getHeading(): string
1823
{
1924
return 'Ping (ms)';

app/Filament/Widgets/RecentSpeedChart.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ class RecentSpeedChart extends LineChartWidget
1414

1515
public ?string $filter = '24h';
1616

17+
protected function getPollingInterval(): ?string
18+
{
19+
return config('speedtest.dashboard_polling');
20+
}
21+
1722
protected function getHeading(): string
1823
{
1924
return 'Download / Upload';

app/Filament/Widgets/StatsOverview.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
class StatsOverview extends BaseWidget
1111
{
12+
protected function getPollingInterval(): ?string
13+
{
14+
return config('speedtest.dashboard_polling');
15+
}
16+
1217
protected function getCards(): array
1318
{
1419
$result = Result::latest()->first();

config/speedtest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,11 @@
99
'build_date' => Carbon::parse('2023-05-12'),
1010

1111
'build_version' => '0.11.16',
12+
13+
/**
14+
* Polling
15+
*/
16+
'dashboard_polling' => env('DASHBOARD_POLLING', '5s'),
17+
18+
'results_polling' => env('RESULTS_POLLING', '5s'),
1219
];

0 commit comments

Comments
 (0)