From 1f38c920119aa66e83c0c06b1898a889c97ca623 Mon Sep 17 00:00:00 2001 From: David-Sarah Hopwood <david-sarah@jacaranda.org> Date: Tue, 19 Mar 2013 03:47:24 +0000 Subject: [PATCH] New Welcome page: ensure 'not connected' status for Introducer and Helper is shown via text as well as bullet colour. refs #1713 Signed-off-by: David-Sarah Hopwood <david-sarah@jacaranda.org> --- src/allmydata/test/test_system.py | 2 +- src/allmydata/test/test_web.py | 6 +++--- src/allmydata/web/root.py | 11 +++++++++-- src/allmydata/web/welcome.xhtml | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 3abdc787..6ef94b30 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -1113,7 +1113,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase): d.addCallback(lambda res: getPage(self.helper_webish_url)) def _got_welcome_helper(page): html = page.replace('\n', ' ') - self.failUnless(re.search('<div class="status-indicator connected-yes"></div>[ ]*Helper', html), page) + self.failUnless(re.search('<div class="status-indicator connected-yes"></div>[ ]*<div>Helper</div>', html), page) self.failUnlessIn("Not running helper", page) d.addCallback(_got_welcome_helper) diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index f56fb555..13750b85 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -627,7 +627,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d.addCallback(_set_no_helper) def _check_no_helper(res): html = res.replace('\n', ' ') - self.failUnless(re.search('<div class="status-indicator connected-not-configured"></div>[ ]*Helper', html), res) + self.failUnless(re.search('<div class="status-indicator connected-not-configured"></div>[ ]*<div>Helper</div>', html), res) d.addCallback(_check_no_helper) # enable helper, not connected @@ -638,7 +638,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d.addCallback(_set_helper_not_connected) def _check_helper_not_connected(res): html = res.replace('\n', ' ') - self.failUnless(re.search('<div class="status-indicator connected-no"></div>[ ]*Helper', html), res) + self.failUnless(re.search('<div class="status-indicator connected-no"></div>[ ]*<div>Helper not connected</div>', html), res) d.addCallback(_check_helper_not_connected) # enable helper, connected @@ -649,7 +649,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d.addCallback(_set_helper_connected) def _check_helper_connected(res): html = res.replace('\n', ' ') - self.failUnless(re.search('<div class="status-indicator connected-yes"></div>[ ]*Helper', html), res) + self.failUnless(re.search('<div class="status-indicator connected-yes"></div>[ ]*<div>Helper</div>', html), res) d.addCallback(_check_helper_connected) return d diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index 186c4941..c23d39ce 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -201,6 +201,11 @@ class Root(rend.Page): def data_introducer_furl(self, ctx, data): return self.client.introducer_furl + def data_introducer_description(self, ctx, data): + if self.data_connected_to_introducer(ctx, data) == "no": + return "Introducer not connected" + return "Introducer" + def data_connected_to_introducer(self, ctx, data): if self.client.connected_to_introducer(): return "yes" @@ -214,8 +219,10 @@ class Root(rend.Page): furl, connected = uploader.get_helper_info() return furl - def data_connected_to_helper_description(self, ctx, data): - return self.data_connected_to_helper(ctx, data).replace('-', ' ') + def data_helper_description(self, ctx, data): + if self.data_connected_to_helper(ctx, data) == "no": + return "Helper not connected" + return "Helper" def data_connected_to_helper(self, ctx, data): try: diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml index b6dcb778..439bfbe3 100644 --- a/src/allmydata/web/welcome.xhtml +++ b/src/allmydata/web/welcome.xhtml @@ -137,14 +137,14 @@ <div> <h3> <div><n:attr name="class">status-indicator connected-<n:invisible n:render="string" n:data="connected_to_introducer" /></n:attr></div> - Introducer + <div n:render="string" n:data="introducer_description" /> </h3> <div class="furl" n:render="string" n:data="introducer_furl" /> </div> <div> <h3> <div><n:attr name="class">status-indicator connected-<n:invisible n:render="string" n:data="connected_to_helper" /></n:attr></div> - Helper + <div n:render="string" n:data="helper_description" /> </h3> <div class="furl" n:render="string" n:data="helper_furl" /> </div> -- 2.45.2