feat(parcel-sync): redesign PostGIS/QGIS section with clear instructions
- Renamed "Setup PostGIS" to "Activeaza compatibilitate QGIS" - Tooltip: "Operatie sigura, reversibila. Nu modifica datele existente." - After setup: shows step-by-step QGIS connection instructions (host, port, database, views, SRID) - Button hidden after successful setup (shows instructions instead) - Clear explanation for non-technical users Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3453,79 +3453,112 @@ export function ParcelSyncModule() {
|
||||
<div className="flex items-center gap-2">
|
||||
<Database className="h-4 w-4 text-violet-500" />
|
||||
<span className="text-sm font-semibold">
|
||||
QGIS / PostGIS
|
||||
Conectare QGIS
|
||||
</span>
|
||||
</div>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
disabled={postgisRunning}
|
||||
onClick={() => void handleSetupPostgis()}
|
||||
className="border-violet-300 text-violet-700 dark:border-violet-700 dark:text-violet-300"
|
||||
>
|
||||
{postgisRunning ? (
|
||||
<Loader2 className="h-3.5 w-3.5 animate-spin mr-1.5" />
|
||||
) : (
|
||||
<Database className="h-3.5 w-3.5 mr-1.5" />
|
||||
)}
|
||||
{postgisRunning ? "Se configurează…" : "Setup PostGIS"}
|
||||
</Button>
|
||||
{!postgisResult?.success && (
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
disabled={postgisRunning}
|
||||
onClick={() => void handleSetupPostgis()}
|
||||
className="border-violet-300 text-violet-700 dark:border-violet-700 dark:text-violet-300"
|
||||
>
|
||||
{postgisRunning ? (
|
||||
<Loader2 className="h-3.5 w-3.5 animate-spin mr-1.5" />
|
||||
) : (
|
||||
<Database className="h-3.5 w-3.5 mr-1.5" />
|
||||
)}
|
||||
{postgisRunning
|
||||
? "Se activeaza…"
|
||||
: "Activeaza compatibilitate QGIS"}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-xs">
|
||||
<p className="font-medium">
|
||||
Operatie sigura, reversibila
|
||||
</p>
|
||||
<p className="text-xs mt-1">
|
||||
Creeaza coloane native PostGIS + view-uri read-only
|
||||
pentru QGIS. Nu modifica datele existente. Ruleaza o
|
||||
singura data (~30s).
|
||||
</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<CardContent className="py-3 space-y-2">
|
||||
<CardContent className="py-3 space-y-3">
|
||||
{postgisResult ? (
|
||||
postgisResult.success ? (
|
||||
<div className="space-y-2">
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<CheckCircle2 className="h-4 w-4 text-emerald-500" />
|
||||
<span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">
|
||||
{postgisResult.message}
|
||||
QGIS compatibil — gata de conectare
|
||||
</span>
|
||||
</div>
|
||||
{postgisResult.details && (
|
||||
<div className="rounded bg-muted/50 p-3 text-xs space-y-1 font-mono">
|
||||
<div className="rounded bg-muted/50 p-3 text-xs space-y-2">
|
||||
<p className="font-medium text-sm">
|
||||
Cum te conectezi din QGIS:
|
||||
</p>
|
||||
<ol className="list-decimal list-inside space-y-1 text-muted-foreground">
|
||||
<li>
|
||||
QGIS → Layer → Add Layer → Add PostGIS Layers
|
||||
</li>
|
||||
<li>New connection:</li>
|
||||
</ol>
|
||||
<div className="font-mono bg-background rounded px-2 py-1.5 space-y-0.5">
|
||||
<p>
|
||||
Backfill:{" "}
|
||||
{String(
|
||||
(
|
||||
postgisResult.details as {
|
||||
backfilledFeatures?: number;
|
||||
}
|
||||
).backfilledFeatures ?? 0,
|
||||
)}{" "}
|
||||
features convertite
|
||||
Host: <strong>10.10.10.166</strong>
|
||||
</p>
|
||||
<p>
|
||||
Total cu geometrie nativă:{" "}
|
||||
Port: <strong>5432</strong>
|
||||
</p>
|
||||
<p>
|
||||
Database: <strong>architools_db</strong>
|
||||
</p>
|
||||
<p>
|
||||
Username: <strong>architools_user</strong>
|
||||
</p>
|
||||
</div>
|
||||
<p className="text-muted-foreground">
|
||||
View-uri disponibile (read-only):
|
||||
</p>
|
||||
<div className="font-mono text-muted-foreground">
|
||||
gis_terenuri, gis_cladiri, gis_documentatii,
|
||||
gis_administrativ
|
||||
</div>
|
||||
<p className="text-muted-foreground">
|
||||
SRID: 3844 (Stereo70)
|
||||
</p>
|
||||
{postgisResult.details && (
|
||||
<p className="text-muted-foreground">
|
||||
{String(
|
||||
(
|
||||
postgisResult.details as {
|
||||
totalFeaturesWithGeom?: number;
|
||||
}
|
||||
).totalFeaturesWithGeom ?? 0,
|
||||
)}
|
||||
)}{" "}
|
||||
features cu geometrie nativa
|
||||
</p>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
QGIS → PostgreSQL → 10.10.10.166:5432 /
|
||||
architools_db
|
||||
</p>
|
||||
<p className="text-muted-foreground">
|
||||
View-uri: gis_terenuri, gis_cladiri,
|
||||
gis_documentatii, gis_administrativ
|
||||
</p>
|
||||
<p className="text-muted-foreground">SRID: 3844</p>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-start gap-2">
|
||||
<XCircle className="h-4 w-4 text-red-500 shrink-0 mt-0.5" />
|
||||
<div className="text-sm">
|
||||
<p className="font-medium text-red-700 dark:text-red-400">
|
||||
PostGIS nu este instalat
|
||||
PostGIS nu este instalat pe server
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground mt-1">
|
||||
Instalează PostGIS pe serverul PostgreSQL:
|
||||
Contacteaza administratorul pentru instalare:
|
||||
</p>
|
||||
<code className="text-xs block mt-1 bg-muted rounded px-2 py-1">
|
||||
apt install postgresql-16-postgis-3
|
||||
@@ -3534,11 +3567,17 @@ export function ParcelSyncModule() {
|
||||
</div>
|
||||
)
|
||||
) : (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Creează coloana nativă PostGIS, trigger auto-conversie,
|
||||
index spațial GiST și view-uri QGIS-compatibile. Necesită
|
||||
PostGIS instalat pe server.
|
||||
</p>
|
||||
<div className="text-xs text-muted-foreground space-y-2">
|
||||
<p>
|
||||
Permite conectarea din QGIS direct la baza de date pentru
|
||||
vizualizare si analiza spatiala a parcelelor, cladirilor
|
||||
si limitelor UAT.
|
||||
</p>
|
||||
<p>
|
||||
Apasa butonul pentru a activa — creeaza view-uri read-only
|
||||
(nu modifica datele, nu afecteaza performanta aplicatiei).
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user