fix(geoportal): layers off by default + bulk enrichment feedback
- UAT + Intravilan layers OFF by default (user activates when needed) - Terenuri/Cladiri listed first in panel (most used) - Bulk enrichment: per-feature with progress counter (3/10), success summary - Progress text shown in toolbar during enrichment Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,13 +21,6 @@ type LayerGroupDef = {
|
||||
};
|
||||
|
||||
const LAYER_GROUPS: LayerGroupDef[] = [
|
||||
{
|
||||
id: "uats",
|
||||
label: "Limite UAT",
|
||||
description: "Unitati administrativ-teritoriale",
|
||||
color: "#7c3aed",
|
||||
defaultVisible: true,
|
||||
},
|
||||
{
|
||||
id: "terenuri",
|
||||
label: "Terenuri",
|
||||
@@ -42,10 +35,17 @@ const LAYER_GROUPS: LayerGroupDef[] = [
|
||||
color: "#3b82f6",
|
||||
defaultVisible: true,
|
||||
},
|
||||
{
|
||||
id: "uats",
|
||||
label: "Limite UAT",
|
||||
description: "Unitati administrativ-teritoriale",
|
||||
color: "#7c3aed",
|
||||
defaultVisible: false,
|
||||
},
|
||||
{
|
||||
id: "administrativ",
|
||||
label: "Intravilan",
|
||||
description: "Limite intravilan, arii speciale (zoom >= 10)",
|
||||
description: "Limite intravilan, arii speciale (zoom >= 13)",
|
||||
color: "#ea580c",
|
||||
defaultVisible: false,
|
||||
},
|
||||
|
||||
@@ -43,6 +43,7 @@ export function SelectionToolbar({
|
||||
}: SelectionToolbarProps) {
|
||||
const [exporting, setExporting] = useState(false);
|
||||
const [enriching, setEnriching] = useState(false);
|
||||
const [enrichProgress, setEnrichProgress] = useState("");
|
||||
const active = selectionMode !== "off";
|
||||
|
||||
const handleExport = async (format: ExportFormat) => {
|
||||
@@ -140,21 +141,28 @@ export function SelectionToolbar({
|
||||
<Button
|
||||
variant="ghost" size="sm" className="h-7 px-2 text-xs gap-1"
|
||||
disabled={enriching}
|
||||
title="Enrichment pentru parcelele selectate (obtine proprietari, CF, categorie). Datele se salveaza permanent."
|
||||
title="Enrichment pentru parcelele selectate. Datele se salveaza permanent in baza de date."
|
||||
onClick={async () => {
|
||||
// Get unique SIRUTAs from selected features
|
||||
const sirutas = [...new Set(selectedFeatures.map((f) => String(f.properties.siruta ?? "")).filter(Boolean))];
|
||||
if (sirutas.length === 0) return;
|
||||
setEnriching(true);
|
||||
try {
|
||||
for (const siruta of sirutas) {
|
||||
await fetch("/api/geoportal/enrich", {
|
||||
setEnrichProgress("0/" + selectedFeatures.length);
|
||||
let done = 0;
|
||||
let ok = 0;
|
||||
for (const f of selectedFeatures) {
|
||||
try {
|
||||
const siruta = String(f.properties.siruta ?? "");
|
||||
const objectId = Number(f.properties.object_id ?? f.id);
|
||||
const r = await fetch("/api/geoportal/enrich", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ siruta }),
|
||||
body: JSON.stringify({ siruta, objectId }),
|
||||
});
|
||||
}
|
||||
} catch { /* noop */ }
|
||||
if (r.ok) ok++;
|
||||
} catch { /* noop */ }
|
||||
done++;
|
||||
setEnrichProgress(done + "/" + selectedFeatures.length);
|
||||
}
|
||||
setEnrichProgress(ok + " parcele imbogatite");
|
||||
setTimeout(() => setEnrichProgress(""), 5000);
|
||||
setEnriching(false);
|
||||
}}
|
||||
>
|
||||
@@ -165,6 +173,10 @@ export function SelectionToolbar({
|
||||
<Button variant="ghost" size="sm" className="h-7 w-7 p-0" onClick={onClearSelection} title="Sterge selectia">
|
||||
<Trash2 className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
|
||||
{enrichProgress && (
|
||||
<span className="text-xs text-muted-foreground">{enrichProgress}</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user