Boy132 b003404aea
Collection of small admin area changes (#604)
* enable tags for nodes

* update icon for cpu column

* disable inline for "force outgoing ip" label

* change label for database hosts resource

* add custom empty state for database hosts & api keys

* add icons to egg tabs

* fix typo

* rename node "Automatic Allocation" to avoid confusion

* run code cleanup

* remove regex for node name

* only check count for application api keys

* replace "New" with "Create"

* change sidebar width to fit "Database Hosts"
2024-10-04 01:15:08 +02:00

58 lines
2.3 KiB
PHP

<?php
namespace App\Filament\Resources\NodeResource\RelationManagers;
use App\Models\Server;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables\Columns\SelectColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class NodesRelationManager extends RelationManager
{
protected static string $relationship = 'servers';
protected static ?string $icon = 'tabler-brand-docker';
public function table(Table $table): Table
{
return $table
->searchable(false)
->columns([
TextColumn::make('user.username')
->label('Owner')
->icon('tabler-user')
->url(fn (Server $server): string => route('filament.admin.resources.users.edit', ['record' => $server->user]))
->searchable(),
TextColumn::make('name')
->icon('tabler-brand-docker')
->url(fn (Server $server): string => route('filament.admin.resources.servers.edit', ['record' => $server]))
->searchable()
->sortable(),
TextColumn::make('egg.name')
->icon('tabler-egg')
->url(fn (Server $server): string => route('filament.admin.resources.eggs.edit', ['record' => $server->user]))
->sortable(),
SelectColumn::make('allocation.id')
->label('Primary Allocation')
->options(fn (Server $server) => [$server->allocation->id => $server->allocation->address])
->selectablePlaceholder(false)
->sortable(),
TextColumn::make('memory')->icon('tabler-device-desktop-analytics'),
TextColumn::make('cpu')->icon('tabler-cpu'),
TextColumn::make('databases_count')
->counts('databases')
->label('Databases')
->icon('tabler-database')
->numeric()
->sortable(),
TextColumn::make('backups_count')
->counts('backups')
->label('Backups')
->icon('tabler-file-download')
->numeric()
->sortable(),
]);
}
}