summaryrefslogtreecommitdiff
path: root/searx/templates
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-04-22 17:47:53 +0200
committerAlexandre Flament <alex@al-f.net>2021-04-24 06:58:49 +0200
commit09e7ecdce22733be82bb141355c646ddec538714 (patch)
tree03d401cbd20e41cc81e88a03e03b2a647149df61 /searx/templates
parentc54bf42cb9699501ccbd54a2df0d7fa73be8dcdb (diff)
[mod] /stats : add reliability column and sort by column links
Diffstat (limited to 'searx/templates')
-rw-r--r--searx/templates/oscar/stats.html28
1 files changed, 22 insertions, 6 deletions
diff --git a/searx/templates/oscar/stats.html b/searx/templates/oscar/stats.html
index 0851343ce..149522226 100644
--- a/searx/templates/oscar/stats.html
+++ b/searx/templates/oscar/stats.html
@@ -1,6 +1,5 @@
{% extends "oscar/base.html" %}
{% block styles %}
- <link rel="stylesheet" href="{{ url_for('static', filename='css/charts.min.css') }}" type="text/css" />
<style>
#engine-times {
--labels-size: 20rem;
@@ -12,6 +11,15 @@
</style>
{% endblock %}
{% block title %}{{ _('stats') }} - {% endblock %}
+
+{%- macro th_sort(column_order, column_name) -%}
+ {% if column_order==sort_order %}
+ {{ column_name }} {{ icon('chevron-down') }}
+ {% else %}
+ <a href="{{ url_for('stats', sort=column_order) }}">{{ column_name }}
+ {% endif %}
+{%- endmacro -%}
+
{% block content %}
<div class="container-fluid">
<h1>{{ _('Engine stats') }}</h1>
@@ -25,27 +33,33 @@
{% else %}
<table class="table table-hover table-condensed table-striped">
<tr>
- <th scope="col" style="width:20rem;">{{ _("Engine name") }}</th>
- <th scope="col" style="width:7rem; text-align: right;">{{ _('Scores') }}</th>
- <th scope="col">{{ _('Number of results') }}</th>
- <th scope="col">{{ _('Response time') }}</th>
+ <th scope="col" style="width:20rem;">{{ th_sort('name', _("Engine name")) }}</th>
+ <th scope="col" style="width:7rem; text-align: right;">{{ th_sort('score', _('Scores')) }}</th>
+ <th scope="col">{{ th_sort('result_count', _('Result count')) }}</th>
+ <th scope="col">{{ th_sort('time', _('Response time')) }}</th>
+ <th scope="col" style="text-align: right;">{{ th_sort('reliability', _('Reliability')) }}</th>
</tr>
{% for engine_stat in engine_stats.get('time', []) %}
<tr>
<td>{{ engine_stat.name }}</td>
<td style="text-align: right;">
+ {% if engine_stat.score %}
<span aria-labelledby="{{engine_stat.name}}_score" >{{ engine_stat.score|round(1) }}</span>
<div class="engine-tooltip text-left" role="tooltip" id="{{engine_name}}_score">{{- "" -}}
<p>{{ _('Scores per result') }}: {{ engine_stat.score_per_result | round(3) }}</p>
</div>
+ {% endif %}
</td>
<td>
+ {%- if engine_stat.result_count -%}
<span class="stacked-bar-chart-value">{{- engine_stat.result_count | int -}}</span>{{- "" -}}
<span class="stacked-bar-chart" aria-labelledby="{{engine_stat.name}}_chart_result_count" aria-hidden="true">{{- "" -}}
<span style="width: calc(max(2px, 100%*{{ (engine_stat.result_count / engine_stats.max_result_count )|round(3) }}))" class="stacked-bar-chart-serie1"></span>{{- "" -}}
- </span>{{- "" -}}
+ </span>
+ {%- endif -%}
</td>
<td>
+ {%- if engine_stat.total -%}
<span class="stacked-bar-chart-value">{{- engine_stat.total | round(1) -}}</span>{{- "" -}}
<span class="stacked-bar-chart" aria-labelledby="{{engine_stat.name}}_chart" aria-hidden="true">{{- "" -}}
<span style="width: calc(max(2px, 100%*{{ (engine_stat.http / engine_stats.max_time )|round(3) }}))" class="stacked-bar-chart-serie1"></span>{{- "" -}}
@@ -79,7 +93,9 @@
</tr>
</table>
</div>
+ {%- endif -%}
</td>
+ <td style="text-align: right;"> {{ engine_reliabilities.get(engine_stat.name, {}).get('reliablity') }}</td>
</tr>
{% endfor %}
</table>