2.x - databases

This commit is contained in:
Saeed Vaziry
2024-09-29 00:30:04 +02:00
parent 32993025de
commit e4fed24498
62 changed files with 802 additions and 237 deletions

View File

@ -42,8 +42,9 @@ public function infolist(Infolist $infolist): Infolist
->inlineLabel()
->hintIcon('heroicon-o-information-circle')
->hintIconTooltip('Server unique identifier to use in the API'),
TextEntry::make('created_at_by_timezone')
TextEntry::make('created_at')
->label('Created At')
->formatStateUsing(fn ($record) => $record->created_at_by_timezone)
->inlineLabel(),
TextEntry::make('last_updated_check')
->label('Last Updated Check')

View File

@ -55,8 +55,14 @@ public function infolist(Infolist $infolist): Infolist
->icon('heroicon-o-arrow-path')
->tooltip('Check Connection')
->action(function (Server $record) {
$previousStatus = $record->status;
$record = $record->checkConnection();
if ($previousStatus !== $record->status) {
$this->redirect(url()->previous());
}
$this->dispatch('$refresh');
Notification::make()

View File

@ -3,6 +3,7 @@
namespace App\Web\Pages\Servers\Widgets;
use App\Models\Server;
use App\Web\Pages\Servers\Settings;
use App\Web\Pages\Servers\View;
use Filament\Tables\Actions\Action;
use Filament\Tables\Columns\TextColumn;
@ -41,8 +42,9 @@ protected function getTableColumns(): array
->color(fn (Server $server) => Server::$statusColors[$server->status])
->searchable()
->sortable(),
TextColumn::make('created_at_by_timezone')
TextColumn::make('created_at')
->label('Created At')
->formatStateUsing(fn ($record) => $record->created_at_by_timezone)
->searchable()
->sortable(),
];
@ -57,7 +59,7 @@ public function getTable(): Table
->label('Settings')
->icon('heroicon-o-cog-6-tooth')
->authorize(fn ($record) => auth()->user()->can('update', $record))
->url(fn (Server $record) => '/'),
->url(fn (Server $record) => Settings::getUrl(parameters: ['server' => $record])),
]);
}
}