-
Notifications
You must be signed in to change notification settings - Fork 2k
/
resource_data.html
86 lines (78 loc) · 3.25 KB
/
resource_data.html
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
{% extends "package/resource_edit_base.html" %}
{% block subtitle %}{{ h.dataset_display_name(pkg) }} - {{ h.resource_display_name(res) }}{% endblock %}
{% block primary_content_inner %}
{% set action = h.url_for(controller='ckanext.datapusher.plugin:ResourceDataController', action='resource_data', id=pkg.name, resource_id=res.id) %}
{% set show_table = true %}
<form method="post" action="{{ action }}" >
<button class="btn btn-primary" name="save" type="submit">
<i class="icon-cloud-upload"></i> {{ _('Upload to DataStore') }}
</button>
</form>
{% if status.error and status.error.message %}
{% set show_table = false %}
<div class="alert alert-error">
<strong>{{ _('Upload error:') }}</strong> {{ status.error.message }}
</div>
{% elif status.task_info and status.task_info.error %}
<div class="alert alert-error">
{% if status.task_info.error is string %}
{# DataPusher < 0.0.3 #}
<strong>{{ _('Error:') }}</strong> {{ status.task_info.error }}
{% elif status.task_info.error is mapping %}
<strong>{{ _('Error:') }}</strong> {{ status.task_info.error.message }}
{% for error_key, error_value in status.task_info.error.iteritems() %}
{% if error_key != "message" and error_value %}
<br>
<strong>{{ error_key }}</strong>:
{{ error_value }}
{% endif %}
{% endfor %}
{% elif status.task_info.error is iterable %}
<strong>{{ _('Error traceback:') }}</strong>
<pre>{{ ''.join(status.task_info.error) }}</pre>
{% endif %}
</div>
{% endif %}
<table class="table table-bordered">
<colgroup>
<col width="150">
<col>
</colgroup>
<tr>
<th>{{ _('Status') }}</th>
<td>{{ h.datapusher_status_description(status) }}</td>
</tr>
<tr>
<th>{{ _('Last updated') }}</th>
{% if status.status %}
<td><span class="date" title="{{ h.render_datetime(status.last_updated, with_hours=True) }}">{{ h.time_ago_from_timestamp(status.last_updated) }}</span></td>
{% else %}
<td>{{ _('Never') }}</td>
{% endif %}
</tr>
</table>
{% if status.status and status.task_info and show_table %}
<h3>{{ _('Upload Log') }}</h3>
<ul class="activity">
{% for item in status.task_info.logs %}
{% set icon = 'ok' if item.level == 'INFO' else 'exclamation' %}
{% set class = ' failure' if icon == 'exclamation' else ' success' %}
{% set popover_content = 'test' %}
<li class="item no-avatar{{ class }}">
<i class="icon icon-{{ icon }}"></i>
<p>
{{ item.message | urlize }}<br>
<span class="date" title="{{ h.render_datetime(item.timestamp, with_hours=True) }}">
{{ h.time_ago_from_timestamp(item.timestamp) }}
<a href="#" data-target="popover" data-content="<dl>{% for key, value in item.iteritems() %}<dt>{{ key }}</dt><dd>{{ h.clean_html(value) }}</dd>{% endfor %}</dl>" data-html="true">{{ _('Details') }}</a>
</span>
</p>
</li>
{% endfor %}
<li class="item no-avatar">
<i class="icon icon-info"></i>
<p class="muted">{{ _('End of log') }}</p>
</li>
</ul>
{% endif %}
{% endblock %}