From e145fcdc56651793359aa53a4781d597a3836953 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 13 Jan 2025 09:31:37 -0500 Subject: [PATCH] Use Filament labels. (#906) * Use Filament labels. * use `trans` * Show more files No reason for this to be its own pr... --- app/Filament/Admin/Resources/EggResource/Pages/EditEgg.php | 2 +- app/Filament/Admin/Resources/NodeResource/Pages/EditNode.php | 2 +- app/Filament/Components/Actions/ExportEggAction.php | 2 +- app/Filament/Components/Actions/ImportEggAction.php | 2 +- .../Server/Resources/FileResource/Pages/ListFiles.php | 5 ++--- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/Filament/Admin/Resources/EggResource/Pages/EditEgg.php b/app/Filament/Admin/Resources/EggResource/Pages/EditEgg.php index 9db14303b2..5bd30de3fe 100644 --- a/app/Filament/Admin/Resources/EggResource/Pages/EditEgg.php +++ b/app/Filament/Admin/Resources/EggResource/Pages/EditEgg.php @@ -248,7 +248,7 @@ protected function getHeaderActions(): array return [ DeleteAction::make() ->disabled(fn (Egg $egg): bool => $egg->servers()->count() > 0) - ->label(fn (Egg $egg): string => $egg->servers()->count() <= 0 ? 'Delete' : 'In Use'), + ->label(fn (Egg $egg): string => $egg->servers()->count() <= 0 ? trans('filament-actions::delete.single.label') : 'In Use'), ExportEggAction::make(), ImportEggAction::make(), $this->getSaveFormAction()->formId('form'), diff --git a/app/Filament/Admin/Resources/NodeResource/Pages/EditNode.php b/app/Filament/Admin/Resources/NodeResource/Pages/EditNode.php index b39a4b2b22..d5e1c4e2b9 100644 --- a/app/Filament/Admin/Resources/NodeResource/Pages/EditNode.php +++ b/app/Filament/Admin/Resources/NodeResource/Pages/EditNode.php @@ -593,7 +593,7 @@ protected function getHeaderActions(): array return [ Actions\DeleteAction::make() ->disabled(fn (Node $node) => $node->servers()->count() > 0) - ->label(fn (Node $node) => $node->servers()->count() > 0 ? 'Node Has Servers' : 'Delete'), + ->label(fn (Node $node) => $node->servers()->count() > 0 ? 'Node Has Servers' : trans('filament-actions::delete.single.label')), $this->getSaveFormAction()->formId('form'), ]; } diff --git a/app/Filament/Components/Actions/ExportEggAction.php b/app/Filament/Components/Actions/ExportEggAction.php index 57588d7858..1f3e4705d8 100644 --- a/app/Filament/Components/Actions/ExportEggAction.php +++ b/app/Filament/Components/Actions/ExportEggAction.php @@ -17,7 +17,7 @@ protected function setUp(): void { parent::setUp(); - $this->label('Export'); + $this->label(trans('filament-actions::export.modal.actions.export.label')); $this->authorize(fn () => auth()->user()->can('export egg')); diff --git a/app/Filament/Components/Actions/ImportEggAction.php b/app/Filament/Components/Actions/ImportEggAction.php index f3026caed7..44748e42ac 100644 --- a/app/Filament/Components/Actions/ImportEggAction.php +++ b/app/Filament/Components/Actions/ImportEggAction.php @@ -23,7 +23,7 @@ protected function setUp(): void { parent::setUp(); - $this->label('Import'); + $this->label(trans('filament-actions::import.modal.actions.import.label')); $this->authorize(fn () => auth()->user()->can('import egg')); diff --git a/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php b/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php index 1f83193ba1..9700af26c7 100644 --- a/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php +++ b/app/Filament/Server/Resources/FileResource/Pages/ListFiles.php @@ -78,8 +78,8 @@ public function table(Table $table): Table $server = Filament::getTenant(); return $table - ->paginated([15, 25, 50, 100]) - ->defaultPaginationPageOption(15) + ->paginated([25, 50, 100, 250]) + ->defaultPaginationPageOption(50) ->query(fn () => File::get($server, $this->path)->orderByDesc('is_directory')) ->defaultSort('name') ->columns([ @@ -116,7 +116,6 @@ public function table(Table $table): Table ->url(fn (File $file) => self::getUrl(['path' => join_paths($this->path, $file->name)])), EditAction::make('edit') ->authorize(fn () => auth()->user()->can(Permission::ACTION_FILE_READ_CONTENT, $server)) - ->label('Edit') ->icon('tabler-edit') ->visible(fn (File $file) => $file->canEdit()) ->url(fn (File $file) => EditFiles::getUrl(['path' => join_paths($this->path, $file->name)])),