Fix sync errors for duplicate projects and add modal scrolling

Root cause: Projects with duplicate (code, variant) pairs fail to sync
due to unique constraint on server. Example: multiple "OPS-1934" projects
with variant="Dell" where one already exists on server.

Fixes:
1. Sync service now detects duplicate (code, variant) on server and links
   local project to existing server project instead of failing
2. Local repair checks for duplicate (code, variant) pairs and deduplicates
   by appending UUID suffix to variant
3. Modal now scrollable with fixed header/footer (max-h-90vh)

This allows users to sync projects that were created offline with
conflicting codes/variants without losing data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 21:25:22 +03:00
parent b153afbf51
commit 8508ee2921
3 changed files with 48 additions and 9 deletions

View File

@@ -45,10 +45,10 @@
<div id="toast" class="fixed bottom-4 right-4 z-50"></div>
<!-- Sync Info Modal -->
<div id="sync-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg shadow-xl max-w-lg w-full mx-4">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<div id="sync-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden p-4">
<div class="bg-white rounded-lg shadow-xl max-w-lg w-full max-h-[90vh] flex flex-col">
<div class="p-6 border-b border-gray-200 flex-shrink-0">
<div class="flex justify-between items-center">
<h3 class="text-lg font-medium text-gray-900">Информация о синхронизации</h3>
<button onclick="closeSyncModal()" class="text-gray-400 hover:text-gray-500">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -56,8 +56,10 @@
</svg>
</button>
</div>
</div>
<div class="space-y-5">
<div class="overflow-y-auto flex-1">
<div class="p-6 space-y-5">
<!-- Section 1: DB Connection -->
<div>
<h4 class="font-medium text-gray-900 mb-2">Подключение к БД</h4>
@@ -144,8 +146,10 @@
</div>
</div>
</div>
</div>
<div class="mt-6 flex justify-end">
<div class="p-6 border-t border-gray-200 flex-shrink-0">
<div class="flex justify-end">
<button onclick="closeSyncModal()" class="px-4 py-2 bg-gray-600 text-white rounded-md hover:bg-gray-700">
Закрыть
</button>