|
1 {% extends "base.html" %} |
|
2 |
|
3 {% block title %} |
|
4 {{ application_name }} Development Console - Tasks Viewer{% endblock %} |
|
5 |
|
6 {% block head %} |
|
7 <style type="text/css">{% include "css/pager.css" %}</style> |
|
8 <style type="text/css">{% include "css/tasks.css" %}</style> |
|
9 <script type="text/javascript"> |
|
10 {% include "js/webhook.js" %} |
|
11 |
|
12 var handleTaskResult = function(hook, req, error) { |
|
13 if (error != null) { |
|
14 return; |
|
15 }; |
|
16 if (req == null) { |
|
17 return; |
|
18 }; |
|
19 if (req.status != 200) { |
|
20 return; |
|
21 }; |
|
22 var parts = hook.formId.split('.');// + ['']; |
|
23 var deleteForm = document.getElementById('deleteform.' + parts[1]); |
|
24 if (deleteForm != null) { |
|
25 deleteForm.submit(); |
|
26 }; |
|
27 }; |
|
28 </script> |
|
29 {% endblock %} |
|
30 |
|
31 {% block breadcrumbs %} |
|
32 <span class="item"><a href="">Tasks Viewer</a></span> |
|
33 {% endblock %} |
|
34 |
|
35 {% block body %} |
|
36 <h3>Tasks for Queue: {{ queue_name|escape }}</h3> |
|
37 |
|
38 {% if tasks %} |
|
39 <p> |
|
40 Tasks will not run automatically. Push the 'Run' button to execute each task. |
|
41 </p> |
|
42 |
|
43 <table id="ah-tasks" class="ae-table ae-table-striped"> |
|
44 <thead> |
|
45 <tr> |
|
46 <th>Task Name</th> |
|
47 <th>ETA (UTC)</th> |
|
48 <th>Method</th> |
|
49 <th>URL</th> |
|
50 <th></th> |
|
51 <th></th> |
|
52 </tr> |
|
53 </thead> |
|
54 <tbody> |
|
55 {% for task in tasks %} |
|
56 <tr class="{% cycle ae-odd,ae-even %}"> |
|
57 <td valign="top"> |
|
58 {{ task.name|escape }} |
|
59 </td> |
|
60 <td valign="top"> |
|
61 {{ task.eta|escape }} ({{ task.eta_delta|escape }}) |
|
62 </td> |
|
63 <td valign="top"> |
|
64 {{ task.method|escape }} |
|
65 </td> |
|
66 <td valign="top"> |
|
67 {{ task.url|escape }} |
|
68 </td> |
|
69 <td valign="top"> |
|
70 <form id="runform.{{ task.name|escape }}" action="{{ task.url|escape }}" method="{{ task.method|escape }}" onsubmit="(new Webhook('runform.{{ task.name|escape }}')).run(handleTaskResult); return false"> |
|
71 <input type="hidden" name="payload" value="{{ task.body|escape }}"> |
|
72 {% for header in task.headers.items %} |
|
73 <input type="hidden" name="header:{{ header.0|escape }}" |
|
74 value="{{ header.1|escape }}"/> |
|
75 {% endfor %} |
|
76 <input type="submit" value="Run"/> |
|
77 </form> |
|
78 </td> |
|
79 <td valign="top"> |
|
80 <form id="deleteform.{{ task.name|escape }}" action="/_ah/admin/tasks" method="post"> |
|
81 <input type="hidden" name="queue" value="{{ queue_name|escape }}"/> |
|
82 <input type="hidden" name="task" value="{{ task.name|escape }}"/> |
|
83 <input type="hidden" name="action:deletetask" value="true"/> |
|
84 <input type="submit" value="Delete"/> |
|
85 </form> |
|
86 </td> |
|
87 </tr> |
|
88 {% endfor %} |
|
89 <tr> |
|
90 <td colspan="6" class="ae-pager" align="right"> |
|
91 {% include "pager.html" %} |
|
92 </td> |
|
93 </tr> |
|
94 </tbody> |
|
95 </table> |
|
96 |
|
97 {% else %} |
|
98 This queue doesn't contain any tasks. |
|
99 {% endif %} |
|
100 |
|
101 |
|
102 {% endblock %} |
|
103 |