diff --git a/web/public/theme/venix/css/admin-home.css b/web/public/theme/venix/css/admin-home.css index 59ffb671..373a8fd9 100644 --- a/web/public/theme/venix/css/admin-home.css +++ b/web/public/theme/venix/css/admin-home.css @@ -1,5 +1,6 @@ .admin-template-body { min-height: 100vh; + min-height: 100dvh; background: #f3f5f9; } @@ -22,6 +23,7 @@ inset: 0 auto 0 0; width: 260px; height: 100vh; + height: 100dvh; padding-top: 0 !important; z-index: 1001 !important; background: #061836; @@ -44,6 +46,7 @@ .admin-template .content-page { min-height: 100vh; + min-height: 100dvh; margin-left: 260px; margin-top: 0; padding-top: 72px; @@ -2053,6 +2056,8 @@ body.billing-detail-open { display: block; position: fixed; inset: 0; + height: 100vh; + height: 100dvh; z-index: 1000; border: 0; background: rgba(0, 8, 26, 0.48); diff --git a/web/resources/views/venix/admin/static_footer.tpl b/web/resources/views/venix/admin/static_footer.tpl index 5f2321f7..f420a959 100644 --- a/web/resources/views/venix/admin/static_footer.tpl +++ b/web/resources/views/venix/admin/static_footer.tpl @@ -42,12 +42,38 @@ } sidebarLinks.forEach(function (link) { - link.addEventListener('click', function () { - if (window.innerWidth <= 991) { + link.addEventListener('click', function (event) { + if (window.innerWidth > 991 + || event.defaultPrevented + || event.button !== 0 + || event.metaKey + || event.ctrlKey + || event.shiftKey + || event.altKey + || link.target === '_blank' + || link.hasAttribute('download')) { + return; + } + + var target = new URL(link.href, window.location.href); + var current = new URL(window.location.href); + if (target.origin === current.origin + && target.pathname === current.pathname + && target.search === current.search) { + if (target.hash === current.hash) { + event.preventDefault(); + } closeSidebar(); } }); }); + + window.addEventListener('pagehide', closeSidebar); + window.addEventListener('pageshow', function (event) { + if (event.persisted) { + closeSidebar(); + } + }); })(); {/literal} diff --git a/web/tests/AdminOverviewContractTest.php b/web/tests/AdminOverviewContractTest.php index 987b5d85..0a2d28da 100644 --- a/web/tests/AdminOverviewContractTest.php +++ b/web/tests/AdminOverviewContractTest.php @@ -5,6 +5,7 @@ $servicePath = $root . '/app/Services/Cloud/CloudAdminOverviewService.php'; $controllerPath = $root . '/app/Controllers/AdminController.php'; $templatePath = $root . '/resources/views/venix/admin/index.tpl'; $headerPath = $root . '/resources/views/venix/admin/static_header.tpl'; +$footerPath = $root . '/resources/views/venix/admin/static_footer.tpl'; $sharedStylePath = $root . '/public/theme/venix/css/admin-home.css'; $removedStylePath = $root . '/public/cloud/admin-overview.css'; $schemaPath = $root . '/sql/cloud.sql'; @@ -23,6 +24,7 @@ $service = file_get_contents($servicePath); $controller = file_get_contents($controllerPath); $template = file_get_contents($templatePath); $header = file_get_contents($headerPath); +$footer = file_get_contents($footerPath); $styles = file_get_contents($sharedStylePath); $schema = file_get_contents($schemaPath); $baseSchema = file_get_contents($baseSchemaPath); @@ -101,4 +103,16 @@ $assert(str_contains($header, '/theme/venix/css/admin-home.css') && str_contains($styles, '@media (max-width: 575.98px)'), 'Overview must inherit the existing administrator component and responsive rules.'); +$assert(preg_match('/\.admin-template \.app-sidebar-menu\s*\{(?=[^}]*height:\s*100vh)(?=[^}]*height:\s*100dvh)[^}]*\}/s', $styles) + && preg_match('/\.admin-template-body\.admin-sidebar-open \.admin-sidebar-backdrop\s*\{(?=[^}]*height:\s*100vh)(?=[^}]*height:\s*100dvh)[^}]*\}/s', $styles) + && str_contains($footer, "window.addEventListener('pagehide', closeSidebar)") + && str_contains($footer, "window.addEventListener('pageshow'") + && str_contains($footer, 'event.persisted') + && str_contains($footer, 'target.pathname === current.pathname') + && str_contains($footer, 'target.search === current.search') + && str_contains($footer, 'target.hash === current.hash') + && str_contains($footer, 'event.preventDefault();') + && !preg_match('/link\.addEventListener\(\'click\'.*?window\.innerWidth <= 991.*?closeSidebar\(\);/s', $footer), + 'Mobile administrator navigation must cover the dynamic viewport and keep its overlay during cross-page navigation.'); + echo 'Administrator operational overview contracts passed.' . PHP_EOL; diff --git a/web/tests/VirtualizationAssetsTest.php b/web/tests/VirtualizationAssetsTest.php index a0752a11..9aead02c 100644 --- a/web/tests/VirtualizationAssetsTest.php +++ b/web/tests/VirtualizationAssetsTest.php @@ -754,6 +754,7 @@ foreach (['hosts/index.tpl', 'cloud/instances.tpl', 'cloud/rescue.tpl', 'cloud/t $adminBillingSource = file_get_contents($adminBillingTemplate); $assert(str_contains($adminBillingSource, '/cloud/admin-billing.js?v={$venix_asset_version}') + && str_contains($adminBillingSource, "{include file='admin/static_footer.tpl'}") && !str_contains($adminBillingSource, '/cloud/admin-billing.css') && !is_file($adminBillingStyles) && str_contains($adminBillingSource, 'admin-ticket-stat')