merge fixes

This commit is contained in:
notCharles 2025-07-19 16:54:58 -04:00
parent 90a3f38750
commit 4835192acd
5 changed files with 26 additions and 36 deletions

View File

@ -14,12 +14,12 @@ use App\Traits\Filament\CanCustomizeHeaderWidgets;
use Exception;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Infolists\Components\TextEntry\TextEntrySize;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ListRecords;
use Filament\Schemas\Components\Tabs\Tab;
use Filament\Support\Enums\Alignment;
use Filament\Support\Enums\IconSize;
use Filament\Support\Enums\TextSize;
use Filament\Tables\Columns\Column;
use Filament\Tables\Columns\Layout\Stack;
use Filament\Tables\Columns\TextColumn;
@ -71,7 +71,7 @@ class ListServers extends ListRecords
->alignCenter()
->default('unknown')
->wrap()
->size(TextSize::Medium)
->size(TextEntrySize::Medium)
->badge()
->tooltip(fn (Server $server) => $server->formatResource('uptime', type: ServerResourceType::Time))
->icon(fn (Server $server) => $server->condition->getIcon())
@ -80,7 +80,7 @@ class ListServers extends ListRecords
->label('Server')
->description(fn (Server $server) => $server->description)
->grow()
->size(TextSize::Medium)
->size(TextEntrySize::Medium)
->searchable(),
TextColumn::make('allocation.address')
->label('')
@ -90,7 +90,7 @@ class ListServers extends ListRecords
->state(fn (Server $server) => $server->allocation->address ?? 'None'),
TextColumn::make('cpuUsage')
->label('Resources')
->size(TextSize::Medium)
->size(TextEntrySize::Medium)
->icon('tabler-cpu')
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('cpu', limit: true, type: ServerResourceType::Percentage, precision: 0))
->state(fn (Server $server) => $server->formatResource('cpu_absolute', type: ServerResourceType::Percentage))
@ -98,14 +98,14 @@ class ListServers extends ListRecords
TextColumn::make('memoryUsage')
->label('')
->icon('tabler-device-desktop-analytics')
->size(TextSize::Medium)
->size(TextEntrySize::Medium)
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('memory', limit: true))
->state(fn (Server $server) => $server->formatResource('memory_bytes'))
->color(fn (Server $server) => $this->getResourceColor($server, 'memory')),
TextColumn::make('diskUsage')
->label('')
->icon('tabler-device-sd-card')
->size(TextSize::Medium)
->size(TextEntrySize::Medium)
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('disk', limit: true))
->state(fn (Server $server) => $server->formatResource('disk_bytes'))
->color(fn (Server $server) => $this->getResourceColor($server, 'disk')),
@ -240,7 +240,7 @@ class ListServers extends ListRecords
}
/** @return Action[]|ActionGroup[] */
public static function getPowerActions(string $view): array
public static function getPowerActions(string $view, Server $Server): array
{
$actions = [
Action::make('start')
@ -282,4 +282,9 @@ class ListServers extends ListRecords
];
}
}
public function isTableColumnToggledHidden(string $name): bool
{
// TODO: Implement isTableColumnToggledHidden() method.
}
}

View File

@ -10,10 +10,10 @@ use Filament\Actions\Action;
use Filament\Facades\Filament;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Tabs;
use Filament\Forms\Components\Tabs\Tab;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
use Illuminate\Support\Arr;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
@ -35,7 +35,7 @@ class ImportScheduleAction extends Action
$this->authorize(fn () => auth()->user()->can(Permission::ACTION_SCHEDULE_CREATE, $server));
$this->form([
$this->schema([
Tabs::make('Tabs')
->contained(false)
->tabs([

View File

@ -2,9 +2,9 @@
namespace App\Filament\Components\Forms\Actions;
use Filament\Forms\Components\Actions\Action;
use Filament\Forms\Get;
use Filament\Forms\Set;
use Filament\Actions\Action;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\Utilities\Set;
class CronPresetAction extends Action
{

View File

@ -95,6 +95,7 @@ class ScheduleResource extends Resource
->label('Schedule Name')
->placeholder('A human readable identifier for this schedule.')
->autocomplete(false)
->columnSpanFull()
->required(),
Toggle::make('only_when_online')
->label('Only when Server is Online?')
@ -142,7 +143,7 @@ class ScheduleResource extends Resource
&& $get('cron_day_of_month') == '*'
&& $get('cron_month') == '*'
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
->form([
->schema([
TextInput::make('x')
->label('')
->numeric()
@ -164,7 +165,7 @@ class ScheduleResource extends Resource
&& $get('cron_day_of_month') == '*'
&& $get('cron_month') == '*'
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
->form([
->schema([
TextInput::make('x')
->label('')
->numeric()
@ -186,7 +187,7 @@ class ScheduleResource extends Resource
&& str($get('cron_day_of_month'))->startsWith('*/')
&& $get('cron_month') == '*'
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
->form([
->schema([
TextInput::make('x')
->label('')
->numeric()
@ -208,7 +209,7 @@ class ScheduleResource extends Resource
&& $get('cron_day_of_month') == '1'
&& str($get('cron_month'))->startsWith('*/')
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
->form([
->schema([
TextInput::make('x')
->label('')
->numeric()
@ -230,7 +231,7 @@ class ScheduleResource extends Resource
&& $get('cron_day_of_month') == '*'
&& $get('cron_month') == '*'
&& $get('cron_day_of_week') != '*' ? 'success' : 'primary')
->form([
->schema([
Select::make('x')
->label('')
->prefix('Every')
@ -290,7 +291,8 @@ class ScheduleResource extends Resource
'default' => 4,
'lg' => 5,
]),
]),
])
->columnSpanFull(),
]);
}

View File

@ -21,15 +21,6 @@
({{ $server->formatResource('uptime', type: \App\Enums\ServerResourceType::Time) }})
</span>
</h2>
<div class="end-0" x-on:click.stop>
<div class="flex-1 dark:bg-gray-800 dark:text-white rounded-b-lg overflow-hidden p-1">
<x-filament-tables::actions
:actions="\App\Filament\App\Resources\ServerResource\Pages\ListServers::getPowerActions(view: 'grid')"
:alignment="\Filament\Support\Enums\Alignment::Center"
:record="$server"
/>
</div>
</div>
</div>
<div class="flex justify-between text-center items-center gap-4">
@ -56,14 +47,6 @@
<hr class="p-0.5">
<p class="text-md font-semibold">{{ $server->allocation->address }} </p>
</div>
<div x-on:click.stop>
<x-filament-actions::group
:actions="\App\Filament\App\Resources\ServerResource\Pages\ListServers::getPowerActions($server)"
size="xl"
icon="tabler-power"
tooltip="Power Actions"
/>
</div>
</div>
</div>