aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/base/dashboard/status.html
blob: 734bb9ad3a1bd1f5b1019215557f8ca6076eda01 (plain)
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
[% USE date %]
[% IF NOT c.get_param('ajax') %]
[% INCLUDE 'header.html'
    title = loc('Dashboard')
    robots = 'noindex, nofollow'
    bodyclass = 'fullwidthpage';
%]

[% IF body %]
<hgroup>
    [% tprintf(loc('<h2>Reports, Statistics and Actions for</h2> <h1>%s</h1>'), body_name) %]
</hgroup>
[% ELSE %]
<h1>[% loc('Summary statistics') %]</h1>
[% END %]

<p><a href="[% c.uri_for_action('dashboard/index') %]">[% loc('Back') %]</a></p>

[% END %]

<table id="overview" cellpadding=8 cellspacing=0>
    <tr>
        <th scope="col">[% loc('Created') %]</th>
        <th scope="col">[% loc('CSV File') %]</th>
    </tr>
  [% in_progress = 0 %]
  [% FOR file IN rows %]
    <tr>
        <td>[% date.format(file.ctime, format = '%Y-%m-%d %H:%M') %]</td>
        <td>
            [% IF file.finished %]
                <a href="/dashboard/csv/[% file.name %]">[% file.name %]</a>
                <br>[% file.size div 1024 %]KB
            [% ELSE %]
                [% file.name %]
                <br>[% file.size div 1024 %]KB
                <i>[% loc('In progress') %]</i>
                [% in_progress = 1 %]
            [% END %]
        </td>
    </tr>
  [% END %]
</table>

[% IF NOT c.get_param('ajax') %]

[% IF in_progress %]
<script nonce="[% csp_nonce %]">
(function() {
    var wait = 1;
    setTimeout(function refresh() {
        $('#overview').load('[% c.uri_for_action('dashboard/status') %]?ajax=1', function() {
            if ($(this).html().indexOf('<i>[% loc('In progress', "JS") %]</i>') === -1) {
                return;
            }
            wait += 1;
            if (wait > 10) {
                wait = 10;
            }
            setTimeout(refresh, wait * 1000);
        });
    }, wait * 1000);
})();
</script>
[% END %]

[% INCLUDE 'footer.html' %]
[% END %]