depicts/templates/query_list.html

118 lines
2.9 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">endpoint</div>
2019-11-26 17:21:58 +00:00
<div class="col-2">template</div>
2019-11-26 19:10:30 +00:00
<div class="col-2">when</div>
2019-11-26 20:11:27 +00:00
<div class="col-1">rows</div>
2019-11-26 19:10:30 +00:00
<div class="col-2">time</div>
2019-11-27 09:45:29 +00:00
<div class="col"></div>
2019-11-26 14:01:14 +00:00
</div>
{% for obj in q %}
2019-11-26 19:23:48 +00:00
<div class="border {% if obj.bad %}border-danger{% endif %} my-1 py-1">
<div class="row">
<div class="col-2">{{ obj.endpoint or '' }}</div>
2019-11-26 19:23:48 +00:00
<div class="col-2">
2019-11-26 19:10:30 +00:00
{{ obj.template or '' }}
</div>
2019-11-26 19:23:48 +00:00
<div class="col-2">
2019-11-26 19:01:38 +00:00
{{ obj.start_time.strftime('%Y %b %d %H:%M') }}
2019-11-26 14:01:14 +00:00
</div>
2019-11-26 17:21:58 +00:00
2019-11-26 20:11:27 +00:00
<div class="col-1">
2019-11-27 09:45:29 +00:00
{% if obj.row_count is not none %}
{{ obj.row_count }}
{% elif obj.bad %}
<span class="badge badge-danger">error</span>
{% endif %}
2019-11-26 20:11:27 +00:00
</div>
2019-11-26 19:23:48 +00:00
<div class="col-2">
2019-11-26 19:01:38 +00:00
{% if obj.end_time %}
2019-11-26 19:10:30 +00:00
{{ obj.display_seconds }}&nbsp;seconds
2019-11-26 19:01:38 +00:00
{% else %}
2019-11-26 19:04:09 +00:00
<span class="badge badge-info">running</span>
2019-11-26 19:01:38 +00:00
{% endif %}
2019-11-26 17:21:58 +00:00
</div>
2019-11-26 14:01:14 +00:00
<div class="col">
2019-11-27 09:45:29 +00:00
<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 %}
2019-11-26 19:10:30 +00:00
<a href="https://query.wikidata.org/#{{ obj.sparql_query | urlencode }}">view in WDQS</a>
</div>
2019-11-26 14:01:14 +00:00
</div>
2019-11-26 19:10:30 +00:00
<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>
2019-11-26 14:01:14 +00:00
</div>
<div id="query_{{ obj.id }}" class="row sparql">
<div class="col">
<pre>{{ obj.sparql_query }}</pre>
</div>
</div>
2019-11-27 09:45:29 +00:00
<div id="error_{{ obj.id }}" class="row error">
2019-11-26 14:01:14 +00:00
<div class="col">
{% if obj.status_code != 200 %}
<div>status code: {{ obj.status_code }}</div>
<pre>{{ obj.error_text }}</pre>
{% endif %}
</div>
</div>
2019-11-26 19:23:48 +00:00
</div>
2019-11-26 14:01:14 +00:00
{% endfor %}
</div>
</div>
{% endblock %}
{% block script %}
<script>
$('.sparql').hide();
$('.error').hide();
2019-11-27 09:45:29 +00:00
$('.toggle-sparql').click(function(event) {
event.preventDefault();
2019-11-26 14:01:14 +00:00
var query_id = $(this).data('id');
$('#query_' + query_id).toggle();
});
2019-11-27 09:45:29 +00:00
$('.toggle-error').click(function(event) {
event.preventDefault();
var query_id = $(this).data('id');
$('#error_' + query_id).toggle();
});
2019-11-26 14:01:14 +00:00
</script>
{% endblock %}