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">
|
<div className="flex items-center gap-2">
|
||||||
<Database className="h-4 w-4 text-violet-500" />
|
<Database className="h-4 w-4 text-violet-500" />
|
||||||
<span className="text-sm font-semibold">
|
<span className="text-sm font-semibold">
|
||||||
QGIS / PostGIS
|
Conectare QGIS
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
{!postgisResult?.success && (
|
||||||
size="sm"
|
<TooltipProvider>
|
||||||
variant="outline"
|
<Tooltip>
|
||||||
disabled={postgisRunning}
|
<TooltipTrigger asChild>
|
||||||
onClick={() => void handleSetupPostgis()}
|
<Button
|
||||||
className="border-violet-300 text-violet-700 dark:border-violet-700 dark:text-violet-300"
|
size="sm"
|
||||||
>
|
variant="outline"
|
||||||
{postgisRunning ? (
|
disabled={postgisRunning}
|
||||||
<Loader2 className="h-3.5 w-3.5 animate-spin mr-1.5" />
|
onClick={() => void handleSetupPostgis()}
|
||||||
) : (
|
className="border-violet-300 text-violet-700 dark:border-violet-700 dark:text-violet-300"
|
||||||
<Database className="h-3.5 w-3.5 mr-1.5" />
|
>
|
||||||
)}
|
{postgisRunning ? (
|
||||||
{postgisRunning ? "Se configurează…" : "Setup PostGIS"}
|
<Loader2 className="h-3.5 w-3.5 animate-spin mr-1.5" />
|
||||||
</Button>
|
) : (
|
||||||
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<CardContent className="py-3 space-y-2">
|
<CardContent className="py-3 space-y-3">
|
||||||
{postgisResult ? (
|
{postgisResult ? (
|
||||||
postgisResult.success ? (
|
postgisResult.success ? (
|
||||||
<div className="space-y-2">
|
<div className="space-y-3">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<CheckCircle2 className="h-4 w-4 text-emerald-500" />
|
<CheckCircle2 className="h-4 w-4 text-emerald-500" />
|
||||||
<span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">
|
<span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">
|
||||||
{postgisResult.message}
|
QGIS compatibil — gata de conectare
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{postgisResult.details && (
|
<div className="rounded bg-muted/50 p-3 text-xs space-y-2">
|
||||||
<div className="rounded bg-muted/50 p-3 text-xs space-y-1 font-mono">
|
<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>
|
<p>
|
||||||
Backfill:{" "}
|
Host: <strong>10.10.10.166</strong>
|
||||||
{String(
|
|
||||||
(
|
|
||||||
postgisResult.details as {
|
|
||||||
backfilledFeatures?: number;
|
|
||||||
}
|
|
||||||
).backfilledFeatures ?? 0,
|
|
||||||
)}{" "}
|
|
||||||
features convertite
|
|
||||||
</p>
|
</p>
|
||||||
<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(
|
{String(
|
||||||
(
|
(
|
||||||
postgisResult.details as {
|
postgisResult.details as {
|
||||||
totalFeaturesWithGeom?: number;
|
totalFeaturesWithGeom?: number;
|
||||||
}
|
}
|
||||||
).totalFeaturesWithGeom ?? 0,
|
).totalFeaturesWithGeom ?? 0,
|
||||||
)}
|
)}{" "}
|
||||||
|
features cu geometrie nativa
|
||||||
</p>
|
</p>
|
||||||
<p className="text-muted-foreground mt-1">
|
)}
|
||||||
QGIS → PostgreSQL → 10.10.10.166:5432 /
|
</div>
|
||||||
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">
|
<div className="flex items-start gap-2">
|
||||||
<XCircle className="h-4 w-4 text-red-500 shrink-0 mt-0.5" />
|
<XCircle className="h-4 w-4 text-red-500 shrink-0 mt-0.5" />
|
||||||
<div className="text-sm">
|
<div className="text-sm">
|
||||||
<p className="font-medium text-red-700 dark:text-red-400">
|
<p className="font-medium text-red-700 dark:text-red-400">
|
||||||
PostGIS nu este instalat
|
PostGIS nu este instalat pe server
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-muted-foreground mt-1">
|
<p className="text-xs text-muted-foreground mt-1">
|
||||||
Instalează PostGIS pe serverul PostgreSQL:
|
Contacteaza administratorul pentru instalare:
|
||||||
</p>
|
</p>
|
||||||
<code className="text-xs block mt-1 bg-muted rounded px-2 py-1">
|
<code className="text-xs block mt-1 bg-muted rounded px-2 py-1">
|
||||||
apt install postgresql-16-postgis-3
|
apt install postgresql-16-postgis-3
|
||||||
@@ -3534,11 +3567,17 @@ export function ParcelSyncModule() {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<p className="text-xs text-muted-foreground">
|
<div className="text-xs text-muted-foreground space-y-2">
|
||||||
Creează coloana nativă PostGIS, trigger auto-conversie,
|
<p>
|
||||||
index spațial GiST și view-uri QGIS-compatibile. Necesită
|
Permite conectarea din QGIS direct la baza de date pentru
|
||||||
PostGIS instalat pe server.
|
vizualizare si analiza spatiala a parcelelor, cladirilor
|
||||||
</p>
|
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>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Reference in New Issue
Block a user