Fix updates list and align admin navigation
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
A modern web hosting control panel for WordPress and general PHP hosting. Built with Laravel 12, Filament v5, Livewire 4, and Tailwind CSS v4.
|
||||
|
||||
Version: 0.9-rc31 (release candidate)
|
||||
Version: 0.9-rc32 (release candidate)
|
||||
|
||||
This is a release candidate. Expect rapid iteration and breaking changes until 1.0.
|
||||
|
||||
@@ -156,6 +156,7 @@ php artisan test --compact
|
||||
|
||||
## Initial Release
|
||||
|
||||
- 0.9-rc32: Server Updates list loads reliably; admin sidebar order aligned; apt update parsing expanded.
|
||||
- 0.9-rc31: File manager navigation uses Livewire actions; parent row excluded from bulk select.
|
||||
- 0.9-rc30: Avoid IncludeOptional in ModSecurity CRS includes.
|
||||
- 0.9-rc29: Ensure ModSecurity unicode mapping is installed automatically.
|
||||
|
||||
@@ -27,7 +27,7 @@ class AutomationApi extends Page implements HasActions, HasTable
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedKey;
|
||||
|
||||
protected static ?int $navigationSort = 17;
|
||||
protected static ?int $navigationSort = 16;
|
||||
|
||||
protected static ?string $slug = 'automation-api';
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class DatabaseTuning extends Page implements HasActions, HasTable
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCircleStack;
|
||||
|
||||
protected static ?int $navigationSort = 19;
|
||||
protected static ?int $navigationSort = 18;
|
||||
|
||||
protected static ?string $slug = 'database-tuning';
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class EmailQueue extends Page implements HasActions, HasTable
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedQueueList;
|
||||
|
||||
protected static ?int $navigationSort = 15;
|
||||
protected static ?int $navigationSort = 14;
|
||||
|
||||
protected static ?string $slug = 'email-queue';
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class ServerUpdates extends Page implements HasActions, HasTable
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedArrowPathRoundedSquare;
|
||||
|
||||
protected static ?int $navigationSort = 16;
|
||||
protected static ?int $navigationSort = 15;
|
||||
|
||||
protected static ?string $slug = 'server-updates';
|
||||
|
||||
@@ -35,6 +35,8 @@ class ServerUpdates extends Page implements HasActions, HasTable
|
||||
|
||||
protected ?AgentClient $agent = null;
|
||||
|
||||
protected bool $updatesLoaded = false;
|
||||
|
||||
public function getTitle(): string|Htmlable
|
||||
{
|
||||
return __('Server Updates');
|
||||
@@ -47,7 +49,7 @@ class ServerUpdates extends Page implements HasActions, HasTable
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->loadUpdates();
|
||||
$this->loadUpdates(false);
|
||||
}
|
||||
|
||||
protected function getAgent(): AgentClient
|
||||
@@ -55,13 +57,15 @@ class ServerUpdates extends Page implements HasActions, HasTable
|
||||
return $this->agent ??= new AgentClient;
|
||||
}
|
||||
|
||||
public function loadUpdates(): void
|
||||
public function loadUpdates(bool $refreshTable = true): void
|
||||
{
|
||||
try {
|
||||
$result = $this->getAgent()->updatesList();
|
||||
$this->packages = $result['packages'] ?? [];
|
||||
$this->updatesLoaded = true;
|
||||
} catch (\Exception $e) {
|
||||
$this->packages = [];
|
||||
$this->updatesLoaded = true;
|
||||
Notification::make()
|
||||
->title(__('Failed to load updates'))
|
||||
->body($e->getMessage())
|
||||
@@ -69,8 +73,10 @@ class ServerUpdates extends Page implements HasActions, HasTable
|
||||
->send();
|
||||
}
|
||||
|
||||
if ($refreshTable) {
|
||||
$this->resetTable();
|
||||
}
|
||||
}
|
||||
|
||||
public function runUpdates(): void
|
||||
{
|
||||
@@ -94,7 +100,24 @@ class ServerUpdates extends Page implements HasActions, HasTable
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->records(fn () => $this->packages)
|
||||
->records(function () {
|
||||
if (! $this->updatesLoaded) {
|
||||
$this->loadUpdates(false);
|
||||
}
|
||||
|
||||
return collect($this->packages)
|
||||
->mapWithKeys(function (array $package, int $index): array {
|
||||
$keyParts = [
|
||||
$package['name'] ?? (string) $index,
|
||||
$package['current_version'] ?? '',
|
||||
$package['new_version'] ?? '',
|
||||
];
|
||||
$key = implode('|', array_filter($keyParts, fn (string $part): bool => $part !== ''));
|
||||
|
||||
return [$key !== '' ? $key : (string) $index => $package];
|
||||
})
|
||||
->all();
|
||||
})
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->label(__('Package'))
|
||||
|
||||
@@ -24,7 +24,7 @@ class Waf extends Page implements HasForms
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedShieldCheck;
|
||||
|
||||
protected static ?int $navigationSort = 20;
|
||||
protected static ?int $navigationSort = 19;
|
||||
|
||||
protected static ?string $slug = 'waf';
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class GeoBlockRuleResource extends Resource
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedGlobeAlt;
|
||||
|
||||
protected static ?int $navigationSort = 22;
|
||||
protected static ?int $navigationSort = 20;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ class WebhookEndpointResource extends Resource
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBellAlert;
|
||||
|
||||
protected static ?int $navigationSort = 18;
|
||||
protected static ?int $navigationSort = 17;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
|
||||
@@ -24692,7 +24692,7 @@ function updatesList(array $params): array
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/^([^\/]+)\/[^\s]+\s+([^\s]+)\s+[^\s]+\s+[^\s]+\s+\[upgradable from: ([^\]]+)\]/', $line, $matches)) {
|
||||
if (preg_match('/^([^\/]+)\/\S+\s+(\S+)\s+\S+(?:\s+\S+)?\s+\[upgradable from: ([^\]]+)\]/', $line, $matches)) {
|
||||
$packages[] = [
|
||||
'name' => $matches[1],
|
||||
'new_version' => $matches[2],
|
||||
|
||||
Reference in New Issue
Block a user