mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-21 03:55:27 +00:00
Use slots to render storage stats table
This commit is contained in:
parent
0cbe2871fd
commit
6c3256517a
@ -82,64 +82,30 @@ class StorageStatusElement(Element):
|
|||||||
return u"%d" % size
|
return u"%d" % size
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def disk_total(self, req, tag):
|
def storage_stats(self, req, tag):
|
||||||
val = self._get_storage_stat("storage_server.disk_total")
|
# Render storage status table that appears near the top of the page.
|
||||||
return tag(self.render_space(val))
|
total = self._get_storage_stat("storage_server.disk_total")
|
||||||
|
used = self._get_storage_stat("storage_server.disk_used")
|
||||||
|
free_root = self._get_storage_stat("storage_server.disk_free_for_root")
|
||||||
|
free_nonroot = self._get_storage_stat("storage_server.disk_free_for_nonroot")
|
||||||
|
reserved = self._get_storage_stat("storage_server.reserved_space")
|
||||||
|
available = self._get_storage_stat("storage_server.disk_avail")
|
||||||
|
|
||||||
@renderer
|
tag.fillSlots(
|
||||||
def disk_total_abbrev(self, req, tag):
|
disk_total = self.render_space(total),
|
||||||
val = self._get_storage_stat("storage_server.disk_total")
|
disk_total_abbrev = self.render_abbrev_space(total),
|
||||||
return tag(self.render_abbrev_space(val))
|
disk_used = self.render_space(used),
|
||||||
|
disk_used_abbrev = self.render_abbrev_space(used),
|
||||||
@renderer
|
disk_free_for_root = self.render_space(free_root),
|
||||||
def disk_used(self, req, tag):
|
disk_free_for_root_abbrev = self.render_abbrev_space(free_root),
|
||||||
val = self._get_storage_stat("storage_server.disk_used")
|
disk_free_for_nonroot = self.render_space(free_nonroot),
|
||||||
return tag(self.render_space(val))
|
disk_free_for_nonroot_abbrev = self.render_abbrev_space(free_nonroot),
|
||||||
|
reserved_space = self.render_space(reserved),
|
||||||
@renderer
|
reserved_space_abbrev = self.render_abbrev_space(reserved),
|
||||||
def disk_used_abbrev(self, req, tag):
|
disk_avail = self.render_space(available),
|
||||||
val = self._get_storage_stat("storage_server.disk_used")
|
disk_avail_abbrev = self.render_abbrev_space(available)
|
||||||
return tag(self.render_abbrev_space(val))
|
)
|
||||||
|
return tag
|
||||||
@renderer
|
|
||||||
def disk_free_for_root(self, req, tag):
|
|
||||||
val = self._get_storage_stat("storage_server.disk_free_for_root")
|
|
||||||
return tag(self.render_space(val))
|
|
||||||
|
|
||||||
@renderer
|
|
||||||
def disk_free_for_root_abbrev(self, req, tag):
|
|
||||||
val = self._get_storage_stat("storage_server.disk_free_for_root")
|
|
||||||
return tag(self.render_abbrev_space(val))
|
|
||||||
|
|
||||||
@renderer
|
|
||||||
def disk_free_for_nonroot(self, req, tag):
|
|
||||||
val = self._get_storage_stat("storage_server.disk_free_for_nonroot")
|
|
||||||
return tag(self.render_space(val))
|
|
||||||
|
|
||||||
@renderer
|
|
||||||
def disk_free_for_nonroot_abbrev(self, req, tag):
|
|
||||||
val = self._get_storage_stat("storage_server.disk_free_for_nonroot")
|
|
||||||
return tag(self.render_abbrev_space(val))
|
|
||||||
|
|
||||||
@renderer
|
|
||||||
def reserved_space(self, req, tag):
|
|
||||||
val = self._get_storage_stat("storage_server.reserved_space")
|
|
||||||
return tag(self.render_space(val))
|
|
||||||
|
|
||||||
@renderer
|
|
||||||
def reserved_space_abbrev(self, req, tag):
|
|
||||||
val = self._get_storage_stat("storage_server.reserved_space")
|
|
||||||
return tag(self.render_abbrev_space(val))
|
|
||||||
|
|
||||||
@renderer
|
|
||||||
def disk_avail(self, req, tag):
|
|
||||||
val = self._get_storage_stat("storage_server.disk_avail")
|
|
||||||
return tag(self.render_space(val))
|
|
||||||
|
|
||||||
@renderer
|
|
||||||
def disk_avail_abbrev(self, req, tag):
|
|
||||||
val = self._get_storage_stat("storage_server.disk_avail")
|
|
||||||
return tag(self.render_abbrev_space(val))
|
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def accepting_immutable_shares(self, req, tag):
|
def accepting_immutable_shares(self, req, tag):
|
||||||
|
@ -11,15 +11,15 @@
|
|||||||
|
|
||||||
<h1>Storage Server Status</h1>
|
<h1>Storage Server Status</h1>
|
||||||
|
|
||||||
<table class="storage_status">
|
<table class="storage_status" t:render="storage_stats">
|
||||||
<tr><td>Total disk space:</td>
|
<tr><td>Total disk space:</td>
|
||||||
<td><t:transparent t:render="disk_total_abbrev" /></td>
|
<td><t:slot name="disk_total_abbrev" /></td>
|
||||||
<td>(<t:transparent t:render="disk_total" />)</td>
|
<td>(<t:slot name="disk_total" />)</td>
|
||||||
<td />
|
<td />
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>Disk space used:</td>
|
<tr><td>Disk space used:</td>
|
||||||
<td>- <t:transparent t:render="disk_used_abbrev" /></td>
|
<td>- <t:slot name="disk_used_abbrev" /></td>
|
||||||
<td>(<t:transparent t:render="disk_used" />)</td>
|
<td>(<t:slot name="disk_used" />)</td>
|
||||||
<td />
|
<td />
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td />
|
<tr><td />
|
||||||
@ -28,18 +28,18 @@
|
|||||||
<td />
|
<td />
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>Disk space free (root):</td>
|
<tr><td>Disk space free (root):</td>
|
||||||
<td><t:transparent t:render="disk_free_for_root_abbrev"/></td>
|
<td><t:slot name="disk_free_for_root_abbrev"/></td>
|
||||||
<td>(<t:transparent t:render="disk_free_for_root"/>)</td>
|
<td>(<t:slot name="disk_free_for_root"/>)</td>
|
||||||
<td>[see 1]</td>
|
<td>[see 1]</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>Disk space free (non-root):</td>
|
<tr><td>Disk space free (non-root):</td>
|
||||||
<td><t:transparent t:render="disk_free_for_nonroot_abbrev" /></td>
|
<td><t:slot name="disk_free_for_nonroot_abbrev" /></td>
|
||||||
<td>(<t:transparent t:render="disk_free_for_nonroot" />)</td>
|
<td>(<t:slot name="disk_free_for_nonroot" />)</td>
|
||||||
<td>[see 2]</td>
|
<td>[see 2]</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>Reserved space:</td>
|
<tr><td>Reserved space:</td>
|
||||||
<td>- <t:transparent t:render="reserved_space_abbrev" /></td>
|
<td>- <t:slot name="reserved_space_abbrev" /></td>
|
||||||
<td>(<t:transparent t:render="reserved_space" />)</td>
|
<td>(<t:slot name="reserved_space" />)</td>
|
||||||
<td />
|
<td />
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td />
|
<tr><td />
|
||||||
@ -48,8 +48,8 @@
|
|||||||
<td />
|
<td />
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>Space Available to Tahoe:</td>
|
<tr><td>Space Available to Tahoe:</td>
|
||||||
<td><t:transparent t:render="disk_avail_abbrev" /></td>
|
<td><t:slot name="disk_avail_abbrev" /></td>
|
||||||
<td>(<t:transparent t:render="disk_avail" />)</td>
|
<td>(<t:slot name="disk_avail" />)</td>
|
||||||
<td />
|
<td />
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user