fix: sync now resets installed_version when extension removed from server

- Backend: sync_customer_extensions now sets installed_version=NULL when
  extension is missing_on_server (previously only detected drift without
  updating DB)
- Frontend: refresh button now calls /sync endpoint before reloading,
  ensuring the dashboard reflects actual server state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-30 09:02:11 +00:00
parent 36812af6e7
commit a11ddb82a6
2 changed files with 24 additions and 4 deletions
+18 -4
View File
@@ -204,6 +204,20 @@ function CustomerDetail({ customerId }) {
const [selected, setSelected] = useState(new Set())
const [batchDeploying, setBatchDeploying] = useState(false)
const [batchProgress, setBatchProgress] = useState({ current: 0, total: 0, module: '' })
const [syncing, setSyncing] = useState(false)
const syncAndReload = async () => {
setSyncing(true)
setDeployResult(null)
try {
await fetch('/sync', {
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ customer_id: customerId })
})
} catch (_) {}
reload()
setSyncing(false)
}
if (!customer) return <Loader />
@@ -311,10 +325,10 @@ function CustomerDetail({ customerId }) {
<h3 className="text-xl font-black text-slate-900">{customer.name}</h3>
<p className="text-sm text-slate-500" dir="ltr">{customer.espocrm_url}</p>
</div>
<button onClick={() => reload()}
className="p-2 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-all"
title="רענון הרחבות">
<Icon name="refresh" className="text-lg" />
<button onClick={syncAndReload} disabled={syncing}
className="p-2 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-all disabled:opacity-50"
title="סנכרון מול השרת">
<Icon name="sync" className={`text-lg ${syncing ? 'animate-spin' : ''}`} />
</button>
<button onClick={() => setEditing(true)}
className="p-2 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-all"