#514: add meta-refresh=60 tag to t=status page for incomplete operations

This commit is contained in:
Brian Warner 2008-10-22 09:48:42 -07:00
parent 2ee6356c89
commit 0129e9931f
5 changed files with 16 additions and 3 deletions

View File

@ -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:

View File

@ -5,6 +5,7 @@
rel="stylesheet" type="text/css"/> -->
<link href="/webform_css" rel="stylesheet" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta n:render="refresh" />
</head>
<body>

View File

@ -5,6 +5,7 @@
rel="stylesheet" type="text/css"/> -->
<link href="/webform_css" rel="stylesheet" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta n:render="refresh" />
</head>
<body>

View File

@ -5,6 +5,7 @@
rel="stylesheet" type="text/css"/> -->
<link href="/tahoe_css" rel="stylesheet" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta n:render="refresh" />
</head>
<body>

View File

@ -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():