summaryrefslogtreecommitdiff
path: root/searx/templates
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-05-19 11:28:57 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2021-05-22 15:17:18 +0200
commit99aaf86b739b8b93ec0f133822753e8c5ea96e0e (patch)
treebec5707b488274eac86efa5fde83a0b415b11111 /searx/templates
parent3014463fedd5a4a1e4a7077578a8095e12390c9a (diff)
downloadsearxng-99aaf86b739b8b93ec0f133822753e8c5ea96e0e.tar.gz
searxng-99aaf86b739b8b93ec0f133822753e8c5ea96e0e.zip
[fix] offline engines: fix templates /stats and /preferences
Diffstat (limited to 'searx/templates')
-rw-r--r--searx/templates/oscar/preferences.html6
-rw-r--r--searx/templates/oscar/stats.html12
-rw-r--r--searx/templates/simple/preferences.html6
-rw-r--r--searx/templates/simple/stats.html13
4 files changed, 20 insertions, 17 deletions
diff --git a/searx/templates/oscar/preferences.html b/searx/templates/oscar/preferences.html
index 33fb41061..352b90eed 100644
--- a/searx/templates/oscar/preferences.html
+++ b/searx/templates/oscar/preferences.html
@@ -25,11 +25,13 @@
<td class="{{ label }}" style="padding: 2px">{{- "" -}}
{%- if stats[engine_name].time != None -%}
<span class="stacked-bar-chart-value">{{- stats[engine_name].time -}}</span>{{- "" -}}
- <span class="stacked-bar-chart" aria-labelledby="{{engine_name}}_chart" aria-hidden="true">{{- "" -}}
+ <span class="stacked-bar-chart" aria-labelledby="{{engine_name}}_chart" aria-hidden="true">
+ {%- if max_rate95 is not none and max_rate95 > 0 -%}
<span style="width: calc(max(2px, 100%*{{ (stats[engine_name].time / max_rate95)|round(3) }}))" class="stacked-bar-chart-median"></span>{{- "" -}}
<span style="width: calc(100%*{{ ((stats[engine_name].rate80 - stats[engine_name].time) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate80"></span>{{- "" -}}
<span style="width: calc(100%*{{ ((stats[engine_name].rate95 - stats[engine_name].rate80) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate95"></span>{{- "" -}}
- <span class="stacked-bar-chart-rate100"></span>{{- "" -}}
+ <span class="stacked-bar-chart-rate100"></span>
+ {%- endif -%}
</span>{{- "" -}}
<div class="engine-tooltip text-left" role="tooltip" id="{{engine_name}}_graph">{{- "" -}}
<p>{{ _('Median') }}: {{ stats[engine_name].time }}</p>{{- "" -}}
diff --git a/searx/templates/oscar/stats.html b/searx/templates/oscar/stats.html
index 94117b673..d9b2ab68e 100644
--- a/searx/templates/oscar/stats.html
+++ b/searx/templates/oscar/stats.html
@@ -52,11 +52,11 @@
{%- endif -%}
</td>
<td class="response-time">
- {%- if engine_stat.total -%}
+ {%- if engine_stat.total is not none -%}
<div class="bar-chart-value">{{- engine_stat.total | round(1) -}}</div>{{- "" -}}
<div class="bar-chart-graph" aria-labelledby="{{engine_stat.name}}_time" aria-hidden="true">{{- "" -}}
- <div class="bar-chart-serie1 bar{{ (100 * engine_stat.http / engine_stats.max_time)|round }}"></div>{{- "" -}}
- <div class="bar-chart-serie2 bar{{ (100 * engine_stat.processing / engine_stats.max_time)|round }}"></div>{{- "" -}}
+ {% if engine_stat.http is not none and engine_stats.max_time %}<div class="bar-chart-serie1 bar{{ (100 * engine_stat.http / engine_stats.max_time)|round }}"></div>{%- endif -%}
+ {% if engine_stat.processing is not none and engine_stats.max_time %}<div class="bar-chart-serie2 bar{{ (100 * engine_stat.processing / engine_stats.max_time)|round }}"></div>{%- endif -%}
</div>
<div class="engine-tooltip text-left" role="tooltip" id="{{engine_stat.name}}_time">{{- "" -}}
<table class="table table-striped">
@@ -69,19 +69,19 @@
<tr>
<th scope="col">{{ _('Median') }}</th>
<td>{{ engine_stat.total }}</td>
- <td>{{ engine_stat.http }}</td>
+ <td>{{ engine_stat.http or '' }}</td>
<td>{{ engine_stat.processing }}</td>
</tr>
<tr>
<th scope="col">{{ _('P80') }}</th>
<td>{{ engine_stat.total_p80 }}</td>
- <td>{{ engine_stat.http_p80 }}</td>
+ <td>{{ engine_stat.http_p80 or '' }}</td>
<td>{{ engine_stat.processing_p80 }}</td>
</tr>
<tr>
<th scope="col">{{ _('P95') }}</th>
<td>{{ engine_stat.total_p95 }}</td>
- <td>{{ engine_stat.http_p95 }}</td>
+ <td>{{ engine_stat.http_p95 or '' }}</td>
<td>{{ engine_stat.processing_p95 }}</td>
</tr>
</table>
diff --git a/searx/templates/simple/preferences.html b/searx/templates/simple/preferences.html
index 6d33233c7..e3b1545b9 100644
--- a/searx/templates/simple/preferences.html
+++ b/searx/templates/simple/preferences.html
@@ -39,11 +39,13 @@
<td class="{{ label }}" style="padding: 2px; width: 13rem;">{{- "" -}}
{%- if stats[engine_name].time != None -%}
<span class="stacked-bar-chart-value">{{- stats[engine_name].time -}}</span>{{- "" -}}
- <span class="stacked-bar-chart" aria-labelledby="{{engine_name}}_chart" aria-hidden="true">{{- "" -}}
+ <span class="stacked-bar-chart" aria-labelledby="{{engine_name}}_chart" aria-hidden="true">
+ {%- if max_rate95 is not none and max_rate95 > 0 -%}
<span style="width: calc(max(2px, 100%*{{ (stats[engine_name].time / max_rate95)|round(3) }}))" class="stacked-bar-chart-median"></span>{{- "" -}}
<span style="width: calc(100%*{{ ((stats[engine_name].rate80 - stats[engine_name].time) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate80"></span>{{- "" -}}
<span style="width: calc(100%*{{ ((stats[engine_name].rate95 - stats[engine_name].rate80) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate95"></span>{{- "" -}}
- <span class="stacked-bar-chart-rate100"></span>{{- "" -}}
+ <span class="stacked-bar-chart-rate100"></span>
+ {%- endif -%}
</span>{{- "" -}}
<div class="engine-tooltip text-left" role="tooltip" id="{{engine_name}}_graph">{{- "" -}}
<p>{{ _('Median') }}: {{ stats[engine_name].time }}</p>{{- "" -}}
diff --git a/searx/templates/simple/stats.html b/searx/templates/simple/stats.html
index 67c9c79cc..7058d04d4 100644
--- a/searx/templates/simple/stats.html
+++ b/searx/templates/simple/stats.html
@@ -52,12 +52,11 @@
{%- endif -%}
</td>
<td class="response-time">
- {%- if engine_stat.total -%}
-
+ {%- if engine_stat.total is not none -%}
<div class="bar-chart-value">{{- engine_stat.total | round(1) -}}</div>{{- "" -}}
<div class="bar-chart-graph" aria-labelledby="{{engine_stat.name}}_time" aria-hidden="true">
- <div class="bar-chart-serie1 bar{{ (100 * engine_stat.http / engine_stats.max_time)|round }}"></div>{{- "" -}}
- <div class="bar-chart-serie2 bar{{ (100 * engine_stat.processing / engine_stats.max_time)|round }}"></div>{{- "" -}}
+ {% if engine_stat.http is not none and engine_stats.max_time %}<div class="bar-chart-serie1 bar{{ (100 * engine_stat.http / engine_stats.max_time)|round }}"></div>{%- endif -%}
+ {% if engine_stat.processing is not none and engine_stats.max_time %}<div class="bar-chart-serie2 bar{{ (100 * engine_stat.processing / engine_stats.max_time)|round }}"></div>{%- endif -%}
</div>
<div class="engine-tooltip" role="tooltip" id="{{engine_stat.name}}_time">{{- "" -}}
<table>
@@ -70,19 +69,19 @@
<tr>
<th scope="col">{{ _('Median') }}</th>
<td>{{ engine_stat.total }}</td>
- <td>{{ engine_stat.http }}</td>
+ <td>{{ engine_stat.http or ''}}</td>
<td>{{ engine_stat.processing }}</td>
</tr>
<tr>
<th scope="col">{{ _('P80') }}</th>
<td>{{ engine_stat.total_p80 }}</td>
- <td>{{ engine_stat.http_p80 }}</td>
+ <td>{{ engine_stat.http_p80 or '' }}</td>
<td>{{ engine_stat.processing_p80 }}</td>
</tr>
<tr>
<th scope="col">{{ _('P95') }}</th>
<td>{{ engine_stat.total_p95 }}</td>
- <td>{{ engine_stat.http_p95 }}</td>
+ <td>{{ engine_stat.http_p95 or '' }}</td>
<td>{{ engine_stat.processing_p95 }}</td>
</tr>
</table>