This commit is contained in:
Matthias Hochmeister
2026-03-13 13:25:43 +01:00
parent 86bb8a45c1
commit 1d5122a2cd
2 changed files with 42 additions and 31 deletions

View File

@@ -1,8 +1,9 @@
import { useRef, useEffect } from 'react';
import { useRef, useEffect, useCallback } from 'react';
import {
Box, Button, Card, CardContent, Chip, CircularProgress, Typography,
Box, Button, Card, CardContent, Chip, CircularProgress, IconButton, Tooltip, Typography,
} from '@mui/material';
import SyncIcon from '@mui/icons-material/Sync';
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { adminApi } from '../../services/admin';
import { useNotification } from '../../contexts/NotificationContext';
@@ -41,6 +42,14 @@ function FdiskSyncTab() {
const running = data?.running ?? false;
const copyLogs = useCallback(() => {
const text = (data?.logs ?? []).map((e) => e.line).join('\n');
navigator.clipboard.writeText(text).then(
() => showSuccess('Logs kopiert'),
() => showError('Kopieren fehlgeschlagen'),
);
}, [data?.logs, showSuccess, showError]);
return (
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
<Card>
@@ -73,7 +82,20 @@ function FdiskSyncTab() {
<Card>
<CardContent>
<Typography variant="subtitle2" gutterBottom>Protokoll (letzte 500 Zeilen)</Typography>
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 1 }}>
<Typography variant="subtitle2">Protokoll (letzte 500 Zeilen)</Typography>
<Tooltip title="Logs kopieren">
<span>
<IconButton
size="small"
onClick={copyLogs}
disabled={!data?.logs?.length}
>
<ContentCopyIcon fontSize="small" />
</IconButton>
</span>
</Tooltip>
</Box>
{isLoading && (
<Box sx={{ display: 'flex', justifyContent: 'center', py: 4 }}>
<CircularProgress size={28} />