Also add tahoe.css to the page, to make it look slightly prettier.
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)
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)
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):
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)
}
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
<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