summaryrefslogtreecommitdiffstats
path: root/google_appengine/google/appengine/ext/admin/templates/tasks.html
blob: c4749a03f38350c6b8cfe1a9a98d8653463f99cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{% extends "base.html" %}

{% block title %}
{{ application_name }} Development Console - Tasks Viewer{% endblock %}

{% block head %}
  <style type="text/css">{% include "css/pager.css" %}</style>
  <style type="text/css">{% include "css/tasks.css" %}</style>
  <script type="text/javascript">
    {% include "js/webhook.js" %}

    var handleTaskResult = function(hook, req, error) {
      if (error != null) {
        return;
      };
      if (req == null) {
        return;
      };
      if (req.status != 200) {
        return;
      };
      var parts = hook.formId.split('.');// + [''];
      var deleteForm = document.getElementById('deleteform.' + parts[1]);
      if (deleteForm != null) {
        deleteForm.submit();
      };
    };
  </script>
{% endblock %}

{% block breadcrumbs %}
  <span class="item"><a href="">Tasks Viewer</a></span>
{% endblock %}

{% block body %}
<h3>Tasks for Queue: {{ queue_name|escape }}</h3>

{% if tasks %}
  <p>
  Tasks will not run automatically. Push the 'Run' button to execute each task.
  </p>

  <table id="ah-tasks" class="ae-table ae-table-striped">
    <thead>
      <tr>
        <th>Task Name</th>
        <th>ETA (UTC)</th>
        <th>Method</th>
        <th>URL</th>
        <th></th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      {% for task in tasks %}
        <tr class="{% cycle ae-odd,ae-even %}">
          <td valign="top">
            {{ task.name|escape }}
          </td>
          <td valign="top">
            {{ task.eta|escape }} ({{ task.eta_delta|escape }})
          </td>
          <td valign="top">
            {{ task.method|escape }}
          </td>
          <td valign="top">
            {{ task.url|escape }}
          </td>
          <td valign="top">
            <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">
            <input type="hidden" name="payload" value="{{ task.body|escape }}">
            {% for header in task.headers.items %}
              <input type="hidden" name="header:{{ header.0|escape }}"
               value="{{ header.1|escape }}"/>
            {% endfor %}
            <input type="submit" value="Run"/>
            </form>
          </td>
          <td valign="top">
            <form id="deleteform.{{ task.name|escape }}" action="/_ah/admin/tasks" method="post">
            <input type="hidden" name="queue" value="{{ queue_name|escape }}"/>
            <input type="hidden" name="task" value="{{ task.name|escape }}"/>
            <input type="hidden" name="action:deletetask" value="true"/>
            <input type="submit" value="Delete"/>
            </form>
          </td>
        </tr>
      {% endfor %}
      <tr>
        <td colspan="6" class="ae-pager" align="right">
          {% include "pager.html" %}
        </td>
      </tr>
    </tbody>
  </table>

{% else %}
  This queue doesn't contain any tasks.
{% endif %}


{% endblock %}