depicts/templates/query_list.html

118 lines
2.9 KiB
HTML

{% extends "base.html" %}
{% block title %}Wikidata Query Service report{% endblock %}
{% block content %}
<div class="p-2">
<div class="container">
<div class="row">
<div class="col">
<h1>{{ self.title() }}</h1>
<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>
<div class="row">
<div class="col-2">endpoint</div>
<div class="col-2">template</div>
<div class="col-2">when</div>
<div class="col-1">rows</div>
<div class="col-2">time</div>
<div class="col"></div>
</div>
{% for obj in q %}
<div class="border {% if obj.bad %}border-danger{% endif %} my-1 py-1">
<div class="row">
<div class="col-2">{{ obj.endpoint or '' }}</div>
<div class="col-2">
{{ obj.template or '' }}
</div>
<div class="col-2">
{{ obj.start_time.strftime('%Y %b %d %H:%M') }}
</div>
<div class="col-1">
{% if obj.row_count is not none %}
{{ obj.row_count }}
{% elif obj.bad %}
<span class="badge badge-danger">error</span>
{% endif %}
</div>
<div class="col-2">
{% if obj.end_time %}
{{ obj.display_seconds }}&nbsp;seconds
{% else %}
<span class="badge badge-info">running</span>
{% endif %}
</div>
<div class="col">
<a href="#" class="toggle-sparql" data-id="{{ obj.id }}">view SPARQL</a> |
{% if obj.bad %}
<a href="#" class="toggle-error" data-id="{{ obj.id }}">view error</a> |
{% endif %}
<a href="https://query.wikidata.org/#{{ obj.sparql_query | urlencode }}">view in WDQS</a>
</div>
</div>
<div class="row">
<div class="col"><a href="{{ obj.path }}">{{ obj.path }}</a></div>
</div>
<div class="row">
<div class="col">{{ obj.page_title or '' }}</div>
</div>
<div id="query_{{ obj.id }}" class="row sparql">
<div class="col">
<pre>{{ obj.sparql_query }}</pre>
</div>
</div>
<div id="error_{{ obj.id }}" 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>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
{% block script %}
<script>
$('.sparql').hide();
$('.error').hide();
$('.toggle-sparql').click(function(event) {
event.preventDefault();
var query_id = $(this).data('id');
$('#query_' + query_id).toggle();
});
$('.toggle-error').click(function(event) {
event.preventDefault();
var query_id = $(this).data('id');
$('#error_' + query_id).toggle();
});
</script>
{% endblock %}