fix(parcel-sync): add intravilan to primary layers + tooltip on stale badge
- LIMITE_INTRAV_DYNAMIC added to primary layers checked for freshness - Auto-refresh scheduler and weekend sync now also sync intravilan - "X vechi" badge shows tooltip with exact layer names and dates - "Proaspete" badge also shows tooltip with layer details Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -143,9 +143,8 @@ export function ExportTab({
|
|||||||
|
|
||||||
const dbTotalFeatures = dbLayersSummary.reduce((sum, l) => sum + l.count, 0);
|
const dbTotalFeatures = dbLayersSummary.reduce((sum, l) => sum + l.count, 0);
|
||||||
|
|
||||||
// Only check primary layers (terenuri + cladiri) for freshness —
|
// Primary layers synced by background jobs — these determine freshness
|
||||||
// secondary layers (intravilan, limite UAT) don't affect export readiness
|
const PRIMARY_LAYERS = ["TERENURI_ACTIVE", "CLADIRI_ACTIVE", "LIMITE_INTRAV_DYNAMIC"];
|
||||||
const PRIMARY_LAYERS = ["TERENURI_ACTIVE", "CLADIRI_ACTIVE"];
|
|
||||||
const primaryLayers = dbLayersSummary.filter((l) =>
|
const primaryLayers = dbLayersSummary.filter((l) =>
|
||||||
PRIMARY_LAYERS.includes(l.id),
|
PRIMARY_LAYERS.includes(l.id),
|
||||||
);
|
);
|
||||||
@@ -626,11 +625,8 @@ export function ExportTab({
|
|||||||
layere
|
layere
|
||||||
</span>
|
</span>
|
||||||
{(() => {
|
{(() => {
|
||||||
// Check freshness only for primary layers (terenuri + cladiri)
|
const staleLayers = primaryLayers.filter((l) => !l.isFresh);
|
||||||
const freshCount = primaryLayers.filter(
|
const freshLayers = primaryLayers.filter((l) => l.isFresh);
|
||||||
(l) => l.isFresh,
|
|
||||||
).length;
|
|
||||||
const staleCount = primaryLayers.length - freshCount;
|
|
||||||
const newestSync = primaryLayers.reduce(
|
const newestSync = primaryLayers.reduce(
|
||||||
(newest, l) => {
|
(newest, l) => {
|
||||||
if (!l.lastSynced) return newest;
|
if (!l.lastSynced) return newest;
|
||||||
@@ -639,25 +635,35 @@ export function ExportTab({
|
|||||||
},
|
},
|
||||||
null as Date | null,
|
null as Date | null,
|
||||||
);
|
);
|
||||||
|
// Tooltip: list which layers are stale/fresh with dates
|
||||||
|
const staleTooltip = staleLayers.length > 0
|
||||||
|
? `Vechi: ${staleLayers.map((l) => `${l.label} (${l.lastSynced ? relativeTime(l.lastSynced) : "nesincronizat"})`).join(", ")}`
|
||||||
|
: "";
|
||||||
|
const freshTooltip = freshLayers.length > 0
|
||||||
|
? `Proaspete: ${freshLayers.map((l) => `${l.label} (${l.lastSynced ? relativeTime(l.lastSynced) : ""})`).join(", ")}`
|
||||||
|
: "";
|
||||||
|
const fullTooltip = [staleTooltip, freshTooltip].filter(Boolean).join("\n");
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{staleCount === 0 && primaryLayers.length > 0 ? (
|
{staleLayers.length === 0 && primaryLayers.length > 0 ? (
|
||||||
<Badge
|
<Badge
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="text-emerald-600 border-emerald-200 dark:text-emerald-400 dark:border-emerald-800"
|
className="text-emerald-600 border-emerald-200 dark:text-emerald-400 dark:border-emerald-800 cursor-default"
|
||||||
|
title={fullTooltip}
|
||||||
>
|
>
|
||||||
<CheckCircle2 className="h-3 w-3 mr-1" />
|
<CheckCircle2 className="h-3 w-3 mr-1" />
|
||||||
Proaspete
|
Proaspete
|
||||||
</Badge>
|
</Badge>
|
||||||
) : (
|
) : staleLayers.length > 0 ? (
|
||||||
<Badge
|
<Badge
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="text-amber-600 border-amber-200 dark:text-amber-400 dark:border-amber-800"
|
className="text-amber-600 border-amber-200 dark:text-amber-400 dark:border-amber-800 cursor-default"
|
||||||
|
title={fullTooltip}
|
||||||
>
|
>
|
||||||
<Clock className="h-3 w-3 mr-1" />
|
<Clock className="h-3 w-3 mr-1" />
|
||||||
{staleCount} vechi
|
{staleLayers.length} vechi
|
||||||
</Badge>
|
</Badge>
|
||||||
)}
|
) : null}
|
||||||
{newestSync && (
|
{newestSync && (
|
||||||
<span className="text-xs text-muted-foreground">
|
<span className="text-xs text-muted-foreground">
|
||||||
Ultima sincronizare: {relativeTime(newestSync)}
|
Ultima sincronizare: {relativeTime(newestSync)}
|
||||||
|
|||||||
@@ -172,6 +172,18 @@ async function runAutoRefresh() {
|
|||||||
"CLADIRI_ACTIVE",
|
"CLADIRI_ACTIVE",
|
||||||
{ uatName: uat.name },
|
{ uatName: uat.name },
|
||||||
);
|
);
|
||||||
|
// Intravilan — lightweight, non-fatal
|
||||||
|
try {
|
||||||
|
await syncLayer(
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
uat.siruta,
|
||||||
|
"LIMITE_INTRAV_DYNAMIC",
|
||||||
|
{ uatName: uat.name },
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
// intravilan is best-effort
|
||||||
|
}
|
||||||
const dur = ((Date.now() - start) / 1000).toFixed(1);
|
const dur = ((Date.now() - start) / 1000).toFixed(1);
|
||||||
console.log(
|
console.log(
|
||||||
`[auto-refresh] ${uat.name} (${uat.siruta}): terenuri +${tRes.newFeatures}/-${tRes.removedFeatures}, cladiri +${cRes.newFeatures}/-${cRes.removedFeatures} (${dur}s)`,
|
`[auto-refresh] ${uat.name} (${uat.siruta}): terenuri +${tRes.newFeatures}/-${tRes.removedFeatures}, cladiri +${cRes.newFeatures}/-${cRes.removedFeatures} (${dur}s)`,
|
||||||
|
|||||||
@@ -186,10 +186,22 @@ async function executeStep(
|
|||||||
"TERENURI_ACTIVE",
|
"TERENURI_ACTIVE",
|
||||||
{ uatName: city.name, forceFullSync: true },
|
{ uatName: city.name, forceFullSync: true },
|
||||||
);
|
);
|
||||||
|
// Also sync intravilan limits (lightweight, non-fatal)
|
||||||
|
try {
|
||||||
|
await syncLayer(
|
||||||
|
process.env.ETERRA_USERNAME!,
|
||||||
|
process.env.ETERRA_PASSWORD!,
|
||||||
|
city.siruta,
|
||||||
|
"LIMITE_INTRAV_DYNAMIC",
|
||||||
|
{ uatName: city.name },
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
// intravilan is best-effort
|
||||||
|
}
|
||||||
const dur = ((Date.now() - start) / 1000).toFixed(1);
|
const dur = ((Date.now() - start) / 1000).toFixed(1);
|
||||||
return {
|
return {
|
||||||
success: res.status === "done",
|
success: res.status === "done",
|
||||||
message: `Terenuri: ${res.totalLocal} local (+${res.newFeatures}/-${res.removedFeatures}) [${dur}s]`,
|
message: `Terenuri: ${res.totalLocal} local (+${res.newFeatures}/-${res.removedFeatures}) + intravilan [${dur}s]`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user