From 58227ba7296f28cb944d9328be4c191db60dafd4 Mon Sep 17 00:00:00 2001 From: Alex Justesen Date: Fri, 7 Jun 2024 15:45:11 -0400 Subject: [PATCH 1/4] [Feature] Display next speedtest run at date on dashboard (#1477) --- app/Filament/Pages/Dashboard.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/Filament/Pages/Dashboard.php b/app/Filament/Pages/Dashboard.php index df07f4c32..9ab14589f 100644 --- a/app/Filament/Pages/Dashboard.php +++ b/app/Filament/Pages/Dashboard.php @@ -11,6 +11,8 @@ use App\Filament\Widgets\RecentUploadChartWidget; use App\Filament\Widgets\RecentUploadLatencyChartWidget; use App\Filament\Widgets\StatsOverviewWidget; +use Carbon\Carbon; +use Cron\CronExpression; use Filament\Actions\Action; use Filament\Actions\ActionGroup; use Filament\Notifications\Notification; @@ -24,6 +26,19 @@ class Dashboard extends BasePage protected static string $view = 'filament.pages.dashboard'; + public function getSubheading(): ?string + { + if (blank(config('speedtest.schedule'))) { + return __('No speedtests scheduled.'); + } + + $cronExpression = new CronExpression(config('speedtest.schedule')); + + $nextRunDate = Carbon::parse($cronExpression->getNextRunDate(timeZone: config('app.display_timezone')))->format(config('app.datetime_format')); + + return 'Next speedtest at: '.$nextRunDate; + } + protected function getHeaderActions(): array { return [ From 3917138ced0d5eb9e482c4324685bc437f02f4bf Mon Sep 17 00:00:00 2001 From: Alex Justesen Date: Fri, 7 Jun 2024 19:14:04 -0400 Subject: [PATCH 2/4] [Feature] Added chart datetime format environment variable (#1480) --- app/Filament/Widgets/RecentDownloadChartWidget.php | 2 +- app/Filament/Widgets/RecentDownloadLatencyChartWidget.php | 2 +- app/Filament/Widgets/RecentJitterChartWidget.php | 2 +- app/Filament/Widgets/RecentPingChartWidget.php | 2 +- app/Filament/Widgets/RecentUploadChartWidget.php | 2 +- app/Filament/Widgets/RecentUploadLatencyChartWidget.php | 2 +- config/app.php | 2 ++ 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Filament/Widgets/RecentDownloadChartWidget.php b/app/Filament/Widgets/RecentDownloadChartWidget.php index 05b993ee2..7aca1d1df 100644 --- a/app/Filament/Widgets/RecentDownloadChartWidget.php +++ b/app/Filament/Widgets/RecentDownloadChartWidget.php @@ -61,7 +61,7 @@ protected function getData(): array 'tension' => 0.4, ], ], - 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format('M. j - g:ia')), + 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format(config('app.chart_datetime_format'))), ]; } diff --git a/app/Filament/Widgets/RecentDownloadLatencyChartWidget.php b/app/Filament/Widgets/RecentDownloadLatencyChartWidget.php index a7a5c510a..c7bb0e05a 100644 --- a/app/Filament/Widgets/RecentDownloadLatencyChartWidget.php +++ b/app/Filament/Widgets/RecentDownloadLatencyChartWidget.php @@ -80,7 +80,7 @@ protected function getData(): array 'tension' => 0.4, ], ], - 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format('M. j - g:ia')), + 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format(config('app.chart_datetime_format'))), ]; } diff --git a/app/Filament/Widgets/RecentJitterChartWidget.php b/app/Filament/Widgets/RecentJitterChartWidget.php index 952c33f62..2d2454862 100644 --- a/app/Filament/Widgets/RecentJitterChartWidget.php +++ b/app/Filament/Widgets/RecentJitterChartWidget.php @@ -80,7 +80,7 @@ protected function getData(): array 'tension' => 0.4, ], ], - 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format('M. j - g:ia')), + 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format(config('app.chart_datetime_format'))), ]; } diff --git a/app/Filament/Widgets/RecentPingChartWidget.php b/app/Filament/Widgets/RecentPingChartWidget.php index 6e6daa53e..57a10eee5 100644 --- a/app/Filament/Widgets/RecentPingChartWidget.php +++ b/app/Filament/Widgets/RecentPingChartWidget.php @@ -60,7 +60,7 @@ protected function getData(): array 'tension' => 0.4, ], ], - 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format('M. j - g:ia')), + 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format(config('app.chart_datetime_format'))), ]; } diff --git a/app/Filament/Widgets/RecentUploadChartWidget.php b/app/Filament/Widgets/RecentUploadChartWidget.php index a479f0f2b..5c9c85baf 100644 --- a/app/Filament/Widgets/RecentUploadChartWidget.php +++ b/app/Filament/Widgets/RecentUploadChartWidget.php @@ -61,7 +61,7 @@ protected function getData(): array 'tension' => 0.4, ], ], - 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format('M. j - g:ia')), + 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format(config('app.chart_datetime_format'))), ]; } diff --git a/app/Filament/Widgets/RecentUploadLatencyChartWidget.php b/app/Filament/Widgets/RecentUploadLatencyChartWidget.php index 02d54be01..049055adc 100644 --- a/app/Filament/Widgets/RecentUploadLatencyChartWidget.php +++ b/app/Filament/Widgets/RecentUploadLatencyChartWidget.php @@ -80,7 +80,7 @@ protected function getData(): array 'tension' => 0.4, ], ], - 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format('M. j - g:ia')), + 'labels' => $results->map(fn ($item) => $item->created_at->timezone(config('app.display_timezone'))->format(config('app.chart_datetime_format'))), ]; } diff --git a/config/app.php b/config/app.php index acf287984..60b38f700 100644 --- a/config/app.php +++ b/config/app.php @@ -6,6 +6,8 @@ 'env' => env('APP_ENV', 'production'), + 'chart_datetime_format' => env('CHART_DATETIME_FORMAT', 'M. j - G:i'), + 'datetime_format' => env('DATETIME_FORMAT', 'M. jS, Y g:ia'), 'display_timezone' => env('DISPLAY_TIMEZONE', 'UTC'), From 84fba204468119470b235f6abd7e1bc1a1eac638 Mon Sep 17 00:00:00 2001 From: Alex Justesen Date: Fri, 7 Jun 2024 19:16:30 -0400 Subject: [PATCH 3/4] [Chore] Removed deprecated image warning (#1481) --- app/Filament/Pages/Dashboard.php | 2 -- app/Filament/Widgets/DeprecatedImage.php | 18 ------------------ .../widgets/deprecated-image.blade.php | 14 -------------- 3 files changed, 34 deletions(-) delete mode 100644 app/Filament/Widgets/DeprecatedImage.php delete mode 100644 resources/views/filament/widgets/deprecated-image.blade.php diff --git a/app/Filament/Pages/Dashboard.php b/app/Filament/Pages/Dashboard.php index 9ab14589f..77e1e9169 100644 --- a/app/Filament/Pages/Dashboard.php +++ b/app/Filament/Pages/Dashboard.php @@ -3,7 +3,6 @@ namespace App\Filament\Pages; use App\Actions\Speedtests\RunOoklaSpeedtest; -use App\Filament\Widgets\DeprecatedImage; use App\Filament\Widgets\RecentDownloadChartWidget; use App\Filament\Widgets\RecentDownloadLatencyChartWidget; use App\Filament\Widgets\RecentJitterChartWidget; @@ -83,7 +82,6 @@ protected function getHeaderActions(): array protected function getHeaderWidgets(): array { return [ - DeprecatedImage::make(), StatsOverviewWidget::make(), RecentDownloadChartWidget::make(), RecentUploadChartWidget::make(), diff --git a/app/Filament/Widgets/DeprecatedImage.php b/app/Filament/Widgets/DeprecatedImage.php deleted file mode 100644 index 8e5f7886b..000000000 --- a/app/Filament/Widgets/DeprecatedImage.php +++ /dev/null @@ -1,18 +0,0 @@ -exists('.deprecated_image'); - } -} diff --git a/resources/views/filament/widgets/deprecated-image.blade.php b/resources/views/filament/widgets/deprecated-image.blade.php deleted file mode 100644 index f4d2e5eb2..000000000 --- a/resources/views/filament/widgets/deprecated-image.blade.php +++ /dev/null @@ -1,14 +0,0 @@ - - - - Docker Image Deprecated - - -
-

- The Docker image you're using has been deprecated and will be replaced in v0.20.0. To upgrade to the new image - follow the steps in the GitHub issue to continue to receive updates. -

-
-
-
From db73a1242889bd7dded334667798eceba6b053f7 Mon Sep 17 00:00:00 2001 From: Alex Justesen Date: Fri, 7 Jun 2024 19:17:44 -0400 Subject: [PATCH 4/4] Release v0.20.2 (#1482) --- config/speedtest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/speedtest.php b/config/speedtest.php index b6723d824..393e45b3a 100644 --- a/config/speedtest.php +++ b/config/speedtest.php @@ -6,7 +6,7 @@ 'build_date' => Carbon::parse('2024-06-07'), - 'build_version' => 'v0.20.1', + 'build_version' => 'v0.20.2', /** * General settings.