Skip to content

Commit

Permalink
[Feature] Made more result columns sortable (#926)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjustesen committed Nov 26, 2023
1 parent 2cbace6 commit 6385719
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 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,25 +114,31 @@ 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()
->toggledHiddenByDefault(),
->toggledHiddenByDefault()
->sortable(),
TextColumn::make('upload_jitter')
->getStateUsing(fn (Result $record): ?string => json_decode($record->data, true)['upload']['latency']['jitter'] ?? null)
->toggleable()
->toggledHiddenByDefault(),
->toggledHiddenByDefault()
->sortable(),
TextColumn::make('ping_jitter')
->getStateUsing(fn (Result $record): ?string => json_decode($record->data, true)['ping']['jitter'] ?? null)
->toggleable()
->toggledHiddenByDefault(),
->toggledHiddenByDefault()
->sortable(),
TextColumn::make('created_at')
->label('Created')
->dateTime($settings->time_format ?? 'M j, Y G:i:s')
Expand Down

0 comments on commit 6385719

Please sign in to comment.