From ba35543aaa308aa5418e3be6e18181d9438f2adf Mon Sep 17 00:00:00 2001 From: Sven van Ginkel Date: Thu, 28 Nov 2024 09:26:53 +0100 Subject: [PATCH 1/3] Add Healhty to export and comments to column --- app/Filament/Exports/ResultExporter.php | 32 ++++++++++++++++------- app/Filament/Resources/ResultResource.php | 7 +++++ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/app/Filament/Exports/ResultExporter.php b/app/Filament/Exports/ResultExporter.php index a7d7f3d7a..ad8e0c54b 100644 --- a/app/Filament/Exports/ResultExporter.php +++ b/app/Filament/Exports/ResultExporter.php @@ -71,39 +71,48 @@ public static function getColumns(): array ExportColumn::make('download_jitter') ->state(function (Result $record): ?string { return $record->download_jitter; - }), + }) + ->enabledByDefault(false), ExportColumn::make('upload_jitter') ->state(function (Result $record): ?string { return $record->upload_jitter; - }), + }) + ->enabledByDefault(false), ExportColumn::make('ping_jitter') ->state(function (Result $record): ?string { return $record->ping_jitter; - }), + }) + ->enabledByDefault(false), ExportColumn::make('upload_latency_high') ->state(function (Result $record): ?string { return $record->upload_latency_high; - }), + }) + ->enabledByDefault(false), ExportColumn::make('upload_latency_low') ->state(function (Result $record): ?string { return $record->upload_latency_low; - }), + }) + ->enabledByDefault(false), ExportColumn::make('upload_latency_avg') ->state(function (Result $record): ?string { return $record->upload_latency_iqm; - }), + }) + ->enabledByDefault(false), ExportColumn::make('download_latency_high') ->state(function (Result $record): ?string { return $record->download_latency_high; - }), + }) + ->enabledByDefault(false), ExportColumn::make('download_latency_low') ->state(function (Result $record): ?string { return $record->download_latency_low; - }), + }) + ->enabledByDefault(false), ExportColumn::make('download_latency_avg') ->state(function (Result $record): ?string { return $record->download_latency_iqm; - }), + }) + ->enabledByDefault(false), ExportColumn::make('result_url') ->state(function (Result $record) { return $record->result_url; @@ -118,6 +127,11 @@ public static function getColumns(): array ->state(function (Result $record): string { return $record->scheduled ? 'Yes' : 'No'; }), + ExportColumn::make('healthy') + ->state(function (Result $record): string { + return $record->healthy ? 'Yes' : 'No'; + }) + ->enabledByDefault(false), ExportColumn::make('created_at'), ExportColumn::make('updated_at') ->enabledByDefault(false), diff --git a/app/Filament/Resources/ResultResource.php b/app/Filament/Resources/ResultResource.php index d8fdc55ef..be118cc26 100644 --- a/app/Filament/Resources/ResultResource.php +++ b/app/Filament/Resources/ResultResource.php @@ -139,8 +139,12 @@ public static function form(Form $form): Form ->content(fn (Result $result): ?string => $result->server_location), Forms\Components\Placeholder::make('server_host') ->content(fn (Result $result): ?string => $result->server_host), + Forms\Components\Placeholder::make('comment') + ->label('Comments') + ->content(fn (Result $result): ?string => $result->comments), Forms\Components\Checkbox::make('scheduled'), Forms\Components\Checkbox::make('healthy'), + ]) ->columns(1) ->columnSpan([ @@ -311,6 +315,9 @@ public static function table(Table $table): Table ->badge() ->toggleable() ->sortable(), + Tables\Columns\TextColumn::make('comments') + ->toggleable() + ->sortable(), Tables\Columns\IconColumn::make('scheduled') ->boolean() ->toggleable() From b59646ac87fd2c6982d681b9f9fde250b2bfffe5 Mon Sep 17 00:00:00 2001 From: Sven van Ginkel Date: Thu, 28 Nov 2024 09:29:49 +0100 Subject: [PATCH 2/3] remove label --- app/Filament/Resources/ResultResource.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Filament/Resources/ResultResource.php b/app/Filament/Resources/ResultResource.php index be118cc26..94bb19428 100644 --- a/app/Filament/Resources/ResultResource.php +++ b/app/Filament/Resources/ResultResource.php @@ -140,7 +140,6 @@ public static function form(Form $form): Form Forms\Components\Placeholder::make('server_host') ->content(fn (Result $result): ?string => $result->server_host), Forms\Components\Placeholder::make('comment') - ->label('Comments') ->content(fn (Result $result): ?string => $result->comments), Forms\Components\Checkbox::make('scheduled'), Forms\Components\Checkbox::make('healthy'), From c0adbd16b419bbc7582bcc2bd6627a0dca7067b6 Mon Sep 17 00:00:00 2001 From: Sven van Ginkel Date: Thu, 28 Nov 2024 14:31:46 +0100 Subject: [PATCH 3/3] Remove from table --- app/Filament/Resources/ResultResource.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Filament/Resources/ResultResource.php b/app/Filament/Resources/ResultResource.php index 94bb19428..4ce9a11a9 100644 --- a/app/Filament/Resources/ResultResource.php +++ b/app/Filament/Resources/ResultResource.php @@ -314,9 +314,6 @@ public static function table(Table $table): Table ->badge() ->toggleable() ->sortable(), - Tables\Columns\TextColumn::make('comments') - ->toggleable() - ->sortable(), Tables\Columns\IconColumn::make('scheduled') ->boolean() ->toggleable()