Skip to content

Commit 342f340

Browse files
authored
[Feature] Add Error Message to the results table & Export (alexjustesen#2151)
1 parent 8ae4ef6 commit 342f340

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

app/Actions/CheckInternetConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function handle(): bool|string
2525

2626
return Str::trim($response->body());
2727
} catch (Throwable $e) {
28-
Log::error('Failed to check internet connection.', [$e->getMessage()]);
28+
Log::error('Failed to connect to the internet.', [$e->getMessage()]);
2929

3030
return false;
3131
}

app/Filament/Exports/ResultExporter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ public static function getColumns(): array
117117
->state(function (Result $record) {
118118
return $record->result_url;
119119
}),
120+
ExportColumn::make('error_message')
121+
->state(function (Result $record) {
122+
return $record->error_message;
123+
})
124+
->enabledByDefault(false),
120125
ExportColumn::make('comments')
121126
->enabledByDefault(false),
122127
ExportColumn::make('status')

app/Filament/Resources/ResultResource.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,13 @@ public static function table(Table $table): Table
319319
->toggledHiddenByDefault()
320320
->sortable()
321321
->alignment(Alignment::Center),
322+
Tables\Columns\TextColumn::make('data.message')
323+
->label('Error Message')
324+
->limit(15)
325+
->tooltip(fn ($state) => $state)
326+
->toggleable()
327+
->toggledHiddenByDefault()
328+
->sortable(),
322329
Tables\Columns\TextColumn::make('created_at')
323330
->dateTime(config('app.datetime_format'))
324331
->timezone(config('app.display_timezone'))

app/Jobs/CheckForInternetConnectionJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function handle(): void
5151
$this->result->update([
5252
'data->type' => 'log',
5353
'data->level' => 'error',
54-
'data->message' => 'Failed to fetch external IP address, server is likely unable to connect to the internet.',
54+
'data->message' => 'Failed to connect to the internet.',
5555
'status' => ResultStatus::Failed,
5656
]);
5757

0 commit comments

Comments
 (0)