From: Brian Warner Date: Tue, 13 Mar 2012 02:57:36 +0000 (-0700) Subject: Add nickname/nodeid to storage-status web page. Closes #1204. X-Git-Url: https://git.rkrishnan.org/pf/content/en/service/somewhere?a=commitdiff_plain;h=880af4e1fd398adb290ed7cb6c56c1d2306a0481;p=tahoe-lafs%2Ftahoe-lafs.git Add nickname/nodeid to storage-status web page. Closes #1204. Also add tahoe.css to the page, to make it look slightly prettier. --- diff --git a/src/allmydata/test/test_storage.py b/src/allmydata/test/test_storage.py index bf1e3fd5..d51180d2 100644 --- a/src/allmydata/test/test_storage.py +++ b/src/allmydata/test/test_storage.py @@ -3966,13 +3966,16 @@ class WebStatus(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin): def test_status(self): basedir = "storage/WebStatus/status" fileutil.make_dirs(basedir) - ss = StorageServer(basedir, "\x00" * 20) + nodeid = "\x00" * 20 + ss = StorageServer(basedir, nodeid) ss.setServiceParent(self.s) - w = StorageStatus(ss) + w = StorageStatus(ss, "nickname") d = self.render1(w) def _check_html(html): self.failUnlessIn("

Storage Server Status

", html) s = remove_tags(html) + self.failUnlessIn("Server Nickname: nickname", s) + self.failUnlessIn("Server Nodeid: %s" % base32.b2a(nodeid), s) self.failUnlessIn("Accepting new shares: Yes", s) self.failUnlessIn("Reserved space: - 0 B (0)", s) d.addCallback(_check_html) diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index 47793201..2cd315d9 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -142,7 +142,7 @@ class Root(rend.Page): s = client.getServiceNamed("storage") except KeyError: s = None - self.child_storage = storage.StorageStatus(s) + self.child_storage = storage.StorageStatus(s, self.client.nickname) self.child_uri = URIHandler(client) self.child_cap = URIHandler(client) diff --git a/src/allmydata/web/storage.py b/src/allmydata/web/storage.py index f224c289..24d769bb 100644 --- a/src/allmydata/web/storage.py +++ b/src/allmydata/web/storage.py @@ -3,7 +3,7 @@ import time, simplejson from nevow import rend, tags as T, inevow from allmydata.web.common import getxmlfile, abbreviate_time, get_arg from allmydata.util.abbreviate import abbreviate_space -from allmydata.util import time_format +from allmydata.util import time_format, idlib def remove_prefix(s, prefix): if not s.startswith(prefix): @@ -14,9 +14,10 @@ class StorageStatus(rend.Page): docFactory = getxmlfile("storage_status.xhtml") # the default 'data' argument is the StorageServer instance - def __init__(self, storage): + def __init__(self, storage, nickname=""): rend.Page.__init__(self, storage) self.storage = storage + self.nickname = nickname def renderHTTP(self, ctx): req = inevow.IRequest(ctx) @@ -34,6 +35,11 @@ class StorageStatus(rend.Page): } return simplejson.dumps(d, indent=1) + "\n" + def data_nickname(self, ctx, storage): + return self.nickname + def data_nodeid(self, ctx, storage): + return idlib.nodeid_b2a(self.storage.my_nodeid) + def render_storage_running(self, ctx, storage): if storage: return ctx.tag diff --git a/src/allmydata/web/storage_status.xhtml b/src/allmydata/web/storage_status.xhtml index 64029c55..19860a49 100644 --- a/src/allmydata/web/storage_status.xhtml +++ b/src/allmydata/web/storage_status.xhtml @@ -1,6 +1,7 @@ Tahoe-LAFS - Storage Server Status + @@ -53,12 +54,11 @@ - -