depicts/templates/query_list.html

80 lines
2 KiB
HTML
Raw Normal View History

2019-11-26 14:01:14 +00:00
{% extends "base.html" %}
2019-11-26 16:09:30 +00:00
{% block title %}Wikidata Query Service report{% endblock %}
2019-11-26 14:01:14 +00:00
{% block content %}
<div class="p-2">
<div class="container">
2019-11-26 16:07:57 +00:00
<div class="row">
<div class="col">
2019-11-26 16:09:30 +00:00
<h1>{{ self.title() }}</h1>
2019-11-26 16:07:57 +00:00
<p>This report lists every query sent to the <a href="https://query.wikidata.org/">Wikidata Query Service</a> (WQDS) by WADE. Failed queries are in red.</p>
</div>
</div>
2019-11-26 14:01:14 +00:00
<div class="row">
<div class="col-2">when</div>
2019-11-26 17:21:58 +00:00
<div class="col-4">page</div>
<div class="col-1">time</div>
<div class="col-2">template</div>
2019-11-26 14:01:14 +00:00
<div class="col">options</div>
</div>
{% for obj in q %}
{% if obj.status_code != 200 %}{% set class=" text-light bg-danger"%}{% endif %}
<div class="row">
<div class="col-2{{ class }}">
{{ obj.start_time.strftime('%Y %b %d %H:%M') }}
</div>
2019-11-26 17:21:58 +00:00
<div class="col-4"><a href="{{ obj.path }}">{{ obj.path }}</a></div>
<div class="col-1{{ class }}">
{{ obj.display_seconds }}&nbsp;secs
</div>
2019-11-26 14:01:14 +00:00
<div class="col-2{{ class }}">
2019-11-26 17:21:58 +00:00
{{ obj.template or '' }}
2019-11-26 14:01:14 +00:00
</div>
<div class="col">
2019-11-26 17:21:58 +00:00
<a href="#" class="toggle" data-id="{{ obj.id }}">show/hide</a> |
<a href="https://query.wikidata.org/#{{ obj.sparql_query | urlencode }}">run</a>
2019-11-26 14:01:14 +00:00
</div>
</div>
<div id="query_{{ obj.id }}" class="row sparql">
<div class="col">
<pre>{{ obj.sparql_query }}</pre>
</div>
</div>
<div class="row error">
<div class="col">
{% if obj.status_code != 200 %}
<div>status code: {{ obj.status_code }}</div>
<pre>{{ obj.error_text }}</pre>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
{% block script %}
<script>
$('.sparql').hide();
$('.error').hide();
$('.toggle').click(function() {
var query_id = $(this).data('id');
$('#query_' + query_id).toggle();
});
</script>
{% endblock %}