fix(ui): fehlende onError-Handler + i18n in Backends/Domains/Dashboard

- Backends: create + del Mutations bekommen onError; 'Backup'-Tag → t()
- Domains: create + del Mutations bekommen onError
- Dashboard: LicenseChip-Texte ('License OK', 'Trial') in t() überführt;
  useTranslation() direkt in der Komponente verwendet
- en/de: dashboard.licenseOk/licenseTrial/licenseTrialDays ergänzt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-05-24 12:42:37 +02:00
parent ca1ee64829
commit 6e52dc0620
9 changed files with 25 additions and 11 deletions

View File

@@ -1 +1 @@
1.1.83
1.1.84

View File

@@ -60,7 +60,7 @@ import (
usersvc "git.netcell-it.de/projekte/edgeguard-native/internal/services/users"
)
var version = "1.1.83"
var version = "1.1.84"
func main() {
addr := os.Getenv("EDGEGUARD_API_ADDR")

View File

@@ -11,7 +11,7 @@ import (
"git.netcell-it.de/projekte/edgeguard-native/internal/services/setup"
)
var version = "1.1.83"
var version = "1.1.84"
const usage = `edgeguard-ctl — EdgeGuard CLI

View File

@@ -35,7 +35,7 @@ import (
"git.netcell-it.de/projekte/edgeguard-native/internal/services/tlscerts"
)
var version = "1.1.83"
var version = "1.1.84"
const (
// renewTickInterval — how often we re-evaluate expiring certs.

View File

@@ -773,7 +773,10 @@
"free": "frei",
"conntrack": "Conntrack",
"uptime": "Uptime"
}
},
"licenseOk": "Lizenz OK",
"licenseTrial": "Trial",
"licenseTrialDays": "Trial · {{days}}d"
},
"ntp": {
"title": "Zeitserver (Chrony)",

View File

@@ -773,7 +773,10 @@
"free": "free",
"conntrack": "Conntrack",
"uptime": "Uptime"
}
},
"licenseOk": "License OK",
"licenseTrial": "Trial",
"licenseTrialDays": "Trial · {{days}}d"
},
"ntp": {
"title": "Time server (Chrony)",

View File

@@ -216,11 +216,13 @@ export default function BackendsPage() {
void qc.invalidateQueries({ queryKey: ['backends'] })
void qc.invalidateQueries({ queryKey: ['domains'] })
},
onError: (e: Error) => message.error(e.message),
})
const del = useMutation({
mutationFn: async (id: number) => { await apiClient.delete(`/backends/${id}`) },
onSuccess: () => { void qc.invalidateQueries({ queryKey: ['backends'] }) },
onError: (e: Error) => message.error(e.message),
})
const quickToggle = useMutation({
mutationFn: async ({ id, row, checked }: { id: number; row: Backend; checked: boolean }) => {
@@ -453,7 +455,7 @@ function ServerPanel({ backendID }: { backendID: number }) {
},
{ title: t('backends.server.weight'), dataIndex: 'weight', width: 80 },
{ title: t('backends.server.backup'), dataIndex: 'backup',
render: (v: boolean) => v ? <Tag color="purple">Backup</Tag> : '—', width: 100 },
render: (v: boolean) => v ? <Tag color="purple">{t('backends.server.backup')}</Tag> : '—', width: 100 },
{
title: t('backends.active'), dataIndex: 'active', width: 80,
render: (v: boolean, row: BackendServer) => (

View File

@@ -713,6 +713,7 @@ function LicenseChip({ data }: { data: {
expires_at?: string
license_key?: string
}}) {
const { t } = useTranslation()
const exp = data.valid_until ?? data.expires_at
const days = exp ? Math.ceil((new Date(exp).getTime() - Date.now()) / 86_400_000) : null
const isTrial = data.type === 'trial' || (!data.license_key && data.status === 'active')
@@ -720,12 +721,15 @@ function LicenseChip({ data }: { data: {
return <Tag color="red">{data.status}</Tag>
}
if (isTrial) {
if (days != null && days <= 7) return <Tag color="red">Trial · {days}d</Tag>
if (days != null && days <= 14) return <Tag color="orange">Trial · {days}d</Tag>
return <Tag color="blue">{days != null ? `Trial · ${days}d` : 'Trial'}</Tag>
const trialLabel = days != null
? t('dashboard.licenseTrialDays', { days })
: t('dashboard.licenseTrial')
if (days != null && days <= 7) return <Tag color="red">{trialLabel}</Tag>
if (days != null && days <= 14) return <Tag color="orange">{trialLabel}</Tag>
return <Tag color="blue">{trialLabel}</Tag>
}
if (data.status === 'active') {
return <Tag color="green">License OK</Tag>
return <Tag color="green">{t('dashboard.licenseOk')}</Tag>
}
return null
}

View File

@@ -167,6 +167,7 @@ export default function DomainsPage() {
form.resetFields()
void qc.invalidateQueries({ queryKey: ['domains'] })
},
onError: (e: Error) => message.error(e.message),
})
const del = useMutation({
@@ -176,6 +177,7 @@ export default function DomainsPage() {
onSuccess: () => {
void qc.invalidateQueries({ queryKey: ['domains'] })
},
onError: (e: Error) => message.error(e.message),
})
const quickToggle = useMutation({
mutationFn: async ({ id, row, checked }: { id: number; row: Domain; checked: boolean }) => {