- create i18n.py for managing translations and resolving locale - add German and English translations for various UI components - integrate translation functions into templates for dynamic language support
131 lines
5.8 KiB
HTML
131 lines
5.8 KiB
HTML
{% extends "base.html" %}
|
||
{% block content %}
|
||
<div class="flex flex-col gap-4">
|
||
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
|
||
<div>
|
||
<h1 class="text-lg font-semibold tracking-tight">{{ t("server_list.title") }}</h1>
|
||
<p class="text-xs text-slate-400">
|
||
{{ t("server_list.subtitle") }}
|
||
</p>
|
||
</div>
|
||
<div class="flex items-center gap-3 text-xs text-slate-400">
|
||
{% if not can_encrypt %}
|
||
<span class="px-2 py-1 rounded-md border border-amber-500/60 bg-amber-500/10 text-amber-200">
|
||
{{ t("warning.no_encryption") }}
|
||
</span>
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
|
||
{% if stats %}
|
||
<!-- Small dashboard summary row -->
|
||
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3 text-xs">
|
||
<div class="rounded-xl border border-slate-800 bg-slate-900/70 px-3 py-3 flex flex-col">
|
||
<span class="text-[11px] text-slate-400 mb-1">{{ t("stats.total") }}</span>
|
||
<span class="text-lg font-semibold text-slate-100">
|
||
{{ stats.total_servers }}
|
||
</span>
|
||
<span class="text-[11px] text-slate-500 mt-1">{{ t("stats.active") }}</span>
|
||
</div>
|
||
<div class="rounded-xl border border-slate-800 bg-slate-900/70 px-3 py-3 flex flex-col">
|
||
<span class="text-[11px] text-slate-400 mb-1">{{ t("stats.costs") }}</span>
|
||
<span class="text-lg font-semibold text-slate-100">
|
||
{{ "%.2f"|format(stats.monthly_total) }}
|
||
{% if stats.monthly_currency %} {{ stats.monthly_currency }}{% endif %}
|
||
</span>
|
||
<span class="text-[11px] text-slate-500 mt-1">
|
||
{{ t("stats.per_month") }}{% if stats.mixed_currencies %} {{ t("stats.mixed_currencies") }}{% endif %}
|
||
</span>
|
||
</div>
|
||
<div class="rounded-xl border border-amber-500/40 bg-amber-500/10 px-3 py-3 flex flex-col">
|
||
<span class="text-[11px] text-amber-200 mb-1">{{ t("stats.expiring_soon") }}</span>
|
||
<span class="text-lg font-semibold text-amber-100">
|
||
{{ stats.expiring_soon }}
|
||
</span>
|
||
<span class="text-[11px] text-amber-200/80 mt-1">{{ t("stats.expiring_soon_hint") }}</span>
|
||
</div>
|
||
<div class="rounded-xl border border-rose-600/60 bg-rose-600/10 px-3 py-3 flex flex-col">
|
||
<span class="text-[11px] text-rose-100 mb-1">{{ t("stats.expired") }}</span>
|
||
<span class="text-lg font-semibold text-rose-50">
|
||
{{ stats.expired }}
|
||
</span>
|
||
<span class="text-[11px] text-rose-100/80 mt-1">{{ t("stats.expired_hint") }}</span>
|
||
</div>
|
||
</div>
|
||
{% endif %}
|
||
|
||
{% if servers %}
|
||
<div class="overflow-hidden rounded-xl border border-slate-800 bg-slate-900/60">
|
||
<table class="min-w-full text-sm">
|
||
<thead class="bg-slate-900/80">
|
||
<tr class="text-xs uppercase tracking-wide text-slate-400">
|
||
<th class="px-3 py-2 text-left">{{ t("table.name") }}</th>
|
||
<th class="px-3 py-2 text-left">{{ t("table.provider") }}</th>
|
||
<th class="px-3 py-2 text-left">{{ t("table.type") }}</th>
|
||
<th class="px-3 py-2 text-left">{{ t("table.location") }}</th>
|
||
<th class="px-3 py-2 text-left">{{ t("table.ipv4") }}</th>
|
||
<th class="px-3 py-2 text-right">{{ t("table.costs") }}</th>
|
||
<th class="px-3 py-2 text-right">{{ t("table.action") }}</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for s in servers %}
|
||
<tr class="border-t border-slate-800/80 hover:bg-slate-800/50">
|
||
<td class="px-3 py-2">
|
||
<div class="flex items-center gap-2">
|
||
<div>
|
||
<a href="/servers/{{ s.id }}" class="text-slate-100 hover:text-indigo-300 font-medium">
|
||
{{ s.name }}
|
||
</a>
|
||
{% if s.hostname %}
|
||
<div class="text-[11px] text-slate-400">{{ s.hostname }}</div>
|
||
{% endif %}
|
||
</div>
|
||
{% if s.is_expired %}
|
||
<span class="inline-flex items-center rounded-full bg-rose-600/15 border border-rose-600/60 px-2 py-0.5 text-[10px] text-rose-200">
|
||
{{ t("status.expired") }}
|
||
</span>
|
||
{% elif s.is_expiring_soon %}
|
||
<span class="inline-flex items-center rounded-full bg-amber-500/15 border border-amber-500/60 px-2 py-0.5 text-[10px] text-amber-200">
|
||
{{ t("status.expiring") }}
|
||
</span>
|
||
{% endif %}
|
||
</div>
|
||
</td>
|
||
<td class="px-3 py-2 text-slate-200">{{ s.provider }}</td>
|
||
<td class="px-3 py-2">
|
||
<span class="inline-flex rounded-full bg-slate-800 px-2 py-0.5 text-[11px] text-slate-300">
|
||
{{ s.type }}
|
||
</span>
|
||
</td>
|
||
<td class="px-3 py-2 text-slate-200">
|
||
{% if s.location %}{{ s.location }}{% else %}<span class="text-slate-500">–</span>{% endif %}
|
||
</td>
|
||
<td class="px-3 py-2 text-slate-200">
|
||
{% if s.ipv4 %}{{ s.ipv4 }}{% else %}<span class="text-slate-500">–</span>{% endif %}
|
||
</td>
|
||
<td class="px-3 py-2 text-right text-slate-200">
|
||
{% if s.price %}
|
||
{{ "%.2f"|format(s.price) }} {{ s.currency }}
|
||
<span class="text-[11px] text-slate-400">/ {{ t("price.month") if s.billing_period == "monthly" else t("price.year") }}</span>
|
||
{% else %}
|
||
<span class="text-slate-500">–</span>
|
||
{% endif %}
|
||
</td>
|
||
<td class="px-3 py-2 text-right text-slate-200">
|
||
<a href="/servers/{{ s.id }}/edit" class="text-indigo-300 hover:text-indigo-200 underline text-xs">
|
||
{{ t("server_detail.edit") }}
|
||
</a>
|
||
</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
{% else %}
|
||
<div class="rounded-xl border border-dashed border-slate-700 bg-slate-900/40 p-6 text-sm text-slate-300">
|
||
{{ t("server_list.empty") }}
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
{% endblock %}
|