diff options
| author | rubenwardy <rw@rubenwardy.com> | 2018-05-11 15:29:26 +0100 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2018-05-11 15:29:26 +0100 |
| commit | 510bf50ff2fb29817fc754d6793e506e3414bc6b (patch) | |
| tree | d4dc5c04d9bcf793593d7091607b978c1950832a /app/templates | |
| parent | 6d7b810270b21575dca54eb36f371969b976bafd (diff) | |
| download | cheatdb-510bf50ff2fb29817fc754d6793e506e3414bc6b.tar.xz | |
Remove meta refresh on task page, use JS to poll
Diffstat (limited to 'app/templates')
| -rw-r--r-- | app/templates/packages/create_edit.html | 1 | ||||
| -rw-r--r-- | app/templates/tasks/view.html | 16 |
2 files changed, 11 insertions, 6 deletions
diff --git a/app/templates/packages/create_edit.html b/app/templates/packages/create_edit.html index 3378a5d..9049e81 100644 --- a/app/templates/packages/create_edit.html +++ b/app/templates/packages/create_edit.html @@ -55,6 +55,7 @@ {% if not package.title %} <script src="/static/jquery.min.js"></script> <script src="/static/url.min.js"></script> + <script src="/static/polltask.js"></script> <script src="/static/package_create.js"></script> <noscript> <div class="box box_grey alert alert-warning"> diff --git a/app/templates/tasks/view.html b/app/templates/tasks/view.html index a01ca80..d47203f 100644 --- a/app/templates/tasks/view.html +++ b/app/templates/tasks/view.html @@ -4,12 +4,6 @@ Working {% endblock %} -{% block headextra %} - {% if not "error" in info %} - <meta http-equiv="refresh" content="1;URL="> - {% endif %} -{% endblock %} - {% block content %} {% if "error" in info %} <h1>Task Failed</h1> @@ -17,5 +11,15 @@ Working <p>{{ info. error }}</p> {% else %} <h1>Working…</h1> + + <script src="/static/polltask.js"></script> + <script> + pollTask("{{ url_for('check_task', id=info.id) }}", true) + .then(function() { location.reload() }) + .catch(function() { location.reload() }) + </script> + <noscript> + Reload the page to check for updates. + </noscript> {% endif %} {% endblock %} |
