Fix: Display fill operation statistics correctly

Problem: Statistics were empty because frontend was expecting different
field names than backend was returning.

Solution: Updated frontend to match backend response format:
- updates_total, updates_successful, updates_failed
- deletes_total, deletes_successful, deletes_failed
- Added error display for failed operations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Docker Config Backup
2025-10-10 20:17:35 +02:00
parent 8cbc9771ae
commit 414d3c64e8

View File

@@ -185,13 +185,23 @@ export default function DataPreview({ data, loading, formData }: DataPreviewProp
</h3>
<div className={`text-sm ${fillResult.dry_run ? 'text-blue-800' : 'text-green-800'}`}>
<p>Měsíc: {fillResult.month}</p>
<p>Celkem řádků: {fillResult.total_rows}</p>
{fillResult.dry_run ? (
<>
<p>Připraveno aktualizací: {fillResult.updates_prepared}</p>
<p>Připraveno smazání: {fillResult.deletes_prepared}</p>
</>
) : (
<>
<p>Úspěšně vyplněno: {fillResult.successful}</p>
<p>Chyby: {fillResult.failed}</p>
<p>Celkem aktualizací: {fillResult.updates_total}</p>
<p>Úspěšně vyplněno: {fillResult.updates_successful}</p>
<p>Chyby při vyplňování: {fillResult.updates_failed}</p>
{fillResult.deletes_total > 0 && (
<>
<p className="mt-2">Celkem smazání: {fillResult.deletes_total}</p>
<p>Úspěšně smazáno: {fillResult.deletes_successful}</p>
<p>Chyby při mazání: {fillResult.deletes_failed}</p>
</>
)}
</>
)}
{fillResult.dry_run && (
@@ -199,11 +209,19 @@ export default function DataPreview({ data, loading, formData }: DataPreviewProp
DRY RUN MODE - Data nebyla odeslána na web
</p>
)}
{!fillResult.dry_run && fillResult.successful > 0 && (
{!fillResult.dry_run && fillResult.updates_successful > 0 && (
<p className="mt-2 font-semibold text-green-700">
Data byla úspěšně vyplněna. Nyní zkontrolujte na webu a klikněte "Uzavřít měsíc" ručně.
</p>
)}
{!fillResult.dry_run && fillResult.errors && fillResult.errors.length > 0 && (
<div className="mt-2 p-2 bg-red-100 border border-red-300 rounded">
<p className="font-semibold text-red-900">Chyby:</p>
{fillResult.errors.map((err: any, idx: number) => (
<p key={idx} className="text-xs text-red-800"> {err.type} řádek {err.row}: {err.error}</p>
))}
</div>
)}
</div>
</div>
)}