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[] = [
|
const LAYER_GROUPS: LayerGroupDef[] = [
|
||||||
{
|
|
||||||
id: "uats",
|
|
||||||
label: "Limite UAT",
|
|
||||||
description: "Unitati administrativ-teritoriale",
|
|
||||||
color: "#7c3aed",
|
|
||||||
defaultVisible: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: "terenuri",
|
id: "terenuri",
|
||||||
label: "Terenuri",
|
label: "Terenuri",
|
||||||
@@ -42,10 +35,17 @@ const LAYER_GROUPS: LayerGroupDef[] = [
|
|||||||
color: "#3b82f6",
|
color: "#3b82f6",
|
||||||
defaultVisible: true,
|
defaultVisible: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "uats",
|
||||||
|
label: "Limite UAT",
|
||||||
|
description: "Unitati administrativ-teritoriale",
|
||||||
|
color: "#7c3aed",
|
||||||
|
defaultVisible: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "administrativ",
|
id: "administrativ",
|
||||||
label: "Intravilan",
|
label: "Intravilan",
|
||||||
description: "Limite intravilan, arii speciale (zoom >= 10)",
|
description: "Limite intravilan, arii speciale (zoom >= 13)",
|
||||||
color: "#ea580c",
|
color: "#ea580c",
|
||||||
defaultVisible: false,
|
defaultVisible: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export function SelectionToolbar({
|
|||||||
}: SelectionToolbarProps) {
|
}: SelectionToolbarProps) {
|
||||||
const [exporting, setExporting] = useState(false);
|
const [exporting, setExporting] = useState(false);
|
||||||
const [enriching, setEnriching] = useState(false);
|
const [enriching, setEnriching] = useState(false);
|
||||||
|
const [enrichProgress, setEnrichProgress] = useState("");
|
||||||
const active = selectionMode !== "off";
|
const active = selectionMode !== "off";
|
||||||
|
|
||||||
const handleExport = async (format: ExportFormat) => {
|
const handleExport = async (format: ExportFormat) => {
|
||||||
@@ -140,21 +141,28 @@ export function SelectionToolbar({
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost" size="sm" className="h-7 px-2 text-xs gap-1"
|
variant="ghost" size="sm" className="h-7 px-2 text-xs gap-1"
|
||||||
disabled={enriching}
|
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 () => {
|
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);
|
setEnriching(true);
|
||||||
|
setEnrichProgress("0/" + selectedFeatures.length);
|
||||||
|
let done = 0;
|
||||||
|
let ok = 0;
|
||||||
|
for (const f of selectedFeatures) {
|
||||||
try {
|
try {
|
||||||
for (const siruta of sirutas) {
|
const siruta = String(f.properties.siruta ?? "");
|
||||||
await fetch("/api/geoportal/enrich", {
|
const objectId = Number(f.properties.object_id ?? f.id);
|
||||||
|
const r = await fetch("/api/geoportal/enrich", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ siruta }),
|
body: JSON.stringify({ siruta, objectId }),
|
||||||
});
|
});
|
||||||
}
|
if (r.ok) ok++;
|
||||||
} catch { /* noop */ }
|
} catch { /* noop */ }
|
||||||
|
done++;
|
||||||
|
setEnrichProgress(done + "/" + selectedFeatures.length);
|
||||||
|
}
|
||||||
|
setEnrichProgress(ok + " parcele imbogatite");
|
||||||
|
setTimeout(() => setEnrichProgress(""), 5000);
|
||||||
setEnriching(false);
|
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">
|
<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" />
|
<Trash2 className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
{enrichProgress && (
|
||||||
|
<span className="text-xs text-muted-foreground">{enrichProgress}</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user