feat: make noVNC and xterm.js console links open in minimal popup windows

This commit is contained in:
2026-01-25 11:54:33 -05:00
parent 59057b98e3
commit e322c0cda7
5 changed files with 163 additions and 97 deletions

View File

@@ -1588,8 +1588,8 @@
'label' => 'Console',
'dropdown' => true,
'items' => [
['label' => 'NoVNC', 'view' => 'vnc', 'route' => route('proxmox.server.vnc', ['server' => $server->id])],
['label' => 'Xterm.js', 'view' => 'xterm', 'route' => route('proxmox.server.xterm', ['server' => $server->id])],
['label' => 'NoVNC', 'view' => 'vnc', 'route' => route('proxmox.server.vnc-popup', ['server' => $server->id]), 'popup' => true],
['label' => 'Xterm.js', 'view' => 'xterm', 'route' => route('proxmox.server.xterm-popup', ['server' => $server->id]), 'popup' => true],
]
];
}
@@ -1974,15 +1974,26 @@
@foreach($tab['items'] as $itemIndex => $item)
@php
$itemAdvanced = $item['advanced'] ?? false;
$isPopup = $item['popup'] ?? false;
@endphp
<div @if($itemAdvanced)
x-show="isAdvancedView"
@endif>
<a href="{{ $item['route'] }}" wire:navigate
class="dropdown-item {{ $view === $item['view'] ? 'active' : '' }}"
@click="open = false">
{{ $item['label'] }}
</a>
@if($isPopup)
<a href="{{ $item['route'] }}"
target="_blank"
onclick="event.preventDefault(); window.open('{{ $item['route'] }}', '{{ $item['label'] }}Console', 'width=1024,height=768,menubar=no,toolbar=no,location=no,status=no,scrollbars=no,resizable=yes'); return false;"
class="dropdown-item {{ $view === $item['view'] ? 'active' : '' }}"
@click="open = false">
{{ $item['label'] }}
</a>
@else
<a href="{{ $item['route'] }}" wire:navigate
class="dropdown-item {{ $view === $item['view'] ? 'active' : '' }}"
@click="open = false">
{{ $item['label'] }}
</a>
@endif
@if($itemIndex < count($tab['items']) - 1 && $itemAdvanced && !($tab['items'][$itemIndex + 1]['advanced'] ?? false))
<div x-show="isAdvancedView" class="dropdown-divider"></div>
@endif