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:
@@ -60,7 +60,7 @@ import (
|
|||||||
usersvc "git.netcell-it.de/projekte/edgeguard-native/internal/services/users"
|
usersvc "git.netcell-it.de/projekte/edgeguard-native/internal/services/users"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version = "1.1.83"
|
var version = "1.1.84"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
addr := os.Getenv("EDGEGUARD_API_ADDR")
|
addr := os.Getenv("EDGEGUARD_API_ADDR")
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"git.netcell-it.de/projekte/edgeguard-native/internal/services/setup"
|
"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
|
const usage = `edgeguard-ctl — EdgeGuard CLI
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import (
|
|||||||
"git.netcell-it.de/projekte/edgeguard-native/internal/services/tlscerts"
|
"git.netcell-it.de/projekte/edgeguard-native/internal/services/tlscerts"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version = "1.1.83"
|
var version = "1.1.84"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// renewTickInterval — how often we re-evaluate expiring certs.
|
// renewTickInterval — how often we re-evaluate expiring certs.
|
||||||
|
|||||||
@@ -773,7 +773,10 @@
|
|||||||
"free": "frei",
|
"free": "frei",
|
||||||
"conntrack": "Conntrack",
|
"conntrack": "Conntrack",
|
||||||
"uptime": "Uptime"
|
"uptime": "Uptime"
|
||||||
}
|
},
|
||||||
|
"licenseOk": "Lizenz OK",
|
||||||
|
"licenseTrial": "Trial",
|
||||||
|
"licenseTrialDays": "Trial · {{days}}d"
|
||||||
},
|
},
|
||||||
"ntp": {
|
"ntp": {
|
||||||
"title": "Zeitserver (Chrony)",
|
"title": "Zeitserver (Chrony)",
|
||||||
|
|||||||
@@ -773,7 +773,10 @@
|
|||||||
"free": "free",
|
"free": "free",
|
||||||
"conntrack": "Conntrack",
|
"conntrack": "Conntrack",
|
||||||
"uptime": "Uptime"
|
"uptime": "Uptime"
|
||||||
}
|
},
|
||||||
|
"licenseOk": "License OK",
|
||||||
|
"licenseTrial": "Trial",
|
||||||
|
"licenseTrialDays": "Trial · {{days}}d"
|
||||||
},
|
},
|
||||||
"ntp": {
|
"ntp": {
|
||||||
"title": "Time server (Chrony)",
|
"title": "Time server (Chrony)",
|
||||||
|
|||||||
@@ -216,11 +216,13 @@ export default function BackendsPage() {
|
|||||||
void qc.invalidateQueries({ queryKey: ['backends'] })
|
void qc.invalidateQueries({ queryKey: ['backends'] })
|
||||||
void qc.invalidateQueries({ queryKey: ['domains'] })
|
void qc.invalidateQueries({ queryKey: ['domains'] })
|
||||||
},
|
},
|
||||||
|
onError: (e: Error) => message.error(e.message),
|
||||||
})
|
})
|
||||||
|
|
||||||
const del = useMutation({
|
const del = useMutation({
|
||||||
mutationFn: async (id: number) => { await apiClient.delete(`/backends/${id}`) },
|
mutationFn: async (id: number) => { await apiClient.delete(`/backends/${id}`) },
|
||||||
onSuccess: () => { void qc.invalidateQueries({ queryKey: ['backends'] }) },
|
onSuccess: () => { void qc.invalidateQueries({ queryKey: ['backends'] }) },
|
||||||
|
onError: (e: Error) => message.error(e.message),
|
||||||
})
|
})
|
||||||
const quickToggle = useMutation({
|
const quickToggle = useMutation({
|
||||||
mutationFn: async ({ id, row, checked }: { id: number; row: Backend; checked: boolean }) => {
|
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.weight'), dataIndex: 'weight', width: 80 },
|
||||||
{ title: t('backends.server.backup'), dataIndex: 'backup',
|
{ 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,
|
title: t('backends.active'), dataIndex: 'active', width: 80,
|
||||||
render: (v: boolean, row: BackendServer) => (
|
render: (v: boolean, row: BackendServer) => (
|
||||||
|
|||||||
@@ -713,6 +713,7 @@ function LicenseChip({ data }: { data: {
|
|||||||
expires_at?: string
|
expires_at?: string
|
||||||
license_key?: string
|
license_key?: string
|
||||||
}}) {
|
}}) {
|
||||||
|
const { t } = useTranslation()
|
||||||
const exp = data.valid_until ?? data.expires_at
|
const exp = data.valid_until ?? data.expires_at
|
||||||
const days = exp ? Math.ceil((new Date(exp).getTime() - Date.now()) / 86_400_000) : null
|
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')
|
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>
|
return <Tag color="red">{data.status}</Tag>
|
||||||
}
|
}
|
||||||
if (isTrial) {
|
if (isTrial) {
|
||||||
if (days != null && days <= 7) return <Tag color="red">Trial · {days}d</Tag>
|
const trialLabel = days != null
|
||||||
if (days != null && days <= 14) return <Tag color="orange">Trial · {days}d</Tag>
|
? t('dashboard.licenseTrialDays', { days })
|
||||||
return <Tag color="blue">{days != null ? `Trial · ${days}d` : 'Trial'}</Tag>
|
: 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') {
|
if (data.status === 'active') {
|
||||||
return <Tag color="green">License OK</Tag>
|
return <Tag color="green">{t('dashboard.licenseOk')}</Tag>
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ export default function DomainsPage() {
|
|||||||
form.resetFields()
|
form.resetFields()
|
||||||
void qc.invalidateQueries({ queryKey: ['domains'] })
|
void qc.invalidateQueries({ queryKey: ['domains'] })
|
||||||
},
|
},
|
||||||
|
onError: (e: Error) => message.error(e.message),
|
||||||
})
|
})
|
||||||
|
|
||||||
const del = useMutation({
|
const del = useMutation({
|
||||||
@@ -176,6 +177,7 @@ export default function DomainsPage() {
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
void qc.invalidateQueries({ queryKey: ['domains'] })
|
void qc.invalidateQueries({ queryKey: ['domains'] })
|
||||||
},
|
},
|
||||||
|
onError: (e: Error) => message.error(e.message),
|
||||||
})
|
})
|
||||||
const quickToggle = useMutation({
|
const quickToggle = useMutation({
|
||||||
mutationFn: async ({ id, row, checked }: { id: number; row: Domain; checked: boolean }) => {
|
mutationFn: async ({ id, row, checked }: { id: number; row: Domain; checked: boolean }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user