migrating tests (Backups)

This commit is contained in:
Saeed Vaziry
2024-10-08 23:00:16 +02:00
parent 0da21f40bd
commit eaecafc9b0
5 changed files with 43 additions and 25 deletions

View File

@ -14,6 +14,8 @@ class Index extends Page
protected static ?string $title = 'Headless Console';
protected static ?string $navigationLabel = 'Console';
public function mount(): void
{
$this->authorize('manage', $this->server);

View File

@ -31,7 +31,7 @@ public function mount(): void
protected function getHeaderActions(): array
{
return [
Action::make('Create backup')
Action::make('create')
->icon('heroicon-o-plus')
->modalWidth(MaxWidth::Large)
->authorize(fn () => auth()->user()?->can('create', [Backup::class, $this->server]))

View File

@ -31,7 +31,7 @@ class MetricDetails extends Widget implements HasForms, HasInfolists
public function infolist(Infolist $infolist): Infolist
{
return $infolist
->record($this->server->metrics()->latest()->first())
->record($this->server->metrics()->latest()->first() ?? new Metric)
->schema([
Grid::make()
->schema([

View File

@ -37,10 +37,10 @@ protected function getStats(): array
Stat::make('CPU Load', $lastMetric?->load ?? 0)
->color('success')
->chart($metrics->pluck('load')->toArray()),
Stat::make('Memory Usage', Number::fileSize($lastMetric->memory_used_in_bytes, 2))
Stat::make('Memory Usage', Number::fileSize($lastMetric?->memory_used_in_bytes || 0, 2))
->color('warning')
->chart($metrics->pluck('memory_used')->toArray()),
Stat::make('Disk Usage', Number::fileSize($lastMetric->disk_used_in_bytes, 2))
Stat::make('Disk Usage', Number::fileSize($lastMetric?->disk_used_in_bytes || 0, 2))
->color('primary')
->chart($metrics->pluck('disk_used')->toArray()),
];