launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07032
[Merge] lp:~rvb/maas/long-lasting-warnings-ui into lp:maas
Raphaël Badin has proposed merging lp:~rvb/maas/long-lasting-warnings-ui into lp:maas with lp:~rvb/maas/long-lasting-warnings as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~rvb/maas/long-lasting-warnings-ui/+merge/101127
This branch is a ui branch. It use the component error reporting module to display permanent errors in the UI.
--
https://code.launchpad.net/~rvb/maas/long-lasting-warnings-ui/+merge/101127
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/long-lasting-warnings-ui into lp:maas.
=== modified file 'src/maasserver/context_processors.py'
--- src/maasserver/context_processors.py 2012-03-14 10:38:31 +0000
+++ src/maasserver/context_processors.py 2012-04-06 16:07:25 +0000
@@ -14,6 +14,7 @@
]
from django.conf import settings
+from maasserver.components import get_persistent_errors
from maasserver.forms import NodeForm
from maasserver.models import Config
@@ -29,6 +30,7 @@
def global_options(context):
return {
+ 'persistent_errors': get_persistent_errors(),
'node_form': NodeForm(),
'global_options': {
'site_name': Config.objects.get_config('maas_name'),
=== modified file 'src/maasserver/templates/maasserver/base.html'
--- src/maasserver/templates/maasserver/base.html 2012-03-22 05:05:52 +0000
+++ src/maasserver/templates/maasserver/base.html 2012-04-06 16:07:25 +0000
@@ -84,6 +84,9 @@
{% endif %}
<div id="body">
<ul id="flash-messages">
+ {% for persistent_error in persistent_errors %}
+ <li class="warning">{{ persistent_error }}</li>
+ {% endfor %}
{% if messages %}
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>
=== modified file 'src/maasserver/tests/test_views.py'
--- src/maasserver/tests/test_views.py 2012-04-05 07:50:52 +0000
+++ src/maasserver/tests/test_views.py 2012-04-06 16:07:25 +0000
@@ -22,9 +22,14 @@
from django.core.urlresolvers import reverse
from lxml.html import fromstring
from maasserver import (
+ components,
messages,
views,
)
+from maasserver.components import (
+ PERSISTENT_COMPONENTS_ERRORS,
+ register_persistent_error,
+ )
from maasserver.exceptions import NoRabbit
from maasserver.forms import NodeActionForm
from maasserver.models import (
@@ -54,6 +59,10 @@
proxy_to_longpoll,
)
from maastesting.rabbit import uses_rabbit_fixture
+from testtools.matchers import (
+ Contains,
+ MatchesAll,
+ )
def get_prefixed_form_data(prefix, data):
@@ -983,3 +992,24 @@
content_text = doc.cssselect('#content')[0].text_content()
self.assertIn(user.username, content_text)
self.assertIn(user.email, content_text)
+
+
+class PermanentErrorDisplayTest(LoggedInTestCase):
+
+ def test_permanent_error_displayed(self):
+ self.patch(components, '_PERSISTENT_ERRORS', set())
+ errors = PERSISTENT_COMPONENTS_ERRORS.keys()
+ for error in errors:
+ register_persistent_error(error)
+ links = [
+ reverse('index'),
+ reverse('node-list'),
+ reverse('prefs'),
+ ]
+ for link in links:
+ response = self.client.get(link)
+ self.assertThat(
+ response.content,
+ MatchesAll(
+ *[Contains(PERSISTENT_COMPONENTS_ERRORS[error])
+ for error in errors]))