mirror of
https://github.com/pelican-dev/panel.git
synced 2026-05-04 18:00:48 +03:00
Compare commits
8 Commits
release/v1
...
release/v1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
386b8aea0e | ||
|
|
2bfc788e13 | ||
|
|
839ff96271 | ||
|
|
5d2b892eab | ||
|
|
c953b97009 | ||
|
|
9716b1e64d | ||
|
|
8358e410dc | ||
|
|
f6c586bf5b |
@@ -5,6 +5,7 @@ namespace App\Filament\Admin\Resources\NodeResource\RelationManagers;
|
||||
use App\Models\Allocation;
|
||||
use App\Models\Node;
|
||||
use App\Services\Allocations\AssignmentService;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TagsInput;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
@@ -73,8 +74,8 @@ class AllocationsRelationManager extends RelationManager
|
||||
->headerActions([
|
||||
Tables\Actions\Action::make('create new allocation')->label('Create Allocations')
|
||||
->form(fn () => [
|
||||
TextInput::make('allocation_ip')
|
||||
->datalist($this->getOwnerRecord()->ipAddresses())
|
||||
Select::make('allocation_ip')
|
||||
->options(collect($this->getOwnerRecord()->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
|
||||
->label('IP Address')
|
||||
->inlineLabel()
|
||||
->ipv4()
|
||||
|
||||
@@ -192,13 +192,12 @@ class CreateServer extends CreateRecord
|
||||
->whereNull('server_id'),
|
||||
)
|
||||
->createOptionForm(fn (Get $get) => [
|
||||
TextInput::make('allocation_ip')
|
||||
->datalist(Node::find($get('node_id'))?->ipAddresses() ?? [])
|
||||
Select::make('allocation_ip')
|
||||
->options(collect(Node::find($get('node_id'))?->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
|
||||
->label('IP Address')
|
||||
->inlineLabel()
|
||||
->ipv4()
|
||||
->helperText("Usually your machine's public IP unless you are port forwarding.")
|
||||
// ->selectablePlaceholder(false)
|
||||
->required(),
|
||||
TextInput::make('allocation_alias')
|
||||
->label('Alias')
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Filament\Admin\Resources\ServerResource\RelationManagers;
|
||||
use App\Models\Allocation;
|
||||
use App\Models\Server;
|
||||
use App\Services\Allocations\AssignmentService;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TagsInput;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
@@ -71,8 +72,8 @@ class AllocationsRelationManager extends RelationManager
|
||||
CreateAction::make()->label('Create Allocation')
|
||||
->createAnother(false)
|
||||
->form(fn () => [
|
||||
TextInput::make('allocation_ip')
|
||||
->datalist($this->getOwnerRecord()->node->ipAddresses())
|
||||
Select::make('allocation_ip')
|
||||
->options(collect($this->getOwnerRecord()->node->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
|
||||
->label('IP Address')
|
||||
->inlineLabel()
|
||||
->ipv4()
|
||||
@@ -151,6 +152,7 @@ class AllocationsRelationManager extends RelationManager
|
||||
->associateAnother(false)
|
||||
->preloadRecordSelect()
|
||||
->recordSelectOptionsQuery(fn ($query) => $query->whereBelongsTo($this->getOwnerRecord()->node)->whereNull('server_id'))
|
||||
->recordSelectSearchColumns(['ip', 'port'])
|
||||
->label('Add Allocation'),
|
||||
])
|
||||
->bulkActions([
|
||||
|
||||
@@ -42,6 +42,7 @@ class ListServers extends ListRecords
|
||||
->emptyStateIcon('tabler-brand-docker')
|
||||
->emptyStateDescription('')
|
||||
->emptyStateHeading('You don\'t have access to any servers!')
|
||||
->persistFiltersInSession()
|
||||
->filters([
|
||||
TernaryFilter::make('only_my_servers')
|
||||
->label('Owned by')
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Server\Pages;
|
||||
|
||||
use App\Enums\ContainerStatus;
|
||||
use App\Filament\Server\Widgets\ServerConsole;
|
||||
use App\Filament\Server\Widgets\ServerCpuChart;
|
||||
use App\Filament\Server\Widgets\ServerMemoryChart;
|
||||
@@ -12,6 +13,7 @@ use Filament\Actions\Action;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Support\Enums\ActionSize;
|
||||
use Livewire\Attributes\On;
|
||||
|
||||
class Console extends Page
|
||||
{
|
||||
@@ -21,6 +23,8 @@ class Console extends Page
|
||||
|
||||
protected static string $view = 'filament.server.pages.console';
|
||||
|
||||
public ContainerStatus $status = ContainerStatus::Missing;
|
||||
|
||||
public function getWidgetData(): array
|
||||
{
|
||||
return [
|
||||
@@ -50,6 +54,16 @@ class Console extends Page
|
||||
return 3;
|
||||
}
|
||||
|
||||
#[On('powerChanged')]
|
||||
public function powerChanged(string $state): void
|
||||
{
|
||||
$this->status = ContainerStatus::from($state);
|
||||
|
||||
$this->cachedHeaderActions = [];
|
||||
|
||||
$this->cacheHeaderActions();
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
/** @var Server $server */
|
||||
@@ -60,17 +74,18 @@ class Console extends Page
|
||||
->color('primary')
|
||||
->size(ActionSize::ExtraLarge)
|
||||
->action(fn () => $this->dispatch('setServerState', state: 'start'))
|
||||
->disabled(fn () => $server->isInConflictState()),
|
||||
->disabled(fn () => $server->isInConflictState() || in_array($this->status, [ContainerStatus::Running, ContainerStatus::Starting, ContainerStatus::Stopping, ContainerStatus::Restarting])),
|
||||
Action::make('restart')
|
||||
->color('gray')
|
||||
->size(ActionSize::ExtraLarge)
|
||||
->action(fn () => $this->dispatch('setServerState', state: 'restart'))
|
||||
->disabled(fn () => $server->isInConflictState() || $server->retrieveStatus() == 'offline'),
|
||||
->disabled(fn () => $server->isInConflictState() || $this->status !== ContainerStatus::Running),
|
||||
Action::make('stop')
|
||||
->color('danger')
|
||||
->size(ActionSize::ExtraLarge)
|
||||
->action(fn () => $this->dispatch('setServerState', state: 'stop'))
|
||||
->disabled(fn () => $server->isInConflictState() || $server->retrieveStatus() == 'offline'),
|
||||
->hidden(fn () => in_array($this->status, [ContainerStatus::Stopping, ContainerStatus::Restarting, ContainerStatus::Starting]))
|
||||
->disabled(fn () => $server->isInConflictState() || in_array($this->status, [ContainerStatus::Starting, ContainerStatus::Stopping, ContainerStatus::Restarting, ContainerStatus::Exited, ContainerStatus::Offline])),
|
||||
Action::make('kill')
|
||||
->color('danger')
|
||||
->requiresConfirmation()
|
||||
@@ -79,7 +94,8 @@ class Console extends Page
|
||||
->modalSubmitActionLabel('Kill Server')
|
||||
->size(ActionSize::ExtraLarge)
|
||||
->action(fn () => $this->dispatch('setServerState', state: 'kill'))
|
||||
->disabled(fn () => $server->isInConflictState() || $server->retrieveStatus() == 'offline'),
|
||||
->hidden(fn () => $server->isInConflictState() || in_array($this->status, [ContainerStatus::Running, ContainerStatus::Restarting, ContainerStatus::Offline, ContainerStatus::Removing, ContainerStatus::Dead, ContainerStatus::Exited, ContainerStatus::Created]))
|
||||
->disabled(fn () => $server->isInConflictState() || $this->status === ContainerStatus::Offline),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,6 +545,7 @@ class ListFiles extends ListRecords
|
||||
->form([
|
||||
TextInput::make('searchTerm')
|
||||
->placeholder('Enter a search term, e.g. *.txt')
|
||||
->regex('/^[^*]*\*?[^*]*$/')
|
||||
->minLength(3),
|
||||
])
|
||||
->action(fn ($data) => redirect(SearchFiles::getUrl([
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Filament\Pages\Installer\PanelInstaller;
|
||||
use App\Livewire\Installer\PanelInstaller;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Installer;
|
||||
namespace App\Livewire\Installer;
|
||||
|
||||
use App\Filament\Admin\Pages\Dashboard;
|
||||
use App\Filament\Pages\Installer\Steps\CacheStep;
|
||||
use App\Filament\Pages\Installer\Steps\DatabaseStep;
|
||||
use App\Filament\Pages\Installer\Steps\EnvironmentStep;
|
||||
use App\Filament\Pages\Installer\Steps\QueueStep;
|
||||
use App\Filament\Pages\Installer\Steps\RequirementsStep;
|
||||
use App\Filament\Pages\Installer\Steps\SessionStep;
|
||||
use App\Livewire\Installer\Steps\CacheStep;
|
||||
use App\Livewire\Installer\Steps\DatabaseStep;
|
||||
use App\Livewire\Installer\Steps\EnvironmentStep;
|
||||
use App\Livewire\Installer\Steps\QueueStep;
|
||||
use App\Livewire\Installer\Steps\RequirementsStep;
|
||||
use App\Livewire\Installer\Steps\SessionStep;
|
||||
use App\Models\User;
|
||||
use App\Services\Users\UserCreationService;
|
||||
use App\Traits\CheckMigrationsTrait;
|
||||
@@ -42,7 +42,7 @@ class PanelInstaller extends SimplePage implements HasForms
|
||||
|
||||
public function getMaxWidth(): MaxWidth|string
|
||||
{
|
||||
return config('panel.filament.display-width', 'screen-2xl');
|
||||
return MaxWidth::SevenExtraLarge;
|
||||
}
|
||||
|
||||
public static function isInstalled(): bool
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Installer\Steps;
|
||||
namespace App\Livewire\Installer\Steps;
|
||||
|
||||
use App\Filament\Pages\Installer\PanelInstaller;
|
||||
use App\Livewire\Installer\PanelInstaller;
|
||||
use Exception;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\ToggleButtons;
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Installer\Steps;
|
||||
namespace App\Livewire\Installer\Steps;
|
||||
|
||||
use App\Filament\Pages\Installer\PanelInstaller;
|
||||
use App\Livewire\Installer\PanelInstaller;
|
||||
use Exception;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\ToggleButtons;
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Installer\Steps;
|
||||
namespace App\Livewire\Installer\Steps;
|
||||
|
||||
use App\Filament\Pages\Installer\PanelInstaller;
|
||||
use App\Livewire\Installer\PanelInstaller;
|
||||
use Filament\Forms\Components\Fieldset;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Wizard\Step;
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Installer\Steps;
|
||||
namespace App\Livewire\Installer\Steps;
|
||||
|
||||
use App\Filament\Pages\Installer\PanelInstaller;
|
||||
use App\Livewire\Installer\PanelInstaller;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Components\ToggleButtons;
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Installer\Steps;
|
||||
namespace App\Livewire\Installer\Steps;
|
||||
|
||||
use Filament\Forms\Components\Placeholder;
|
||||
use Filament\Forms\Components\Section;
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Installer\Steps;
|
||||
namespace App\Livewire\Installer\Steps;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\ToggleButtons;
|
||||
@@ -384,7 +384,10 @@ class Node extends Model
|
||||
// pass
|
||||
}
|
||||
|
||||
return $ips->all();
|
||||
// Only IPV4
|
||||
$ips = $ips->filter(fn (string $ip) => filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false);
|
||||
|
||||
return $ips->unique()->all();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ return [
|
||||
'name' => env('APP_NAME', 'Pelican'),
|
||||
'favicon' => env('APP_FAVICON', '/pelican.ico'),
|
||||
|
||||
'version' => '1.0.0-beta15',
|
||||
'version' => '1.0.0-beta16',
|
||||
|
||||
'timezone' => 'UTC',
|
||||
|
||||
|
||||
@@ -125,6 +125,8 @@
|
||||
break;
|
||||
case 'status':
|
||||
handlePowerChangeEvent(args[0]);
|
||||
|
||||
$wire.dispatch('powerChanged', {state: args[0]})
|
||||
break;
|
||||
case 'transfer status':
|
||||
handleTransferStatus(args[0]);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Filament\Pages\Installer\PanelInstaller;
|
||||
use App\Livewire\Installer\PanelInstaller;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\Base;
|
||||
use App\Http\Middleware\RequireTwoFactorAuthentication;
|
||||
|
||||
Reference in New Issue
Block a user