fix: finalize earth bgp incident interactions
This commit is contained in:
@@ -433,6 +433,15 @@ function showBGPInfo(marker) {
|
||||
country: marker.userData.country,
|
||||
},
|
||||
];
|
||||
const observedBy =
|
||||
marker.userData.observed_by ||
|
||||
formatBGPObservedBy(marker.userData.collectors);
|
||||
const impactedScope = formatBGPImpactedScope(impactedRegions);
|
||||
const relatedCables = formatBGPRelatedCables(marker.userData.related_cables);
|
||||
const narrative =
|
||||
marker.userData.summary && marker.userData.summary !== "-"
|
||||
? marker.userData.summary
|
||||
: buildBGPIncidentNarrative(marker, impactedRegions);
|
||||
showInfoCard("bgp", {
|
||||
anomaly_type: formatBGPAnomalyTypeLabel(
|
||||
marker.userData.incident_type || marker.userData.anomaly_type,
|
||||
@@ -465,20 +474,18 @@ function showBGPInfo(marker) {
|
||||
: marker.userData.new_origin_asn,
|
||||
confidence: formatBGPConfidence(marker.userData.confidence),
|
||||
collector: marker.userData.collector,
|
||||
observed_by:
|
||||
marker.userData.observed_by ||
|
||||
formatBGPObservedBy(marker.userData.collectors),
|
||||
impacted_scope: formatBGPImpactedScope(impactedRegions),
|
||||
related_cables: formatBGPRelatedCables(marker.userData.related_cables),
|
||||
observed_by: observedBy,
|
||||
impacted_scope: impactedScope,
|
||||
related_cables: relatedCables,
|
||||
related_satellites:
|
||||
marker.userData.related_satellite_count > 0
|
||||
? `${marker.userData.related_satellite_count}颗附近卫星`
|
||||
? `${marker.userData.related_satellite_count}颗事件附近卫星`
|
||||
: "-",
|
||||
location:
|
||||
marker.userData.location ||
|
||||
formatBGPLocation(marker.userData.city, marker.userData.country),
|
||||
created_at: formatBGPObservedTime(marker.userData.created_at_raw),
|
||||
summary: marker.userData.summary,
|
||||
summary: narrative,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -495,10 +502,7 @@ function showBGPCollectorInfo(marker) {
|
||||
origin_asn_count: marker.userData.origin_asn_count ?? 0,
|
||||
top_event_types: formatBGPTopEventTypes(marker.userData.top_event_types),
|
||||
coverage_halo: formatBGPCollectorCoverageHalo(marker.userData),
|
||||
related_satellites:
|
||||
marker.userData.related_satellite_count > 0
|
||||
? `${marker.userData.related_satellite_count}颗附近卫星`
|
||||
: "-",
|
||||
related_satellites: "-",
|
||||
latest_event_type: marker.userData.latest_event_type || "-",
|
||||
latest_observed_at: formatBGPObservedTime(marker.userData.latest_observed_at),
|
||||
baseline_scope: formatBGPScope(marker.userData.baseline_scope),
|
||||
@@ -523,6 +527,35 @@ function getBGPRelatedCableNames(marker) {
|
||||
return names;
|
||||
}
|
||||
|
||||
function getBGPInfrastructureSummary(marker) {
|
||||
return {
|
||||
cableCount: getBGPRelatedCableNames(marker).length,
|
||||
regionCount: getBGPRelatedRegions(marker).length,
|
||||
};
|
||||
}
|
||||
|
||||
function buildBGPIncidentNarrative(marker, impactedRegions) {
|
||||
const eventLabel = formatBGPAnomalyTypeLabel(
|
||||
marker.userData.incident_type || marker.userData.anomaly_type,
|
||||
);
|
||||
const severityLabel = formatBGPSeverityLabel(
|
||||
marker.userData.rawSeverity || marker.userData.severity,
|
||||
);
|
||||
const observedBy =
|
||||
marker.userData.observed_by ||
|
||||
formatBGPObservedBy(marker.userData.collectors);
|
||||
const routeLabel =
|
||||
marker.userData.route_change ||
|
||||
formatBGPRouteChange(
|
||||
marker.userData.origin_asn,
|
||||
marker.userData.new_origin_asn,
|
||||
);
|
||||
const cableCount = getBGPRelatedCableNames(marker).length;
|
||||
const regionCount = impactedRegions.length;
|
||||
|
||||
return `${eventLabel},${severityLabel};${observedBy},影响${regionCount}个区域,关联${cableCount}条海缆线索${routeLabel && routeLabel !== "-" ? `,特征 ${routeLabel}` : ""}。`;
|
||||
}
|
||||
|
||||
function getBGPRelatedRegions(marker) {
|
||||
if (Array.isArray(marker?.userData?.impacted_regions) && marker.userData.impacted_regions.length > 0) {
|
||||
return marker.userData.impacted_regions;
|
||||
@@ -572,8 +605,7 @@ function applyCableVisualState() {
|
||||
if (
|
||||
(lockedObjectType === "cable" && lockedObject) ||
|
||||
(lockedObjectType === "satellite" && lockedSatellite) ||
|
||||
(lockedObjectType === "bgp" && lockedObject) ||
|
||||
(lockedObjectType === "bgp_collector" && lockedObject)
|
||||
(lockedObjectType === "bgp" && lockedObject)
|
||||
) {
|
||||
cable.material.opacity = CABLE_CONFIG.otherOpacity;
|
||||
const origColor = cable.userData.originalColor;
|
||||
@@ -1344,9 +1376,10 @@ function onClick(event) {
|
||||
clickedMarker.userData.related_satellite_count = relatedSatelliteIndices.length;
|
||||
highlightRelatedSatellites(relatedSatelliteIndices, "#7dd3fc");
|
||||
}
|
||||
const incidentSummary = getBGPInfrastructureSummary(clickedMarker);
|
||||
showBGPInfo(clickedMarker);
|
||||
showStatusMessage(
|
||||
`已选择BGP事件: ${clickedMarker.userData.collector}`,
|
||||
`已选择BGP事件: ${clickedMarker.userData.collector} · ${incidentSummary.regionCount}个区域 / ${incidentSummary.cableCount}条相关海缆`,
|
||||
"info",
|
||||
);
|
||||
return;
|
||||
@@ -1366,14 +1399,7 @@ function onClick(event) {
|
||||
lastBGPClickPos = { x: event.clientX, y: event.clientY };
|
||||
setAutoRotate(false);
|
||||
showBGPCollectorCoverageOverlay(clickedMarker, earth);
|
||||
{
|
||||
const relatedSatelliteIndices = getRelatedSatelliteIndicesForRegions(
|
||||
getBGPRelatedRegions(clickedMarker),
|
||||
{ limit: 4, maxAngleDeg: 18 },
|
||||
);
|
||||
clickedMarker.userData.related_satellite_count = relatedSatelliteIndices.length;
|
||||
highlightRelatedSatellites(relatedSatelliteIndices, "#93c5fd");
|
||||
}
|
||||
clickedMarker.userData.related_satellite_count = 0;
|
||||
showBGPCollectorInfo(clickedMarker);
|
||||
showStatusMessage(
|
||||
`已选择观测站: ${clickedMarker.userData.collector}`,
|
||||
@@ -1522,7 +1548,7 @@ function animate() {
|
||||
relatedCableNames.forEach((name) => {
|
||||
getCableLines().forEach((cable) => {
|
||||
if (cable.userData?.name === name) {
|
||||
setCableState(cable.userData.cableId, CABLE_STATE.HOVERED);
|
||||
setCableState(cable.userData.cableId, CABLE_STATE.LOCKED);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1532,7 +1558,7 @@ function animate() {
|
||||
);
|
||||
} else if (lockedObjectType === "bgp_collector" && lockedObject) {
|
||||
clearAllCableStates();
|
||||
applyLandingPointVisualState(null, true);
|
||||
resetLandingPointVisualState();
|
||||
} else {
|
||||
resetLandingPointVisualState();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user