From: Brian Warner Date: Tue, 12 Feb 2008 22:40:05 +0000 (-0700) Subject: webish: add /status page to display current uploads/downloads X-Git-Tag: allmydata-tahoe-0.8.0~88 X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/flags/(%5B%5E?a=commitdiff_plain;h=b17b7695a44391cd3d6d25a6f40ef2a0f6f52e11;p=tahoe-lafs%2Ftahoe-lafs.git webish: add /status page to display current uploads/downloads --- diff --git a/src/allmydata/web/status.xhtml b/src/allmydata/web/status.xhtml new file mode 100644 index 00000000..7b331ef0 --- /dev/null +++ b/src/allmydata/web/status.xhtml @@ -0,0 +1,59 @@ + + + AllMyData - Tahoe - Current Uploads/Downloads + + + + + + +

Current Uploads and Downloads

+ + +

Current Uploads:

+ + + + + + + + + + + + + + + + + + + + +
Storage IndexHelper?Total SizeProgress (Hash)Progress (Ciphertext)Progress (Encode+Push)Status
No current uploads!
+ +

Current Downloads:

+ + + + + + + + + + + + + + + + +
Storage IndexHelper?Total SizeProgressStatus
No current uploads!
+ +
Return to the Welcome Page
+ + + diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml index ecd35496..485059a0 100644 --- a/src/allmydata/web/welcome.xhtml +++ b/src/allmydata/web/welcome.xhtml @@ -12,7 +12,8 @@
Please visit the Tahoe home page for code updates and bug reporting. The provisioning -tool may also be useful.
+tool may also be useful. Current Uploads and +Downloads

Grid Status

diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index 4c2c5abe..e5abc8aa 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -1493,6 +1493,45 @@ class UnlinkedPOSTCreateDirectory(rend.Page): d.addCallback(lambda dirnode: dirnode.get_uri()) return d +class Status(rend.Page): + docFactory = getxmlfile("status.xhtml") + + def data_uploads(self, ctx, data): + return IClient(ctx).list_uploads() + + def data_downloads(self, ctx, data): + return IClient(ctx).list_downloads() + + def _render_common(self, ctx, data): + s = data + si_s = idlib.b2a_or_none(s.get_storage_index()) + if si_s is None: + si_s = "(None)" + ctx.fillSlots("si", si_s) + ctx.fillSlots("helper", {True: "Yes", + False: "No"}[s.using_helper()]) + size = s.get_size() + if size is None: + size = "(unknown)" + ctx.fillSlots("total_size", size) + ctx.fillSlots("status", s.get_status()) + + def render_row_upload(self, ctx, data): + self._render_common(ctx, data) + (chk, ciphertext, encandpush) = data.get_progress() + # TODO: make an ascii-art bar + ctx.fillSlots("progress_hash", "%.1f%%" % (100.0 * chk)) + ctx.fillSlots("progress_ciphertext", "%.1f%%" % (100.0 * ciphertext)) + ctx.fillSlots("progress_encode", "%.1f%%" % (100.0 * encandpush)) + return ctx.tag + + def render_row_download(self, ctx, data): + self._render_common(ctx, data) + progress = data.get_progress() + # TODO: make an ascii-art bar + ctx.fillSlots("progress", "%.1f%%" % (100.0 * progress)) + return ctx.tag + class Root(rend.Page): @@ -1569,6 +1608,7 @@ class Root(rend.Page): child_tahoe_css = nevow_File(resource_filename('allmydata.web', 'tahoe.css')) child_provisioning = provisioning.ProvisioningTool() + child_status = Status() def data_version(self, ctx, data): return get_package_versions_string()