New Welcome page: ensure 'not connected' status for Introducer and Helper is shown...
authorDavid-Sarah Hopwood <david-sarah@jacaranda.org>
Tue, 19 Mar 2013 03:47:24 +0000 (03:47 +0000)
committerDavid-Sarah Hopwood <david-sarah@jacaranda.org>
Tue, 19 Mar 2013 05:37:09 +0000 (05:37 +0000)
Signed-off-by: David-Sarah Hopwood <david-sarah@jacaranda.org>
src/allmydata/test/test_system.py
src/allmydata/test/test_web.py
src/allmydata/web/root.py
src/allmydata/web/welcome.xhtml

index 3abdc787f2fba01d42a621baf748ed3232f6980a..6ef94b30842ddfa9ab679647dc21b229a93b3d6f 100644 (file)
@@ -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)
 
index f56fb555108f4c91d9ccb1313306ea94d6d5b8fe..13750b851860a2754c76fed81d0f3b1646867b0d 100644 (file)
@@ -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
 
index 186c49414fbf7168ffb172a4bee12ca0dfee5ca8..c23d39ceeabe791bf3e8fff90c8d3c558a10cfca 100644 (file)
@@ -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:
index b6dcb778e7248179ebe5f11594cc0a50e66cbf60..439bfbe36835a804148322eec7da0799be27de3e 100644 (file)
                 <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>