Skip to content

Commit b304686

Browse files
committed
Add a preference to show end-of-life modal
1 parent 825aeef commit b304686

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

packages/compass-connections/src/stores/connections-store-redux.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,12 +1818,15 @@ const connectWithOptions = (
18181818
connectionId: connectionInfo.id,
18191819
});
18201820

1821+
const { networkTraffic, showEndOfLifeConnectionModal } =
1822+
preferences.getPreferences();
1823+
18211824
if (
18221825
getGenuineMongoDB(connectionInfo.connectionOptions.connectionString)
18231826
.isGenuine === false
18241827
) {
18251828
dispatch(showNonGenuineMongoDBWarningModal(connectionInfo.id));
1826-
} else if (preferences.getPreferences().networkTraffic) {
1829+
} else if (networkTraffic && showEndOfLifeConnectionModal) {
18271830
void dataService
18281831
.instance()
18291832
.then(async (instance) => {

packages/compass-preferences-model/src/preferences-schema.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,9 @@ export type UserConfigurablePreferences = PermanentFeatureFlags &
104104
};
105105

106106
/**
107-
* Internally used preferences that are not configurable
107+
* Internally used preferences that are not configurable by users.
108108
*/
109109
export type InternalUserPreferences = {
110-
// by users.
111110
showedNetworkOptIn: boolean; // Has the settings dialog been shown before.
112111
id: string;
113112
cloudFeatureRolloutAccess?: {
@@ -121,6 +120,7 @@ export type InternalUserPreferences = {
121120
userCreatedAt: number;
122121
// TODO: Remove this as part of COMPASS-8970.
123122
enableConnectInNewWindow: boolean;
123+
showEndOfLifeConnectionModal: boolean;
124124
};
125125

126126
// UserPreferences contains all preferences stored to disk.
@@ -440,6 +440,21 @@ export const storedUserPreferencesProps: Required<{
440440
validator: z.boolean().default(true),
441441
type: 'boolean',
442442
},
443+
/**
444+
* Show a modal when the user tries to connect to a server which has an end-of-life version.
445+
*/
446+
showEndOfLifeConnectionModal: {
447+
ui: false,
448+
cli: false,
449+
global: false,
450+
description: null,
451+
validator: z
452+
.boolean()
453+
.default(
454+
process.env.COMPASS_DISABLE_END_OF_LIFE_CONNECTION_MODAL !== 'true'
455+
),
456+
type: 'boolean',
457+
},
443458
/**
444459
* Enable/disable the AI services. This is currently set
445460
* in the atlas-service initialization where we make a request to the

0 commit comments

Comments
 (0)