web: make nickname more visible in the welcome page, closes #361

This commit is contained in:
Brian Warner 2008-06-03 15:02:10 -07:00
parent 9f59ecafbb
commit 9f5075e83d
3 changed files with 9 additions and 3 deletions

View File

@ -27,6 +27,7 @@ class FakeIntroducerClient:
class FakeClient(service.MultiService): class FakeClient(service.MultiService):
nodeid = "fake_nodeid" nodeid = "fake_nodeid"
nickname = "fake_nickname"
basedir = "fake_basedir" basedir = "fake_basedir"
def get_versions(self): def get_versions(self):
return {'allmydata': "fake", return {'allmydata': "fake",

View File

@ -128,6 +128,8 @@ class Root(rend.Page):
return str(allmydata) return str(allmydata)
def data_my_nodeid(self, ctx, data): def data_my_nodeid(self, ctx, data):
return idlib.nodeid_b2a(IClient(ctx).nodeid) return idlib.nodeid_b2a(IClient(ctx).nodeid)
def data_my_nickname(self, ctx, data):
return IClient(ctx).nickname
def render_services(self, ctx, data): def render_services(self, ctx, data):
ul = T.ul() ul = T.ul()
@ -198,8 +200,8 @@ class Root(rend.Page):
def render_service_row(self, ctx, data): def render_service_row(self, ctx, data):
(service_name, nodeid, rsc) = data (service_name, nodeid, rsc) = data
ctx.fillSlots("peerid", "%s %s" % (idlib.nodeid_b2a(nodeid), ctx.fillSlots("peerid", idlib.nodeid_b2a(nodeid))
rsc.nickname)) ctx.fillSlots("nickname", rsc.nickname)
if rsc.rref: if rsc.rref:
rhost = rsc.remote_host rhost = rsc.remote_host
if nodeid == IClient(ctx).nodeid: if nodeid == IClient(ctx).nodeid:

View File

@ -13,6 +13,7 @@
<h2>Status of this Client</h2> <h2>Status of this Client</h2>
<div>My nodeid: <span n:render="string" n:data="my_nodeid" /></div> <div>My nodeid: <span n:render="string" n:data="my_nodeid" /></div>
<div>My nickname: <span n:render="string" n:data="my_nickname" /></div>
<div>My versions: <span n:render="string" n:data="version" /></div> <div>My versions: <span n:render="string" n:data="version" /></div>
<div>Tahoe code imported from: <span n:render="string" n:data="import_path" /></div> <div>Tahoe code imported from: <span n:render="string" n:data="import_path" /></div>
<div n:render="services">Services Running:</div> <div n:render="services">Services Running:</div>
@ -45,7 +46,8 @@
<div> <div>
<table n:render="sequence" n:data="services" border="1"> <table n:render="sequence" n:data="services" border="1">
<tr n:pattern="header"> <tr n:pattern="header">
<td>PeerID / Nickname</td> <td>PeerID</td>
<td>Nickname</td>
<td>Connected?</td> <td>Connected?</td>
<td>Since</td> <td>Since</td>
<td>Announced</td> <td>Announced</td>
@ -54,6 +56,7 @@
</tr> </tr>
<tr n:pattern="item" n:render="service_row"> <tr n:pattern="item" n:render="service_row">
<td><tt><n:slot name="peerid"/></tt></td> <td><tt><n:slot name="peerid"/></tt></td>
<td><b><n:slot name="nickname"/></b></td>
<td><tt><n:slot name="connected"/></tt></td> <td><tt><n:slot name="connected"/></tt></td>
<td><tt><n:slot name="since"/></tt></td> <td><tt><n:slot name="since"/></tt></td>
<td><tt><n:slot name="announced"/></tt></td> <td><tt><n:slot name="announced"/></tt></td>