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:
@@ -773,7 +773,10 @@
|
||||
"free": "frei",
|
||||
"conntrack": "Conntrack",
|
||||
"uptime": "Uptime"
|
||||
}
|
||||
},
|
||||
"licenseOk": "Lizenz OK",
|
||||
"licenseTrial": "Trial",
|
||||
"licenseTrialDays": "Trial · {{days}}d"
|
||||
},
|
||||
"ntp": {
|
||||
"title": "Zeitserver (Chrony)",
|
||||
|
||||
@@ -773,7 +773,10 @@
|
||||
"free": "free",
|
||||
"conntrack": "Conntrack",
|
||||
"uptime": "Uptime"
|
||||
}
|
||||
},
|
||||
"licenseOk": "License OK",
|
||||
"licenseTrial": "Trial",
|
||||
"licenseTrialDays": "Trial · {{days}}d"
|
||||
},
|
||||
"ntp": {
|
||||
"title": "Time server (Chrony)",
|
||||
|
||||
@@ -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) => (
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
Reference in New Issue
Block a user