mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-22 07:24:44 +02:00

* 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"
70 lines
2.1 KiB
PHP
70 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\DatabaseHostResource\Pages;
|
|
|
|
use App\Filament\Resources\DatabaseHostResource;
|
|
use App\Models\DatabaseHost;
|
|
use Filament\Actions;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
use Filament\Tables\Actions\BulkActionGroup;
|
|
use Filament\Tables\Actions\CreateAction;
|
|
use Filament\Tables\Actions\DeleteBulkAction;
|
|
use Filament\Tables\Actions\EditAction;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class ListDatabaseHosts extends ListRecords
|
|
{
|
|
protected static string $resource = DatabaseHostResource::class;
|
|
|
|
protected ?string $heading = 'Database Hosts';
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->searchable(false)
|
|
->columns([
|
|
TextColumn::make('name')
|
|
->searchable(),
|
|
TextColumn::make('host')
|
|
->searchable(),
|
|
TextColumn::make('port')
|
|
->sortable(),
|
|
TextColumn::make('username')
|
|
->searchable(),
|
|
TextColumn::make('max_databases')
|
|
->numeric()
|
|
->sortable(),
|
|
TextColumn::make('node.name')
|
|
->numeric()
|
|
->sortable(),
|
|
])
|
|
->actions([
|
|
EditAction::make(),
|
|
])
|
|
->bulkActions([
|
|
BulkActionGroup::make([
|
|
DeleteBulkAction::make()
|
|
->authorize(fn () => auth()->user()->can('delete databasehost')),
|
|
]),
|
|
])
|
|
->emptyStateIcon('tabler-database')
|
|
->emptyStateDescription('')
|
|
->emptyStateHeading('No Database Hosts')
|
|
->emptyStateActions([
|
|
CreateAction::make('create')
|
|
->label('Create Database Host')
|
|
->button(),
|
|
]);
|
|
}
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Actions\CreateAction::make('create')
|
|
->label('Create Database Host')
|
|
->hidden(fn () => DatabaseHost::count() <= 0),
|
|
];
|
|
}
|
|
}
|