Skip to content

Commit 7306500

Browse files
authored
[Feature] Add server name as a filter in the results (alexjustesen#2015)
1 parent 91651e9 commit 7306500

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app/Filament/Resources/ResultResource.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,22 @@ public static function table(Table $table): Table
350350
->toArray();
351351
})
352352
->attribute('data->interface->externalIp'),
353+
Tables\Filters\SelectFilter::make('server_name')
354+
->label('Server Name')
355+
->multiple()
356+
->options(function (): array {
357+
return Result::query()
358+
->whereNotNull('data')
359+
->where('status', '=', ResultStatus::Completed)
360+
->orderBy('data->server->name')
361+
->distinct()
362+
->get()
363+
->mapWithKeys(fn (Result $result) => [
364+
$result->data['server']['name'] => $result->data['server']['name'],
365+
])
366+
->toArray();
367+
})
368+
->attribute('data->server->name'),
353369
Tables\Filters\TernaryFilter::make('scheduled')
354370
->nullable()
355371
->trueLabel('Only scheduled speedtests')

0 commit comments

Comments
 (0)