]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Add nickname/nodeid to storage-status web page. Closes #1204.
authorBrian Warner <warner@lothar.com>
Tue, 13 Mar 2012 02:57:36 +0000 (19:57 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 13 Mar 2012 02:57:36 +0000 (19:57 -0700)
Also add tahoe.css to the page, to make it look slightly prettier.

src/allmydata/test/test_storage.py
src/allmydata/web/root.py
src/allmydata/web/storage.py
src/allmydata/web/storage_status.xhtml

index bf1e3fd5ad01d67d04f4584378ae0bca3789b992..d51180d29924d18a5294de18f2399e70addf306d 100644 (file)
@@ -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("<h1>Storage Server Status</h1>", 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)
index 47793201d72ab60c61efdbc3cf108371c55124a0..2cd315d99b373c71b9b5fd910194fa07a8ca6cec 100644 (file)
@@ -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)
index f224c2897a1cb0117d5a77d82ad07f9e7fcb92dc..24d769bb79f2b80f930e3d0fa540be8ab65391b0 100644 (file)
@@ -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
index 64029c55352d8803f5fca7dd5cc9e19ebe27021f..19860a499b307c11b612ac404af017f67e7198fc 100644 (file)
@@ -1,6 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Storage Server Status</title>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <link href="/icon.png" rel="shortcut icon" />
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
       </tr>
   </table>
 
-  <ul n:data="stats">
-    <li>Accepting new shares:
-       <span n:render="bool" n:data="accepting_immutable_shares" /></li>
-  </ul>
-
   <ul>
+    <li>Server Nickname: <span class="nickname mine" n:render="string" n:data="nickname" /></li>
+    <li>Server Nodeid: <span class="nodeid mine data-chars" n:render="string" n:data="nodeid" /></li>
+    <li n:data="stats">Accepting new shares:
+     <span n:render="bool" n:data="accepting_immutable_shares" /></li>
     <li>Total buckets:
        <span n:render="string" n:data="last_complete_bucket_count" />
        (the number of files and directories for which this server is holding