mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 11:46:49 +00:00
fix(console): the console error is an alert under the navbar that closes
A script built the console page's error alert as HTML text, with a broken class attribute (role="alert" ended up in it), a close button without a handler on a danger alert that never fades, and placed it above the viewport-high console container, cutting off its bottom. The template now renders the message (autoescaped) as a dismissible Bootstrap alert inside the container, under the navbar; the log_* functions had no other caller.
This commit is contained in:
parent
c8b0cb3a4a
commit
117da97c7d
2 changed files with 10 additions and 30 deletions
|
|
@ -14,6 +14,7 @@ from django.urls import reverse
|
|||
from django.utils.html import escapejs
|
||||
from instances.models import Instance
|
||||
from libvirt import libvirtError
|
||||
from lxml import html
|
||||
|
||||
# Dynamically load console/novncd script for testing
|
||||
NOVNCD_PATH = str(Path(__file__).resolve().parent.parent / "novncd")
|
||||
|
|
@ -151,6 +152,9 @@ class ConsoleViewsTestCase(TestCase):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
self.assertTemplateNotUsed(response, "console-xterm.html")
|
||||
self.assertIn("Serial console is disabled", str(response.context["console_error"]))
|
||||
# an element of the page, not a script's string
|
||||
alert = html.fromstring(response.content).xpath("//div[@role='alert']")
|
||||
self.assertIn("Serial console is disabled on this server", alert[0].text_content())
|
||||
|
||||
@patch("console.views.wvmInstance")
|
||||
def test_console_user_assigned_instance_access(self, mock_wvm):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue