From 143c94a56c20f8363211f7cbd675e9b5ae17f941 Mon Sep 17 00:00:00 2001 From: Simon Zhu Date: Wed, 25 Feb 2026 06:01:13 -0500 Subject: [PATCH] fix(atlas-service): generate correct Atlas URLs for Flex clusters COMPASS-10438 The URL builder functions were using the generic `#/host/{metricsType}/{metricsId}` pattern for all cluster types, producing broken URLs for Flex clusters. Flex clusters use a `#/flex/
/` format instead. Co-Authored-By: Claude Opus 4.6 --- packages/atlas-service/src/url-builders.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/atlas-service/src/url-builders.ts b/packages/atlas-service/src/url-builders.ts index cc0dc947bc4..3482bd55fc5 100644 --- a/packages/atlas-service/src/url-builders.ts +++ b/packages/atlas-service/src/url-builders.ts @@ -3,10 +3,14 @@ import type { AtlasClusterMetadata } from '@mongodb-js/connection-info'; export function buildPerformanceMetricsUrl({ projectId, + clusterName, metricsType, metricsId, }: AtlasClusterMetadata): string { const url = new URL(`/v2/${projectId}`, window.location.origin); + if (metricsType === 'flex') { + return `${url}#/flex/realtime/${clusterName}`; + } return `${url}#/host/${metricsType}/${metricsId}/realtime/panel`; } @@ -19,27 +23,39 @@ export function buildProjectSettingsUrl({ export function buildMonitoringUrl({ projectId, + clusterName, metricsType, metricsId, }: AtlasClusterMetadata): string { const url = new URL(`/v2/${projectId}`, window.location.origin); + if (metricsType === 'flex') { + return `${url}#/flex/monitoring/${clusterName}`; + } return `${url}#/host/${metricsType}/${metricsId}`; } export function buildClusterOverviewUrl({ projectId, clusterName, + metricsType, }: AtlasClusterMetadata): string { const url = new URL(`/v2/${projectId}`, window.location.origin); + if (metricsType === 'flex') { + return `${url}#/flex/detail/${clusterName}`; + } return `${url}#/clusters/detail/${clusterName}`; } export function buildQueryInsightsUrl({ projectId, + clusterName, metricsType, metricsId, }: AtlasClusterMetadata): string { const url = new URL(`/v2/${projectId}`, window.location.origin); + if (metricsType === 'flex') { + return `${url}#/flex/queryInsights/${clusterName}`; + } return `${url}#/metrics/${metricsType}/${metricsId}/queryInsights/shape`; }