Skip to content

Commit

Permalink
made more result columns sortable
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjustesen committed Nov 26, 2023
1 parent 2cbace6 commit 70591b8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app/Filament/Resources/ResultResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ public static function table(Table $table): Table
return $table
->columns([
TextColumn::make('id')
->label('ID'),
->label('ID')
->sortable(),
TextColumn::make('server')
->getStateUsing(fn (Result $record): ?string => ! blank($record->server_id) ? $record->server_id.' ('.$record->server_name.')' : null)
->toggleable(),
->toggleable()
->sortable(),
IconColumn::make('successful')
->boolean()
->toggleable(),
Expand All @@ -112,13 +114,16 @@ public static function table(Table $table): Table
->toggleable(),
TextColumn::make('download')
->label('Download (Mbps)')
->getStateUsing(fn (Result $record): ?string => ! blank($record->download) ? toBits(convertSize($record->download), 2) : null),
->getStateUsing(fn (Result $record): ?string => ! blank($record->download) ? toBits(convertSize($record->download), 2) : null)
->sortable(),
TextColumn::make('upload')
->label('Upload (Mbps)')
->getStateUsing(fn (Result $record): ?string => ! blank($record->upload) ? toBits(convertSize($record->upload), 2) : null),
->getStateUsing(fn (Result $record): ?string => ! blank($record->upload) ? toBits(convertSize($record->upload), 2) : null)
->sortable(),
TextColumn::make('ping')
->label('Ping (Ms)')
->toggleable(),
->toggleable()
->sortable(),
TextColumn::make('download_jitter')
->getStateUsing(fn (Result $record): ?string => json_decode($record->data, true)['download']['latency']['jitter'] ?? null)
->toggleable()
Expand Down

0 comments on commit 70591b8

Please sign in to comment.