]> git.openstreetmap.org Git - osqa.git/blob - forum_modules/exporter/templates/running.html
More data handled by the exporter, and a improved "pickled" value parsing.
[osqa.git] / forum_modules / exporter / templates / running.html
1 {% extends basetemplate %}
2
3 {% load i18n %}
4
5 {% block subtitle %}
6     {% trans "XML data exporter" %}
7 {% endblock %}
8 {% block description %}
9     {% trans "Export database to XML format" %}
10 {% endblock %}
11
12 {% block adminjs %}
13     <style type="text/css">
14         .state_bar {
15             width:100%;
16             height: 20px;
17             border: 1px solid black;
18             margin-bottom: 15px;
19             position: relative;
20             background: #FDF;
21         }
22
23         .state_label {
24             margin-left: auto;
25             margin-right: auto;
26             z-index: 1000;
27             position: absolute;
28             left: 0px;
29             top: 0px;
30             width: 100%;
31             height: 100%;
32             text-align: center;
33         }
34
35         .progress {
36             position: absolute;
37             left: 0px;
38             top: 0px;
39             width: 0%;
40             height: 100%;
41             background: #DFF;
42             z-index: 0;
43         }
44
45         #download_link {
46             display: none;
47         }
48     </style>
49
50     <script type="text/javascript">
51     $(function() {
52         var state = null;
53
54         function set_state(name, data) {
55             var $bar = $('#state_' + name);
56
57             if (data[name] === undefined) {
58                 $bar.find('.state_label').html('{% trans "Skiped" %}')
59             } else if (state == null || data[name] != state[name]) {
60                 var width = $bar.width();
61
62                 $bar.find('.state_parsed').html(data[name].parsed);
63                 $bar.find('.state_count').html(data[name].count);
64                 $bar.find('.state_status').html(data[name].status);
65
66                 var rel_parse = data[name].parsed / data[name].count;
67
68                 $bar.find('.state_percentage').html(parseInt(rel_parse * 100) + '%');
69                 $bar.find('.progress').css('width', parseInt(rel_parse * width) + 'px')
70             }
71         }
72
73         function check_state() {
74          $.getJSON('{% url exporter_state %}', function(data) {
75             set_state('overall', data.state)
76             {% for s in steps %}
77                 set_state('{{ s.id }}', data.state);
78             {% endfor %}
79
80             $('#time_started').html(data.time_started);
81
82             state = data;
83
84             if (data.running) {
85                 check_state();
86             } else {
87                 if (data.errors == false) {
88                     $('#wait_message').html('{% trans "Your backup is ready to be downloaded."%}')
89                     $('#download_link').slideDown();
90                 } else {
91                     $('#wait_message').html('{% trans "An error has occurred during de export proccess: "%}' + data.errors + '<br />' +
92                     '{% trans "Please check the log file for a full stack trace." %}')
93                 }
94             }
95          });
96         }
97
98         check_state();
99     });
100     </script>
101 {% endblock %}
102
103 {% block admincontent %}
104     <p id="wait_message">
105         {% trans "Please wait while we prepare your backup file to download." %} -
106         {% blocktrans %}
107             Started <span id="time_started"></span>
108         {% endblocktrans %}
109     </p>
110     <p id="download_link"><a href="{% url exporter_download %}">{% trans "Download file" %}</a></p>
111     <table style="width: 100%">
112         <tr>
113             <td colspan="2">
114                 <div class="state_bar" id="state_overall">
115                     <div class="state_label"><span class="state_status"></span> ({% trans "Total progress" %}: <span class="state_percentage">0%</span>)</div>
116                     <div class="progress"></div>
117                 </div>
118             </td>
119         </tr>
120         {% for s in steps %}
121         <tr>
122             <td>{{ s.name }}:</td>
123             <td width="100%">
124                 <div class="state_bar" id="state_{{ s.id }}">
125                     <div class="state_label"><span class="state_status"></span> - </span><span class="state_parsed">0</span> {% trans " of " %} <span class="state_count">{% trans "unknown" %}</span> (<span class="state_percentage">0%</span>)</div>
126                     <div class="progress"></div>
127                 </div>
128             </td>
129         </tr>
130         {% endfor %}
131     </table>
132 {% endblock %}