From 736270b08c7bdf43f013c4c12683122f2f1d1045 Mon Sep 17 00:00:00 2001 From: rustmailer Date: Thu, 27 Nov 2025 03:53:27 +0800 Subject: [PATCH] feat(dashboard): Display system version and Git hash, link to release tag #19 --- src/modules/dashboard/mod.rs | 6 +++- web/src/api/system/api.ts | 2 ++ web/src/features/dashboard/index.tsx | 44 +++++++++++++++++++++++----- web/src/locales/ar.json | 3 +- web/src/locales/da.json | 3 +- web/src/locales/de.json | 3 +- web/src/locales/en.json | 3 +- web/src/locales/es.json | 3 +- web/src/locales/fi.json | 3 +- web/src/locales/fr.json | 3 +- web/src/locales/it.json | 3 +- web/src/locales/jp.json | 3 +- web/src/locales/ko.json | 3 +- web/src/locales/nl.json | 3 +- web/src/locales/no.json | 3 +- web/src/locales/pt.json | 3 +- web/src/locales/ru.json | 3 +- web/src/locales/sv.json | 3 +- web/src/locales/zh-tw.json | 3 +- web/src/locales/zh.json | 3 +- 20 files changed, 77 insertions(+), 26 deletions(-) diff --git a/src/modules/dashboard/mod.rs b/src/modules/dashboard/mod.rs index f570a13..66b787b 100644 --- a/src/modules/dashboard/mod.rs +++ b/src/modules/dashboard/mod.rs @@ -16,12 +16,12 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - use poem_openapi::Object; use serde::{Deserialize, Serialize}; use tantivy::{schema::Value, TantivyDocument}; use crate::{ + bichon_version, modules::{ account::migration::AccountModel, error::{code::ErrorCode, BichonResult}, @@ -45,6 +45,8 @@ pub struct DashboardStats { pub with_attachment_count: u64, // Emails with attachments pub without_attachment_count: u64, // Emails without attachments pub top_largest_emails: Vec, // Top 10 largest emails + pub system_version: String, // The semantic version string of the currently running backend service + pub commit_hash: String, // Git commit hash used to build this system version } impl DashboardStats { @@ -57,6 +59,8 @@ impl DashboardStats { .map_err(|e| raise_error!(format!("{:#?}", e), ErrorCode::InternalError))?; stat.index_usage_bytes = get_total_size(&DATA_DIR_MANAGER.envelope_dir) .map_err(|e| raise_error!(format!("{:#?}", e), ErrorCode::InternalError))?; + stat.system_version = bichon_version!().to_string(); + stat.commit_hash = env!("GIT_HASH").to_string(); Ok(stat) } } diff --git a/web/src/api/system/api.ts b/web/src/api/system/api.ts index 6f14cb5..1360987 100644 --- a/web/src/api/system/api.ts +++ b/web/src/api/system/api.ts @@ -54,6 +54,8 @@ export interface DashboardStats { with_attachment_count: number; // Emails with attachments without_attachment_count: number; // Emails without attachments top_largest_emails: LargestEmail[]; // Top 10 largest emails + system_version: string, //The semantic version string of the currently running backend service + commit_hash: string //Git commit hash used to build this system version } export interface TimeBucket { diff --git a/web/src/features/dashboard/index.tsx b/web/src/features/dashboard/index.tsx index 3d373ac..99ebd31 100644 --- a/web/src/features/dashboard/index.tsx +++ b/web/src/features/dashboard/index.tsx @@ -10,11 +10,11 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . +// along with this program.  If not, see . import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; @@ -22,7 +22,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'; import { Skeleton } from '@/components/ui/skeleton'; import { XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, PieChart, Pie, Cell, BarChart, Bar } from 'recharts'; -import { Mail, HardDrive, Database, Users, Inbox } from 'lucide-react'; +import { Mail, HardDrive, Database, Users, Inbox, Info } from 'lucide-react'; import { formatBytes, formatNumber } from '@/lib/utils'; import { useQuery } from '@tanstack/react-query'; import { get_dashboard_stats, TimeBucket } from '@/api/system/api'; @@ -94,7 +94,7 @@ export default function MailArchiveDashboard() { queryFn: get_dashboard_stats, }); - const { t } = useTranslation(); + const { t } = useTranslation(); const totalAttachments = (stats?.with_attachment_count ?? 0) + (stats?.without_attachment_count ?? 0); const attachmentRatio = totalAttachments > 0 ? (stats?.with_attachment_count ?? 0) / totalAttachments : 0; @@ -123,8 +123,8 @@ export default function MailArchiveDashboard() { -
- {[...Array(5)].map((_, i) => ( +
+ {[...Array(6)].map((_, i) => ( ))}
@@ -156,8 +156,8 @@ export default function MailArchiveDashboard() {
- -
+ +
{t('dashboard.mailAccounts')} @@ -212,6 +212,29 @@ export default function MailArchiveDashboard() {

{t('dashboard.tantivyIndex')}

+ + + {t('dashboard.systemVersion')} + + + +
+ {stats!.system_version ? ( + + {stats!.system_version} + + ) : 'N/A'} +
+

+ {stats!.commit_hash ?? 'N/A'} +

+
+
@@ -406,6 +429,11 @@ export default function MailArchiveDashboard() {
+ + {/* Footer / Copyright - New Addition */} +
+ © 2025 rustmailer.com - Bichon Email Archiving Project +
); diff --git a/web/src/locales/ar.json b/web/src/locales/ar.json index 789b34d..0b7961b 100644 --- a/web/src/locales/ar.json +++ b/web/src/locales/ar.json @@ -126,7 +126,8 @@ "noRecentActivity": "لا يوجد نشاط حديث", "noSendersData": "لا توجد بيانات للمرسلين", "noLargeEmails": "لا توجد رسائل بريد إلكتروني كبيرة", - "noAccountData": "لا توجد بيانات للحساب" + "noAccountData": "لا توجد بيانات للحساب", + "systemVersion": "إصدار النظام" }, "accounts": { "title": "حسابات البريد الإلكتروني", diff --git a/web/src/locales/da.json b/web/src/locales/da.json index f95d08a..b30b0c1 100644 --- a/web/src/locales/da.json +++ b/web/src/locales/da.json @@ -126,7 +126,8 @@ "noRecentActivity": "Ingen nylig aktivitet", "noSendersData": "Ingen afsenderdata", "noLargeEmails": "Ingen store e-mails", - "noAccountData": "Ingen kontodata" + "noAccountData": "Ingen kontodata", + "systemVersion": "Systemversion" }, "accounts": { "title": "E-mailkonti", diff --git a/web/src/locales/de.json b/web/src/locales/de.json index df497ee..7c0cd7b 100644 --- a/web/src/locales/de.json +++ b/web/src/locales/de.json @@ -126,7 +126,8 @@ "noRecentActivity": "Keine kürzliche Aktivität", "noSendersData": "Keine Absenderdaten", "noLargeEmails": "Keine großen E-Mails", - "noAccountData": "Keine Kontodaten" + "noAccountData": "Keine Kontodaten", + "systemVersion": "Systemversion" }, "accounts": { "title": "E-Mail-Konten", diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 43290fc..5f26891 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -126,7 +126,8 @@ "noRecentActivity": "No recent activity", "noSendersData": "No senders data", "noLargeEmails": "No large emails", - "noAccountData": "No account data" + "noAccountData": "No account data", + "systemVersion": "System Version" }, "accounts": { "title": "Email Accounts", diff --git a/web/src/locales/es.json b/web/src/locales/es.json index 0169b45..7dd0bba 100644 --- a/web/src/locales/es.json +++ b/web/src/locales/es.json @@ -126,7 +126,8 @@ "noRecentActivity": "Sin actividad reciente", "noSendersData": "Sin datos de remitentes", "noLargeEmails": "Sin correos grandes", - "noAccountData": "Sin datos de cuenta" + "noAccountData": "Sin datos de cuenta", + "systemVersion": "Versión del sistema" }, "accounts": { "title": "Cuentas de correo", diff --git a/web/src/locales/fi.json b/web/src/locales/fi.json index 20fe0b3..d39d86d 100644 --- a/web/src/locales/fi.json +++ b/web/src/locales/fi.json @@ -126,7 +126,8 @@ "noRecentActivity": "Ei viimeaikaisia tapahtumia", "noSendersData": "Ei lähettäjätietoja", "noLargeEmails": "Ei suuria sähköposteja", - "noAccountData": "Ei tilitietoja" + "noAccountData": "Ei tilitietoja", + "systemVersion": "Järjestelmäversio" }, "accounts": { "title": "Sähköpostitilit", diff --git a/web/src/locales/fr.json b/web/src/locales/fr.json index 9682d4b..d91d62d 100644 --- a/web/src/locales/fr.json +++ b/web/src/locales/fr.json @@ -126,7 +126,8 @@ "noRecentActivity": "Aucune activité récente", "noSendersData": "Aucune donnée d'expéditeurs", "noLargeEmails": "Aucun gros e-mail", - "noAccountData": "Aucune donnée de compte" + "noAccountData": "Aucune donnée de compte", + "systemVersion": "Version du système" }, "accounts": { "title": "Comptes de Messagerie", diff --git a/web/src/locales/it.json b/web/src/locales/it.json index e6c2291..18183db 100644 --- a/web/src/locales/it.json +++ b/web/src/locales/it.json @@ -126,7 +126,8 @@ "noRecentActivity": "Nessuna attività recente", "noSendersData": "Nessun dato sui mittenti", "noLargeEmails": "Nessuna email di grandi dimensioni", - "noAccountData": "Nessun dato sull'account" + "noAccountData": "Nessun dato sull'account", + "systemVersion": "Versione del sistema" }, "accounts": { "title": "Account Email", diff --git a/web/src/locales/jp.json b/web/src/locales/jp.json index 5c3eca7..3a022a3 100644 --- a/web/src/locales/jp.json +++ b/web/src/locales/jp.json @@ -126,7 +126,8 @@ "noRecentActivity": "最近のアクティビティなし", "noSendersData": "送信者データなし", "noLargeEmails": "サイズの大きいメールなし", - "noAccountData": "アカウントデータなし" + "noAccountData": "アカウントデータなし", + "systemVersion": "システムバージョン" }, "accounts": { "title": "メールアカウント", diff --git a/web/src/locales/ko.json b/web/src/locales/ko.json index 468bac6..5a4697f 100644 --- a/web/src/locales/ko.json +++ b/web/src/locales/ko.json @@ -126,7 +126,8 @@ "noRecentActivity": "최근 활동 없음", "noSendersData": "발신자 데이터 없음", "noLargeEmails": "크기가 큰 이메일 없음", - "noAccountData": "계정 데이터 없음" + "noAccountData": "계정 데이터 없음", + "systemVersion": "시스템 버전" }, "accounts": { "title": "이메일 계정", diff --git a/web/src/locales/nl.json b/web/src/locales/nl.json index 44e89f5..e94e8af 100644 --- a/web/src/locales/nl.json +++ b/web/src/locales/nl.json @@ -126,7 +126,8 @@ "noRecentActivity": "Geen recente activiteit", "noSendersData": "Geen afzendersgegevens", "noLargeEmails": "Geen grote e-mails", - "noAccountData": "Geen accountgegevens" + "noAccountData": "Geen accountgegevens", + "systemVersion": "Systeemversie" }, "accounts": { "title": "E-mailaccounts", diff --git a/web/src/locales/no.json b/web/src/locales/no.json index e20f0c5..4613f13 100644 --- a/web/src/locales/no.json +++ b/web/src/locales/no.json @@ -126,7 +126,8 @@ "noRecentActivity": "Ingen nylig aktivitet", "noSendersData": "Ingen avsenderdata", "noLargeEmails": "Ingen store e-poster", - "noAccountData": "Ingen kontodata" + "noAccountData": "Ingen kontodata", + "systemVersion": "Systemversjon" }, "accounts": { "title": "E-postkontoer", diff --git a/web/src/locales/pt.json b/web/src/locales/pt.json index e8de4fe..232e9f0 100644 --- a/web/src/locales/pt.json +++ b/web/src/locales/pt.json @@ -126,7 +126,8 @@ "noRecentActivity": "Nenhuma Atividade Recente", "noSendersData": "Sem Dados de Remetentes", "noLargeEmails": "Sem Emails Grandes", - "noAccountData": "Sem Dados de Contas" + "noAccountData": "Sem Dados de Contas", + "systemVersion": "Versão do sistema" }, "accounts": { "title": "Contas de Email", diff --git a/web/src/locales/ru.json b/web/src/locales/ru.json index 7b16aed..b81f4d2 100644 --- a/web/src/locales/ru.json +++ b/web/src/locales/ru.json @@ -126,7 +126,8 @@ "noRecentActivity": "Нет недавней активности", "noSendersData": "Нет данных об отправителях", "noLargeEmails": "Нет больших писем", - "noAccountData": "Нет данных об аккаунте" + "noAccountData": "Нет данных об аккаунте", + "systemVersion": "Версия системы" }, "accounts": { "title": "Почтовые учетные записи", diff --git a/web/src/locales/sv.json b/web/src/locales/sv.json index 5a99ef9..3667cce 100644 --- a/web/src/locales/sv.json +++ b/web/src/locales/sv.json @@ -126,7 +126,8 @@ "noRecentActivity": "Ingen nylig aktivitet", "noSendersData": "Inga avsändardata", "noLargeEmails": "Inga stora e-postmeddelanden", - "noAccountData": "Inga kontodata" + "noAccountData": "Inga kontodata", + "systemVersion": "Systemversion" }, "accounts": { "title": "E-postkonton", diff --git a/web/src/locales/zh-tw.json b/web/src/locales/zh-tw.json index 7524b84..c10edcf 100644 --- a/web/src/locales/zh-tw.json +++ b/web/src/locales/zh-tw.json @@ -126,7 +126,8 @@ "noRecentActivity": "無近期活動", "noSendersData": "無寄件人資料", "noLargeEmails": "無大容量郵件", - "noAccountData": "無帳號資料" + "noAccountData": "無帳號資料", + "systemVersion": "系統版本" }, "accounts": { "title": "郵件帳號", diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index 30a5131..528bc8b 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -126,7 +126,8 @@ "noRecentActivity": "无最近活动", "noSendersData": "无发件人数据", "noLargeEmails": "无大邮件", - "noAccountData": "无账户数据" + "noAccountData": "无账户数据", + "systemVersion": "系统版本" }, "accounts": { "title": "邮件账户",