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`; }