From: Brian Warner <warner@lothar.com>
Date: Wed, 22 Oct 2008 16:48:42 +0000 (-0700)
Subject: #514: add meta-refresh=60 tag to t=status page for incomplete operations
X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/%22doc.html/running.html?a=commitdiff_plain;h=0129e9931f2f5a2c3756fa579cef3a8c4b97e7e7;p=tahoe-lafs%2Ftahoe-lafs.git

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

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"/> -->
     <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>
 
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"/> -->
     <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>
 
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"/> -->
     <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>
 
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():