From e499d84755fef9c540feb66558ee7a94fc32c34f Mon Sep 17 00:00:00 2001 From: Nathan Wilcox Date: Tue, 20 Jan 2015 16:31:56 -0800 Subject: [PATCH] Introduce icons with distinct shape for connection status display on the front wui page... This replaces the status display which was only distinct by color which is a usability issue for color-blind users. This commit includes test coverage by way of pattern matching on rendered templates. The PNG icons are conversions of original SVG source which I've included and placed in the public domain. --- src/allmydata/test/test_system.py | 2 +- src/allmydata/test/test_web.py | 12 ++++----- src/allmydata/web/root.py | 13 ++++++++++ src/allmydata/web/static/img/connected-no.png | Bin 0 -> 213 bytes src/allmydata/web/static/img/connected-no.svg | 22 +++++++++++++++++ .../static/img/connected-not-configured.png | Bin 0 -> 427 bytes .../static/img/connected-not-configured.svg | 23 ++++++++++++++++++ .../web/static/img/connected-yes.png | Bin 0 -> 307 bytes .../web/static/img/connected-yes.svg | 22 +++++++++++++++++ src/allmydata/web/welcome.xhtml | 6 ++--- 10 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 src/allmydata/web/static/img/connected-no.png create mode 100644 src/allmydata/web/static/img/connected-no.svg create mode 100644 src/allmydata/web/static/img/connected-not-configured.png create mode 100644 src/allmydata/web/static/img/connected-not-configured.svg create mode 100644 src/allmydata/web/static/img/connected-yes.png create mode 100644 src/allmydata/web/static/img/connected-yes.svg diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 957c14c3..3b23b2f6 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -1114,7 +1114,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(r'
\s*
Helper
', html), page) + self.failUnless(re.search('Connected', 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 8c5ead4b..1f46cbf9 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -649,7 +649,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi html = res.replace('\n', ' ') self.failUnlessIn('
pb://someIntroducer/[censored]
', html) self.failIfIn('pb://someIntroducer/secret', html) - self.failUnless(re.search('
[ ]*
Introducer not connected
', html), res) + self.failUnless(re.search('Disconnected', html), res) d.addCallback(_check_introducer_not_connected_unguessable) # introducer connected, unguessable furl @@ -662,7 +662,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi html = res.replace('\n', ' ') self.failUnlessIn('
pb://someIntroducer/[censored]
', html) self.failIfIn('pb://someIntroducer/secret', html) - self.failUnless(re.search('
[ ]*
Introducer
', html), res) + self.failUnless(re.search('Connected', html), res) d.addCallback(_check_introducer_connected_unguessable) # introducer connected, guessable furl @@ -674,7 +674,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi def _check_introducer_connected_guessable(res): html = res.replace('\n', ' ') self.failUnlessIn('
pb://someIntroducer/introducer
', html) - self.failUnless(re.search('
[ ]*
Introducer
', html), res) + self.failUnless(re.search('Connected', html), res) d.addCallback(_check_introducer_connected_guessable) return d @@ -688,7 +688,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('
[ ]*
Helper
', html), res) + self.failUnless(re.search('Not Configured', html), res) d.addCallback(_check_no_helper) # enable helper, not connected @@ -701,7 +701,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi html = res.replace('\n', ' ') self.failUnlessIn('
pb://someHelper/[censored]
', html) self.failIfIn('pb://someHelper/secret', html) - self.failUnless(re.search('
[ ]*
Helper not connected
', html), res) + self.failUnless(re.search('Disconnected', html), res) d.addCallback(_check_helper_not_connected) # enable helper, connected @@ -714,7 +714,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi html = res.replace('\n', ' ') self.failUnlessIn('
pb://someHelper/[censored]
', html) self.failIfIn('pb://someHelper/secret', html) - self.failUnless(re.search('
[ ]*
Helper
', html), res) + self.failUnless(re.search('Connected', html), res) d.addCallback(_check_helper_connected) return d diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index 5f1d2367..8a9969c6 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -132,6 +132,12 @@ class Root(rend.Page): addSlash = True docFactory = getxmlfile("welcome.xhtml") + _connectedalts = { + "not-configured": "Not Configured", + "yes": "Connected", + "no": "Disconnected", + } + def __init__(self, client, clock=None): rend.Page.__init__(self, client) self.client = client @@ -222,6 +228,9 @@ class Root(rend.Page): return "yes" return "no" + def data_connected_to_introducer_alt(self, ctx, data): + return self._connectedalts[self.data_connected_to_introducer(ctx, data)] + def data_helper_furl_prefix(self, ctx, data): try: uploader = self.client.getServiceNamed("uploader") @@ -252,6 +261,9 @@ class Root(rend.Page): return "yes" return "no" + def data_connected_to_helper_alt(self, ctx, data): + return self._connectedalts[self.data_connected_to_helper(ctx, data)] + def data_known_storage_servers(self, ctx, data): sb = self.client.get_storage_broker() return len(sb.get_all_serverids()) @@ -295,6 +307,7 @@ class Root(rend.Page): available_space = abbreviate_size(available_space) ctx.fillSlots("address", addr) ctx.fillSlots("connected", connected) + ctx.fillSlots("connected_alt", self._connectedalts[connected]) ctx.fillSlots("connected-bool", bool(rhost)) ctx.fillSlots("since", time.strftime(TIME_FORMAT, time.localtime(since))) diff --git a/src/allmydata/web/static/img/connected-no.png b/src/allmydata/web/static/img/connected-no.png new file mode 100644 index 0000000000000000000000000000000000000000..ca32a8e22eb05fede5446e024b951d0a6bc05fb6 GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqER-55nWyI1n5o% MPgg&ebxsLQ0G*aptpET3 literal 0 HcmV?d00001 diff --git a/src/allmydata/web/static/img/connected-no.svg b/src/allmydata/web/static/img/connected-no.svg new file mode 100644 index 00000000..f310eed5 --- /dev/null +++ b/src/allmydata/web/static/img/connected-no.svg @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/src/allmydata/web/static/img/connected-not-configured.png b/src/allmydata/web/static/img/connected-not-configured.png new file mode 100644 index 0000000000000000000000000000000000000000..3c66e6f20d1683594ff6dffb1016605df28875c5 GIT binary patch literal 427 zcmV;c0aX5pP)0Eq;`r63%GKn)T-fi7(l8auK!-t1;1 zH};!vW_HG2r7FyO-z3>3+0|M%s`Obi#K_Q!kQEDF-Aw-S-jzRVKXT13vvgyX`+p8*&; z=lagMerUj~pt&mx9Lv85ceC>OD$T5D;jwriInRLR0LDAttgdOT8w|eyW6V*N{vV24 VNLNEa?>ztj002ovPDHLkV1oHDz2*P_ literal 0 HcmV?d00001 diff --git a/src/allmydata/web/static/img/connected-not-configured.svg b/src/allmydata/web/static/img/connected-not-configured.svg new file mode 100644 index 00000000..77ccb028 --- /dev/null +++ b/src/allmydata/web/static/img/connected-not-configured.svg @@ -0,0 +1,23 @@ + + + + + + + + + + diff --git a/src/allmydata/web/static/img/connected-yes.png b/src/allmydata/web/static/img/connected-yes.png new file mode 100644 index 0000000000000000000000000000000000000000..e3fe59783b81b24e4398a82cc50d716042f222a8 GIT binary patch literal 307 zcmV-30nGl1P)JAqTMcBAy@@5JOHP-axQ$XAwccHr5uFo**|6!9vl(A12ul;_g7I z-FcRod=Oef2g?LYN=_8)AU1tIpwEaTFs&X356u%xYWv}Ax#DD33+2-DvM!=e#1%oTQL#i(wCv@$|c zi&ZmcnAg9$qmOV_;1yw5y7PDDgy9GJHk{efSLYs?6OvNXcb`F-Gc25a24&9O=dC$& zZOYweL+09}Nd + + + + + + + + diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml index 72a2be16..c4774c81 100644 --- a/src/allmydata/web/welcome.xhtml +++ b/src/allmydata/web/welcome.xhtml @@ -137,14 +137,14 @@

-
status-indicator connected-
+ img/connected-.png

-
status-indicator connected-
+ img/connected-.png

@@ -178,7 +178,7 @@ -
status-indicator connected-
+ img/connected-.png
-- 2.45.2