mirror of
https://github.com/pelican-dev/panel.git
synced 2025-09-10 13:58:48 +02:00
merge fixes
This commit is contained in:
parent
90a3f38750
commit
4835192acd
@ -14,12 +14,12 @@ use App\Traits\Filament\CanCustomizeHeaderWidgets;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Actions\ActionGroup;
|
use Filament\Actions\ActionGroup;
|
||||||
|
use Filament\Infolists\Components\TextEntry\TextEntrySize;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
use Filament\Schemas\Components\Tabs\Tab;
|
use Filament\Schemas\Components\Tabs\Tab;
|
||||||
use Filament\Support\Enums\Alignment;
|
use Filament\Support\Enums\Alignment;
|
||||||
use Filament\Support\Enums\IconSize;
|
use Filament\Support\Enums\IconSize;
|
||||||
use Filament\Support\Enums\TextSize;
|
|
||||||
use Filament\Tables\Columns\Column;
|
use Filament\Tables\Columns\Column;
|
||||||
use Filament\Tables\Columns\Layout\Stack;
|
use Filament\Tables\Columns\Layout\Stack;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
@ -71,7 +71,7 @@ class ListServers extends ListRecords
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->default('unknown')
|
->default('unknown')
|
||||||
->wrap()
|
->wrap()
|
||||||
->size(TextSize::Medium)
|
->size(TextEntrySize::Medium)
|
||||||
->badge()
|
->badge()
|
||||||
->tooltip(fn (Server $server) => $server->formatResource('uptime', type: ServerResourceType::Time))
|
->tooltip(fn (Server $server) => $server->formatResource('uptime', type: ServerResourceType::Time))
|
||||||
->icon(fn (Server $server) => $server->condition->getIcon())
|
->icon(fn (Server $server) => $server->condition->getIcon())
|
||||||
@ -80,7 +80,7 @@ class ListServers extends ListRecords
|
|||||||
->label('Server')
|
->label('Server')
|
||||||
->description(fn (Server $server) => $server->description)
|
->description(fn (Server $server) => $server->description)
|
||||||
->grow()
|
->grow()
|
||||||
->size(TextSize::Medium)
|
->size(TextEntrySize::Medium)
|
||||||
->searchable(),
|
->searchable(),
|
||||||
TextColumn::make('allocation.address')
|
TextColumn::make('allocation.address')
|
||||||
->label('')
|
->label('')
|
||||||
@ -90,7 +90,7 @@ class ListServers extends ListRecords
|
|||||||
->state(fn (Server $server) => $server->allocation->address ?? 'None'),
|
->state(fn (Server $server) => $server->allocation->address ?? 'None'),
|
||||||
TextColumn::make('cpuUsage')
|
TextColumn::make('cpuUsage')
|
||||||
->label('Resources')
|
->label('Resources')
|
||||||
->size(TextSize::Medium)
|
->size(TextEntrySize::Medium)
|
||||||
->icon('tabler-cpu')
|
->icon('tabler-cpu')
|
||||||
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('cpu', limit: true, type: ServerResourceType::Percentage, precision: 0))
|
->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))
|
->state(fn (Server $server) => $server->formatResource('cpu_absolute', type: ServerResourceType::Percentage))
|
||||||
@ -98,14 +98,14 @@ class ListServers extends ListRecords
|
|||||||
TextColumn::make('memoryUsage')
|
TextColumn::make('memoryUsage')
|
||||||
->label('')
|
->label('')
|
||||||
->icon('tabler-device-desktop-analytics')
|
->icon('tabler-device-desktop-analytics')
|
||||||
->size(TextSize::Medium)
|
->size(TextEntrySize::Medium)
|
||||||
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('memory', limit: true))
|
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('memory', limit: true))
|
||||||
->state(fn (Server $server) => $server->formatResource('memory_bytes'))
|
->state(fn (Server $server) => $server->formatResource('memory_bytes'))
|
||||||
->color(fn (Server $server) => $this->getResourceColor($server, 'memory')),
|
->color(fn (Server $server) => $this->getResourceColor($server, 'memory')),
|
||||||
TextColumn::make('diskUsage')
|
TextColumn::make('diskUsage')
|
||||||
->label('')
|
->label('')
|
||||||
->icon('tabler-device-sd-card')
|
->icon('tabler-device-sd-card')
|
||||||
->size(TextSize::Medium)
|
->size(TextEntrySize::Medium)
|
||||||
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('disk', limit: true))
|
->tooltip(fn (Server $server) => 'Usage Limit: ' . $server->formatResource('disk', limit: true))
|
||||||
->state(fn (Server $server) => $server->formatResource('disk_bytes'))
|
->state(fn (Server $server) => $server->formatResource('disk_bytes'))
|
||||||
->color(fn (Server $server) => $this->getResourceColor($server, 'disk')),
|
->color(fn (Server $server) => $this->getResourceColor($server, 'disk')),
|
||||||
@ -240,7 +240,7 @@ class ListServers extends ListRecords
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @return Action[]|ActionGroup[] */
|
/** @return Action[]|ActionGroup[] */
|
||||||
public static function getPowerActions(string $view): array
|
public static function getPowerActions(string $view, Server $Server): array
|
||||||
{
|
{
|
||||||
$actions = [
|
$actions = [
|
||||||
Action::make('start')
|
Action::make('start')
|
||||||
@ -282,4 +282,9 @@ class ListServers extends ListRecords
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isTableColumnToggledHidden(string $name): bool
|
||||||
|
{
|
||||||
|
// TODO: Implement isTableColumnToggledHidden() method.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,10 @@ use Filament\Actions\Action;
|
|||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms\Components\FileUpload;
|
use Filament\Forms\Components\FileUpload;
|
||||||
use Filament\Forms\Components\Repeater;
|
use Filament\Forms\Components\Repeater;
|
||||||
use Filament\Forms\Components\Tabs;
|
|
||||||
use Filament\Forms\Components\Tabs\Tab;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
|
use Filament\Schemas\Components\Tabs;
|
||||||
|
use Filament\Schemas\Components\Tabs\Tab;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
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->authorize(fn () => auth()->user()->can(Permission::ACTION_SCHEDULE_CREATE, $server));
|
||||||
|
|
||||||
$this->form([
|
$this->schema([
|
||||||
Tabs::make('Tabs')
|
Tabs::make('Tabs')
|
||||||
->contained(false)
|
->contained(false)
|
||||||
->tabs([
|
->tabs([
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Filament\Components\Forms\Actions;
|
namespace App\Filament\Components\Forms\Actions;
|
||||||
|
|
||||||
use Filament\Forms\Components\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Forms\Get;
|
use Filament\Schemas\Components\Utilities\Get;
|
||||||
use Filament\Forms\Set;
|
use Filament\Schemas\Components\Utilities\Set;
|
||||||
|
|
||||||
class CronPresetAction extends Action
|
class CronPresetAction extends Action
|
||||||
{
|
{
|
@ -95,6 +95,7 @@ class ScheduleResource extends Resource
|
|||||||
->label('Schedule Name')
|
->label('Schedule Name')
|
||||||
->placeholder('A human readable identifier for this schedule.')
|
->placeholder('A human readable identifier for this schedule.')
|
||||||
->autocomplete(false)
|
->autocomplete(false)
|
||||||
|
->columnSpanFull()
|
||||||
->required(),
|
->required(),
|
||||||
Toggle::make('only_when_online')
|
Toggle::make('only_when_online')
|
||||||
->label('Only when Server is Online?')
|
->label('Only when Server is Online?')
|
||||||
@ -142,7 +143,7 @@ class ScheduleResource extends Resource
|
|||||||
&& $get('cron_day_of_month') == '*'
|
&& $get('cron_day_of_month') == '*'
|
||||||
&& $get('cron_month') == '*'
|
&& $get('cron_month') == '*'
|
||||||
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
|
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
|
||||||
->form([
|
->schema([
|
||||||
TextInput::make('x')
|
TextInput::make('x')
|
||||||
->label('')
|
->label('')
|
||||||
->numeric()
|
->numeric()
|
||||||
@ -164,7 +165,7 @@ class ScheduleResource extends Resource
|
|||||||
&& $get('cron_day_of_month') == '*'
|
&& $get('cron_day_of_month') == '*'
|
||||||
&& $get('cron_month') == '*'
|
&& $get('cron_month') == '*'
|
||||||
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
|
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
|
||||||
->form([
|
->schema([
|
||||||
TextInput::make('x')
|
TextInput::make('x')
|
||||||
->label('')
|
->label('')
|
||||||
->numeric()
|
->numeric()
|
||||||
@ -186,7 +187,7 @@ class ScheduleResource extends Resource
|
|||||||
&& str($get('cron_day_of_month'))->startsWith('*/')
|
&& str($get('cron_day_of_month'))->startsWith('*/')
|
||||||
&& $get('cron_month') == '*'
|
&& $get('cron_month') == '*'
|
||||||
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
|
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
|
||||||
->form([
|
->schema([
|
||||||
TextInput::make('x')
|
TextInput::make('x')
|
||||||
->label('')
|
->label('')
|
||||||
->numeric()
|
->numeric()
|
||||||
@ -208,7 +209,7 @@ class ScheduleResource extends Resource
|
|||||||
&& $get('cron_day_of_month') == '1'
|
&& $get('cron_day_of_month') == '1'
|
||||||
&& str($get('cron_month'))->startsWith('*/')
|
&& str($get('cron_month'))->startsWith('*/')
|
||||||
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
|
&& $get('cron_day_of_week') == '*' ? 'success' : 'primary')
|
||||||
->form([
|
->schema([
|
||||||
TextInput::make('x')
|
TextInput::make('x')
|
||||||
->label('')
|
->label('')
|
||||||
->numeric()
|
->numeric()
|
||||||
@ -230,7 +231,7 @@ class ScheduleResource extends Resource
|
|||||||
&& $get('cron_day_of_month') == '*'
|
&& $get('cron_day_of_month') == '*'
|
||||||
&& $get('cron_month') == '*'
|
&& $get('cron_month') == '*'
|
||||||
&& $get('cron_day_of_week') != '*' ? 'success' : 'primary')
|
&& $get('cron_day_of_week') != '*' ? 'success' : 'primary')
|
||||||
->form([
|
->schema([
|
||||||
Select::make('x')
|
Select::make('x')
|
||||||
->label('')
|
->label('')
|
||||||
->prefix('Every')
|
->prefix('Every')
|
||||||
@ -290,7 +291,8 @@ class ScheduleResource extends Resource
|
|||||||
'default' => 4,
|
'default' => 4,
|
||||||
'lg' => 5,
|
'lg' => 5,
|
||||||
]),
|
]),
|
||||||
]),
|
])
|
||||||
|
->columnSpanFull(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,15 +21,6 @@
|
|||||||
({{ $server->formatResource('uptime', type: \App\Enums\ServerResourceType::Time) }})
|
({{ $server->formatResource('uptime', type: \App\Enums\ServerResourceType::Time) }})
|
||||||
</span>
|
</span>
|
||||||
</h2>
|
</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>
|
||||||
|
|
||||||
<div class="flex justify-between text-center items-center gap-4">
|
<div class="flex justify-between text-center items-center gap-4">
|
||||||
@ -56,14 +47,6 @@
|
|||||||
<hr class="p-0.5">
|
<hr class="p-0.5">
|
||||||
<p class="text-md font-semibold">{{ $server->allocation->address }} </p>
|
<p class="text-md font-semibold">{{ $server->allocation->address }} </p>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user