Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -1818,18 +1818,21 @@ const connectWithOptions = (
connectionId: connectionInfo.id,
});

const { networkTraffic, showEndOfLifeConnectionModal } =
preferences.getPreferences();

if (
getGenuineMongoDB(connectionInfo.connectionOptions.connectionString)
.isGenuine === false
) {
dispatch(showNonGenuineMongoDBWarningModal(connectionInfo.id));
} else if (preferences.getPreferences().networkTraffic) {
} else if (showEndOfLifeConnectionModal) {
void dataService
.instance()
.then(async (instance) => {
const { version } = instance.build;
const latestEndOfLifeServerVersion =
await getLatestEndOfLifeServerVersion();
await getLatestEndOfLifeServerVersion(networkTraffic);
if (isEndOfLifeVersion(version, latestEndOfLifeServerVersion)) {
dispatch(
showEndOfLifeMongoDBWarningModal(
Expand Down
10 changes: 8 additions & 2 deletions packages/compass-connections/src/utils/end-of-life-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ const {

let latestEndOfLifeServerVersion: Promise<string> | null = null;

export async function getLatestEndOfLifeServerVersion(): Promise<string> {
export async function getLatestEndOfLifeServerVersion(
allowNetworkRequests = true
): Promise<string> {
if (!allowNetworkRequests) {
return FALLBACK_END_OF_LIFE_SERVER_VERSION;
}

if (!HADRON_AUTO_UPDATE_ENDPOINT) {
log.debug(
mongoLogId(1_001_000_356),
Expand Down Expand Up @@ -68,7 +74,7 @@ export async function getLatestEndOfLifeServerVersion(): Promise<string> {

export function isEndOfLifeVersion(
version: string,
latestEndOfLifeServerVersion: string
latestEndOfLifeServerVersion = FALLBACK_END_OF_LIFE_SERVER_VERSION
) {
try {
const coercedVersion = semverCoerce(version);
Expand Down
3 changes: 3 additions & 0 deletions packages/compass-e2e-tests/helpers/compass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,9 @@ async function startCompassElectron(
// we disable the cues completely for the e2e tests
process.env.DISABLE_GUIDE_CUES = 'true';

// Making sure end-of-life connection modal is not shown, simplify any test connecting to such a server
process.env.COMPASS_DISABLE_END_OF_LIFE_CONNECTION_MODAL = 'true';

const options = {
automationProtocol: 'webdriver' as const,
capabilities: {
Expand Down
19 changes: 17 additions & 2 deletions packages/compass-preferences-model/src/preferences-schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ export type UserConfigurablePreferences = PermanentFeatureFlags &
};

/**
* Internally used preferences that are not configurable
* Internally used preferences that are not configurable by users.
*/
export type InternalUserPreferences = {
// by users.
showedNetworkOptIn: boolean; // Has the settings dialog been shown before.
id: string;
cloudFeatureRolloutAccess?: {
Expand All @@ -121,6 +120,7 @@ export type InternalUserPreferences = {
userCreatedAt: number;
// TODO: Remove this as part of COMPASS-8970.
enableConnectInNewWindow: boolean;
showEndOfLifeConnectionModal: boolean;
};

// UserPreferences contains all preferences stored to disk.
Expand Down Expand Up @@ -440,6 +440,21 @@ export const storedUserPreferencesProps: Required<{
validator: z.boolean().default(true),
type: 'boolean',
},
/**
* Show a modal when the user tries to connect to a server which has an end-of-life version.
*/
showEndOfLifeConnectionModal: {
ui: false,
cli: false,
global: false,
description: null,
validator: z
.boolean()
.default(
process.env.COMPASS_DISABLE_END_OF_LIFE_CONNECTION_MODAL !== 'true'
),
type: 'boolean',
},
/**
* Enable/disable the AI services. This is currently set
* in the atlas-service initialization where we make a request to the
Expand Down
Loading