Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/atlas-service/src/url-builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
}

Expand All @@ -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`;
}

Expand Down
Loading