fix(map): stabilize layers menu and offline cache UX
This commit is contained in:
@@ -1061,8 +1061,24 @@ export const MapFixturePreview = forwardRef<MapFixturePreviewHandle, {
|
||||
}, [animationModeEnabled, inspectorOpen, layersOpen, verifyGateway]);
|
||||
|
||||
const liveCacheStatus = gatewayHealth?.cache;
|
||||
const liveCacheKinds = liveCacheStatus?.byResourceKind;
|
||||
const liveCacheBreakdown = liveCacheKinds
|
||||
? [
|
||||
["imagery", "imagery"],
|
||||
["terrain", "terrain"],
|
||||
["buildings", "buildings"],
|
||||
["3d-binary", "3D/binary"],
|
||||
["metadata", "metadata"],
|
||||
["unknown", "unknown"],
|
||||
]
|
||||
.flatMap(([key, label]) => {
|
||||
const count = liveCacheKinds[key]?.entries ?? 0;
|
||||
return count > 0 ? [`${label}: ${count}`] : [];
|
||||
})
|
||||
.join(" · ")
|
||||
: "";
|
||||
const liveCacheSummary = liveCacheStatus
|
||||
? `${liveCacheStatus.entries ?? 0} объектов · ${Math.round((liveCacheStatus.bytes ?? 0) / 1024 / 1024)} / ${Math.round((liveCacheStatus.maxBytes ?? 0) / 1024 / 1024) || "?"} MB`
|
||||
? `${liveCacheStatus.entries ?? 0} объектов · ${Math.round((liveCacheStatus.bytes ?? 0) / 1024 / 1024)} / ${Math.round((liveCacheStatus.maxBytes ?? 0) / 1024 / 1024) || "?"} MB${liveCacheBreakdown ? ` · ${liveCacheBreakdown}` : ""}`
|
||||
: "индекс ещё не получен";
|
||||
const transportReferenceStatus = gatewayHealth?.referenceSources?.transportStations;
|
||||
const transportDiagnostic = transportReferenceStatus?.lastFailure
|
||||
|
||||
@@ -51,7 +51,7 @@ export const defaultMapReferencePresentationProfiles: readonly MapPresentationPr
|
||||
semanticTypes: [...definition.semanticTypes],
|
||||
label: {
|
||||
mode: "attributes",
|
||||
fields: ["name", "official_name", "local_name"],
|
||||
fields: ["name", "official_name", "local_name", "alternate_names"],
|
||||
fontWeight: 600,
|
||||
sizePx: 20,
|
||||
color: "#cccccc",
|
||||
|
||||
@@ -181,6 +181,7 @@ export type MapGatewayHealth = {
|
||||
maxBytes?: number;
|
||||
atCapacity?: boolean;
|
||||
persistent?: boolean;
|
||||
byResourceKind?: Record<string, { entries?: number; bytes?: number }>;
|
||||
};
|
||||
diagnostics?: {
|
||||
cacheHits?: number;
|
||||
@@ -200,6 +201,7 @@ export type MapGatewayHealth = {
|
||||
fetchEnabled?: boolean;
|
||||
cellDegrees?: number;
|
||||
cachedCellCount?: number;
|
||||
indexedFactCount?: number;
|
||||
upstreamRequests?: number;
|
||||
upstreamFailures?: number;
|
||||
searchRequests?: number;
|
||||
@@ -212,6 +214,13 @@ export type MapGatewayHealth = {
|
||||
lastFailureAt?: string | null;
|
||||
};
|
||||
};
|
||||
providerCache?: Array<{
|
||||
assetId?: number;
|
||||
type?: string;
|
||||
cachedEndpoint?: boolean;
|
||||
credentialUsable?: boolean;
|
||||
entryPointCached?: boolean;
|
||||
}>;
|
||||
ionConfigured?: boolean;
|
||||
};
|
||||
|
||||
|
||||
@@ -211,7 +211,13 @@ function asFact(value: unknown): MapRuntimeFact | null {
|
||||
|| !isIso(value.observedAt) || !isIso(value.receivedAt)
|
||||
|| !isObject(value.attributes) || !categories.has(value.attributes.category as MapReferenceStationCategory)
|
||||
|| !isPoint(value.geometry)) return null;
|
||||
const allowedAttributes = new Set(["name", "category", "network", "operator", "official_name", "local_name", "uic_ref", "wheelchair"]);
|
||||
if (value.attributes.alternate_names !== undefined
|
||||
&& (!Array.isArray(value.attributes.alternate_names)
|
||||
|| value.attributes.alternate_names.length > 16
|
||||
|| value.attributes.alternate_names.some((name) => typeof name !== "string" || !name.trim() || name.length > 256))) {
|
||||
return null;
|
||||
}
|
||||
const allowedAttributes = new Set(["name", "category", "network", "operator", "official_name", "local_name", "alternate_names", "uic_ref", "wheelchair"]);
|
||||
return {
|
||||
sourceId: value.sourceId,
|
||||
semanticType: String(value.semanticType),
|
||||
|
||||
Reference in New Issue
Block a user