From 0129e9931f2f5a2c3756fa579cef3a8c4b97e7e7 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 22 Oct 2008 09:48:42 -0700 Subject: [PATCH] #514: add meta-refresh=60 tag to t=status page for incomplete operations --- docs/webapi.txt | 6 +++--- src/allmydata/web/deep-check-and-repair-results.xhtml | 1 + src/allmydata/web/deep-check-results.xhtml | 1 + src/allmydata/web/manifest.xhtml | 1 + src/allmydata/web/operations.py | 10 ++++++++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/webapi.txt b/docs/webapi.txt index d72ec2fb..a168bb77 100644 --- a/docs/webapi.txt +++ b/docs/webapi.txt @@ -211,7 +211,7 @@ GET /operations/$HANDLE?t=status&output=JSON * how much of the operation is complete, and how much is left, if possible The HTML form will include a meta-refresh tag, which will cause a regular - web browser to reload the status page about 30 seconds later. This tag will + web browser to reload the status page about 60 seconds later. This tag will be removed once the operation has completed. POST /operations/$HANDLE?t=cancel @@ -820,8 +820,8 @@ POST $URL?t=start-deep-check (must add &ophandle=XYZ) /operations page should be used to find out when the operation is done. The HTML /operations/$HANDLE?t=status page for incomplete operations will - contain a meta-refresh tag, set to 30 seconds, so that a browser which uses - deep-check will automatically poll until the operation has completed. (TODO) + contain a meta-refresh tag, set to 60 seconds, so that a browser which uses + deep-check will automatically poll until the operation has completed. The JSON page (/options/$HANDLE?t=status&output=JSON) will contain a machine-readable JSON dictionary with the following keys: diff --git a/src/allmydata/web/deep-check-and-repair-results.xhtml b/src/allmydata/web/deep-check-and-repair-results.xhtml index 2b842f76..b171d7bf 100644 --- a/src/allmydata/web/deep-check-and-repair-results.xhtml +++ b/src/allmydata/web/deep-check-and-repair-results.xhtml @@ -5,6 +5,7 @@ rel="stylesheet" type="text/css"/> --> + diff --git a/src/allmydata/web/deep-check-results.xhtml b/src/allmydata/web/deep-check-results.xhtml index 7c9893e8..a15be3f5 100644 --- a/src/allmydata/web/deep-check-results.xhtml +++ b/src/allmydata/web/deep-check-results.xhtml @@ -5,6 +5,7 @@ rel="stylesheet" type="text/css"/> --> + diff --git a/src/allmydata/web/manifest.xhtml b/src/allmydata/web/manifest.xhtml index 64623087..560ca933 100644 --- a/src/allmydata/web/manifest.xhtml +++ b/src/allmydata/web/manifest.xhtml @@ -5,6 +5,7 @@ rel="stylesheet" type="text/css"/> --> + diff --git a/src/allmydata/web/operations.py b/src/allmydata/web/operations.py index ea44634d..080f8dbb 100644 --- a/src/allmydata/web/operations.py +++ b/src/allmydata/web/operations.py @@ -106,6 +106,16 @@ class OphandleTable(rend.Page, service.Service): self.handles.pop(ophandle, None) class ReloadMixin: + REFRESH_TIME = 1*MINUTE + + def render_refresh(self, ctx, data): + if self.monitor.is_finished(): + return "" + # dreid suggests ctx.tag(**dict([("http-equiv", "refresh")])) + # but I can't tell if he's joking or not + ctx.tag.attributes["http-equiv"] = "refresh" + ctx.tag.attributes["content"] = str(self.REFRESH_TIME) + return ctx.tag def render_reload(self, ctx, data): if self.monitor.is_finished(): -- 2.45.2