mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 00:34:44 +02:00
Mobile + Layout Changes (#836)
* Update Server Listing * Update Edit/Create Server Pages Re-arrange limits, CPU->Memory->Disk * Remove auto focus its cancer on mobile... * Hide Title, Quick yaml fix * Hide columns on mobile * Hide backup locked on mobile * Fix schedules for mobile * Hide Notes on mobile * Consolidate and clean these up * Simplify * Remove unused imports * Replace tabler icon package * Update app/Filament/Server/Resources/FileResource/Pages/EditFiles.php Co-authored-by: Lance Pioch <git@lance.sh> * Allow the unit to be changed * Use existing method * Update composer and pint * Update resources/views/tables/columns/server-entry-column.blade.php Co-authored-by: Boy132 <Boy132@users.noreply.github.com> * Simplify html and add small margin * Unused * Add enum --------- Co-authored-by: Lance Pioch <git@lance.sh> Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
This commit is contained in:
parent
66a17879a0
commit
a8680c7aed
@ -53,6 +53,16 @@ enum ContainerStatus: string
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function colorHex(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Created, self::Restarting => '#2563EB',
|
||||||
|
self::Starting, self::Paused, self::Removing, self::Stopping => '#D97706',
|
||||||
|
self::Running => '#22C55E',
|
||||||
|
self::Exited, self::Missing, self::Dead, self::Offline => '#EF4444',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public function isStartingOrStopping(): bool
|
public function isStartingOrStopping(): bool
|
||||||
{
|
{
|
||||||
return in_array($this, [ContainerStatus::Starting, ContainerStatus::Stopping, ContainerStatus::Restarting]);
|
return in_array($this, [ContainerStatus::Starting, ContainerStatus::Stopping, ContainerStatus::Restarting]);
|
||||||
|
10
app/Enums/ServerResourceType.php
Normal file
10
app/Enums/ServerResourceType.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
enum ServerResourceType
|
||||||
|
{
|
||||||
|
case Unit;
|
||||||
|
case Percentage;
|
||||||
|
case Time;
|
||||||
|
}
|
@ -534,6 +534,37 @@ class CreateServer extends CreateRecord
|
|||||||
'lg' => 3,
|
'lg' => 3,
|
||||||
])
|
])
|
||||||
->schema([
|
->schema([
|
||||||
|
Grid::make()
|
||||||
|
->columns(4)
|
||||||
|
->columnSpanFull()
|
||||||
|
->schema([
|
||||||
|
ToggleButtons::make('unlimited_cpu')
|
||||||
|
->label('CPU')->inlineLabel()->inline()
|
||||||
|
->default(true)
|
||||||
|
->afterStateUpdated(fn (Set $set) => $set('cpu', 0))
|
||||||
|
->live()
|
||||||
|
->options([
|
||||||
|
true => 'Unlimited',
|
||||||
|
false => 'Limited',
|
||||||
|
])
|
||||||
|
->colors([
|
||||||
|
true => 'primary',
|
||||||
|
false => 'warning',
|
||||||
|
])
|
||||||
|
->columnSpan(2),
|
||||||
|
|
||||||
|
TextInput::make('cpu')
|
||||||
|
->dehydratedWhenHidden()
|
||||||
|
->hidden(fn (Get $get) => $get('unlimited_cpu'))
|
||||||
|
->label('CPU Limit')->inlineLabel()
|
||||||
|
->suffix('%')
|
||||||
|
->default(0)
|
||||||
|
->required()
|
||||||
|
->columnSpan(2)
|
||||||
|
->numeric()
|
||||||
|
->minValue(0)
|
||||||
|
->helperText('100% equals one CPU core.'),
|
||||||
|
]),
|
||||||
Grid::make()
|
Grid::make()
|
||||||
->columns(4)
|
->columns(4)
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
@ -564,7 +595,6 @@ class CreateServer extends CreateRecord
|
|||||||
->numeric()
|
->numeric()
|
||||||
->minValue(0),
|
->minValue(0),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Grid::make()
|
Grid::make()
|
||||||
->columns(4)
|
->columns(4)
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
@ -596,37 +626,6 @@ class CreateServer extends CreateRecord
|
|||||||
->minValue(0),
|
->minValue(0),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Grid::make()
|
|
||||||
->columns(4)
|
|
||||||
->columnSpanFull()
|
|
||||||
->schema([
|
|
||||||
ToggleButtons::make('unlimited_cpu')
|
|
||||||
->label('CPU')->inlineLabel()->inline()
|
|
||||||
->default(true)
|
|
||||||
->afterStateUpdated(fn (Set $set) => $set('cpu', 0))
|
|
||||||
->live()
|
|
||||||
->options([
|
|
||||||
true => 'Unlimited',
|
|
||||||
false => 'Limited',
|
|
||||||
])
|
|
||||||
->colors([
|
|
||||||
true => 'primary',
|
|
||||||
false => 'warning',
|
|
||||||
])
|
|
||||||
->columnSpan(2),
|
|
||||||
|
|
||||||
TextInput::make('cpu')
|
|
||||||
->dehydratedWhenHidden()
|
|
||||||
->hidden(fn (Get $get) => $get('unlimited_cpu'))
|
|
||||||
->label('CPU Limit')->inlineLabel()
|
|
||||||
->suffix('%')
|
|
||||||
->default(0)
|
|
||||||
->required()
|
|
||||||
->columnSpan(2)
|
|
||||||
->numeric()
|
|
||||||
->minValue(0)
|
|
||||||
->helperText('100% equals one CPU core.'),
|
|
||||||
]),
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Fieldset::make('Advanced Limits')
|
Fieldset::make('Advanced Limits')
|
||||||
@ -638,6 +637,40 @@ class CreateServer extends CreateRecord
|
|||||||
'lg' => 3,
|
'lg' => 3,
|
||||||
])
|
])
|
||||||
->schema([
|
->schema([
|
||||||
|
Hidden::make('io')
|
||||||
|
->helperText('The IO performance relative to other running containers')
|
||||||
|
->label('Block IO Proportion')
|
||||||
|
->default(500),
|
||||||
|
|
||||||
|
Grid::make()
|
||||||
|
->columns(4)
|
||||||
|
->columnSpanFull()
|
||||||
|
->schema([
|
||||||
|
ToggleButtons::make('cpu_pinning')
|
||||||
|
->label('CPU Pinning')->inlineLabel()->inline()
|
||||||
|
->default(false)
|
||||||
|
->afterStateUpdated(fn (Set $set) => $set('threads', []))
|
||||||
|
->live()
|
||||||
|
->options([
|
||||||
|
false => 'Disabled',
|
||||||
|
true => 'Enabled',
|
||||||
|
])
|
||||||
|
->colors([
|
||||||
|
false => 'success',
|
||||||
|
true => 'warning',
|
||||||
|
])
|
||||||
|
->columnSpan(2),
|
||||||
|
|
||||||
|
TagsInput::make('threads')
|
||||||
|
->dehydratedWhenHidden()
|
||||||
|
->hidden(fn (Get $get) => !$get('cpu_pinning'))
|
||||||
|
->label('Pinned Threads')->inlineLabel()
|
||||||
|
->required(fn (Get $get) => $get('cpu_pinning'))
|
||||||
|
->columnSpan(2)
|
||||||
|
->separator()
|
||||||
|
->splitKeys([','])
|
||||||
|
->placeholder('Add pinned thread, e.g. 0 or 2-4'),
|
||||||
|
]),
|
||||||
Grid::make()
|
Grid::make()
|
||||||
->columns(4)
|
->columns(4)
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
@ -686,41 +719,6 @@ class CreateServer extends CreateRecord
|
|||||||
->integer(),
|
->integer(),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Hidden::make('io')
|
|
||||||
->helperText('The IO performance relative to other running containers')
|
|
||||||
->label('Block IO Proportion')
|
|
||||||
->default(500),
|
|
||||||
|
|
||||||
Grid::make()
|
|
||||||
->columns(4)
|
|
||||||
->columnSpanFull()
|
|
||||||
->schema([
|
|
||||||
ToggleButtons::make('cpu_pinning')
|
|
||||||
->label('CPU Pinning')->inlineLabel()->inline()
|
|
||||||
->default(false)
|
|
||||||
->afterStateUpdated(fn (Set $set) => $set('threads', []))
|
|
||||||
->live()
|
|
||||||
->options([
|
|
||||||
false => 'Disabled',
|
|
||||||
true => 'Enabled',
|
|
||||||
])
|
|
||||||
->colors([
|
|
||||||
false => 'success',
|
|
||||||
true => 'warning',
|
|
||||||
])
|
|
||||||
->columnSpan(2),
|
|
||||||
|
|
||||||
TagsInput::make('threads')
|
|
||||||
->dehydratedWhenHidden()
|
|
||||||
->hidden(fn (Get $get) => !$get('cpu_pinning'))
|
|
||||||
->label('Pinned Threads')->inlineLabel()
|
|
||||||
->required(fn (Get $get) => $get('cpu_pinning'))
|
|
||||||
->columnSpan(2)
|
|
||||||
->separator()
|
|
||||||
->splitKeys([','])
|
|
||||||
->placeholder('Add pinned thread, e.g. 0 or 2-4'),
|
|
||||||
]),
|
|
||||||
|
|
||||||
Grid::make()
|
Grid::make()
|
||||||
->columns(4)
|
->columns(4)
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
|
@ -184,6 +184,35 @@ class EditServer extends EditRecord
|
|||||||
'lg' => 3,
|
'lg' => 3,
|
||||||
])
|
])
|
||||||
->schema([
|
->schema([
|
||||||
|
Grid::make()
|
||||||
|
->columns(4)
|
||||||
|
->columnSpanFull()
|
||||||
|
->schema([
|
||||||
|
ToggleButtons::make('unlimited_cpu')
|
||||||
|
->label('CPU')->inlineLabel()->inline()
|
||||||
|
->afterStateUpdated(fn (Set $set) => $set('cpu', 0))
|
||||||
|
->formatStateUsing(fn (Get $get) => $get('cpu') == 0)
|
||||||
|
->live()
|
||||||
|
->options([
|
||||||
|
true => 'Unlimited',
|
||||||
|
false => 'Limited',
|
||||||
|
])
|
||||||
|
->colors([
|
||||||
|
true => 'primary',
|
||||||
|
false => 'warning',
|
||||||
|
])
|
||||||
|
->columnSpan(2),
|
||||||
|
|
||||||
|
TextInput::make('cpu')
|
||||||
|
->dehydratedWhenHidden()
|
||||||
|
->hidden(fn (Get $get) => $get('unlimited_cpu'))
|
||||||
|
->label('CPU Limit')->inlineLabel()
|
||||||
|
->suffix('%')
|
||||||
|
->required()
|
||||||
|
->columnSpan(2)
|
||||||
|
->numeric()
|
||||||
|
->minValue(0),
|
||||||
|
]),
|
||||||
Grid::make()
|
Grid::make()
|
||||||
->columns(4)
|
->columns(4)
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
@ -243,36 +272,6 @@ class EditServer extends EditRecord
|
|||||||
->numeric()
|
->numeric()
|
||||||
->minValue(0),
|
->minValue(0),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Grid::make()
|
|
||||||
->columns(4)
|
|
||||||
->columnSpanFull()
|
|
||||||
->schema([
|
|
||||||
ToggleButtons::make('unlimited_cpu')
|
|
||||||
->label('CPU')->inlineLabel()->inline()
|
|
||||||
->afterStateUpdated(fn (Set $set) => $set('cpu', 0))
|
|
||||||
->formatStateUsing(fn (Get $get) => $get('cpu') == 0)
|
|
||||||
->live()
|
|
||||||
->options([
|
|
||||||
true => 'Unlimited',
|
|
||||||
false => 'Limited',
|
|
||||||
])
|
|
||||||
->colors([
|
|
||||||
true => 'primary',
|
|
||||||
false => 'warning',
|
|
||||||
])
|
|
||||||
->columnSpan(2),
|
|
||||||
|
|
||||||
TextInput::make('cpu')
|
|
||||||
->dehydratedWhenHidden()
|
|
||||||
->hidden(fn (Get $get) => $get('unlimited_cpu'))
|
|
||||||
->label('CPU Limit')->inlineLabel()
|
|
||||||
->suffix('%')
|
|
||||||
->required()
|
|
||||||
->columnSpan(2)
|
|
||||||
->numeric()
|
|
||||||
->minValue(0),
|
|
||||||
]),
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Fieldset::make('Advanced Limits')
|
Fieldset::make('Advanced Limits')
|
||||||
@ -287,6 +286,36 @@ class EditServer extends EditRecord
|
|||||||
->columns(4)
|
->columns(4)
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->schema([
|
->schema([
|
||||||
|
Grid::make()
|
||||||
|
->columns(4)
|
||||||
|
->columnSpanFull()
|
||||||
|
->schema([
|
||||||
|
ToggleButtons::make('cpu_pinning')
|
||||||
|
->label('CPU Pinning')->inlineLabel()->inline()
|
||||||
|
->default(false)
|
||||||
|
->afterStateUpdated(fn (Set $set) => $set('threads', []))
|
||||||
|
->formatStateUsing(fn (Get $get) => !empty($get('threads')))
|
||||||
|
->live()
|
||||||
|
->options([
|
||||||
|
false => 'Disabled',
|
||||||
|
true => 'Enabled',
|
||||||
|
])
|
||||||
|
->colors([
|
||||||
|
false => 'success',
|
||||||
|
true => 'warning',
|
||||||
|
])
|
||||||
|
->columnSpan(2),
|
||||||
|
|
||||||
|
TagsInput::make('threads')
|
||||||
|
->dehydratedWhenHidden()
|
||||||
|
->hidden(fn (Get $get) => !$get('cpu_pinning'))
|
||||||
|
->label('Pinned Threads')->inlineLabel()
|
||||||
|
->required(fn (Get $get) => $get('cpu_pinning'))
|
||||||
|
->columnSpan(2)
|
||||||
|
->separator()
|
||||||
|
->splitKeys([','])
|
||||||
|
->placeholder('Add pinned thread, e.g. 0 or 2-4'),
|
||||||
|
]),
|
||||||
ToggleButtons::make('swap_support')
|
ToggleButtons::make('swap_support')
|
||||||
->live()
|
->live()
|
||||||
->label('Swap Memory')->inlineLabel()->inline()
|
->label('Swap Memory')->inlineLabel()->inline()
|
||||||
@ -338,37 +367,6 @@ class EditServer extends EditRecord
|
|||||||
->helperText('The IO performance relative to other running containers')
|
->helperText('The IO performance relative to other running containers')
|
||||||
->label('Block IO Proportion'),
|
->label('Block IO Proportion'),
|
||||||
|
|
||||||
Grid::make()
|
|
||||||
->columns(4)
|
|
||||||
->columnSpanFull()
|
|
||||||
->schema([
|
|
||||||
ToggleButtons::make('cpu_pinning')
|
|
||||||
->label('CPU Pinning')->inlineLabel()->inline()
|
|
||||||
->default(false)
|
|
||||||
->afterStateUpdated(fn (Set $set) => $set('threads', []))
|
|
||||||
->formatStateUsing(fn (Get $get) => !empty($get('threads')))
|
|
||||||
->live()
|
|
||||||
->options([
|
|
||||||
false => 'Disabled',
|
|
||||||
true => 'Enabled',
|
|
||||||
])
|
|
||||||
->colors([
|
|
||||||
false => 'success',
|
|
||||||
true => 'warning',
|
|
||||||
])
|
|
||||||
->columnSpan(2),
|
|
||||||
|
|
||||||
TagsInput::make('threads')
|
|
||||||
->dehydratedWhenHidden()
|
|
||||||
->hidden(fn (Get $get) => !$get('cpu_pinning'))
|
|
||||||
->label('Pinned Threads')->inlineLabel()
|
|
||||||
->required(fn (Get $get) => $get('cpu_pinning'))
|
|
||||||
->columnSpan(2)
|
|
||||||
->separator()
|
|
||||||
->splitKeys([','])
|
|
||||||
->placeholder('Add pinned thread, e.g. 0 or 2-4'),
|
|
||||||
]),
|
|
||||||
|
|
||||||
Grid::make()
|
Grid::make()
|
||||||
->columns(4)
|
->columns(4)
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
@ -400,16 +398,19 @@ class EditServer extends EditRecord
|
|||||||
])
|
])
|
||||||
->schema([
|
->schema([
|
||||||
TextInput::make('allocation_limit')
|
TextInput::make('allocation_limit')
|
||||||
|
->label('Allocations')
|
||||||
->suffixIcon('tabler-network')
|
->suffixIcon('tabler-network')
|
||||||
->required()
|
->required()
|
||||||
->minValue(0)
|
->minValue(0)
|
||||||
->numeric(),
|
->numeric(),
|
||||||
TextInput::make('database_limit')
|
TextInput::make('database_limit')
|
||||||
|
->label('Databases')
|
||||||
->suffixIcon('tabler-database')
|
->suffixIcon('tabler-database')
|
||||||
->required()
|
->required()
|
||||||
->minValue(0)
|
->minValue(0)
|
||||||
->numeric(),
|
->numeric(),
|
||||||
TextInput::make('backup_limit')
|
TextInput::make('backup_limit')
|
||||||
|
->label('Backups')
|
||||||
->suffixIcon('tabler-copy-check')
|
->suffixIcon('tabler-copy-check')
|
||||||
->required()
|
->required()
|
||||||
->minValue(0)
|
->minValue(0)
|
||||||
@ -420,7 +421,7 @@ class EditServer extends EditRecord
|
|||||||
'default' => 1,
|
'default' => 1,
|
||||||
'sm' => 2,
|
'sm' => 2,
|
||||||
'md' => 3,
|
'md' => 3,
|
||||||
'lg' => 3,
|
'lg' => 4,
|
||||||
])
|
])
|
||||||
->schema([
|
->schema([
|
||||||
Select::make('select_image')
|
Select::make('select_image')
|
||||||
@ -441,7 +442,12 @@ class EditServer extends EditRecord
|
|||||||
return array_flip($images) + ['ghcr.io/custom-image' => 'Custom Image'];
|
return array_flip($images) + ['ghcr.io/custom-image' => 'Custom Image'];
|
||||||
})
|
})
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->columnSpan(1),
|
->columnSpan([
|
||||||
|
'default' => 1,
|
||||||
|
'sm' => 2,
|
||||||
|
'md' => 3,
|
||||||
|
'lg' => 2,
|
||||||
|
]),
|
||||||
|
|
||||||
TextInput::make('image')
|
TextInput::make('image')
|
||||||
->label('Image')
|
->label('Image')
|
||||||
@ -457,7 +463,12 @@ class EditServer extends EditRecord
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
->placeholder('Enter a custom Image')
|
->placeholder('Enter a custom Image')
|
||||||
->columnSpan(2),
|
->columnSpan([
|
||||||
|
'default' => 1,
|
||||||
|
'sm' => 2,
|
||||||
|
'md' => 3,
|
||||||
|
'lg' => 2,
|
||||||
|
]),
|
||||||
|
|
||||||
KeyValue::make('docker_labels')
|
KeyValue::make('docker_labels')
|
||||||
->label('Container Labels')
|
->label('Container Labels')
|
||||||
|
@ -6,15 +6,12 @@ use App\Filament\App\Resources\ServerResource;
|
|||||||
use App\Filament\Components\Tables\Columns\ServerEntryColumn;
|
use App\Filament\Components\Tables\Columns\ServerEntryColumn;
|
||||||
use App\Filament\Server\Pages\Console;
|
use App\Filament\Server\Pages\Console;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Carbon\CarbonInterface;
|
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
use Filament\Tables\Columns\Layout\Stack;
|
use Filament\Tables\Columns\Layout\Stack;
|
||||||
use Filament\Tables\Filters\SelectFilter;
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
use Filament\Tables\Filters\TernaryFilter;
|
use Filament\Tables\Filters\TernaryFilter;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Illuminate\Support\Number;
|
|
||||||
|
|
||||||
class ListServers extends ListRecords
|
class ListServers extends ListRecords
|
||||||
{
|
{
|
||||||
@ -36,7 +33,7 @@ class ListServers extends ListRecords
|
|||||||
])
|
])
|
||||||
->contentGrid([
|
->contentGrid([
|
||||||
'default' => 1,
|
'default' => 1,
|
||||||
'xl' => 2,
|
'md' => 2,
|
||||||
])
|
])
|
||||||
->recordUrl(fn (Server $server) => Console::getUrl(panel: 'server', tenant: $server))
|
->recordUrl(fn (Server $server) => Console::getUrl(panel: 'server', tenant: $server))
|
||||||
->emptyStateIcon('tabler-brand-docker')
|
->emptyStateIcon('tabler-brand-docker')
|
||||||
@ -61,64 +58,4 @@ class ListServers extends ListRecords
|
|||||||
->preload(),
|
->preload(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @phpstan-ignore-next-line
|
|
||||||
private function uptime(Server $server): string
|
|
||||||
{
|
|
||||||
$uptime = Arr::get($server->resources(), 'uptime', 0);
|
|
||||||
|
|
||||||
if ($uptime === 0) {
|
|
||||||
return 'Offline';
|
|
||||||
}
|
|
||||||
|
|
||||||
return now()->subMillis($uptime)->diffForHumans(syntax: CarbonInterface::DIFF_ABSOLUTE, short: true, parts: 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @phpstan-ignore-next-line
|
|
||||||
private function cpu(Server $server): string
|
|
||||||
{
|
|
||||||
$cpu = Number::format(Arr::get($server->resources(), 'cpu_absolute', 0), maxPrecision: 2, locale: auth()->user()->language) . '%';
|
|
||||||
$max = Number::format($server->cpu, locale: auth()->user()->language) . '%';
|
|
||||||
|
|
||||||
return $cpu . ($server->cpu > 0 ? ' Of ' . $max : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
// @phpstan-ignore-next-line
|
|
||||||
private function memory(Server $server): string
|
|
||||||
{
|
|
||||||
$latestMemoryUsed = Arr::get($server->resources(), 'memory_bytes', 0);
|
|
||||||
$totalMemory = Arr::get($server->resources(), 'memory_limit_bytes', 0);
|
|
||||||
|
|
||||||
$used = config('panel.use_binary_prefix')
|
|
||||||
? Number::format($latestMemoryUsed / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB'
|
|
||||||
: Number::format($latestMemoryUsed / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB';
|
|
||||||
|
|
||||||
if ($totalMemory === 0) {
|
|
||||||
$total = config('panel.use_binary_prefix')
|
|
||||||
? Number::format($server->memory / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB'
|
|
||||||
: Number::format($server->memory / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB';
|
|
||||||
} else {
|
|
||||||
$total = config('panel.use_binary_prefix')
|
|
||||||
? Number::format($totalMemory / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB'
|
|
||||||
: Number::format($totalMemory / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $used . ($server->memory > 0 ? ' Of ' . $total : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
// @phpstan-ignore-next-line
|
|
||||||
private function disk(Server $server): string
|
|
||||||
{
|
|
||||||
$usedDisk = Arr::get($server->resources(), 'disk_bytes', 0);
|
|
||||||
|
|
||||||
$used = config('panel.use_binary_prefix')
|
|
||||||
? Number::format($usedDisk / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB'
|
|
||||||
: Number::format($usedDisk / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB';
|
|
||||||
|
|
||||||
$total = config('panel.use_binary_prefix')
|
|
||||||
? Number::format($server->disk / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB'
|
|
||||||
: Number::format($server->disk / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB';
|
|
||||||
|
|
||||||
return $used . ($server->disk > 0 ? ' Of ' . $total : '');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ class ListAllocations extends ListRecords
|
|||||||
->hidden(),
|
->hidden(),
|
||||||
TextColumn::make('port'),
|
TextColumn::make('port'),
|
||||||
TextInputColumn::make('notes')
|
TextInputColumn::make('notes')
|
||||||
|
->visibleFrom('sm')
|
||||||
->disabled(fn () => !auth()->user()->can(Permission::ACTION_ALLOCATION_UPDATE, $server))
|
->disabled(fn () => !auth()->user()->can(Permission::ACTION_ALLOCATION_UPDATE, $server))
|
||||||
->label('Notes')
|
->label('Notes')
|
||||||
->placeholder('No Notes'),
|
->placeholder('No Notes'),
|
||||||
|
@ -74,6 +74,7 @@ class ListBackups extends ListRecords
|
|||||||
->label('Successful')
|
->label('Successful')
|
||||||
->boolean(),
|
->boolean(),
|
||||||
IconColumn::make('is_locked')
|
IconColumn::make('is_locked')
|
||||||
|
->visibleFrom('md')
|
||||||
->label('Lock Status')
|
->label('Lock Status')
|
||||||
->icon(fn (Backup $backup) => !$backup->is_locked ? 'tabler-lock-open' : 'tabler-lock'),
|
->icon(fn (Backup $backup) => !$backup->is_locked ? 'tabler-lock-open' : 'tabler-lock'),
|
||||||
])
|
])
|
||||||
|
@ -42,6 +42,8 @@ class EditFiles extends Page
|
|||||||
|
|
||||||
protected static string $view = 'filament.server.pages.edit-file';
|
protected static string $view = 'filament.server.pages.edit-file';
|
||||||
|
|
||||||
|
protected static ?string $title = '';
|
||||||
|
|
||||||
#[Locked]
|
#[Locked]
|
||||||
public string $path;
|
public string $path;
|
||||||
|
|
||||||
@ -63,9 +65,13 @@ class EditFiles extends Page
|
|||||||
->options(EditorLanguages::class)
|
->options(EditorLanguages::class)
|
||||||
->hidden() //TODO Fix Dis
|
->hidden() //TODO Fix Dis
|
||||||
->default(function () {
|
->default(function () {
|
||||||
$split = explode('.', $this->path);
|
$ext = pathinfo($this->path, PATHINFO_EXTENSION);
|
||||||
|
|
||||||
return end($split);
|
if ($ext === 'yml') {
|
||||||
|
return 'yaml';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ext;
|
||||||
}),
|
}),
|
||||||
Section::make('Editing: ' . $this->path)
|
Section::make('Editing: ' . $this->path)
|
||||||
->footerActions([
|
->footerActions([
|
||||||
|
@ -88,8 +88,10 @@ class ListFiles extends ListRecords
|
|||||||
->sortable()
|
->sortable()
|
||||||
->icon(fn (File $file) => $file->getIcon()),
|
->icon(fn (File $file) => $file->getIcon()),
|
||||||
BytesColumn::make('size')
|
BytesColumn::make('size')
|
||||||
|
->visibleFrom('md')
|
||||||
->sortable(),
|
->sortable(),
|
||||||
DateTimeColumn::make('modified_at')
|
DateTimeColumn::make('modified_at')
|
||||||
|
->visibleFrom('md')
|
||||||
->since()
|
->since()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
])
|
])
|
||||||
|
@ -64,10 +64,17 @@ class ScheduleResource extends Resource
|
|||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
->columns(10)
|
->columns([
|
||||||
|
'default' => 4,
|
||||||
|
'lg' => 5,
|
||||||
|
])
|
||||||
->schema([
|
->schema([
|
||||||
TextInput::make('name')
|
TextInput::make('name')
|
||||||
->columnSpan(fn ($operation) => $operation !== 'view' ? 10 : 5)
|
->columnSpan([
|
||||||
|
'default' => 4,
|
||||||
|
'md' => 3,
|
||||||
|
'lg' => 4,
|
||||||
|
])
|
||||||
->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)
|
||||||
@ -81,13 +88,20 @@ class ScheduleResource extends Resource
|
|||||||
'active' => 'success',
|
'active' => 'success',
|
||||||
])
|
])
|
||||||
->visibleOn('view')
|
->visibleOn('view')
|
||||||
->columnSpan(5),
|
->columnSpan([
|
||||||
|
'default' => 4,
|
||||||
|
'md' => 1,
|
||||||
|
'lg' => 1,
|
||||||
|
]),
|
||||||
Toggle::make('only_when_online')
|
Toggle::make('only_when_online')
|
||||||
->label('Only when Server is Online?')
|
->label('Only when Server is Online?')
|
||||||
->hintIconTooltip('Only execute this schedule when the server is in a running state.')
|
->hintIconTooltip('Only execute this schedule when the server is in a running state.')
|
||||||
->hintIcon('tabler-question-mark')
|
->hintIcon('tabler-question-mark')
|
||||||
->inline(false)
|
->inline(false)
|
||||||
->columnSpan(5)
|
->columnSpan([
|
||||||
|
'default' => 2,
|
||||||
|
'lg' => 3,
|
||||||
|
])
|
||||||
->required()
|
->required()
|
||||||
->default(1),
|
->default(1),
|
||||||
Toggle::make('is_active')
|
Toggle::make('is_active')
|
||||||
@ -95,36 +109,55 @@ class ScheduleResource extends Resource
|
|||||||
->hintIconTooltip('This schedule will be executed automatically if enabled.')
|
->hintIconTooltip('This schedule will be executed automatically if enabled.')
|
||||||
->hintIcon('tabler-question-mark')
|
->hintIcon('tabler-question-mark')
|
||||||
->inline(false)
|
->inline(false)
|
||||||
->columnSpan(5)
|
->columnSpan([
|
||||||
|
'default' => 2,
|
||||||
|
'lg' => 2,
|
||||||
|
])
|
||||||
->required()
|
->required()
|
||||||
->default(1),
|
->default(1),
|
||||||
TextInput::make('cron_minute')
|
TextInput::make('cron_minute')
|
||||||
->columnSpan(2)
|
->columnSpan([
|
||||||
|
'default' => 2,
|
||||||
|
'lg' => 1,
|
||||||
|
])
|
||||||
->label('Minute')
|
->label('Minute')
|
||||||
->default('*/5')
|
->default('*/5')
|
||||||
->required(),
|
->required(),
|
||||||
TextInput::make('cron_hour')
|
TextInput::make('cron_hour')
|
||||||
->columnSpan(2)
|
->columnSpan([
|
||||||
|
'default' => 2,
|
||||||
|
'lg' => 1,
|
||||||
|
])
|
||||||
->label('Hour')
|
->label('Hour')
|
||||||
->default('*')
|
->default('*')
|
||||||
->required(),
|
->required(),
|
||||||
TextInput::make('cron_day_of_month')
|
TextInput::make('cron_day_of_month')
|
||||||
->columnSpan(2)
|
->columnSpan([
|
||||||
|
'default' => 2,
|
||||||
|
'lg' => 1,
|
||||||
|
])
|
||||||
->label('Day of Month')
|
->label('Day of Month')
|
||||||
->default('*')
|
->default('*')
|
||||||
->required(),
|
->required(),
|
||||||
TextInput::make('cron_month')
|
TextInput::make('cron_month')
|
||||||
->columnSpan(2)
|
->columnSpan([
|
||||||
|
'default' => 2,
|
||||||
|
'lg' => 1,
|
||||||
|
])
|
||||||
->label('Month')
|
->label('Month')
|
||||||
->default('*')
|
->default('*')
|
||||||
->required(),
|
->required(),
|
||||||
TextInput::make('cron_day_of_week')
|
TextInput::make('cron_day_of_week')
|
||||||
->columnSpan(2)
|
->columnSpan([
|
||||||
|
'default' => 2,
|
||||||
|
'lg' => 1,
|
||||||
|
])
|
||||||
->label('Day of Week')
|
->label('Day of Week')
|
||||||
->default('*')
|
->default('*')
|
||||||
->required(),
|
->required(),
|
||||||
Section::make('Presets')
|
Section::make('Presets')
|
||||||
->hiddenOn('view')
|
->hiddenOn('view')
|
||||||
|
->columns(1)
|
||||||
->schema([
|
->schema([
|
||||||
Actions::make([
|
Actions::make([
|
||||||
Action::make('hourly')
|
Action::make('hourly')
|
||||||
|
@ -3,9 +3,11 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Enums\ContainerStatus;
|
use App\Enums\ContainerStatus;
|
||||||
|
use App\Enums\ServerResourceType;
|
||||||
use App\Enums\ServerState;
|
use App\Enums\ServerState;
|
||||||
use App\Exceptions\Http\Connection\DaemonConnectionException;
|
use App\Exceptions\Http\Connection\DaemonConnectionException;
|
||||||
use App\Repositories\Daemon\DaemonServerRepository;
|
use App\Repositories\Daemon\DaemonServerRepository;
|
||||||
|
use Carbon\CarbonInterface;
|
||||||
use GuzzleHttp\Exception\GuzzleException;
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
@ -13,6 +15,7 @@ use Illuminate\Notifications\Notifiable;
|
|||||||
use Illuminate\Database\Query\JoinClause;
|
use Illuminate\Database\Query\JoinClause;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Number;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
@ -453,6 +456,32 @@ class Server extends Model
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function formatResource(string $resourceKey, bool $limit = false, ServerResourceType $type = ServerResourceType::Unit, int $precision = 2): string
|
||||||
|
{
|
||||||
|
$resourceAmount = $this->{$resourceKey} ?? 0;
|
||||||
|
if (!$limit) {
|
||||||
|
$resourceAmount = $this->resources()[$resourceKey] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === ServerResourceType::Time) {
|
||||||
|
if ($resourceAmount === 0) {
|
||||||
|
return 'Offline';
|
||||||
|
}
|
||||||
|
|
||||||
|
return now()->subMillis($resourceAmount)->diffForHumans(syntax: CarbonInterface::DIFF_ABSOLUTE, short: true, parts: 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($resourceAmount === 0 & $limit) {
|
||||||
|
return 'Unlimited';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === ServerResourceType::Percentage) {
|
||||||
|
return Number::format($resourceAmount, precision: $precision, locale: auth()->user()->language ?? 'en') . '%';
|
||||||
|
}
|
||||||
|
|
||||||
|
return convert_bytes_to_readable($resourceAmount, decimals: $precision, base: 3);
|
||||||
|
}
|
||||||
|
|
||||||
public function condition(): Attribute
|
public function condition(): Attribute
|
||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
@ -481,4 +510,9 @@ class Server extends Model
|
|||||||
|
|
||||||
return $this->status->color();
|
return $this->status->color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function conditionColorHex(): string
|
||||||
|
{
|
||||||
|
return ContainerStatus::from($this->retrieveStatus())->colorHex();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ if (!function_exists('is_ip')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('convert_bytes_to_readable')) {
|
if (!function_exists('convert_bytes_to_readable')) {
|
||||||
function convert_bytes_to_readable(int $bytes, int $decimals = 2): string
|
function convert_bytes_to_readable(int $bytes, int $decimals = 2, ?int $base = null): string
|
||||||
{
|
{
|
||||||
$conversionUnit = config('panel.use_binary_prefix') ? 1024 : 1000;
|
$conversionUnit = config('panel.use_binary_prefix') ? 1024 : 1000;
|
||||||
$suffix = config('panel.use_binary_prefix') ? ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB'] : ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
$suffix = config('panel.use_binary_prefix') ? ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB'] : ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||||
@ -28,10 +28,10 @@ if (!function_exists('convert_bytes_to_readable')) {
|
|||||||
return '0 ' . $suffix[0];
|
return '0 ' . $suffix[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$base = log($bytes) / log($conversionUnit);
|
$fromBase = log($bytes) / log($conversionUnit);
|
||||||
$f_base = floor($base);
|
$base ??= floor($fromBase);
|
||||||
|
|
||||||
return round(pow($conversionUnit, $base - $f_base), $decimals) . ' ' . $suffix[$f_base];
|
return round(pow($conversionUnit, $fromBase - $base), $decimals) . ' ' . $suffix[$base];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
"phpseclib/phpseclib": "~3.0.18",
|
"phpseclib/phpseclib": "~3.0.18",
|
||||||
"pragmarx/google2fa": "~8.0.0",
|
"pragmarx/google2fa": "~8.0.0",
|
||||||
"predis/predis": "~2.1.1",
|
"predis/predis": "~2.1.1",
|
||||||
"ryangjchandler/blade-tabler-icons": "^2.3",
|
|
||||||
"s1lentium/iptools": "~1.2.0",
|
"s1lentium/iptools": "~1.2.0",
|
||||||
|
"secondnetwork/blade-tabler-icons": "^3.26",
|
||||||
"socialiteproviders/authentik": "^5.2",
|
"socialiteproviders/authentik": "^5.2",
|
||||||
"socialiteproviders/discord": "^4.2",
|
"socialiteproviders/discord": "^4.2",
|
||||||
"socialiteproviders/steam": "^4.2",
|
"socialiteproviders/steam": "^4.2",
|
||||||
@ -93,4 +93,4 @@
|
|||||||
},
|
},
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"prefer-stable": true
|
"prefer-stable": true
|
||||||
}
|
}
|
||||||
|
122
composer.lock
generated
122
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "2fddfe7f5db269cdf9e906b83c815756",
|
"content-hash": "4c83ce23eb3e0fab5738cdd7212e4fe3",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "abdelhamiderrahmouni/filament-monaco-editor",
|
"name": "abdelhamiderrahmouni/filament-monaco-editor",
|
||||||
@ -6762,68 +6762,6 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-02-26T18:08:49+00:00"
|
"time": "2024-02-26T18:08:49+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "ryangjchandler/blade-tabler-icons",
|
|
||||||
"version": "v2.3.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/ryangjchandler/blade-tabler-icons.git",
|
|
||||||
"reference": "cd359f5d3b406a982dae1aaaf121d84067576a2e"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/ryangjchandler/blade-tabler-icons/zipball/cd359f5d3b406a982dae1aaaf121d84067576a2e",
|
|
||||||
"reference": "cd359f5d3b406a982dae1aaaf121d84067576a2e",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"blade-ui-kit/blade-icons": "^1.5",
|
|
||||||
"illuminate/support": "^10.0 || ^11.0",
|
|
||||||
"php": "^8.1"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"friendsofphp/php-cs-fixer": "^3.14",
|
|
||||||
"orchestra/testbench": "^8.0 || ^9.0",
|
|
||||||
"phpunit/phpunit": "^9.5.10 || ^10.5"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"laravel": {
|
|
||||||
"providers": [
|
|
||||||
"RyanChandler\\TablerIcons\\BladeTablerIconsServiceProvider"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"RyanChandler\\TablerIcons\\": "src"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Ryan Chandler",
|
|
||||||
"email": "support@ryangjchandler.co.uk",
|
|
||||||
"homepage": "https://ryangjchandler.co.uk",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "A package to easily make use of Tabler icons in your Laravel Blade views.",
|
|
||||||
"homepage": "https://github.com/ryangjchandler/blade-tabler-icons",
|
|
||||||
"keywords": [
|
|
||||||
"blade",
|
|
||||||
"laravel",
|
|
||||||
"tabler"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/ryangjchandler/blade-tabler-icons/issues",
|
|
||||||
"source": "https://github.com/ryangjchandler/blade-tabler-icons/tree/v2.3.0"
|
|
||||||
},
|
|
||||||
"time": "2024-03-12T23:54:24+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "s1lentium/iptools",
|
"name": "s1lentium/iptools",
|
||||||
"version": "v1.2.0",
|
"version": "v1.2.0",
|
||||||
@ -6879,6 +6817,64 @@
|
|||||||
},
|
},
|
||||||
"time": "2022-08-17T14:28:59+00:00"
|
"time": "2022-08-17T14:28:59+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "secondnetwork/blade-tabler-icons",
|
||||||
|
"version": "v3.26.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/secondnetwork/blade-tabler-icons.git",
|
||||||
|
"reference": "d25677773f7b3a534faedcbba089bff7a25568e8"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/secondnetwork/blade-tabler-icons/zipball/d25677773f7b3a534faedcbba089bff7a25568e8",
|
||||||
|
"reference": "d25677773f7b3a534faedcbba089bff7a25568e8",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"blade-ui-kit/blade-icons": "^1.1|^1.5|^1.6",
|
||||||
|
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
|
||||||
|
"php": "^7.4|^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"orchestra/testbench": "^6.0|^7.0|^9.0",
|
||||||
|
"phpunit/phpunit": "^9.0|^10.0|^11.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"secondnetwork\\TablerIcons\\BladeTablerIconsServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"secondnetwork\\TablerIcons\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Andreas Farah"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A package to easily make use of tabler-icons in your Laravel Blade views.",
|
||||||
|
"homepage": "https://github.com/secondnetwork/blade-tabler-icons",
|
||||||
|
"keywords": [
|
||||||
|
"blade",
|
||||||
|
"laravel",
|
||||||
|
"tabler-icons"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/secondnetwork/blade-tabler-icons/issues",
|
||||||
|
"source": "https://github.com/secondnetwork/blade-tabler-icons/tree/v3.26.0"
|
||||||
|
},
|
||||||
|
"time": "2024-12-21T15:50:20+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "socialiteproviders/authentik",
|
"name": "socialiteproviders/authentik",
|
||||||
"version": "5.2.0",
|
"version": "5.2.0",
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
class="w-full focus:outline-none focus:ring-0 border-none"
|
class="w-full focus:outline-none focus:ring-0 border-none"
|
||||||
style="background-color: #202A32;"
|
style="background-color: #202A32;"
|
||||||
type="text"
|
type="text"
|
||||||
autofocus
|
|
||||||
:readonly="{{ $this->canSendCommand() ? 'false' : 'true' }}"
|
:readonly="{{ $this->canSendCommand() ? 'false' : 'true' }}"
|
||||||
title="{{ $this->canSendCommand() ? '' : 'Can\'t send command when the server is Offline' }}"
|
title="{{ $this->canSendCommand() ? '' : 'Can\'t send command when the server is Offline' }}"
|
||||||
placeholder="{{ $this->canSendCommand() ? 'Type a command...' : 'Server Offline...' }}"
|
placeholder="{{ $this->canSendCommand() ? 'Type a command...' : 'Server Offline...' }}"
|
||||||
@ -126,7 +125,7 @@
|
|||||||
case 'status':
|
case 'status':
|
||||||
handlePowerChangeEvent(args[0]);
|
handlePowerChangeEvent(args[0]);
|
||||||
|
|
||||||
$wire.dispatch('console-status', {state: args[0]})
|
$wire.dispatch('console-status', { state: args[0] });
|
||||||
break;
|
break;
|
||||||
case 'transfer status':
|
case 'transfer status':
|
||||||
handleTransferStatus(args[0]);
|
handleTransferStatus(args[0]);
|
||||||
|
@ -1,65 +1,67 @@
|
|||||||
|
@php
|
||||||
|
use App\Enums\ServerResourceType;
|
||||||
|
|
||||||
|
/** @var \App\Models\Server $server */
|
||||||
|
$server = $getRecord();
|
||||||
|
@endphp
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
.inline-flex {
|
hr {
|
||||||
display: inline-flex;
|
border-color: #9ca3af;
|
||||||
align-items: center;
|
|
||||||
gap: 0.75rem;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<div class="w-full grid gap-y-2 overflow-x-auto">
|
<div class="w-full">
|
||||||
<div class="flex items-center gap-x-1">
|
<!-- Wrapper for Positioning -->
|
||||||
<x-filament::icon-button
|
<div class="relative flex">
|
||||||
:icon="$getRecord()->conditionIcon()"
|
<!-- Status Strip Outside the Box -->
|
||||||
:color="$getRecord()->conditionColor()"
|
<div
|
||||||
:tooltip="\Illuminate\Support\Str::title($getRecord()->condition)" size="xl"
|
class="absolute left-0 top-1 bottom-0 w-1 rounded-lg"
|
||||||
/>
|
style="background-color: {{ $server->conditionColorHex() }};">
|
||||||
|
</div>
|
||||||
|
|
||||||
<span class="text-2xl font-semibold text-gray-500 dark:text-gray-400">
|
<!-- Card Component -->
|
||||||
{{ $getRecord()->name }} ({{ $this->uptime($getRecord()) }})
|
<div class="flex-1 bg-gray-800 text-white rounded-lg overflow-hidden p-3">
|
||||||
</span>
|
<!-- Header -->
|
||||||
</div>
|
<div class="flex items-center mb-5 gap-2">
|
||||||
|
<x-filament::icon-button
|
||||||
|
:icon="$server->conditionIcon()"
|
||||||
|
:color="$server->conditionColor()"
|
||||||
|
:tooltip="\Illuminate\Support\Str::title($server->condition)"
|
||||||
|
size="xl"
|
||||||
|
/>
|
||||||
|
<h2 class="text-xl font-bold">
|
||||||
|
{{ $server->name }}
|
||||||
|
<span class="text-gray-400">({{ $server->formatResource('uptime', type: ServerResourceType::Time) }})</span>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex">
|
<!-- Resource Usage -->
|
||||||
<div class="flex-1 text-md font-medium text-gray-850 dark:text-white inline-flex" title="Egg Name">
|
<div class="flex justify-between text-center">
|
||||||
<x-filament::icon
|
<div>
|
||||||
icon="tabler-egg"
|
<p class="text-sm text-gray-400">CPU</p>
|
||||||
/>
|
<p class="text-md font-semibold">{{ $server->formatResource('cpu_absolute', type: ServerResourceType::Percentage) }}</p>
|
||||||
{{ $getRecord()->egg->name }}
|
<hr class="p-0.5">
|
||||||
</div>
|
<p class="text-xs text-gray-400">{{ $server->formatResource('cpu', type: ServerResourceType::Percentage, limit: true) }}</p>
|
||||||
<div class="flex-1 text-md font-medium text-gray-850 dark:text-white inline-flex" title="Owner">
|
</div>
|
||||||
<x-filament::icon
|
<div>
|
||||||
icon="tabler-user"
|
<p class="text-sm text-gray-400">Memory</p>
|
||||||
/>
|
<p class="text-md font-semibold">{{ $server->formatResource('memory_bytes') }}</p>
|
||||||
{{ $getRecord()->user->username }}
|
<hr class="p-0.5">
|
||||||
</div>
|
<p class="text-xs text-gray-400">{{ $server->formatResource('memory', limit: true) }}</p>
|
||||||
<div class="flex-1 text-md font-medium text-gray-850 dark:text-white inline-flex" title="Primary Allocation">
|
</div>
|
||||||
<x-filament::icon
|
<div>
|
||||||
icon="tabler-network"
|
<p class="text-sm text-gray-400">Disk</p>
|
||||||
/>
|
<p class="text-md font-semibold">{{ $server->formatResource('disk_bytes') }}</p>
|
||||||
{{ $getRecord()->allocation->address }}
|
<hr class="p-0.5">
|
||||||
</div>
|
<p class="text-xs text-gray-400">{{ $server->formatResource('disk', limit: true) }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="hidden sm:block">
|
||||||
|
<p class="text-sm text-gray-400">Network</p>
|
||||||
<div class="flex">
|
<p class="text-md font-semibold">{{ $server->allocation->address }} </p>
|
||||||
<div class="flex-1 text-md font-medium text-gray-850 dark:text-white inline-flex" title="CPU Usage">
|
</div>
|
||||||
<x-filament::icon
|
</div>
|
||||||
icon="tabler-cpu"
|
|
||||||
/>
|
|
||||||
{{ $this->cpu($getRecord()) }}
|
|
||||||
</div>
|
|
||||||
<div class="flex-1 text-md font-medium text-gray-850 dark:text-white inline-flex" title="Memory Usage">
|
|
||||||
<x-filament::icon
|
|
||||||
icon="tabler-device-desktop-analytics"
|
|
||||||
/>
|
|
||||||
{{ $this->memory($getRecord()) }}
|
|
||||||
</div>
|
|
||||||
<div class="flex-1 text-md font-medium text-gray-850 dark:text-white inline-flex" title="Disk Usage">
|
|
||||||
<x-filament::icon
|
|
||||||
icon="tabler-packages"
|
|
||||||
/>
|
|
||||||
{{ $this->disk($getRecord()) }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user