feat(settings): Copy + Download buttons for config preview

v1.1.100

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-05-25 10:48:45 +02:00
parent 757b58f607
commit 57b9cd89b2
7 changed files with 35 additions and 6 deletions

View File

@@ -1 +1 @@
1.1.99
1.1.100

View File

@@ -60,7 +60,7 @@ import (
usersvc "git.netcell-it.de/projekte/edgeguard-native/internal/services/users"
)
var version = "1.1.99"
var version = "1.1.100"
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.99"
var version = "1.1.100"
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.99"
var version = "1.1.100"
const (
// renewTickInterval — how often we re-evaluate expiring certs.

View File

@@ -596,6 +596,7 @@
"configPreviewCardTitle": "Config-Vorschau",
"configPreviewBtn": "Vorschau laden",
"configPreviewHint": "Rendert die gewählte Service-Config aus dem aktuellen DB-State. Nur Lesezugriff — es wird nichts auf Disk geschrieben oder neu geladen.",
"configCopied": "Config in Zwischenablage kopiert",
"passwordCardTitle": "Admin-Passwort ändern",
"currentPassword": "Aktuelles Passwort",
"newPassword": "Neues Passwort",

View File

@@ -596,6 +596,7 @@
"configPreviewCardTitle": "Config preview",
"configPreviewBtn": "Load preview",
"configPreviewHint": "Renders the selected service config from the current DB state. Read-only — nothing is written to disk or reloaded.",
"configCopied": "Config copied to clipboard",
"passwordCardTitle": "Change admin password",
"currentPassword": "Current password",
"newPassword": "New password",

View File

@@ -1,5 +1,5 @@
import { Alert, Button, Card, Descriptions, Form, Input, InputNumber, Select, Space, Spin, Switch, Tooltip, Typography, message } from 'antd'
import { CloudDownloadOutlined, CloudSyncOutlined, CodeOutlined, DatabaseOutlined, ExclamationCircleOutlined, FileSearchOutlined, GlobalOutlined, LockOutlined, MailOutlined, ReloadOutlined, SettingOutlined, StopOutlined, ToolOutlined } from '@ant-design/icons'
import { CloudDownloadOutlined, CloudSyncOutlined, CodeOutlined, CopyOutlined, DatabaseOutlined, DownloadOutlined, ExclamationCircleOutlined, FileSearchOutlined, GlobalOutlined, LockOutlined, MailOutlined, ReloadOutlined, SettingOutlined, StopOutlined, ToolOutlined } from '@ant-design/icons'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -702,7 +702,7 @@ export default function SettingsPage() {
size="small"
>
<Space direction="vertical" size={8} style={{ width: '100%' }}>
<Space>
<Space wrap>
<Select
value={previewGen}
onChange={(v) => setPreviewGen(v)}
@@ -723,6 +723,33 @@ export default function SettingsPage() {
>
{t('settings.configPreviewBtn')}
</Button>
{previewData?.content && (
<>
<Button
icon={<CopyOutlined />}
onClick={() => {
void navigator.clipboard.writeText(previewData.content)
void msg.success(t('settings.configCopied'))
}}
>
{t('common.copy')}
</Button>
<Button
icon={<DownloadOutlined />}
onClick={() => {
const blob = new Blob([previewData.content], { type: 'text/plain' })
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = `${previewData.generator}.conf`
a.click()
URL.revokeObjectURL(url)
}}
>
{t('common.download')}
</Button>
</>
)}
</Space>
{previewData?.content && (
<pre style={{