Skip to content

Commit ad390c6

Browse files
authored
[Bug] Fixed server name filter (alexjustesen#2031)
1 parent 01df918 commit ad390c6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

app/Filament/Resources/ResultResource.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ public static function table(Table $table): Table
343343
->whereNotNull('data->interface->externalIp')
344344
->where('status', '=', ResultStatus::Completed)
345345
->distinct()
346+
->orderBy('data->interface->externalIp')
346347
->get()
347348
->mapWithKeys(function (Result $item, int $key) {
348349
return [$item['public_ip_address'] => $item['public_ip_address']];
@@ -351,18 +352,19 @@ public static function table(Table $table): Table
351352
})
352353
->attribute('data->interface->externalIp'),
353354
Tables\Filters\SelectFilter::make('server_name')
354-
->label('Server Name')
355+
->label('Server name')
355356
->multiple()
356357
->options(function (): array {
357358
return Result::query()
358-
->whereNotNull('data')
359+
->select('data->server->name AS data_server_name')
360+
->whereNotNull('data->server->name')
359361
->where('status', '=', ResultStatus::Completed)
360-
->orderBy('data->server->name')
361362
->distinct()
363+
->orderBy('data->server->name')
362364
->get()
363-
->mapWithKeys(fn (Result $result) => [
364-
$result->data['server']['name'] => $result->data['server']['name'],
365-
])
365+
->mapWithKeys(function (Result $item, int $key) {
366+
return [$item['data_server_name'] => $item['data_server_name']];
367+
})
366368
->toArray();
367369
})
368370
->attribute('data->server->name'),

0 commit comments

Comments
 (0)