fix(geoportal-v2): cladiri-aware deep-enrich button + clearer error
Marius hit "Parcela nu există în baza centrală gis_core." on building
304629-C3 (siruta=54975) — feature exists in gis_core (verified, id
70fd7485-fa39-4c38-9074-cfad154ed288) but orchestrator's
parcel-deep-enrich hardcodes layerId='TERENURI_ACTIVE' in its
pre-flight lookup:
// gis-sync-orchestrator src/lib/parcel-deep-enrich/fetch.ts L232–240
SELECT id, attributes, enrichment, "enrichedAt"
FROM gis_core."GisFeature"
WHERE "layerId" = 'TERENURI_ACTIVE'
AND siruta = $1 AND "cadastralRef" = $2
LIMIT 1
→ throws ParcelNotFoundError for any CLADIRI cadref. Architots
mapped that to a misleading "doesn't exist" message even though
by-ref correctly retrieved the building row up-front.
Architots-side fix (the proper fix is on orchestrator):
1. Error message for `parcel_not_found` now branches on
feature.layerId. For CLADIRI_ACTIVE the user sees:
"Deep-enrich nu suportă încă construcțiile — datele clădirii
vin via parcela părinte (gis-api orchestrator side)."
No more "parcela nu există" confusion when the parcel obviously
does.
2. "Actualizează" / "Încarcă din ANCPI" button in the Date eTerra
header is now disabled when isCladiri. Tooltip explains why.
The button is the one that triggers refreshFromAncpi →
/parcel/enrich → the very orchestrator path that doesn't handle
buildings.
Result: building panels show whatever's in gis_core (CLADIRE_TYPE,
CLADIRE_DESTINATIE, etc. if previously enriched via eterra.live's own
flow) and don't pretend they can be re-fetched.
Next step (orchestrator session): teach loadFeature() to accept an
optional layerId param OR auto-detect from cadref-suffix pattern
(/-C\\d+$/) so /parcel/enrich works for both layers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -873,11 +873,13 @@ export function FeatureInfoPanel({ feature, onClose, onSelectFeature, basic = fa
|
||||
: error === "no_immovable_match"
|
||||
? "Parcela nu există în baza eTerra (cadref + SIRUTA nu se potrivesc)."
|
||||
: error === "parcel_not_found"
|
||||
? "Parcela nu există în baza centrală gis_core."
|
||||
? isCladiri
|
||||
? "Deep-enrich nu suportă încă construcțiile — datele clădirii vin via parcela părinte (gis-api orchestrator side)."
|
||||
: "Parcela nu există în baza centrală gis_core."
|
||||
: error === "eterra_fetch_failed"
|
||||
? "eTerra ANCPI nu răspunde momentan. Reîncearcă în 1-2 minute."
|
||||
: error === "search_limit_exceeded"
|
||||
? "Numărul cadastral e foarte comun (sute de parcele). gis-api are limit 50 la căutare — aceasta nu apare. Trebuie un endpoint /parcela/by-ref dedicat."
|
||||
? "Numărul cadastral e foarte comun (sute de parcele). gis-api are limit 50 la căutare — aceasta nu apare."
|
||||
: `Eroare: ${error}`}
|
||||
</span>
|
||||
</div>
|
||||
@@ -936,7 +938,8 @@ export function FeatureInfoPanel({ feature, onClose, onSelectFeature, basic = fa
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => refreshFromAncpi({ manual: true })}
|
||||
disabled={refreshing || !feature.siruta || !feature.cadastralRef}
|
||||
disabled={refreshing || !feature.siruta || !feature.cadastralRef || isCladiri}
|
||||
title={isCladiri ? "Deep-enrich pentru construcții nu e încă suportat de orchestrator" : undefined}
|
||||
className={cn(
|
||||
"ml-auto inline-flex h-7 shrink-0 items-center gap-1.5 whitespace-nowrap rounded px-2 text-[11px] font-medium transition-colors",
|
||||
"border bg-background hover:bg-muted disabled:opacity-50",
|
||||
|
||||
Reference in New Issue
Block a user